StudyTables.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573
  1. <template>
  2. <div class="studyRecordTable">
  3. <div
  4. class="studyStyle"
  5. :class="{ isFixed: headerFixed }"
  6. :style="{ left: left }"
  7. >
  8. <div class="a_style">
  9. <i></i>
  10. <span>视频审核进度</span>
  11. <div class="flex_style_study">
  12. <div class="num_style" style="color: #0047d0">
  13. 待审:{{ userData.pending }}节
  14. </div>
  15. <div class="num_style" style="color: #e53935">
  16. 作弊:{{ userData.cheat }}节
  17. </div>
  18. <div class="num_style" style="color: #43a047">
  19. 通过:{{ userData.pass }}节
  20. </div>
  21. <div style="clear: both"></div>
  22. </div>
  23. </div>
  24. <div class="a_style">
  25. <i></i>
  26. <span>做题审核进度</span>
  27. <div class="flex_style_study">
  28. <div class="num_style" style="color: #0047d0">
  29. 待审:{{ userData.examPending }}节
  30. </div>
  31. <div class="num_style" style="color: #e53935">
  32. 作弊:{{ userData.examCheat }}节
  33. </div>
  34. <div class="num_style" style="color: #43a047">
  35. 通过:{{ userData.examPass }}节
  36. </div>
  37. <div style="clear: both"></div>
  38. </div>
  39. </div>
  40. <div class="a_style" style="width: 280px">
  41. <i></i>
  42. <span>学时审批状态</span>
  43. <div class="flex_style_study">
  44. <div class="num_style" style="color: #0047d0">
  45. {{
  46. ["不可审核", "未通过", "通过审核", "待审核", "审核中"][
  47. periodStatus + 1
  48. ]
  49. }}
  50. </div>
  51. <div style="clear: both"></div>
  52. </div>
  53. </div>
  54. <div class="s_sd">
  55. <template v-if="periodStatus === 2">
  56. <el-checkbox
  57. :disabled="!allIds.length"
  58. :indeterminate="isIndeterminate"
  59. v-model="checkAll"
  60. @change="handleCheckAllChange"
  61. >待审全选</el-checkbox
  62. >
  63. <el-button
  64. style="margin-left: 10px"
  65. size="mini"
  66. type="success"
  67. @click="getChangeStatus(1)"
  68. >勾选通过</el-button
  69. >
  70. <el-button size="mini" type="danger" @click="getChangeStatus(2)"
  71. >勾选作弊</el-button
  72. >
  73. </template>
  74. <template v-if="periodStatus === 3">
  75. <el-button style="margin-left: 10px" size="mini" @click="checkBack"
  76. >勾选数据,打回待审核状态</el-button
  77. >
  78. <el-button size="mini" type="warning" @click="approvedOK = true"
  79. >确认审核通过结果</el-button
  80. >
  81. </template>
  82. <!-- <el-button
  83. v-if="periodStatus === 1"
  84. style="margin-left: 10px"
  85. size="mini"
  86. @click="backToAudit"
  87. >打回待审核状态</el-button
  88. > -->
  89. </div>
  90. </div>
  91. <el-checkbox-group v-model="checkList" @change="handleCheckedCitiesChange">
  92. <component
  93. :is="keys[key]"
  94. v-for="key in Object.keys(tablesData)"
  95. :key="key"
  96. :tabledata="tablesData[key]"
  97. :label="key == 5 ? '卷' : '章'"
  98. :setData="setData"
  99. ></component>
  100. </el-checkbox-group>
  101. <Cheat-dialog
  102. :disabledBtn="disabledBtn"
  103. :vidBoxHours.sync="vidBoxHours"
  104. @close="loadingClose"
  105. @submit="
  106. (reason) => {
  107. submitOK(2, reason);
  108. }
  109. "
  110. ></Cheat-dialog>
  111. <Base-dialog
  112. title="操作提示:"
  113. :disabledBtn="disabledBtn"
  114. :isShow.sync="through"
  115. @close="loadingClose"
  116. @submit="
  117. () => {
  118. submitOK(1);
  119. }
  120. "
  121. >
  122. <div>
  123. 确定所勾选的内容,审核结果为【通过】?<br />
  124. 确认后,初审不可再修改,请检查清楚再操作!
  125. </div>
  126. </Base-dialog>
  127. <Base-dialog
  128. title="操作提示:"
  129. :disabledBtn="disabledBtn"
  130. :isShow.sync="popback"
  131. @close="loadingClose"
  132. @submit="uploadForm"
  133. >
  134. <div>
  135. <div style="color: red">
  136. <h4 style="margin: 0px">当前勾选了{{ checkList.length }}条数据:</h4>
  137. <ul style="margin: 0px 0px 6px; max-height: 500px; overflow: auto">
  138. <li v-for="(item, index) in checkList" :key="index">
  139. {{ index + 1 }}.{{ getSecName(item) }}
  140. </li>
  141. </ul>
  142. </div>
  143. <div style="text-align: center; font-weight: bold">
  144. 所选数据,确定要打回待审核状态吗?<br />
  145. 打回后,重新走审核流程,请慎重操作。
  146. </div>
  147. </div>
  148. </Base-dialog>
  149. <Base-dialog
  150. title="操作提示:"
  151. :disabledBtn="disabledBtn"
  152. :isShow.sync="approvedOK"
  153. @close="loadingClose"
  154. @submit="approvedOKFunc"
  155. >
  156. <div>
  157. <div style="color: red">
  158. <h4 style="margin: 0px">确认审核通过结果后:</h4>
  159. <ul style="margin: 0px 0px 6px">
  160. <li>
  161. (1)有做官方接口的,自动触发【学时官方推送】<br />
  162. (2)公开【学习学时记录-学时记录】按钮,权限人可查看【审核结果】<br />
  163. (3)有匹配的预约考试,可走预约流程
  164. </li>
  165. </ul>
  166. </div>
  167. <div style="font-weight: bold; margin-top: 20px">
  168. 确认提交审核通过结果?<br />
  169. 确认后,不能再修改,请慎重操作。
  170. </div>
  171. </div>
  172. </Base-dialog>
  173. </div>
  174. </template>
  175. <script>
  176. import ModulTable from "./ModulTable.vue";
  177. import ChapterTable from "./ChapterTable.vue";
  178. import LessonTable from "./LessonTable.vue";
  179. import CheatDialog from "./CheatDialog.vue";
  180. import { rollBackPeriod } from "@/api/education/classManageMent";
  181. import { debounce } from "@/utils";
  182. import { mapGetters } from "vuex";
  183. export default {
  184. props: {
  185. tablesData: {
  186. type: Object,
  187. default: () => {
  188. return {};
  189. },
  190. },
  191. userData: {
  192. type: Object,
  193. default: () => {
  194. return {};
  195. },
  196. },
  197. setData: {
  198. type: Object,
  199. default: () => {
  200. return {};
  201. },
  202. },
  203. getUserInfo: {
  204. type: Function,
  205. default: () => {},
  206. },
  207. },
  208. provide() {
  209. return {
  210. getPeriodStatus: () => this.periodStatus,
  211. getUserInfo: this.getUserInfo,
  212. getAllIds: () => this.allIds,
  213. };
  214. },
  215. data() {
  216. return {
  217. checkList: [],
  218. allIds: [],
  219. checkAll: false,
  220. isIndeterminate: false,
  221. vidBoxHours: false,
  222. through: false,
  223. popback: false,
  224. approvedOK: false,
  225. disabledBtn: false,
  226. formData: {
  227. cheating_reason: "",
  228. },
  229. statusPop: "", //1单个2批量
  230. rules: {
  231. cheating_reason: [
  232. {
  233. required: true,
  234. message: "请填写作弊原因",
  235. trigger: ["blur", "change"],
  236. },
  237. ],
  238. },
  239. msgTitle: [
  240. { label: "学习拍照异常", value: 1 },
  241. {
  242. label: "学习拍照太黑无法识别人像,请确保拍照光线充足并拍到全脸",
  243. value: 2,
  244. },
  245. {
  246. label: "学习拍照太模糊无法识别人像,请确保拍照光线充足并拍到全脸",
  247. value: 3,
  248. },
  249. {
  250. label: "学习拍照人像不全无法识别,请确保拍照光线充足并拍到全脸",
  251. value: 4,
  252. },
  253. ],
  254. allType3List: [],
  255. offsetTop: 0,
  256. offsetHeight: 0,
  257. headerFixed: false,
  258. };
  259. },
  260. methods: {
  261. handleScroll() {
  262. // 得到页面滚动的距离
  263. let scrollTop =
  264. window.pageYOffset ||
  265. document.documentElement.scrollTop ||
  266. document.body.scrollTop;
  267. // 判断页面滚动的距离是否大于吸顶元素的位置
  268. this.headerFixed = scrollTop > this.offsetTop + this.offsetHeight;
  269. },
  270. submitAllSlect(reason) {
  271. this.submitOK(2, reason);
  272. },
  273. handleCheckedCitiesChange(value) {
  274. let checkedCount = value.length;
  275. if (checkedCount) {
  276. this.checkAll = checkedCount === this.allIds.length;
  277. } else {
  278. this.checkAll = false;
  279. }
  280. this.isIndeterminate =
  281. checkedCount > 0 && checkedCount < this.allIds.length;
  282. },
  283. handleCheckAllChange(val) {
  284. this.checkList = val ? this.allIds : [];
  285. this.isIndeterminate = false;
  286. },
  287. getAllId(data) {
  288. if (!data || !data.length) {
  289. return;
  290. }
  291. data.forEach((ele) => {
  292. if (ele.type == 3 || ele.type == 4) {
  293. this.allType3List.push(ele);
  294. ele.status === 2 && this.allIds.push(ele.periodStatusId);
  295. } else {
  296. if (ele.type == 1 && ele.arr) {
  297. let item = ele.arr[0];
  298. this.allType3List.push(item);
  299. item.status === 2 && this.allIds.push(item.periodStatusId);
  300. }
  301. this.getAllId(
  302. ele.type == 1 ? ele.classPeriods : ele.classPeriodSectionList
  303. );
  304. }
  305. });
  306. },
  307. getChangeStatus(int) {
  308. if (!this.checkList.length) {
  309. this.$message.warning("请勾选需要操作的待审核数据");
  310. return;
  311. }
  312. var data = {
  313. gradeId: Number(this.setData.id),
  314. userId: Number(this.setData.userId),
  315. goodsId: Number(this.setData.goodsId),
  316. };
  317. if (int === 1) {
  318. data.status = 1;
  319. this.through = true;
  320. }
  321. if (int === 2) {
  322. data.status = 0;
  323. this.statusPop = 2;
  324. this.formData.cheating_reason = "";
  325. this.vidBoxHours = true;
  326. }
  327. },
  328. loadingClose() {
  329. this.disabledBtn = false;
  330. },
  331. submitOK(int, msg) {
  332. this.disabledBtn = true;
  333. var data = {
  334. gradeId: Number(this.setData.id),
  335. userId: Number(this.setData.userId),
  336. goodsId: Number(this.setData.goodsId),
  337. ids: this.checkList,
  338. };
  339. if (int === 1) {
  340. data.status = 1;
  341. }
  342. if (int === 2) {
  343. data.auditReason = msg;
  344. data.status = 0;
  345. }
  346. this.$api
  347. .editGradeUsereditPeriodeAll(data)
  348. .then((res) => {
  349. if (int === 1) {
  350. this.$message.success("状态全部通过修改成功");
  351. this.through = false;
  352. this.checkAll && this.goReview();
  353. }
  354. if (int === 2) {
  355. this.$message.success("状态全部作弊修改成功");
  356. this.vidBoxHours = false;
  357. }
  358. this.checkList = [];
  359. this.isIndeterminate = false;
  360. this.checkAll = false;
  361. this.getUserInfo(true);
  362. })
  363. .catch(() => {
  364. this.disabledBtn = false;
  365. });
  366. },
  367. getSecName(id) {
  368. try {
  369. return this.allType3List.find((e) => e.periodStatusId == id).typeName;
  370. } catch (error) {
  371. return "";
  372. }
  373. },
  374. uploadText(msg) {
  375. this.formData.cheating_reason = msg;
  376. },
  377. checkBack() {
  378. if (!this.checkList.length) {
  379. this.$message.warning("请勾选数据");
  380. return;
  381. }
  382. this.popback = true;
  383. },
  384. // 打回审核状态
  385. uploadForm() {
  386. this.disabledBtn = true;
  387. let data = {
  388. gradeId: Number(this.setData.id),
  389. userId: Number(this.setData.userId),
  390. goodsId: Number(this.setData.goodsId),
  391. orderGoodsId: Number(this.setData.orderGoodsId),
  392. ids: this.checkList,
  393. };
  394. this.$api
  395. .editGradeUsereditrollbackPeriod(data)
  396. .then((res) => {
  397. this.checkList = []; //勾选列表
  398. this.isIndeterminate = false; //待审半选
  399. this.checkAll = false; //全选状态
  400. this.getUserInfo(true);
  401. this.$message.success("已打回待审核状态");
  402. this.popback = false;
  403. this.goReview();
  404. })
  405. .catch(() => {
  406. this.disabledBtn = false;
  407. });
  408. },
  409. // 确认审核结果
  410. approvedOKFunc() {
  411. this.disabledBtn = true;
  412. let data = {
  413. gradeId: Number(this.setData.id),
  414. userId: Number(this.setData.userId),
  415. goodsId: Number(this.setData.goodsId),
  416. orderGoodsId: Number(this.setData.orderGoodsId),
  417. };
  418. this.$api
  419. .editGradeUsereditrollconfirmPeriod(data)
  420. .then((res) => {
  421. this.getUserInfo(true);
  422. this.$message.success("审核通过");
  423. this.approvedOK = false;
  424. this.goReview();
  425. })
  426. .catch(() => {
  427. this.disabledBtn = false;
  428. });
  429. },
  430. backToAudit() {
  431. this.$confirm("此操作将打回审核状态, 是否继续?", "提示", {
  432. confirmButtonText: "确定",
  433. cancelButtonText: "取消",
  434. type: "warning",
  435. })
  436. .then(() => {
  437. rollBackPeriod({ orderGoodsId: this.userData.orderGoodsId }).then(
  438. (res) => {
  439. this.getUserInfo(true);
  440. this.$message.success("已打回待审核状态");
  441. }
  442. );
  443. })
  444. .catch(() => {
  445. this.$message({
  446. type: "info",
  447. message: "已取消删除",
  448. });
  449. });
  450. },
  451. goReview() {
  452. this.$router.push({
  453. name: "ListOfhoursToBeReviewed",
  454. });
  455. },
  456. },
  457. created() {
  458. this.keys = {
  459. 1: "ModulTable",
  460. 2: "ChapterTable",
  461. 5: "ChapterTable",
  462. 6: "LessonTable",
  463. };
  464. },
  465. components: { ModulTable, LessonTable, ChapterTable, CheatDialog },
  466. watch: {
  467. tablesData: {
  468. handler() {
  469. this.allIds = [];
  470. for (const key in this.tablesData) {
  471. this.getAllId(this.tablesData[key]);
  472. }
  473. },
  474. immediate: true,
  475. deep: true,
  476. },
  477. },
  478. computed: {
  479. periodStatus() {
  480. return this.userData.periodStatus;
  481. },
  482. ...mapGetters(["sidebar"]),
  483. left() {
  484. return this.sidebar.opened ? "206px" : "60px";
  485. },
  486. },
  487. mounted() {
  488. this.$nextTick(function () {
  489. let header = document.getElementsByClassName("studyStyle")[0];
  490. this.offsetTop = header.offsetTop;
  491. this.offsetHeight = header.offsetHeight;
  492. });
  493. window.addEventListener("scroll", debounce(this.handleScroll, 50));
  494. },
  495. };
  496. </script>
  497. <style lang="scss" scoped>
  498. .studyRecordTable {
  499. .studyStyle {
  500. margin: 16px 0;
  501. display: flex;
  502. align-items: center;
  503. & > .a_style {
  504. display: flex;
  505. align-items: center;
  506. margin-right: 16px;
  507. padding: 11px 16px;
  508. box-shadow: 0px 0px 8px 0px rgba(217, 217, 217, 0.8);
  509. border-radius: 4px;
  510. height: 40px;
  511. width: 440px;
  512. user-select: none;
  513. i {
  514. width: 2px;
  515. height: 18px;
  516. display: inline-block;
  517. background-color: #0047d0;
  518. margin-right: 8px;
  519. }
  520. span {
  521. color: #666;
  522. font-weight: bold;
  523. }
  524. .flex_style_study {
  525. flex: 1;
  526. }
  527. .num_style {
  528. float: right;
  529. font-size: 14px;
  530. margin-left: 14px;
  531. }
  532. }
  533. .s_sd {
  534. flex: 1;
  535. justify-content: flex-end;
  536. display: flex;
  537. align-items: center;
  538. flex-shrink: 0;
  539. .dis_colu {
  540. height: 55px;
  541. margin-right: 14px;
  542. display: flex;
  543. flex-direction: column;
  544. justify-content: space-around;
  545. font-size: 14px;
  546. }
  547. }
  548. }
  549. .isFixed {
  550. position: fixed;
  551. top: 84px;
  552. right: 0;
  553. z-index: 10;
  554. background: #fff;
  555. padding: 0 20px;
  556. margin: 0;
  557. }
  558. }
  559. </style>