index.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661
  1. <template>
  2. <div id="classHours">
  3. <div style="margin-bottom: 10px">
  4. <el-button
  5. :size="size"
  6. :type="active === 1 ? 'primary' : ''"
  7. @click="changeActive(1)"
  8. >班级学员</el-button
  9. >
  10. <el-button
  11. :size="size"
  12. :type="active === 2 ? 'primary' : ''"
  13. @click="changeActive(2)"
  14. >学时管理</el-button
  15. >
  16. </div>
  17. <div class="dis__s">
  18. <div>
  19. <span style="font-size: 15px; color: #666">审核状态:</span
  20. ><el-button
  21. :type="activeBtn === 3 ? 'primary' : ''"
  22. :size="size"
  23. @click="changeBTN(3)"
  24. >全部</el-button
  25. ><el-button
  26. :type="activeBtn === 2 ? 'primary' : ''"
  27. :size="size"
  28. @click="changeBTN(2)"
  29. >待审核
  30. <i
  31. class="el-icon-warning-outline"
  32. :style="
  33. reviewListNums >= 200
  34. ? 'color:red;'
  35. : reviewListNums < 200 && reviewListNums > 99
  36. ? 'color:green'
  37. : reviewListNums < 100
  38. ? 'color:block;'
  39. : ''
  40. "
  41. style="font-weight: bold"
  42. ></i>
  43. <!-- <i
  44. class="el-icon-warning-outline"
  45. :style="
  46. reviewListNums >= 3
  47. ? 'color:red;'
  48. : reviewListNums < 3 && reviewListNums > 1
  49. ? 'color:green'
  50. : reviewListNums <= 1
  51. ? 'color:block;'
  52. : ''
  53. "
  54. style="font-weight: bold"
  55. ></i> --> </el-button
  56. ><el-button
  57. :type="activeBtn === 0 ? 'primary' : ''"
  58. :size="size"
  59. @click="changeBTN(0)"
  60. >不通过</el-button
  61. ><el-button
  62. :type="activeBtn === 1 ? 'primary' : ''"
  63. :size="size"
  64. @click="changeBTN(1)"
  65. >已通过</el-button
  66. >
  67. </div>
  68. <div>
  69. <el-button
  70. size="small"
  71. v-if="statusShow.indexOf(2) !== -1"
  72. @click="uploadXS"
  73. >官方学时推送</el-button
  74. >
  75. <span
  76. style="font-size: 14px; margin: 0px 6px"
  77. v-if="statusShow.indexOf(2) !== -1"
  78. >已推送:{{gfNum}}/{{total}}</span
  79. >
  80. </div>
  81. </div>
  82. <table-list
  83. ref="tableList"
  84. :tableSets="tableSet"
  85. :tableData="tableData"
  86. :navText="navText"
  87. @addClick="addClick"
  88. :loading="loading"
  89. @editInfo="editInfo"
  90. >
  91. <template slot="btn" slot-scope="props">
  92. <el-button type="text" @click="addClick(props.scope.row, 2)"
  93. >学时审核</el-button
  94. >
  95. </template>
  96. </table-list>
  97. <pagination
  98. :total="total"
  99. :pageSize="formData.pageSize"
  100. :currentPage="formData.pageNum"
  101. @handleSizeChange="handleSizeChange"
  102. @handleCurrentChange="handleCurrentChange"
  103. />
  104. <el-dialog
  105. :visible.sync="dialogVisible"
  106. width="560px"
  107. :show-close="false"
  108. :close-on-click-modal="false"
  109. >
  110. <div slot="title" class="hearders">
  111. <div class="leftTitle">
  112. {{ stice == 1 ? "批准结业" : stice == 3 ? "移除学员" : "" }}
  113. </div>
  114. <div class="rightBoxs">
  115. <img
  116. src="@/assets/images/Close@2x.png"
  117. alt=""
  118. @click="dialogVisible = false"
  119. />
  120. </div>
  121. </div>
  122. <div>
  123. <ul>
  124. <li
  125. v-for="(item, index) in allCheckList"
  126. :key="index"
  127. class="btnLists"
  128. >
  129. {{ item.realName }}
  130. <i class="el-icon-close btnIcon" @click="clearStudent(index)"></i>
  131. </li>
  132. <div style="clear: both"></div>
  133. <p>
  134. {{
  135. stice == 1
  136. ? "所选学员已完成学习,批准结业!"
  137. : stice == 3
  138. ? "是否移除所选中的学员?"
  139. : ""
  140. }}
  141. </p>
  142. </ul>
  143. </div>
  144. <span slot="footer" class="dialog-footer">
  145. <el-button @click="dialogVisible = false">取 消</el-button>
  146. <el-button type="primary" @click="submit">确 定</el-button>
  147. </span>
  148. </el-dialog>
  149. </div>
  150. </template>
  151. <script>
  152. import tableList from "@/components/tableList";
  153. import pagination from "@/components/pagination";
  154. import { mapGetters } from "vuex";
  155. export default {
  156. // name: "ClassHours",
  157. components: { tableList, pagination },
  158. data() {
  159. return {
  160. reviewListNums: 0,
  161. statusShow: "", //1无官方接口按钮 2只有官方推送 3都有
  162. size: "medium",
  163. active: 2,
  164. activeBtn: 3,
  165. loading: false, //当前表单加载是否加载动画
  166. navText: {
  167. title: "学时管理:",
  168. index: 0,
  169. ch: "条",
  170. num: false,
  171. border: true,
  172. choice: true,
  173. addHide: true,
  174. gfxsStatus: false,
  175. backFatherBtn: {
  176. status: false,
  177. title: "未定义",
  178. },
  179. },
  180. formData: {
  181. gradeId: this.$route.query.id,
  182. status: "0,1",
  183. pageSize: 10,
  184. pageNum: 1,
  185. },
  186. // 表单
  187. tableSet: [
  188. {
  189. label: "学员编码",
  190. prop: "studentCode",
  191. hidden: true,
  192. width: "180px",
  193. },
  194. {
  195. label: "学员姓名",
  196. prop: "realName",
  197. hidden: true,
  198. },
  199. {
  200. label: "学员身份证",
  201. prop: "idCard",
  202. hidden: true,
  203. width: "180px",
  204. },
  205. {
  206. label: "绑定手机号码",
  207. prop: "telPhone",
  208. hidden: true,
  209. width: "130px",
  210. },
  211. {
  212. label: "所购商品",
  213. prop: "goodsName",
  214. hidden: true,
  215. width: "280px",
  216. },
  217. {
  218. label: "所在班级",
  219. prop: "className",
  220. hidden: true,
  221. width: "160px",
  222. },
  223. {
  224. label: "班级有效期",
  225. prop1: "classStartTime",
  226. prop2: "classEndTime",
  227. hidden: true,
  228. scope: "TimeLists",
  229. width: "260px",
  230. },
  231. {
  232. label: "学时",
  233. prop: "classHours",
  234. hidden: true,
  235. },
  236. {
  237. label: "视频学习进度(节)",
  238. prop1: "stuAllNum",
  239. prop2: "secAllNum",
  240. hidden: true,
  241. scope: "computer",
  242. width: "160px",
  243. },
  244. {
  245. label: "做题进度(章卷)",
  246. prop1: "recordNum",
  247. prop2: "examNum",
  248. hidden: true,
  249. scope: "computer",
  250. width: "160px",
  251. },
  252. {
  253. label: "学习开始时间",
  254. prop: "startTime",
  255. hidden: true,
  256. scope: "aTimeList",
  257. width: "160px",
  258. },
  259. {
  260. label: "学习结束时间",
  261. prop: "endTime",
  262. hidden: true,
  263. scope: "aTimeList",
  264. width: "160px",
  265. },
  266. {
  267. label: "学习有效期",
  268. prop1: "studyStartTime",
  269. prop2: "studyEndTime",
  270. hidden: true,
  271. scope: "TimeLists",
  272. width: "310px",
  273. },
  274. {
  275. label: "填写资料审核状态",
  276. prop: "profileStatus",
  277. hidden: true,
  278. scope: "isOptions",
  279. width: "160px",
  280. options: [
  281. {
  282. label: "审核通过",
  283. value: 1,
  284. },
  285. {
  286. label: "待审核",
  287. value: 2,
  288. },
  289. {
  290. label: "审核不通过",
  291. value: 3,
  292. },
  293. ],
  294. },
  295. {
  296. label: "学时审批状态",
  297. prop: "allStatus",
  298. hidden: true,
  299. scope: "statusPeriod",
  300. width: "130px",
  301. },
  302. {
  303. label: "待重修(视频节和题卷)",
  304. prop: "waitRebuildNum",
  305. prop1: "rebuildNum",
  306. hidden: true,
  307. scope: "againStudent",
  308. width: "160px",
  309. },
  310. ],
  311. tableData: [], //表单数据
  312. total: 0, //一共多少条
  313. gfNum: 0, //学时数量
  314. dialogVisible: false,
  315. allCheckList: [], //多选数组
  316. stice: 0,
  317. };
  318. },
  319. computed: { ...mapGetters(["reviewStatus"]) },
  320. async mounted() {
  321. await this.getStatus();
  322. this.search();
  323. this.getInitList();
  324. },
  325. activated() {
  326. this.getStatus();
  327. this.search();
  328. this.getInitList();
  329. },
  330. methods: {
  331. uploadXS() {
  332. if (!this.$refs.tableList.allCheckData.length) {
  333. this.$message.warning("请勾选需要学时信息推送的学员");
  334. return;
  335. }
  336. let arr = this.$refs.tableList.allCheckData.map((item) => {
  337. return {
  338. userId: item.userId,
  339. gradeId: this.$route.query.id,
  340. };
  341. });
  342. this.$api.editGradeUsereditpushPeriod(arr).then((res) => {
  343. if (res.code === 200) {
  344. if (!res.msg) {
  345. this.$message.success("推送成功");
  346. } else {
  347. this.$message.error(res.msg);
  348. }
  349. this.search();
  350. this.$refs.tableList.clearMoreActive();
  351. }
  352. });
  353. },
  354. changeBTN(int) {
  355. this.activeBtn = int;
  356. this.search(6);
  357. },
  358. getStatus() {
  359. return new Promise((resolve, reject) => {
  360. this.$api
  361. .inquireGradegradelistselectButton({
  362. gradeId: parseInt(this.$route.query.id),
  363. })
  364. .then((res) => {
  365. this.statusShow = res.data;
  366. if (res.data.indexOf(2) !== -1) {
  367. this.navText.gfxsStatus = true;
  368. } else {
  369. this.navText.gfxsStatus = false;
  370. }
  371. resolve();
  372. });
  373. });
  374. },
  375. submitTable() {},
  376. submit() {
  377. let ars = [];
  378. this.allCheckList.map((item) => {
  379. ars.push(item.id);
  380. });
  381. let data = {
  382. id: ars,
  383. };
  384. if (this.stice === 1) {
  385. data.finishStatus = 1;
  386. }
  387. if (this.stice === 3) {
  388. data.status = 0;
  389. }
  390. this.$api.editGradeUserGradegrade(data).then((res) => {
  391. this.dialogVisible = false;
  392. this.$message.success("修改成功");
  393. this.search();
  394. });
  395. },
  396. clearStudent(index) {
  397. this.allCheckList.splice(index, 1);
  398. },
  399. editInfo(v) {
  400. this.addClick(v, 2);
  401. },
  402. addClick(v, int) {
  403. // int = 2详情 3学员管理
  404. if (v === undefined) {
  405. // 添加班级
  406. // this.$router.push({
  407. // path: "addClass",
  408. // });
  409. } else {
  410. if (int === 2) {
  411. //学员详情
  412. this.$router.push({
  413. path: "classHoursReview",
  414. query: {
  415. id: v.gradeId,
  416. userId: v.userId,
  417. goodsId: v.goodsId,
  418. },
  419. });
  420. }
  421. if (int === 3) {
  422. // 学员管理
  423. // this.$router.push({
  424. // path: "studentMenu",
  425. // query: {
  426. // id: v.gradeId,
  427. // },
  428. // });
  429. }
  430. }
  431. },
  432. changeActive(int) {
  433. if (int == this.active) {
  434. return;
  435. } else {
  436. if (int === 1) {
  437. const jump = () => {
  438. this.$router.push({
  439. path: "studentMenu",
  440. query: {
  441. id: this.$route.query.id,
  442. goodsId: this.$route.query.goodsId,
  443. },
  444. });
  445. };
  446. const statusPage = this.$store.state.tagsView.visitedViews.some(
  447. (item) => {
  448. return item.name == "StudentMenu";
  449. }
  450. );
  451. if (statusPage) {
  452. this.$store
  453. .dispatch("tagsView/delCachedView", {
  454. name: "StudentMenu",
  455. })
  456. .then((res) => {
  457. jump();
  458. });
  459. } else {
  460. jump();
  461. }
  462. // this.active = int;
  463. }
  464. }
  465. },
  466. search(int) {
  467. this.loading = true;
  468. if (int === 1) {
  469. this.formData.pageNum = 1;
  470. }
  471. if (int === 2) {
  472. this.formData = {
  473. gradeId: this.$route.query.id,
  474. status: "0,1",
  475. pageSize: 10,
  476. pageNum: 1,
  477. };
  478. }
  479. if (int === 6) {
  480. if (this.activeBtn == 3) {
  481. this.formData = {
  482. gradeId: this.$route.query.id,
  483. status: "0,1",
  484. pageSize: 10,
  485. pageNum: 1,
  486. };
  487. } else {
  488. this.formData = {
  489. periodStatus: this.activeBtn,
  490. gradeId: this.$route.query.id,
  491. status: "0,1",
  492. pageSize: 10,
  493. pageNum: 1,
  494. };
  495. }
  496. }
  497. this.$api
  498. .inquireGradegradelistUserPeriod(this.formData)
  499. .then((res) => {
  500. this.tableData = res.rows;
  501. this.total = res.total;
  502. this.navText.index = res.total;
  503. if (this.navText.gfxsStatus) {
  504. this.$api
  505. .inquireGradegradeofficialPeriodCount({
  506. gradeId: this.$route.query.id,
  507. })
  508. .then((res) => {
  509. this.gfNum = res.data;
  510. });
  511. }
  512. })
  513. .finally(() => {
  514. this.loading = false;
  515. });
  516. },
  517. /**
  518. * 待审核数量
  519. */
  520. getInitList() {
  521. this.$api
  522. .inquireGradegradelistUserPeriod({
  523. periodStatus: 2,
  524. gradeId: this.$route.query.id,
  525. status: "0,1",
  526. })
  527. .then((res) => {
  528. this.reviewListNums = res.rows.length;
  529. });
  530. },
  531. handleSizeChange(v) {
  532. this.formData.pageSize = v;
  533. this.formData.pageNum = 1;
  534. this.search();
  535. },
  536. handleCurrentChange(v) {
  537. this.formData.pageNum = v;
  538. this.search();
  539. },
  540. },
  541. };
  542. </script>
  543. <style lang="less" scoped>
  544. .dis__s {
  545. margin-bottom: 14px;
  546. display: flex;
  547. align-items: center;
  548. justify-content: space-between;
  549. }
  550. .btnLists {
  551. float: left;
  552. border: 1px solid #333;
  553. padding: 0px 10px;
  554. margin-right: 10px;
  555. margin-bottom: 10px;
  556. border-radius: 4px;
  557. height: 30px;
  558. line-height: 30px;
  559. .btnIcon {
  560. cursor: pointer;
  561. transition: all 0.2s;
  562. &:hover {
  563. color: blue;
  564. }
  565. }
  566. }
  567. /deep/.el-button {
  568. border-radius: 8px;
  569. }
  570. /deep/.el-dialog {
  571. border-radius: 8px;
  572. .el-dialog__header {
  573. padding: 0;
  574. .hearders {
  575. height: 40px;
  576. display: flex;
  577. align-items: center;
  578. justify-content: space-between;
  579. padding: 0px 18px 0px 20px;
  580. border-bottom: 1px solid #e2e2e2;
  581. .leftTitle {
  582. font-size: 14px;
  583. font-weight: bold;
  584. color: #2f4378;
  585. }
  586. .rightBoxs {
  587. display: flex;
  588. align-items: center;
  589. img {
  590. width: 14px;
  591. height: 14px;
  592. margin-left: 13px;
  593. cursor: pointer;
  594. }
  595. }
  596. }
  597. }
  598. .el-dialog__footer {
  599. padding: 0;
  600. .dialog-footer {
  601. padding: 0px 40px;
  602. height: 70px;
  603. border-top: 1px solid #e2e2e2;
  604. display: flex;
  605. align-items: center;
  606. justify-content: flex-end;
  607. }
  608. }
  609. }
  610. .imgBox {
  611. width: 100%;
  612. // height: 210px;
  613. border: 1px solid #e2e2e2;
  614. border-radius: 8px;
  615. padding: 8px 8px 3px;
  616. display: flex;
  617. flex-direction: column;
  618. align-items: center;
  619. .imgLabel {
  620. flex: 1;
  621. width: 100%;
  622. border: 1px dotted #e2e2e2;
  623. color: #999;
  624. font-size: 14px;
  625. cursor: pointer;
  626. border-radius: 8px;
  627. .msPhoto {
  628. display: flex;
  629. justify-content: center;
  630. align-items: center;
  631. max-width: 100%;
  632. max-height: 270px;
  633. img {
  634. max-width: 100%;
  635. max-height: 270px;
  636. }
  637. }
  638. .imgbbx {
  639. display: flex;
  640. flex-direction: column;
  641. align-items: center;
  642. justify-content: center;
  643. width: 100%;
  644. height: 100%;
  645. i {
  646. font-weight: bold;
  647. margin: 14px 0;
  648. font-size: 24px;
  649. }
  650. }
  651. }
  652. p {
  653. margin: 5px 0px;
  654. }
  655. }
  656. /deep/.radioTables > .el-radio__label {
  657. display: none;
  658. }
  659. </style>