StudyTables.vue 13 KB

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