index copy.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554
  1. <template>
  2. <div id="classList">
  3. <search-box-new
  4. ref="searchBox"
  5. :formData="formData"
  6. :formList="formList"
  7. @search="search"
  8. @init="init"
  9. />
  10. <table-list
  11. :tableSets="tableSet"
  12. :tableData="tableData"
  13. :navText="navText"
  14. @addClick="addClick"
  15. :loading="loading"
  16. @editInfo="editInfo"
  17. >
  18. <template slot="btn" slot-scope="props">
  19. <el-button type="text" @click="addClick(props.scope.row, 2)"
  20. >详情</el-button
  21. >
  22. <el-button type="text" @click="addClick(props.scope.row, 3)"
  23. >学员管理</el-button
  24. >
  25. <el-button type="text" @click="del(props.scope.row)">删除</el-button>
  26. </template>
  27. </table-list>
  28. <pagination
  29. :total="total"
  30. :pageSize="formData.pageSize"
  31. :currentPage="formData.pageNum"
  32. @handleSizeChange="handleSizeChange"
  33. @handleCurrentChange="handleCurrentChange"
  34. />
  35. </div>
  36. </template>
  37. <script>
  38. import searchBoxNew from "@/components/searchBoxNew";
  39. import tableList from "@/components/tableList";
  40. import pagination from "@/components/pagination";
  41. export default {
  42. components: { searchBoxNew, tableList, pagination },
  43. name: "ClassList",
  44. data() {
  45. return {
  46. loading: false, //当前表单加载是否加载动画
  47. navText: {
  48. border: true,
  49. title: "班级管理",
  50. index: 0,
  51. ch: "条",
  52. num: false,
  53. choice: true,
  54. addHide: false,
  55. backFatherBtn: {
  56. status: false,
  57. title: "未定义",
  58. },
  59. },
  60. //搜索
  61. formList: [
  62. {
  63. prop: "educationTypeId",
  64. placeholder: "教育类型",
  65. scope: "educationType",
  66. },
  67. {
  68. prop: "businessId",
  69. placeholder: "业务层次",
  70. scope: "businessLevel",
  71. edu: "educationTypeId",
  72. },
  73. {
  74. prop: "schoolId",
  75. placeholder: "院校",
  76. scope: "schoolList",
  77. edu: "educationTypeId",
  78. },
  79. {
  80. prop: "majorId",
  81. placeholder: "专业",
  82. scope: "Professional",
  83. edu: "educationTypeId",
  84. },
  85. {
  86. prop: "subjectId",
  87. placeholder: "科目",
  88. scope: "sujectType",
  89. edu: "educationTypeId",
  90. },
  91. {
  92. prop: "classStatus",
  93. placeholder: "开班状态",
  94. scope: "select",
  95. options: [
  96. { label: "已开班", value: 1 },
  97. { label: "预报名(未开班)", value: 0 },
  98. ],
  99. },
  100. {
  101. prop: "status",
  102. placeholder: "班级状态",
  103. scope: "select",
  104. noClear: false,
  105. options: [
  106. { label: "全部状态", value: "0,1" },
  107. { label: "无效", value: 0 },
  108. { label: "有效", value: 1 },
  109. ],
  110. },
  111. {
  112. prop1: "classStartTime",
  113. prop2: "classEndTime",
  114. placeholder1: "班级有效期开始时间",
  115. placeholder2: "班级有效期结束时间",
  116. scope: "moreDataPicker",
  117. },
  118. {
  119. prop: "searchKey",
  120. placeholder: "请输入班级名称/商品名称",
  121. },
  122. {
  123. prop: "userName",
  124. placeholder: "请输入学员姓名",
  125. },
  126. ],
  127. formData: {
  128. status: "0,1",
  129. pageSize: 10,
  130. pageNum: 1,
  131. classStatus: "",
  132. },
  133. // 表单
  134. tableSet: [
  135. {
  136. label: "商品编码",
  137. prop: "code",
  138. objProp: "goodsList",
  139. hidden: false,
  140. scope: "objType",
  141. },
  142. {
  143. label: "年份",
  144. prop: "year",
  145. objProp: "goodsList",
  146. hidden: false,
  147. scope: "objType",
  148. },
  149. {
  150. label: "商品业务层级",
  151. prop1: "educationName",
  152. prop2: "projectName",
  153. prop3: "businessName",
  154. objProp: "goodsList",
  155. hidden: false,
  156. scope: "objTypeYW",
  157. },
  158. {
  159. label: "商品名称",
  160. prop: "goodsName",
  161. objProp: "goodsList",
  162. hidden: true,
  163. scope: "objType",
  164. },
  165. {
  166. label: "科目",
  167. prop: "subjectNames",
  168. hidden: true,
  169. },
  170. {
  171. label: "班级编码",
  172. prop: "gradeCode",
  173. hidden: false,
  174. },
  175. {
  176. label: "班级号",
  177. prop: "classStatus",
  178. prop1: "officialName",
  179. hidden: true,
  180. scope: "classTypes",
  181. },
  182. {
  183. label: "班级名称",
  184. prop: "className",
  185. hidden: true,
  186. scope: "editInfo",
  187. },
  188. {
  189. label: "学时",
  190. prop: "classHours",
  191. objProp: "goodsList",
  192. hidden: false,
  193. scope: "objType",
  194. },
  195. {
  196. label: "班主任",
  197. prop: "nickName",
  198. hidden: false,
  199. },
  200. {
  201. label: "班级人数",
  202. prop1: "studentNum",
  203. prop2: "studentUpper",
  204. hidden: true,
  205. scope: "peopleNums",
  206. },
  207. {
  208. label: "班级总人数",
  209. prop1: "studentNumAll",
  210. prop2: "studentUpper",
  211. hidden: true,
  212. scope: "peopleNums",
  213. },
  214. {
  215. label: "开放学习时间",
  216. prop: "learningStatus",
  217. prop1: "learningTimeStart",
  218. hidden: true,
  219. scope: "classTimeTypes",
  220. },
  221. {
  222. label: "班级状态",
  223. prop: "status",
  224. hidden: false,
  225. scope: "isOptions",
  226. options: [
  227. {
  228. label: "有效",
  229. value: 1,
  230. },
  231. {
  232. label: "无效",
  233. value: 0,
  234. },
  235. ],
  236. },
  237. {
  238. label: "班级有效期",
  239. prop1: "classStartTime",
  240. prop2: "classEndTime",
  241. hidden: true,
  242. Diszing: false,
  243. scope: "TimeLists",
  244. },
  245. ],
  246. tableData: [], //表单数据
  247. total: 0, //一共多少条
  248. };
  249. },
  250. async mounted() {
  251. if (Object.keys(this.$route.params).length) {
  252. if (this.$route.params.educationId) {
  253. this.$set(
  254. this.formData,
  255. "educationTypeId",
  256. this.$route.params.educationId
  257. );
  258. this.$refs.searchBox.changeEducationType(
  259. this.$route.params.educationId,
  260. true
  261. );
  262. }
  263. if (this.$route.params.businessId) {
  264. this.$set(this.formData, "businessId", this.$route.params.businessId);
  265. this.$refs.searchBox.changeBusinessLevel(this.$route.params.businessId);
  266. }
  267. if (this.$route.params.userId) {
  268. this.$set(this.formData, "userId", this.$route.params.userId);
  269. }
  270. if (this.$route.params.classStatus >= 0) {
  271. this.$set(this.formData, "classStatus", this.$route.params.classStatus);
  272. }
  273. if (this.$route.params.hasInterface >= 0) {
  274. this.formData.hasInterface = this.$route.params.hasInterface;
  275. }
  276. } else {
  277. // await this.moRenBus();
  278. }
  279. if (this.$route.params.timeType >= 0) {
  280. this.$set(
  281. this.formData,
  282. "classStartTime",
  283. this.$methodsTools.timestampConvert(this.$route.params.timeType)[0]
  284. );
  285. this.$set(
  286. this.formData,
  287. "classEndTime",
  288. this.$methodsTools.timestampConvert(this.$route.params.timeType)[1]
  289. );
  290. }
  291. this.search();
  292. },
  293. activated() {
  294. this.search();
  295. },
  296. methods: {
  297. /**
  298. * 默认选择继教二建业务层次
  299. */
  300. moRenBus() {
  301. return new Promise((resolve, reject) => {
  302. this.$api.inquireCourseEducationType({ status: 1 }).then((res) => {
  303. console.log(res);
  304. for (let i = 0; i < res.rows.length; i++) {
  305. if (res.rows[i].educationName === "继续教育") {
  306. this.$api
  307. .inquirebusinessList({ status: 1, educationId: res.rows[i].id })
  308. .then((result) => {
  309. for (let j = 0; j < result.rows.length; j++) {
  310. if (
  311. result.rows[j].projectName === "建造师" &&
  312. result.rows[j].businessName === "二级"
  313. ) {
  314. this.$set(
  315. this.formData,
  316. "educationTypeId",
  317. res.rows[i].id
  318. );
  319. this.$refs.searchBox.changeEducationType(
  320. res.rows[i].id,
  321. true
  322. );
  323. this.$set(this.formData, "businessId", result.rows[j].id);
  324. this.$refs.searchBox.changeBusinessLevel(
  325. result.rows[j].id
  326. );
  327. resolve();
  328. break;
  329. }
  330. }
  331. });
  332. break;
  333. }
  334. }
  335. });
  336. });
  337. },
  338. editInfo(v) {
  339. this.addClick(v, 2);
  340. },
  341. search(int) {
  342. this.loading = true;
  343. if (int === 1) {
  344. this.formData.pageNum = 1;
  345. }
  346. if (int === 2) {
  347. this.formData = {
  348. status: "0,1",
  349. pageSize: 10,
  350. pageNum: 1,
  351. classStatus: "",
  352. };
  353. }
  354. if (int === 4) {
  355. this.formData.pageNum = 1;
  356. }
  357. var data = JSON.parse(JSON.stringify(this.formData));
  358. if (this.formData.classStartTime) {
  359. data.classStartTime = parseInt(data.classStartTime / 1000);
  360. }
  361. if (this.formData.classEndTime) {
  362. data.classEndTime = parseInt(data.classEndTime / 1000);
  363. }
  364. this.$api
  365. .inquireGradegradesearchList(data)
  366. .then((res) => {
  367. this.tableData = res.rows;
  368. this.total = res.total;
  369. this.navText.index = res.total;
  370. })
  371. .finally(() => {
  372. this.loading = false;
  373. });
  374. },
  375. init() {
  376. this.search(2);
  377. },
  378. del(v) {
  379. this.$alert(
  380. "确定删除此内容?<br />内容删除后将无法恢复,请慎重考虑",
  381. "提示",
  382. {
  383. dangerouslyUseHTMLString: true,
  384. }
  385. )
  386. .then(() => {
  387. var data = {
  388. gradeId: v.gradeId,
  389. status: -1,
  390. };
  391. this.$api.editGradegrade(data).then((res) => {
  392. this.$message.success("删除成功");
  393. this.search();
  394. });
  395. })
  396. .catch(() => {
  397. this.$message({
  398. type: "info",
  399. message: "已取消删除",
  400. });
  401. });
  402. },
  403. addClick(v, int) {
  404. // int = 2详情 3学员管理
  405. if (v === undefined) {
  406. // 添加班级
  407. this.$router.push({
  408. path: "addClass",
  409. });
  410. } else {
  411. if (int === 2) {
  412. const jump = () => {
  413. //班级详情
  414. this.$router.push({
  415. path: "manageClass",
  416. query: {
  417. id: v.gradeId,
  418. },
  419. });
  420. };
  421. const statusPage = this.$store.state.tagsView.visitedViews.some(
  422. (item) => {
  423. return item.name == "ManageClass";
  424. }
  425. );
  426. if (statusPage) {
  427. this.$store
  428. .dispatch("tagsView/delCachedView", {
  429. name: "ManageClass",
  430. })
  431. .then((res) => {
  432. jump();
  433. });
  434. } else {
  435. jump();
  436. }
  437. }
  438. if (int === 3) {
  439. // 学员管理
  440. this.$router.push({
  441. path: "studentMenu",
  442. query: {
  443. id: v.gradeId,
  444. goodsId: v.goodsList[0].goodsId,
  445. },
  446. });
  447. }
  448. }
  449. },
  450. handleSizeChange(v) {
  451. this.formData.pageSize = v;
  452. this.formData.pageNum = 1;
  453. this.search();
  454. },
  455. handleCurrentChange(v) {
  456. this.formData.pageNum = v;
  457. this.search();
  458. },
  459. },
  460. };
  461. </script>
  462. <style lang="less" scoped>
  463. /deep/.el-button {
  464. border-radius: 8px;
  465. }
  466. /deep/.el-dialog {
  467. border-radius: 8px;
  468. .el-dialog__header {
  469. padding: 0;
  470. .hearders {
  471. height: 40px;
  472. display: flex;
  473. align-items: center;
  474. justify-content: space-between;
  475. padding: 0px 18px 0px 20px;
  476. border-bottom: 1px solid #e2e2e2;
  477. .leftTitle {
  478. font-size: 14px;
  479. font-weight: bold;
  480. color: #2f4378;
  481. }
  482. .rightBoxs {
  483. display: flex;
  484. align-items: center;
  485. img {
  486. width: 14px;
  487. height: 14px;
  488. margin-left: 13px;
  489. cursor: pointer;
  490. }
  491. }
  492. }
  493. }
  494. .el-dialog__footer {
  495. padding: 0;
  496. .dialog-footer {
  497. padding: 0px 40px;
  498. height: 70px;
  499. border-top: 1px solid #e2e2e2;
  500. display: flex;
  501. align-items: center;
  502. justify-content: flex-end;
  503. }
  504. }
  505. }
  506. .imgBox {
  507. width: 100%;
  508. // height: 210px;
  509. border: 1px solid #e2e2e2;
  510. border-radius: 8px;
  511. padding: 8px 8px 3px;
  512. display: flex;
  513. flex-direction: column;
  514. align-items: center;
  515. .imgLabel {
  516. flex: 1;
  517. width: 100%;
  518. border: 1px dotted #e2e2e2;
  519. color: #999;
  520. font-size: 14px;
  521. cursor: pointer;
  522. border-radius: 8px;
  523. .msPhoto {
  524. display: flex;
  525. justify-content: center;
  526. align-items: center;
  527. max-width: 100%;
  528. max-height: 270px;
  529. img {
  530. max-width: 100%;
  531. max-height: 270px;
  532. }
  533. }
  534. .imgbbx {
  535. display: flex;
  536. flex-direction: column;
  537. align-items: center;
  538. justify-content: center;
  539. width: 100%;
  540. height: 100%;
  541. i {
  542. font-weight: bold;
  543. margin: 14px 0;
  544. font-size: 24px;
  545. }
  546. }
  547. }
  548. p {
  549. margin: 5px 0px;
  550. }
  551. }
  552. </style>