StudyTables.vue 15 KB

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