liveList.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453
  1. <template>
  2. <div id="studyRecord">
  3. <el-table
  4. v-loading="loading"
  5. height="700"
  6. :data="tableData"
  7. style="width: 100%"
  8. :header-cell-style="{
  9. 'background-color': 'skyblue',
  10. padding: '8px',
  11. color: '#333',
  12. }"
  13. >
  14. <el-table-column type="expand" width="40px">
  15. <template slot-scope="scope">
  16. <el-table
  17. border
  18. :data="scope.row.subjectStudyRecordVos"
  19. style="width: 100%"
  20. default-expand-all
  21. :header-cell-style="{
  22. 'background-color': 'rgb(255,255,204)',
  23. padding: '8px',
  24. color: '#333',
  25. }"
  26. >
  27. <el-table-column
  28. v-for="(item, index) in tableSetChild"
  29. :width="item.width"
  30. :key="index"
  31. :label="item.label"
  32. align="center"
  33. >
  34. <template slot-scope="scope1">
  35. <span v-if="item.scope === 'types'">
  36. {{
  37. scope1.row[item.prop] === 1
  38. ? "开课"
  39. : scope1.row[item.prop] === 0
  40. ? "未开课"
  41. : "未知"
  42. }}
  43. </span>
  44. <span v-else-if="item.scope === 'sectionType'">
  45. {{ getTypes(scope1.row[item.prop]) }}
  46. </span>
  47. <span v-else-if="item.scope === 'studentStatus'">
  48. 已观看{{ scope1.row[item.prop1] }}节
  49. <span style="color: green">{{
  50. compons(scope1.row[item.prop1], scope1.row[item.prop2])
  51. }}</span>
  52. </span>
  53. <span v-else> {{ scope1.row[item.prop] }} </span>
  54. </template>
  55. </el-table-column>
  56. <el-table-column
  57. label="操作"
  58. align="center"
  59. fixed="right"
  60. width="100px"
  61. >
  62. <template slot-scope="scope1s">
  63. <el-button
  64. type="text"
  65. @click="
  66. wantInfo(
  67. scope1s.row,
  68. scope1s.$index,
  69. scope.row.goodsId,
  70. scope.row.gradeId
  71. )
  72. "
  73. >查看</el-button
  74. >
  75. </template>
  76. </el-table-column>
  77. </el-table>
  78. </template>
  79. </el-table-column>
  80. <el-table-column
  81. v-for="(item, index) in tableSet"
  82. :width="item.width"
  83. :key="index"
  84. :label="item.label"
  85. align="center"
  86. >
  87. <template slot-scope="scope">
  88. <span v-if="item.scope === 'yewu'">
  89. {{ scope.row[item.prop1] }}-{{ scope.row[item.prop2] }}-{{
  90. scope.row[item.prop3]
  91. }}
  92. </span>
  93. <span v-else-if="item.scope === 'time'">
  94. {{ $methodsTools.onlyForma(scope.row[item.prop]) }}
  95. </span>
  96. <span v-else-if="item.scope === 'moreTime'">
  97. {{ $methodsTools.onlyForma(scope.row[item.prop1]) }} -
  98. {{ $methodsTools.onlyForma(scope.row[item.prop2]) }}
  99. </span>
  100. <span v-else-if="item.scope === 'mix'">
  101. {{ scope.row[item.prop1] }}/{{ scope.row[item.prop2] }}
  102. </span>
  103. <span v-else>
  104. {{ scope.row[item.prop] }}{{ item.ch ? item.ch : "" }}
  105. </span>
  106. </template>
  107. </el-table-column>
  108. </el-table>
  109. <el-dialog
  110. :visible.sync="dialogVisible"
  111. width="1030px"
  112. :show-close="false"
  113. :close-on-click-modal="false"
  114. >
  115. <div slot="title" class="hearders">
  116. <div class="leftTitle">学习记录</div>
  117. <div class="rightBoxs">
  118. <img src="@/assets/images/Close@2x.png" alt="" @click="close" />
  119. </div>
  120. </div>
  121. <div>
  122. <el-table
  123. border
  124. height="550"
  125. :data="RemardList"
  126. style="width: 100%"
  127. default-expand-all
  128. :header-cell-style="{
  129. 'background-color': 'rgb(255,255,204)',
  130. padding: '8px',
  131. color: '#333',
  132. }"
  133. >
  134. <el-table-column label="序号" align="center" type="index" width="70">
  135. </el-table-column>
  136. <el-table-column
  137. v-for="(item, index) in studyListRemard"
  138. :width="item.width"
  139. :key="index"
  140. :label="item.label"
  141. align="center"
  142. >
  143. <template slot-scope="scope">
  144. <span v-if="item.scope === 'studyTime'">
  145. {{ $methodsTools.onlyForma(scope.row[item.prop1])
  146. }}{{
  147. scope.row[item.prop1] && scope.row[item.prop2] ? "至" : ""
  148. }}
  149. {{ $methodsTools.onlyForma(scope.row[item.prop2]) }}
  150. </span>
  151. <span v-else-if="item.scope === 'timeCg'">{{
  152. $methodsTools.secondToDate(scope.row[item.prop], false)
  153. }}</span>
  154. <span v-else-if="item.scope === 'status'">
  155. {{
  156. scope.row[item.prop] === 1
  157. ? "完成"
  158. : scope.row[item.prop] === 0
  159. ? "学习中"
  160. : "未知"
  161. }}
  162. </span>
  163. <span v-else-if="item.scope === 'computerTimes'">
  164. {{
  165. computerTimesFunc(
  166. scope.row[item.prop1],
  167. scope.row[item.prop2]
  168. )
  169. }}
  170. </span>
  171. <span v-else> {{ scope.row[item.prop] }} </span>
  172. </template>
  173. </el-table-column>
  174. </el-table>
  175. </div>
  176. <span slot="footer" class="dialog-footer">
  177. <el-button @click="close">取 消</el-button>
  178. </span>
  179. </el-dialog>
  180. </div>
  181. </template>
  182. <script>
  183. export default {
  184. name: "studyRecord",
  185. data() {
  186. return {
  187. dialogVisible: false,
  188. tableDataChild: {},
  189. tableSetChild: [
  190. {
  191. label: "课程名称",
  192. prop: "courseName",
  193. width: "160px",
  194. },
  195. {
  196. label: "科目",
  197. prop: "subjectName",
  198. },
  199. // {
  200. // label: "课程开课状态",
  201. // prop: "beginStatus",
  202. // width: "160px",
  203. // scope: "types",
  204. // },
  205. {
  206. label: "模块",
  207. prop: "moduleNum",
  208. },
  209. {
  210. label: "章",
  211. prop: "chapterNum",
  212. },
  213. {
  214. label: "节",
  215. prop: "sectionNum",
  216. },
  217. {
  218. label: "节类型",
  219. prop: "sectionType",
  220. scope: "sectionType",
  221. },
  222. {
  223. label: "学习状态",
  224. prop1: "recordNum",
  225. prop2: "sectionNum",
  226. scope: "studentStatus",
  227. },
  228. ],
  229. tableData: [],
  230. tableSet: [
  231. {
  232. label: "商品编码",
  233. prop: "code",
  234. width: "160px",
  235. },
  236. {
  237. label: "年份",
  238. prop: "year",
  239. },
  240. {
  241. label: "商品名称",
  242. prop: "goodsName",
  243. width: "140px",
  244. },
  245. {
  246. label: "业务层级",
  247. prop1: "educationName",
  248. prop2: "projectName",
  249. prop3: "businessName",
  250. scope: "yewu",
  251. width: "260px",
  252. },
  253. {
  254. label: "学时",
  255. prop: "classHours",
  256. },
  257. {
  258. label: "学习进度(节)",
  259. prop1: "stuAllNum",
  260. prop2: "secAllNum",
  261. scope: "mix",
  262. },
  263. {
  264. label: "视频学习进度(节)",
  265. prop: "studyNum",
  266. width: "140px",
  267. ch: "%",
  268. },
  269. {
  270. label: "学习开始时间",
  271. prop: "startTime",
  272. scope: "time",
  273. width: "140px",
  274. },
  275. {
  276. label: "学习结束时间",
  277. prop: "endTime",
  278. scope: "time",
  279. width: "140px",
  280. },
  281. {
  282. label: "学习服务期",
  283. prop1: "serviceStartTime",
  284. prop2: "serviceEndTime",
  285. scope: "moreTime",
  286. width: "140px",
  287. },
  288. ],
  289. studyListRemard: [
  290. {
  291. label: "模块标题",
  292. prop: "moduleName",
  293. width: "100px",
  294. },
  295. {
  296. label: "章标题",
  297. prop: "chapterName",
  298. width: "100px",
  299. },
  300. {
  301. label: "节标题",
  302. prop: "sectionName",
  303. },
  304. {
  305. label: "节时长",
  306. prop: "durationTime",
  307. scope: "timeCg",
  308. },
  309. {
  310. label: "学习时间",
  311. prop1: "startTime",
  312. prop2: "endTime",
  313. scope: "studyTime",
  314. width: "310px",
  315. },
  316. {
  317. label: "学习时长",
  318. prop1: "startTime",
  319. prop2: "endTime",
  320. width: "100px",
  321. scope: "computerTimes",
  322. },
  323. ], //学习记录表格对应column
  324. RemardList: [], //学习记录列表
  325. loading: false,
  326. };
  327. },
  328. computed: {
  329. computerTimesFunc: function () {
  330. return function (val1, val2) {
  331. if (val1 && val2) {
  332. var ast = this.$methodsTools.secondToDate(val2 - val1, false);
  333. return ast;
  334. } else {
  335. return "00:00";
  336. }
  337. };
  338. },
  339. },
  340. mounted() {
  341. this.loading = true;
  342. this.$api
  343. .inquireuserlistLive({ userId: this.$route.query.id })
  344. .then((res) => {
  345. this.tableData = res.rows;
  346. })
  347. .finally(() => {
  348. this.loading = false;
  349. });
  350. },
  351. methods: {
  352. compons(int1, int2) {
  353. if (!int1 || !int2) {
  354. return;
  355. }
  356. let result = (int1 / int2) * 100;
  357. if (result == 0 || result == 100) {
  358. return result + "%";
  359. } else {
  360. return result.toFixed(2) + "%";
  361. }
  362. },
  363. //改变返回值
  364. getTypes(arr) {
  365. if (!arr) {
  366. return "暂无";
  367. }
  368. let arrays = arr.split(",").map(Number);
  369. let str = [];
  370. for (let i = 0; i < arrays.length; i++) {
  371. if (arrays[i] == 1) {
  372. str.push("录播");
  373. }
  374. if (arrays[i] == 2) {
  375. str.push("直播");
  376. }
  377. if (arrays[i] == 3) {
  378. str.push("回放");
  379. }
  380. }
  381. return str.toString();
  382. },
  383. //关闭窗口
  384. close() {
  385. this.dialogVisible = false;
  386. },
  387. //获取弹出窗内容
  388. wantInfo(item, index, goodsId, gradeId) {
  389. this.$api
  390. .inquiregradestudentlistSection({
  391. userId: this.$route.query.id,
  392. courseId: item.courseId,
  393. goodsId: goodsId,
  394. gradeId: gradeId,
  395. })
  396. .then((res) => {
  397. this.RemardList = res.rows;
  398. this.dialogVisible = true;
  399. });
  400. },
  401. },
  402. };
  403. </script>
  404. <style lang="less" scoped>
  405. /deep/.el-button {
  406. border-radius: 8px;
  407. }
  408. /deep/.el-dialog {
  409. border-radius: 8px;
  410. .el-dialog__header {
  411. padding: 0;
  412. .hearders {
  413. height: 40px;
  414. display: flex;
  415. align-items: center;
  416. justify-content: space-between;
  417. padding: 0px 18px 0px 20px;
  418. border-bottom: 1px solid #e2e2e2;
  419. .leftTitle {
  420. font-size: 14px;
  421. font-weight: bold;
  422. color: #2f4378;
  423. }
  424. .rightBoxs {
  425. display: flex;
  426. align-items: center;
  427. img {
  428. width: 14px;
  429. height: 14px;
  430. margin-left: 13px;
  431. cursor: pointer;
  432. }
  433. }
  434. }
  435. }
  436. .el-dialog__footer {
  437. padding: 0;
  438. .dialog-footer {
  439. padding: 0px 40px;
  440. height: 70px;
  441. border-top: 1px solid #e2e2e2;
  442. display: flex;
  443. align-items: center;
  444. justify-content: flex-end;
  445. }
  446. }
  447. }
  448. .demo-table-expand {
  449. font-size: 0;
  450. }
  451. </style>