StudyTables.vue 15 KB

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