index.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681
  1. <template>
  2. <div id="studentList">
  3. <search-box-new
  4. ref="searchBox"
  5. :formData="formData"
  6. :formList="formList"
  7. @search="search"
  8. @init="init"
  9. ><template slot="customize">
  10. <el-button size="small" type="success" @click="exportUserList"
  11. >导出</el-button
  12. >
  13. </template></search-box-new
  14. >
  15. <table-list
  16. :tableSets="tableSet"
  17. :tableData="tableData"
  18. :navText="navText"
  19. @addClick="addClick"
  20. :loading="loading"
  21. @editInfo="editInfo"
  22. >
  23. <template slot="btn" slot-scope="props">
  24. <el-button type="text" @click="addClick(props.scope.row, 2)"
  25. >详情</el-button
  26. >
  27. <!-- <el-button type="text" @click="addClick(props.scope.row, 3)"
  28. >选班</el-button
  29. > -->
  30. </template>
  31. </table-list>
  32. <pagination
  33. :total="total"
  34. :pageSize="formData.pageSize"
  35. :currentPage="formData.pageNum"
  36. @handleSizeChange="handleSizeChange"
  37. @handleCurrentChange="handleCurrentChange"
  38. />
  39. </div>
  40. </template>
  41. <script>
  42. import * as baseUrls from "@/utils/request.js";
  43. import searchBoxNew from "@/components/searchBoxNew";
  44. import tableList from "@/components/tableList";
  45. import pagination from "@/components/pagination";
  46. export default {
  47. name: "StudentList",
  48. components: { searchBoxNew, tableList, pagination },
  49. data() {
  50. return {
  51. loading: false, //当前表单加载是否加载动画
  52. navText: {
  53. title: "学员管理",
  54. index: 0,
  55. ch: "条",
  56. num: false,
  57. border: true,
  58. choice: true,
  59. addHide: true,
  60. backFatherBtn: {
  61. status: false,
  62. title: "未定义",
  63. },
  64. },
  65. //搜索
  66. formList: [
  67. {
  68. prop: "educationTypeId",
  69. placeholder: "教育类型",
  70. scope: "educationType",
  71. },
  72. {
  73. prop: "businessId",
  74. placeholder: "业务层次",
  75. scope: "businessLevel",
  76. edu: "educationTypeId",
  77. },
  78. {
  79. prop: "gradePoint",
  80. placeholder: "是否分班",
  81. scope: "select",
  82. options: [
  83. {
  84. label: "已分班",
  85. value: 1,
  86. },
  87. {
  88. label: "未分班",
  89. value: 2,
  90. },
  91. ],
  92. },
  93. {
  94. prop: "hasBindWx",
  95. placeholder: "是否绑定微信",
  96. scope: "select",
  97. options: [
  98. {
  99. label: "是",
  100. value: 1,
  101. },
  102. {
  103. label: "否",
  104. value: 0,
  105. },
  106. ],
  107. },
  108. {
  109. prop: "hasFollowWx",
  110. placeholder: "是否关注公众号",
  111. scope: "select",
  112. options: [
  113. {
  114. label: "是",
  115. value: 1,
  116. },
  117. {
  118. label: "否",
  119. value: 0,
  120. },
  121. ],
  122. },
  123. {
  124. prop1: "startTime",
  125. prop2: "endTime",
  126. placeholder1: "创建开始时间",
  127. placeholder2: "创建结束时间",
  128. scope: "moreDataPicker",
  129. Diszing: true,
  130. },
  131. {
  132. prop: "goodsSearchKey",
  133. placeholder: "请输入商品编码/商品名称",
  134. },
  135. {
  136. prop: "companyName",
  137. placeholder: "请输入公司名称",
  138. },
  139. {
  140. prop: "realname",
  141. placeholder: "请输入学员名称",
  142. },
  143. {
  144. prop: "gradeName",
  145. placeholder: "请输入所属班级",
  146. },
  147. {
  148. prop: "lastVisitPlat",
  149. placeholder: "最近访问终端",
  150. scope: "select",
  151. options: [
  152. {
  153. label: "小程序",
  154. value: 1,
  155. },
  156. {
  157. label: "PC网站",
  158. value: 2,
  159. },
  160. ],
  161. },
  162. {
  163. prop1: "visitStartTime",
  164. prop2: "visitEndTime",
  165. placeholder1: "访问开始时间",
  166. placeholder2: "访问结束时间",
  167. scope: "moreDataPicker",
  168. Diszing: true,
  169. },
  170. {
  171. prop: "lastStudyPlat",
  172. placeholder: "最近学习终端",
  173. scope: "select",
  174. options: [
  175. {
  176. label: "小程序",
  177. value: 1,
  178. },
  179. {
  180. label: "PC网站",
  181. value: 2,
  182. },
  183. ],
  184. },
  185. {
  186. prop1: "studyStartTime",
  187. prop2: "studyEndTime",
  188. placeholder1: "学习开始时间",
  189. placeholder2: "学习结束时间",
  190. scope: "moreDataPicker",
  191. Diszing: true,
  192. },
  193. {
  194. prop: "idCard",
  195. placeholder: "学员身份证",
  196. },
  197. {
  198. prop: "telphone",
  199. placeholder: "学员手机号码",
  200. },
  201. ],
  202. formData: {
  203. status: "0,1",
  204. pageSize: 10,
  205. pageNum: 1,
  206. getOrderNum: 1,
  207. },
  208. // 表单
  209. tableSet: [
  210. {
  211. label: "学员编码",
  212. prop: "studentCode",
  213. hidden: true,
  214. },
  215. {
  216. label: "学员姓名",
  217. prop: "realname",
  218. hidden: true,
  219. scope: "editInfo",
  220. },
  221. {
  222. label: "一寸头像",
  223. prop: "oneInchPhotos",
  224. hidden: true,
  225. scope: "img",
  226. width: "120px",
  227. },
  228. {
  229. label: "学员身份证",
  230. prop: "idCard",
  231. hidden: true,
  232. },
  233. {
  234. label: "绑定手机号",
  235. prop: "telphone",
  236. hidden: true,
  237. },
  238. {
  239. label: "是否绑定小程序账号",
  240. prop: "userBindWx",
  241. hidden: true,
  242. scope: "isOptions",
  243. options: [
  244. {
  245. label: "是",
  246. value: 1,
  247. },
  248. {
  249. label: "否",
  250. value: 0,
  251. },
  252. ],
  253. },
  254. {
  255. label: "是否关注公众号",
  256. prop: "userFollowWx",
  257. hidden: true,
  258. scope: "isOptions",
  259. options: [
  260. {
  261. label: "是",
  262. value: 1,
  263. },
  264. {
  265. label: "否",
  266. value: 0,
  267. },
  268. ],
  269. },
  270. {
  271. label: "最近访问终端",
  272. prop: "visitFromPlat",
  273. hidden: true,
  274. scope: "isOptions",
  275. options: [
  276. {
  277. label: "小程序",
  278. value: 1,
  279. },
  280. {
  281. label: "PC网站",
  282. value: 2,
  283. },
  284. ],
  285. },
  286. {
  287. label: "最近访问时间",
  288. prop: "lastVisitTime",
  289. hidden: true,
  290. scope: "aTimeList",
  291. isDiszing:true
  292. },
  293. {
  294. label: "最近学习终端",
  295. prop: "studyFromPlat",
  296. hidden: true,
  297. scope: "isOptions",
  298. options: [
  299. {
  300. label: "小程序",
  301. value: 1,
  302. },
  303. {
  304. label: "PC网站",
  305. value: 2,
  306. },
  307. ],
  308. },
  309. {
  310. label: "最近学习时间",
  311. prop: "lastStudyTime",
  312. hidden: true,
  313. scope: "aTimeList",
  314. isDiszing:true
  315. },
  316. {
  317. label: "所在公司",
  318. prop: "companyName",
  319. hidden: true,
  320. },
  321. {
  322. label: "创建时间",
  323. prop: "createTime",
  324. hidden: true,
  325. scope: "aTimeList",
  326. },
  327. {
  328. label: "所购商品",
  329. prop1: "goodsCourseNum",
  330. prop2: "goodsBankNum",
  331. prop3: "goodsLiveNum",
  332. hidden: true,
  333. scope: "payGoodsList",
  334. },
  335. {
  336. label: "所属班级",
  337. prop: "classGradeUserGoodsVoList",
  338. hidden: true,
  339. scope: "classNums",
  340. sort: true,
  341. width: "120px",
  342. },
  343. ],
  344. tableData: [], //表单数据
  345. total: 0, //一共多少条
  346. };
  347. },
  348. mounted() {
  349. if (this.$route.params.timeType >= 0) {
  350. this.$set(
  351. this.formData,
  352. "startTime",
  353. this.$methodsTools.timestampConvert(this.$route.params.timeType)[0]
  354. );
  355. this.$set(
  356. this.formData,
  357. "endTime",
  358. this.$methodsTools.timestampConvert(this.$route.params.timeType)[1]
  359. );
  360. }
  361. if (this.$route.params.educationId) {
  362. this.$set(
  363. this.formData,
  364. "educationTypeId",
  365. this.$route.params.educationId
  366. );
  367. this.$refs.searchBox.changeEducationType(
  368. this.$route.params.educationId,
  369. true
  370. );
  371. }
  372. if (this.$route.params.businessId) {
  373. this.$set(this.formData, "businessId", this.$route.params.businessId);
  374. this.$refs.searchBox.changeBusinessLevel(this.$route.params.businessId);
  375. }
  376. //学员统计页跳转带参初始化
  377. if (this.$route.params.row) {
  378. console.log(this.$route.params);
  379. let data = JSON.parse(this.$route.params.row);
  380. switch (this.$route.params.type) {
  381. case 1:
  382. //新增学员数
  383. let data1 = new Date(`${data.date} 00:00:00`).getTime();
  384. this.formData.startTime = data1;
  385. this.formData.endTime = data1 + 86399999;
  386. break;
  387. case 2:
  388. //访问学员总数
  389. let data2 = new Date(`${data.date} 00:00:00`).getTime();
  390. this.formData.visitStartTime = data2;
  391. this.formData.visitEndTime = data2 + 86399999;
  392. break;
  393. case 3:
  394. //访问小程序学员数
  395. let data3 = new Date(`${data.date} 00:00:00`).getTime();
  396. this.formData.visitStartTime = data3;
  397. this.formData.visitEndTime = data3 + 86399999;
  398. this.formData.lastVisitPlat = 1;
  399. break;
  400. case 4:
  401. //访问PC学员数
  402. let data4 = new Date(`${data.date} 00:00:00`).getTime();
  403. this.formData.visitStartTime = data4;
  404. this.formData.visitEndTime = data4 + 86399999;
  405. this.formData.lastVisitPlat = 2;
  406. break;
  407. case 5:
  408. //学习学员数
  409. let data5 = new Date(`${data.date} 00:00:00`).getTime();
  410. this.formData.studyStartTime = data5;
  411. this.formData.studyEndTime = data5 + 86399999;
  412. break;
  413. case 6:
  414. //小程序学习学员数
  415. let data6 = new Date(`${data.date} 00:00:00`).getTime();
  416. this.formData.studyStartTime = data6;
  417. this.formData.studyEndTime = data6 + 86399999;
  418. this.formData.lastStudyPlat = 1;
  419. break;
  420. case 7:
  421. //PC学习学员数
  422. let data7 = new Date(`${data.date} 00:00:00`).getTime();
  423. this.formData.studyStartTime = data7;
  424. this.formData.studyEndTime = data7 + 86399999;
  425. this.formData.lastStudyPlat = 2;
  426. break;
  427. default:
  428. break;
  429. }
  430. }
  431. this.search();
  432. },
  433. activated() {
  434. this.search();
  435. },
  436. methods: {
  437. /**
  438. * 导出学员列表
  439. */
  440. exportUserList() {
  441. var data = JSON.parse(JSON.stringify(this.formData));
  442. delete data.pageSize;
  443. delete data.pageNum;
  444. this.$api.inquiregradestudentlistStudentExport(data).then((res) => {
  445. let url = baseUrls.baseURL + "common/download?fileName=" + res.msg;
  446. let link = document.createElement("a");
  447. let fileName = "导入模板" + ".xlsx";
  448. document.body.appendChild(link);
  449. link.href = url;
  450. link.dowmload = fileName;
  451. link.click();
  452. link.remove();
  453. });
  454. },
  455. editInfo(v) {
  456. this.addClick(v, 2);
  457. },
  458. search(int) {
  459. this.loading = true;
  460. if (int === 1) {
  461. this.formData.pageNum = 1;
  462. }
  463. if (int === 2) {
  464. this.formData = {
  465. status: "0,1",
  466. pageSize: 10,
  467. pageNum: 1,
  468. getOrderNum: 1,
  469. };
  470. }
  471. var data = JSON.parse(JSON.stringify(this.formData));
  472. if (this.formData.startTime) {
  473. data.startTime = parseInt(data.startTime / 1000);
  474. }
  475. if (this.formData.endTime) {
  476. data.endTime = parseInt(data.endTime / 1000);
  477. }
  478. if (this.formData.visitStartTime) {
  479. data.visitStartTime = parseInt(data.visitStartTime / 1000);
  480. }
  481. if (this.formData.visitEndTime) {
  482. data.visitEndTime = parseInt(data.visitEndTime / 1000);
  483. }
  484. if (this.formData.studyStartTime) {
  485. data.studyStartTime = parseInt(data.studyStartTime / 1000);
  486. }
  487. if (this.formData.studyEndTime) {
  488. data.studyEndTime = parseInt(data.studyEndTime / 1000);
  489. }
  490. this.$api
  491. .inquiregradestudentlistStudent(data)
  492. .then((res) => {
  493. this.tableData = res.rows;
  494. this.total = res.total;
  495. this.navText.index = res.total;
  496. })
  497. .finally(() => {
  498. this.loading = false;
  499. });
  500. },
  501. init() {
  502. this.search(2);
  503. },
  504. del(v) {
  505. this.$alert(
  506. "确定删除此内容?<br />内容删除后将无法恢复,请慎重考虑",
  507. "提示",
  508. {
  509. dangerouslyUseHTMLString: true,
  510. }
  511. )
  512. .then(() => {
  513. var data = {
  514. chapterExamId: v.chapterExamId,
  515. status: -1,
  516. };
  517. this.$api.editbankchapter(data).then((res) => {
  518. this.$message.success("删除成功");
  519. this.search();
  520. });
  521. })
  522. .catch(() => {
  523. this.$message({
  524. type: "info",
  525. message: "已取消删除",
  526. });
  527. });
  528. },
  529. addClick(v, int) {
  530. // int = 2详情 3选班
  531. if (v === undefined) {
  532. // 添加学员
  533. // this.$router.push({
  534. // path: "addClass",
  535. // });
  536. } else {
  537. if (int === 2) {
  538. const jump = () => {
  539. //学员详情
  540. this.$router.push({
  541. path: "studentXQ",
  542. query: {
  543. id: v.userId,
  544. },
  545. });
  546. };
  547. const statusPage = this.$store.state.tagsView.visitedViews.some(
  548. (item) => {
  549. return item.name == "StudentXQ";
  550. }
  551. );
  552. if (statusPage) {
  553. this.$store
  554. .dispatch("tagsView/delCachedView", {
  555. name: "StudentXQ",
  556. })
  557. .then((res) => {
  558. jump();
  559. });
  560. } else {
  561. jump();
  562. }
  563. }
  564. if (int === 3) {
  565. // 选班
  566. this.$router.push({
  567. path: "studentMenu",
  568. query: {
  569. id: v.userId,
  570. },
  571. });
  572. }
  573. }
  574. },
  575. handleSizeChange(v) {
  576. this.formData.pageSize = v;
  577. this.formData.pageNum = 1;
  578. this.search();
  579. },
  580. handleCurrentChange(v) {
  581. this.formData.pageNum = v;
  582. this.search();
  583. },
  584. },
  585. };
  586. </script>
  587. <style lang="less" scoped>
  588. /deep/.el-button {
  589. border-radius: 8px;
  590. }
  591. /deep/.el-dialog {
  592. border-radius: 8px;
  593. .el-dialog__header {
  594. padding: 0;
  595. .hearders {
  596. height: 40px;
  597. display: flex;
  598. align-items: center;
  599. justify-content: space-between;
  600. padding: 0px 18px 0px 20px;
  601. border-bottom: 1px solid #e2e2e2;
  602. .leftTitle {
  603. font-size: 14px;
  604. font-weight: bold;
  605. color: #2f4378;
  606. }
  607. .rightBoxs {
  608. display: flex;
  609. align-items: center;
  610. img {
  611. width: 14px;
  612. height: 14px;
  613. margin-left: 13px;
  614. cursor: pointer;
  615. }
  616. }
  617. }
  618. }
  619. .el-dialog__footer {
  620. padding: 0;
  621. .dialog-footer {
  622. padding: 0px 40px;
  623. height: 70px;
  624. border-top: 1px solid #e2e2e2;
  625. display: flex;
  626. align-items: center;
  627. justify-content: flex-end;
  628. }
  629. }
  630. }
  631. .imgBox {
  632. width: 100%;
  633. // height: 210px;
  634. border: 1px solid #e2e2e2;
  635. border-radius: 8px;
  636. padding: 8px 8px 3px;
  637. display: flex;
  638. flex-direction: column;
  639. align-items: center;
  640. .imgLabel {
  641. flex: 1;
  642. width: 100%;
  643. border: 1px dotted #e2e2e2;
  644. color: #999;
  645. font-size: 14px;
  646. cursor: pointer;
  647. border-radius: 8px;
  648. .msPhoto {
  649. display: flex;
  650. justify-content: center;
  651. align-items: center;
  652. max-width: 100%;
  653. max-height: 270px;
  654. img {
  655. max-width: 100%;
  656. max-height: 270px;
  657. }
  658. }
  659. .imgbbx {
  660. display: flex;
  661. flex-direction: column;
  662. align-items: center;
  663. justify-content: center;
  664. width: 100%;
  665. height: 100%;
  666. i {
  667. font-weight: bold;
  668. margin: 14px 0;
  669. font-size: 24px;
  670. }
  671. }
  672. }
  673. p {
  674. margin: 5px 0px;
  675. }
  676. }
  677. </style>