MajorTable.vue 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716
  1. <template>
  2. <div class="subject-page">
  3. <div class="content-box">
  4. <div class="xkcx-list-box" v-if="isShowTable">
  5. <div class="xkcx-input-box">
  6. <div>
  7. <el-select
  8. v-model="selectNian"
  9. @change="onChangeYear"
  10. placeholder="全部年份"
  11. >
  12. <el-option
  13. v-for="(item, index) in yearList"
  14. :key="index"
  15. :label="item"
  16. :value="item"
  17. >
  18. </el-option>
  19. </el-select>
  20. </div>
  21. <div class="button-school">
  22. <el-button plain @click="onChangeSchoolPopup">
  23. 学校
  24. <i class="el-icon-my-button"></i>
  25. </el-button>
  26. </div>
  27. <div class="button-major">
  28. <el-button plain @click="onChangeMajorPopup">
  29. 专业<i class="el-icon-my-button"></i
  30. ></el-button>
  31. </div>
  32. <div class="search_header">
  33. <input
  34. placeholder="请输入内容"
  35. v-model="keyword"
  36. @keyup.enter="checkData()"
  37. />
  38. <img
  39. src="@/assets/images/icon_search2.png"
  40. alt=""
  41. @click="checkData()"
  42. />
  43. </div>
  44. </div>
  45. <div class="concerned-college-container">
  46. <mx-table :rows="dataList" :propDefines="propDefines">
  47. <template #select="{ row }">
  48. <img
  49. class="college-icon"
  50. v-if="row.collect"
  51. @click="httpCollectRemove(row)"
  52. src="@/assets/images/subject/icon_shoucang_pre.png"
  53. />
  54. <img
  55. class="college-icon"
  56. v-else
  57. @click="httpCollectAdd(row)"
  58. src="@/assets/images/subject/icon_shoucang_n.png"
  59. />
  60. </template>
  61. </mx-table>
  62. <pagination
  63. v-show="total > 0"
  64. :total="total"
  65. :page.sync="pageNum"
  66. :limit.sync="pageSize"
  67. :page-size="20"
  68. @pagination="onChangePage"
  69. />
  70. </div>
  71. </div>
  72. </div>
  73. <div>
  74. <el-dialog
  75. :visible="isShowSchoolPopup"
  76. width="75%"
  77. :before-close="onChangeSchoolPopup"
  78. >
  79. <div class="popup-box">
  80. <div class="popup-item">
  81. <div class="popup-item-title">地域选择<span>(可多选)</span></div>
  82. <div class="popup-item-content">
  83. <el-checkbox-group v-model="selectLocation">
  84. <el-checkbox
  85. class="check-box-item"
  86. :label="item"
  87. v-for="(item, index) in locationsList"
  88. :key="index"
  89. ></el-checkbox>
  90. </el-checkbox-group>
  91. </div>
  92. </div>
  93. <div class="popup-item">
  94. <div class="popup-item-title">院校特色<span>(可多选)</span></div>
  95. <div class="popup-item-content">
  96. <el-checkbox-group v-model="selectCharacteristic">
  97. <el-checkbox
  98. class="check-box-item"
  99. :label="item.code"
  100. v-for="(item, index) in characteristicList"
  101. :key="index"
  102. >{{ item.label }}</el-checkbox
  103. >
  104. </el-checkbox-group>
  105. </div>
  106. </div>
  107. <div class="popup-item">
  108. <div class="popup-item-title">院校类别<span>(可多选)</span></div>
  109. <div class="popup-item-content">
  110. <el-checkbox-group v-model="selectTypes">
  111. <el-checkbox
  112. class="check-box-item"
  113. :label="item"
  114. v-for="(item, index) in typesList"
  115. :key="index"
  116. ></el-checkbox>
  117. </el-checkbox-group>
  118. </div>
  119. </div>
  120. <div class="bottom-box">
  121. <div class="popup-msg">*请点击(或取消)以下学校信息进行筛选</div>
  122. <div class="button-list">
  123. <el-button @click="cleanSchoolSelect">清空</el-button>
  124. <el-button @click="schoolSubmit" type="primary">确定</el-button>
  125. </div>
  126. </div>
  127. </div>
  128. </el-dialog>
  129. <el-dialog
  130. :visible="isShowMajorPopup"
  131. width="75%"
  132. :before-close="onChangeMajorPopup"
  133. >
  134. <div class="popup-box major-box">
  135. <div class="popup-select">
  136. <div
  137. class="popup-select-item"
  138. :class="marjorsType == '本科' ? 'active' : ''"
  139. @click="clickMarjorsType('本科')"
  140. >
  141. 本科
  142. </div>
  143. <div
  144. class="popup-select-item"
  145. :class="marjorsType == '高职专科' ? 'active' : ''"
  146. @click="clickMarjorsType('高职专科')"
  147. >
  148. 专科
  149. </div>
  150. </div>
  151. <div class="choice-box">
  152. <div class="choice-item">
  153. <div
  154. class="choice-item-menv"
  155. v-for="(item, index) in marjorsList"
  156. :key="index"
  157. :class="curMarjorsCode == item.code ? 'active' : ''"
  158. @click="changeMajor(item)"
  159. >
  160. {{ item.name }}
  161. </div>
  162. </div>
  163. <div class="choice-item">
  164. <div
  165. class="choice-item-menv"
  166. v-for="(item, index) in marjorsList2"
  167. :key="index"
  168. :class="curMarjorsCode2 == item.code ? 'active' : ''"
  169. @click="changeMajor(item)"
  170. >
  171. {{ item.name }}
  172. </div>
  173. </div>
  174. <div class="choice-item">
  175. <el-checkbox-group v-model="curMarjorsCode3">
  176. <el-checkbox
  177. class="choice-item-checkbox"
  178. label="全选"
  179. @change="onSelectMarjorsAll"
  180. ></el-checkbox>
  181. <el-checkbox
  182. class="choice-item-checkbox"
  183. :label="item.name"
  184. v-for="(item, index) in marjorsList3"
  185. :key="index"
  186. ></el-checkbox>
  187. </el-checkbox-group>
  188. </div>
  189. </div>
  190. </div>
  191. <div class="bottom-box">
  192. <div class="popup-msg">*请点击(或取消)以下学校信息进行筛选</div>
  193. <div class="button-list">
  194. <el-button @click="cleanMajorList">清空</el-button>
  195. <el-button @click="majorSubmit" type="primary">确定</el-button>
  196. </div>
  197. </div>
  198. </el-dialog>
  199. </div>
  200. </div>
  201. </template>
  202. <script>
  203. import {
  204. xkcxlist,
  205. xkcxYears,
  206. collectAdd,
  207. collectRemove,
  208. universityFilters,
  209. marjorsList,
  210. } from "@/api/webApi/webQue";
  211. export default {
  212. data() {
  213. return {
  214. scienceList: [
  215. {
  216. name: "物理",
  217. id: 1,
  218. },
  219. {
  220. name: "历史",
  221. id: 2,
  222. },
  223. ],
  224. liberalArts: [
  225. {
  226. name: "化学",
  227. id: 1,
  228. },
  229. {
  230. name: "生物",
  231. id: 2,
  232. },
  233. {
  234. name: "地理",
  235. id: 3,
  236. },
  237. {
  238. name: "政治",
  239. id: 4,
  240. },
  241. ],
  242. propDefines: {
  243. universityName: {
  244. label: "院校名称",
  245. },
  246. marjorName: {
  247. label: "专业(类)名称",
  248. },
  249. resourcesName: {
  250. label: "类中所含专业",
  251. align: "left",
  252. },
  253. level: {
  254. label: "专业层次",
  255. },
  256. courseRemark0: {
  257. label: "首选科目",
  258. align: "left",
  259. },
  260. courseRemark1: {
  261. label: "再选科目",
  262. align: "left",
  263. },
  264. collect: {
  265. label: "选择",
  266. align: "left",
  267. slot: "select",
  268. width: "100px",
  269. },
  270. },
  271. curSelectScienceList: "",
  272. curSelectLiberalArts: [],
  273. options: [],
  274. selectNian: "",
  275. dataList: [],
  276. yearList: [],
  277. pageNum: 1,
  278. pageSize: 20,
  279. total: 0,
  280. keyword: "",
  281. isShowTable: true,
  282. locationsList: [],
  283. typesList: [],
  284. characteristicList: [],
  285. selectLocation: [], //地区
  286. selectTypes: [], //类别
  287. selectCharacteristic: [], //选中的特色
  288. isShowSchoolPopup: false,
  289. isShowMajorPopup: false,
  290. marjorsList: [],
  291. marjorsList2: [],
  292. marjorsList3: [],
  293. marjorsType: "本科",
  294. marjorsLevel: 1,
  295. marjorsCode: "",
  296. curMarjorsCode: "",
  297. curMarjorsCode2: "",
  298. curMarjorsCode3: [],
  299. };
  300. },
  301. created() {
  302. this.httpGetXkcxYears();
  303. this.httpUniversityFilters();
  304. this.httpGetMarjorsList();
  305. },
  306. methods: {
  307. onSelectMarjorsAll(res) {
  308. if (res) {
  309. let len = this.marjorsList3.length;
  310. for (let i = 0; i < len; i++) {
  311. let name = this.marjorsList3[i]["name"];
  312. let index = this.curMarjorsCode3.indexOf(name);
  313. if (index < 0) {
  314. this.curMarjorsCode3.push(name);
  315. }
  316. }
  317. } else {
  318. this.curMarjorsCode3 = [];
  319. }
  320. },
  321. onChangeSchoolPopup() {
  322. this.isShowSchoolPopup = !this.isShowSchoolPopup;
  323. },
  324. onChangeMajorPopup() {
  325. this.isShowMajorPopup = !this.isShowMajorPopup;
  326. },
  327. changeMajor(res) {
  328. this.curMarjorsCode3 = [];
  329. switch (res.level) {
  330. case 1:
  331. this.curMarjorsCode = res.code;
  332. break;
  333. case 2:
  334. this.curMarjorsCode2 = res.code;
  335. break;
  336. }
  337. this.marjorsCode = res.code;
  338. this.marjorsLevel = res.level + 1;
  339. this.httpGetMarjorsList();
  340. },
  341. schoolSubmit() {
  342. this.isShowSchoolPopup = false;
  343. this.checkData();
  344. },
  345. majorSubmit() {
  346. this.isShowMajorPopup = false;
  347. this.checkData();
  348. },
  349. cleanSchoolSelect() {
  350. this.selectLocation = [];
  351. this.selectTypes = [];
  352. this.selectCharacteristic = [];
  353. },
  354. cleanMajorList() {
  355. this.curMarjorsCode3 = [];
  356. },
  357. getSubjectText() {
  358. let rText = "";
  359. rText += this.curSelectScienceList + "+";
  360. let lLen = this.curSelectLiberalArts.length;
  361. for (let i = 0; i < lLen; i++) {
  362. rText += this.curSelectLiberalArts[i];
  363. if (i != lLen - 1) {
  364. rText += "+";
  365. }
  366. }
  367. return rText;
  368. },
  369. clickMarjorsType(type) {
  370. this.marjorsType = type;
  371. this.marjorsLevel = 1;
  372. this.marjorsCode = "";
  373. this.httpGetMarjorsList();
  374. },
  375. httpGetMarjorsList() {
  376. marjorsList({
  377. type: this.marjorsType,
  378. level: this.marjorsLevel,
  379. code: this.marjorsCode,
  380. }).then((res) => {
  381. switch (this.marjorsLevel) {
  382. case 2:
  383. this.marjorsList2 = res.rows;
  384. this.changeMajor(res.rows[0]);
  385. break;
  386. case 3:
  387. this.marjorsList3 = res.rows;
  388. break;
  389. default:
  390. this.marjorsList = res.rows;
  391. this.changeMajor(res.rows[0]);
  392. break;
  393. }
  394. });
  395. },
  396. httpUniversityFilters() {
  397. universityFilters({}).then(({ data }) => {
  398. this.locationsList = data.locations;
  399. this.typesList = data.types;
  400. this.characteristicList = data.features;
  401. });
  402. },
  403. httpCollectAdd(row) {
  404. collectAdd({
  405. refId: row.id,
  406. }).then((res) => {
  407. this.checkData();
  408. });
  409. },
  410. httpCollectRemove(row) {
  411. collectRemove({
  412. refId: row.id,
  413. }).then((res) => {
  414. this.checkData();
  415. });
  416. },
  417. onChangeYear(res) {
  418. this.checkData();
  419. },
  420. onClickScience(item) {
  421. if (this.curSelectScienceList == item.name) {
  422. return;
  423. } else {
  424. this.curSelectScienceList = item.name;
  425. }
  426. this.isShowTable = false;
  427. },
  428. onClickLiberalArts(item) {
  429. let index = this.curSelectLiberalArts.indexOf(item.name);
  430. if (index >= 0) {
  431. this.curSelectLiberalArts.splice(index, 1);
  432. } else {
  433. this.curSelectLiberalArts.push(item.name);
  434. }
  435. this.isShowTable = false;
  436. },
  437. isShowScience(name) {
  438. return this.curSelectScienceList == name;
  439. },
  440. isShowLiberalArts(name) {
  441. return this.curSelectLiberalArts.indexOf(name) >= 0;
  442. },
  443. onSearch() {
  444. this.checkData();
  445. },
  446. httpGetXkcxYears() {
  447. xkcxYears().then((res) => {
  448. this.yearList = res.data;
  449. });
  450. },
  451. onChangePage(page) {
  452. this.pageSize = page.limit;
  453. this.pageNum = page.page;
  454. this.checkData();
  455. },
  456. checkData(cb) {
  457. if (this.curSelectLiberalArts.length != 2) {
  458. this.$message.error("请从右侧4门可选科目中点击选择2门");
  459. return;
  460. }
  461. this.httpGetXkcxList();
  462. },
  463. httpGetXkcxList() {
  464. xkcxlist({
  465. keyword: this.keyword,
  466. course0: this.curSelectScienceList,
  467. course1: this.curSelectLiberalArts.toString(),
  468. locations: this.selectLocation.toString(),
  469. ts: this.selectCharacteristic.toString(),
  470. types: this.selectTypes.toString(),
  471. year: this.selectNian,
  472. pageNum: this.pageNum,
  473. marjors: this.curMarjorsCode3.toString(),
  474. pageSize: this.pageSize,
  475. })
  476. .then((res) => {
  477. this.dataList = res.rows;
  478. this.total = res.total;
  479. this.isShowTable = true;
  480. })
  481. .catch((err) => {
  482. console.log("请求出错!");
  483. this.cleanSchoolSelect();
  484. });
  485. },
  486. },
  487. };
  488. </script>
  489. <style scoped>
  490. .subject-page {
  491. padding: 0 100px;
  492. }
  493. .college-icon {
  494. cursor: pointer;
  495. }
  496. .breadcrumb {
  497. padding: 15px 30px;
  498. margin: 15px 0;
  499. border-bottom: 1px solid #eee;
  500. border-radius: 2px;
  501. background-color: #fff;
  502. box-shadow: 0 1px 2px 0 rgb(0 0 0 / 5%);
  503. }
  504. .el-breadcrumb {
  505. font-size: 16px !important;
  506. }
  507. .content-box {
  508. padding: 60px 40px 60px 50px;
  509. }
  510. .content-box-title {
  511. color: #47c6a2;
  512. font-size: 24px;
  513. }
  514. .content-top-box {
  515. display: flex;
  516. align-items: center;
  517. justify-content: space-between;
  518. }
  519. .my-subject-button {
  520. color: #47c6a2;
  521. font-size: 14px;
  522. border: 1px solid #47c6a2;
  523. padding: 13px 110px;
  524. }
  525. .content-msg {
  526. margin: 32px 0;
  527. font-size: 16px;
  528. }
  529. .select-box {
  530. display: flex;
  531. align-items: center;
  532. justify-content: space-between;
  533. }
  534. .select-item {
  535. box-sizing: border-box;
  536. border: 1px dashed rgba(24, 144, 255, 1);
  537. height: 334px;
  538. padding: 20px;
  539. margin-right: 20px;
  540. }
  541. .select-msg {
  542. color: #47c6a2;
  543. font-size: 14px;
  544. }
  545. .select-click-list {
  546. margin-top: 40px;
  547. display: flex;
  548. flex-wrap: wrap;
  549. justify-content: space-between;
  550. }
  551. .select-box-click-item {
  552. background-color: #fbfbfb;
  553. cursor: pointer;
  554. height: 89px;
  555. line-height: 89px;
  556. font-size: 24px;
  557. color: #414141;
  558. font-weight: 600;
  559. text-align: center;
  560. position: relative;
  561. }
  562. .select-box-click-item.two {
  563. margin: 10px 0;
  564. width: 100%;
  565. }
  566. .select-box-click-item.four {
  567. margin: 10px 0;
  568. width: 46%;
  569. }
  570. .select-box-click-item.active {
  571. background-color: #d4eaff !important;
  572. }
  573. .select-box-click-item-icon {
  574. height: 20px;
  575. width: 20px;
  576. border-radius: 2px;
  577. background: #47c6a2;
  578. display: flex;
  579. align-items: center;
  580. justify-content: center;
  581. font-size: 16px;
  582. position: absolute;
  583. right: 0;
  584. bottom: 0;
  585. color: #fff;
  586. }
  587. .select-button {
  588. padding: 0px 60px;
  589. }
  590. .xkcx-list-title {
  591. width: 100%;
  592. background-color: #e8e8e8;
  593. padding: 30px;
  594. text-align: center;
  595. font-size: 24px;
  596. color: #4c4c4c;
  597. margin-top: 80px;
  598. }
  599. .xkcx-input-box {
  600. padding: 20px 0;
  601. display: flex;
  602. }
  603. .search_header {
  604. margin-left: auto;
  605. display: flex;
  606. flex-direction: row;
  607. align-items: center;
  608. justify-content: flex-end;
  609. position: relative;
  610. margin-right: 20px;
  611. }
  612. .search_header img {
  613. position: absolute;
  614. right: 20px;
  615. cursor: pointer;
  616. top: 6px;
  617. }
  618. .search_header input {
  619. background: #f7f7ff;
  620. border-radius: 20px;
  621. border: 1px solid #c6cbf5;
  622. outline: none;
  623. width: 340px;
  624. height: 32px;
  625. padding-left: 24px;
  626. }
  627. .button-school {
  628. margin: 0 20px;
  629. }
  630. .button-icon {
  631. width: 12px;
  632. height: 12px;
  633. }
  634. .el-icon-my-button {
  635. background: url(../../../assets/images/subject/icon_shaixuan.png) center
  636. no-repeat;
  637. background-size: cover;
  638. }
  639. .el-icon-my-button:before {
  640. content: "替";
  641. font-size: 16px;
  642. visibility: hidden;
  643. }
  644. .popup-item-title {
  645. color: #414141;
  646. font-size: 16px;
  647. font-weight: 600;
  648. }
  649. .popup-item-title span {
  650. font-size: 14px;
  651. font-weight: 500;
  652. }
  653. .check-box-item {
  654. padding: 8px 0;
  655. min-width: 70px;
  656. }
  657. .popup-item-content {
  658. padding: 20px 0;
  659. }
  660. .popup-msg {
  661. color: #ffa400;
  662. font-weight: 400;
  663. font-size: 14px;
  664. }
  665. .bottom-box {
  666. display: flex;
  667. justify-content: space-between;
  668. }
  669. .button-list {
  670. padding: 0 20px;
  671. }
  672. .major-box {
  673. display: flex;
  674. margin-bottom: 30px;
  675. }
  676. .popup-select {
  677. border-right: 1px solid #d7d7d7;
  678. }
  679. .popup-select-item {
  680. cursor: pointer;
  681. line-height: 30px;
  682. width: 100px;
  683. padding: 0 20px 0 30px;
  684. }
  685. .popup-select-item.active {
  686. color: #47c6a2;
  687. border-right: 2px solid #47c6a2;
  688. }
  689. .choice-box {
  690. display: flex;
  691. }
  692. .choice-item {
  693. margin: 0 10px;
  694. min-width: 300px;
  695. border: 1px solid #d7d7d7;
  696. height: 300px;
  697. overflow-x: hidden;
  698. overflow-y: auto;
  699. }
  700. .choice-item-menv {
  701. margin: 15px 20px;
  702. cursor: pointer;
  703. }
  704. .choice-item-menv.active {
  705. color: #47c6a2;
  706. }
  707. .choice-item-checkbox {
  708. padding: 10px 20px;
  709. width: 100%;
  710. box-sizing: border-box;
  711. }
  712. </style>