LessonTable.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554
  1. <template>
  2. <div>
  3. <el-table
  4. :default-expand-all="true"
  5. border
  6. :data="tabledata"
  7. style="width: 100%; border-radius: 4px; overflow: hidden"
  8. :header-cell-style="{
  9. 'background-color': '#F5F5F5',
  10. padding: '8px',
  11. color: '#666',
  12. }"
  13. >
  14. <el-table-column label="节/卷" type="expand" width="70px">
  15. <template slot-scope="scope">
  16. <div
  17. class="dis_flexs"
  18. :class="{ exceedStyle: exceed(scope.row.userStudyRecordPhotoList) }"
  19. >
  20. <ul
  21. style="flex: 1"
  22. v-if="
  23. scope.row.userStudyRecordPhotoList &&
  24. scope.row.userStudyRecordPhotoList.length
  25. "
  26. >
  27. <li
  28. v-for="(its, inds) in scope.row.userStudyRecordPhotoList"
  29. :key="inds"
  30. class="liImgs"
  31. >
  32. <el-image
  33. style="width: 100%; height: 100%"
  34. :src="$methodsTools.splitImgHost(its.photo)"
  35. :preview-src-list="
  36. returnImgUrl(scope.row.userStudyRecordPhotoList)
  37. "
  38. >
  39. </el-image>
  40. <div
  41. class="abos"
  42. @click="
  43. imgChange(
  44. scope.row.userStudyRecordPhotoList[inds],
  45. 'photo',
  46. its.photo
  47. )
  48. "
  49. >
  50. {{ $methodsTools.onlyForma(its.createTime) }}
  51. </div>
  52. </li>
  53. <div style="clear: both"></div>
  54. </ul>
  55. <p v-else style="text-align: center; width: 100%">暂无拍照数据</p>
  56. <div
  57. class="styFlex"
  58. v-if="
  59. (periodStatus === 0 ||
  60. periodStatus === 2 ||
  61. periodStatus === 3) &&
  62. scope.row.periodStatus === 1
  63. "
  64. >
  65. <div>
  66. <el-checkbox
  67. class="checkboxList"
  68. :label="scope.row.periodStatusId"
  69. :disabled="
  70. periodStatus === 3
  71. ? false
  72. : scope.row.status !== 2
  73. ? true
  74. : false
  75. "
  76. ><br
  77. /></el-checkbox>
  78. </div>
  79. <el-button
  80. :disabled="scope.row.status !== 2"
  81. class="btnstyles"
  82. size="small"
  83. type="success"
  84. :loading="disabledBtn"
  85. @click="changeStatus(scope.row.periodStatusId, 1)"
  86. >通过</el-button
  87. >
  88. <el-button
  89. :disabled="scope.row.status !== 2"
  90. class="btnstyles"
  91. size="small"
  92. type="danger"
  93. @click="changeStatus(scope.row.periodStatusId, 0)"
  94. >作弊</el-button
  95. >
  96. </div>
  97. </div>
  98. </template>
  99. </el-table-column>
  100. <el-table-column
  101. v-for="(item, index) in tableSet"
  102. :width="item.width"
  103. :key="index"
  104. :label="item.label"
  105. align="center"
  106. >
  107. <template slot-scope="scope2">
  108. <span v-if="item.scope === 'select'">
  109. <span
  110. v-for="(k, ds) in item.options"
  111. :key="ds"
  112. :style="
  113. scope2.row[item.prop] === 0
  114. ? 'color:red;'
  115. : scope2.row[item.prop] === 2
  116. ? 'color:#0047D0;'
  117. : scope2.row[item.prop] === 1
  118. ? 'color:#67C23A;'
  119. : ''
  120. "
  121. >
  122. {{ k.value == scope2.row[item.prop] ? k.label : "" }}
  123. </span>
  124. </span>
  125. <div v-else-if="item.scope === 'activeNum'">
  126. <el-select
  127. v-model="scope2.row[item.prop]"
  128. placeholder="请选择"
  129. @change="getNewListchapt(scope2.$index, $event, scope2.row)"
  130. >
  131. <el-option
  132. v-for="(items, indexs) in scope2.row['numList']"
  133. :key="indexs"
  134. :label="`第${items}次审核记录${indexs > 0 ? '(重修)' : ''}`"
  135. :value="items"
  136. >
  137. </el-option>
  138. </el-select>
  139. </div>
  140. <span v-else-if="item.scope === 'typeOptions'">
  141. <span v-for="(is, ds) in item.options" :key="ds">
  142. <span v-if="is.value === scope2.row[item.prop]">{{
  143. is.label
  144. }}</span>
  145. </span>
  146. </span>
  147. <span v-else-if="item.scope === 'aTime'">
  148. {{ $methodsTools.onlyForma(scope2.row[item.prop]) }}
  149. </span>
  150. <span v-else-if="item.scope === 'durTime' && scope2.row.type !== 5">
  151. {{
  152. scope2.row["type"] == 3
  153. ? $methodsTools.secondToDate(scope2.row[item.prop], false)
  154. : "分数:" + scope2.row["performance"]
  155. }}
  156. </span>
  157. <div v-else-if="item.scope === 'aTimeSE'">
  158. <div
  159. v-if="
  160. scope2.row['type'] === 3 &&
  161. scope2.row['durationTime'] &&
  162. scope2.row['studyStartTime'] &&
  163. scope2.row['studyEndTime']
  164. "
  165. :style="comput(scope2.row)"
  166. >
  167. <div
  168. v-if="
  169. scope2.row['numIndex'] === scope2.row['numList'] &&
  170. scope2.row['numIndex'] !== 1
  171. "
  172. >
  173. <div>
  174. 上次时间:{{
  175. $methodsTools.onlyForma(scope2.row["preStartTime"]) +
  176. " - " +
  177. $methodsTools.onlyForma(scope2.row["preEndTime"])
  178. }}
  179. </div>
  180. <div>
  181. 重学时间:{{
  182. $methodsTools.onlyForma(scope2.row[item.prop1]) +
  183. " - " +
  184. $methodsTools.onlyForma(scope2.row[item.prop2])
  185. }}
  186. </div>
  187. </div>
  188. <div v-else>
  189. 学习时间:{{
  190. $methodsTools.onlyForma(scope2.row[item.prop1]) +
  191. " - " +
  192. $methodsTools.onlyForma(scope2.row[item.prop2])
  193. }}
  194. </div>
  195. <!-- {{ $methodsTools.onlyForma(scope2.row[item.prop]) }} -->
  196. </div>
  197. <div
  198. v-if="
  199. (scope2.row['type'] === 4 || scope2.row['type'] === 5) &&
  200. scope2.row['studyStartTime'] &&
  201. scope2.row['studyEndTime']
  202. "
  203. >
  204. 学习时间:{{
  205. $methodsTools.onlyForma(scope2.row[item.prop1]) +
  206. " - " +
  207. $methodsTools.onlyForma(scope2.row[item.prop2])
  208. }}
  209. </div>
  210. </div>
  211. <div v-else-if="item.scope === 'aTimeSEComputer'">
  212. <div
  213. v-if="
  214. scope2.row['type'] === 3 &&
  215. scope2.row['durationTime'] &&
  216. scope2.row['studyStartTime'] &&
  217. scope2.row['studyEndTime']
  218. "
  219. >
  220. <div
  221. v-if="
  222. scope2.row['numIndex'] === scope2.row['numList'] &&
  223. scope2.row['numIndex'] !== 1
  224. "
  225. >
  226. <div>
  227. 上次时间:{{
  228. (
  229. (scope2.row["preEndTime"] - scope2.row["preStartTime"]) /
  230. 60
  231. ).toFixed(0) || 0
  232. }}分钟
  233. </div>
  234. <div>
  235. 重学时间:
  236. {{
  237. (
  238. (scope2.row[item.prop2] - scope2.row[item.prop1]) /
  239. 60
  240. ).toFixed(0) || 0
  241. }}分钟
  242. </div>
  243. </div>
  244. <div v-else>
  245. 学习时间:
  246. {{
  247. (
  248. (scope2.row[item.prop2] - scope2.row[item.prop1]) /
  249. 60
  250. ).toFixed(0) || 0
  251. }}分钟
  252. </div>
  253. </div>
  254. </div>
  255. <span v-else> {{ scope2.row[item.prop] }} </span>
  256. </template>
  257. </el-table-column>
  258. </el-table>
  259. <Cheat-dialog
  260. :vidBoxHours.sync="vidBoxHours"
  261. @submit="submit"
  262. ></Cheat-dialog>
  263. </div>
  264. </template>
  265. <script>
  266. import CheatDialog from "./CheatDialog.vue";
  267. export default {
  268. props: {
  269. setData: {
  270. type: Object,
  271. default: () => {
  272. return {};
  273. },
  274. },
  275. tabledata: {
  276. type: Array,
  277. default: () => {
  278. return [];
  279. },
  280. },
  281. erJianErZao:{
  282. type:Boolean,
  283. default:()=>{
  284. return false
  285. }
  286. }
  287. },
  288. inject: ["getPeriodStatus", "getUserInfo", "getAllIds"],
  289. data() {
  290. return {
  291. tableSet: [
  292. {
  293. label: "选择",
  294. prop: "numIndex",
  295. scope: "activeNum",
  296. width: "210px",
  297. },
  298. {
  299. label: "姓名",
  300. prop: "realName",
  301. },
  302. {
  303. label: "标题",
  304. prop: "typeName",
  305. },
  306. {
  307. label: "类型",
  308. prop: "type",
  309. scope: "typeOptions",
  310. width: "90px",
  311. options: [
  312. {
  313. label: "节",
  314. value: 3,
  315. },
  316. {
  317. label: "试卷",
  318. value: 4,
  319. },
  320. {
  321. label: "模块卷",
  322. value: 5,
  323. },
  324. ],
  325. },
  326. {
  327. label: "节时长",
  328. prop: "durationTime",
  329. width: "120px",
  330. scope: "durTime",
  331. },
  332. {
  333. label: "学习时间",
  334. prop1: "studyStartTime",
  335. prop2: "studyEndTime",
  336. scope: "aTimeSE",
  337. width: "420px",
  338. },
  339. {
  340. label: "学习用时",
  341. prop1: "studyStartTime",
  342. prop2: "studyEndTime",
  343. scope: "aTimeSEComputer",
  344. width: "170px",
  345. },
  346. {
  347. label: "审核状态",
  348. prop: "status",
  349. scope: "select",
  350. width: "100px",
  351. options: [
  352. {
  353. label: "待审核",
  354. value: 2,
  355. },
  356. {
  357. label: "通过",
  358. value: 1,
  359. },
  360. {
  361. label: "作弊",
  362. value: 0,
  363. },
  364. {
  365. label: "待重修",
  366. value: 3,
  367. },
  368. ],
  369. },
  370. {
  371. label: "审核人",
  372. prop: "auditUserName",
  373. width: "100px",
  374. },
  375. {
  376. label: "审核时间",
  377. prop: "auditTime",
  378. scope: "aTime",
  379. },
  380. ],
  381. disabledBtn: false,
  382. vidBoxHours: false,
  383. formData: {
  384. status: "",
  385. id: "",
  386. },
  387. };
  388. },
  389. methods: {
  390. exceed(list) {
  391. if (list && list.length > 1 && this.erJianErZao) {
  392. let status = false;
  393. for (let i = 0; i < list.length - 1; i++) {
  394. if (list[i + 1].createTime - list[i].createTime > 1200) {
  395. status = true;
  396. break;
  397. }
  398. }
  399. return status;
  400. } else {
  401. return false;
  402. }
  403. },
  404. imgChange(list, name, url) {
  405. return;
  406. this.$api
  407. .imgChange({
  408. imageUrl: url,
  409. })
  410. .then((res) => {
  411. if (res.code == 200) {
  412. this.$set(list, name, url + `?v=${Math.random()}`);
  413. this.$message.success("操作成功");
  414. }
  415. });
  416. },
  417. submit(text) {
  418. this.formData.auditReason = text;
  419. this.$api
  420. .editGradeUsereditPeriode(this.formData)
  421. .then((res) => {
  422. this.$message.success("修改成功");
  423. this.vidBoxHours = false;
  424. if (this.allIds.length == 1) {
  425. this.$router.push({
  426. name: "ListOfhoursToBeReviewed",
  427. });
  428. }
  429. this.getUserInfo(true);
  430. })
  431. .finally(() => {
  432. this.disabledBtn = false;
  433. });
  434. },
  435. loadingClose() {
  436. this.disabledBtn = false;
  437. },
  438. comput(item) {
  439. var ast = item.studyEndTime - item.studyStartTime;
  440. let status = item.durationTime - ast;
  441. if (status > 25) {
  442. return "color:red;";
  443. } else {
  444. return "";
  445. }
  446. },
  447. getNewListchapt(index, int, item) {
  448. let { courseId, moduleId, chapterId, userId, goodsId, gradeId } = item;
  449. let data = {
  450. courseId: courseId,
  451. moduleId,
  452. chapterId,
  453. numIndex: int,
  454. userId,
  455. goodsId,
  456. gradeId,
  457. orderGoodsId: this.setData.orderGoodsId,
  458. };
  459. if (item.type === 3) {
  460. data.sectionId = item.id;
  461. }
  462. if (item.type === 4) {
  463. data.examId = item.id;
  464. }
  465. this.$api.inquireGradegradelistPeriodAuditStatus(data).then((res) => {
  466. this.$set(this.tabledata, index, res.data);
  467. });
  468. },
  469. changeStatus(id, status) {
  470. this.formData = {
  471. status,
  472. id,
  473. };
  474. if (status == 0) {
  475. this.vidBoxHours = true;
  476. } else {
  477. this.submit();
  478. }
  479. },
  480. },
  481. computed: {
  482. periodStatus() {
  483. return this.getPeriodStatus();
  484. },
  485. allIds() {
  486. return this.getAllIds();
  487. },
  488. returnImgUrl: function () {
  489. return function (ary) {
  490. return (
  491. (ary && ary.map((i) => this.$methodsTools.splitImgHost(i.photo))) ||
  492. []
  493. );
  494. };
  495. },
  496. },
  497. components: {
  498. CheatDialog,
  499. },
  500. };
  501. </script>
  502. <style lang="less" scoped>
  503. .exceedStyle {
  504. background-color: rgb(255, 224, 224);
  505. }
  506. .liImgs {
  507. float: left;
  508. width: 210px;
  509. // height: 280px;
  510. margin-right: 16px;
  511. margin-bottom: 16px;
  512. position: relative;
  513. border-radius: 8px;
  514. overflow: hidden;
  515. .abos {
  516. position: absolute;
  517. bottom: 0px;
  518. width: 100%;
  519. height: 32px;
  520. line-height: 32px;
  521. font-size: 14px;
  522. color: #fff;
  523. text-align: center;
  524. background-color: rgba(51, 51, 51, 0.7);
  525. }
  526. }
  527. .dis_flexs {
  528. display: flex;
  529. align-items: center;
  530. padding: 10px 18px;
  531. ul {
  532. margin-bottom: 0px;
  533. max-height: 588px;
  534. overflow: auto;
  535. }
  536. }
  537. .styFlex {
  538. width: 80px;
  539. text-align: center;
  540. }
  541. .checkboxList {
  542. margin-bottom: 6px;
  543. &/deep/.el-checkbox__label {
  544. display: none;
  545. }
  546. }
  547. .btnstyles {
  548. margin-left: 0px;
  549. margin-bottom: 10px;
  550. }
  551. </style>