CaseDesign.vue 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639
  1. <template>
  2. <div class="cd_body">
  3. <div class="pb_content_body" style="
  4. background: #fff;
  5. padding: 0px 25px;
  6. box-sizing: border-box;
  7. border-radius: 5px;
  8. width: 95%;
  9. ">
  10. <div class="pb_head">
  11. <span>课程数据看板</span>
  12. </div>
  13. <div class="student_head">
  14. <div class="head_left">
  15. <span>筛选:</span>
  16. <el-select v-model="choose" @change="getData">
  17. <el-option label="默认排序" value=""> </el-option>
  18. <el-option label="学校名称" value="school"> </el-option>
  19. <el-option label="任务数量" value="task"> </el-option>
  20. <el-option label="评价" value="eval"> </el-option>
  21. <el-option label="工具" value="tool"> </el-option>
  22. <el-option label="字数" value="font"> </el-option>
  23. </el-select>
  24. <el-input v-model="search" class="student_input" placeholder="请输入教师名称或学校名称" @input="getData"></el-input>
  25. </div>
  26. </div>
  27. </div>
  28. <div class="cd_table">
  29. <el-table ref="table" :data="tableData" border :fit="true" v-loading="isLoading" style="width: 100%"
  30. :header-cell-style="{ background: '#f1f1f1', fontSize: '17px' }" :row-class-name="tableRowClassName"
  31. class="table">
  32. <el-table-column label="课程" min-width="15" align="center">
  33. <template slot-scope="scope">
  34. <div style="max-height: 180px; overflow: auto">
  35. <div v-if="scope.row.course.length">
  36. <div v-for="(item, index) in scope.row.course" :key="index" class="cd_course" @click="jump(item.courseId)">
  37. <el-tooltip :content="item.title">
  38. <span>{{ item.title }}</span>
  39. </el-tooltip>
  40. </div>
  41. </div>
  42. <div v-else>
  43. </div>
  44. </div>
  45. </template>
  46. </el-table-column>
  47. <el-table-column label="学校" prop="school" min-width="15" align="center">
  48. </el-table-column>
  49. <el-table-column label="负责人" prop="username" min-width="15" align="center">
  50. </el-table-column>
  51. <el-table-column label="更新时间" prop="time" min-width="15" align="center">
  52. <template slot-scope="scope">
  53. <div v-if="scope.row.course.length">{{scope.row.time}}</div>
  54. <div v-else>—</div>
  55. </template>
  56. </el-table-column>
  57. <el-table-column label="总计" min-width="15" align="center">
  58. <template slot-scope="scope">
  59. <div class="cd_d_span">
  60. <div>
  61. <div>
  62. <span>{{ scope.row.jdz.taskC }}</span><span>任务</span>
  63. </div>
  64. <div>
  65. <span>{{ scope.row.jdz.toolC }}</span><span>工具</span>
  66. </div>
  67. <div>
  68. <span>{{ scope.row.jdz.evalC }}</span><span>评价</span>
  69. </div>
  70. <div>
  71. <span>{{ scope.row.jdz.fontC }}</span><span>字</span>
  72. </div>
  73. </div>
  74. </div>
  75. </template>
  76. </el-table-column>
  77. <el-table-column label="阶段1" min-width="15" align="center">
  78. <template slot-scope="scope">
  79. <div v-if="scope.row.jd1">
  80. <div class="cd_d_span">
  81. <div>
  82. <span>{{ scope.row.jd1.taskC }}</span><span>任务</span>
  83. </div>
  84. <div>
  85. <span>{{ scope.row.jd1.toolC }}</span><span>工具</span>
  86. </div>
  87. <div>
  88. <span>{{ scope.row.jd1.evalC }}</span><span>评价</span>
  89. </div>
  90. <div>
  91. <span>{{ scope.row.jd1.fontC }}</span><span>字</span>
  92. </div>
  93. </div>
  94. </div>
  95. <div v-else>—</div>
  96. </template>
  97. </el-table-column>
  98. <el-table-column label="阶段2" min-width="15" align="center">
  99. <template slot-scope="scope">
  100. <div v-if="scope.row.jd2">
  101. <div class="cd_d_span">
  102. <div>
  103. <span>{{ scope.row.jd2.taskC }}</span><span>任务</span>
  104. </div>
  105. <div>
  106. <span>{{ scope.row.jd2.toolC }}</span><span>工具</span>
  107. </div>
  108. <div>
  109. <span>{{ scope.row.jd2.evalC }}</span><span>评价</span>
  110. </div>
  111. <div>
  112. <span>{{ scope.row.jd2.fontC }}</span><span>字</span>
  113. </div>
  114. </div>
  115. </div>
  116. <div v-else>—</div>
  117. </template>
  118. </el-table-column>
  119. <el-table-column label="阶段3" min-width="15" align="center">
  120. <template slot-scope="scope">
  121. <div v-if="scope.row.jd3">
  122. <div class="cd_d_span">
  123. <div>
  124. <span>{{ scope.row.jd3.taskC }}</span><span>任务</span>
  125. </div>
  126. <div>
  127. <span>{{ scope.row.jd3.toolC }}</span><span>工具</span>
  128. </div>
  129. <div>
  130. <span>{{ scope.row.jd3.evalC }}</span><span>评价</span>
  131. </div>
  132. <div>
  133. <span>{{ scope.row.jd3.fontC }}</span><span>字</span>
  134. </div>
  135. </div>
  136. </div>
  137. <div v-else>—</div>
  138. </template>
  139. </el-table-column>
  140. <el-table-column label="阶段4" min-width="15" align="center">
  141. <template slot-scope="scope">
  142. <div v-if="scope.row.jd4">
  143. <div class="cd_d_span">
  144. <div>
  145. <span>{{ scope.row.jd4.taskC }}</span><span>任务</span>
  146. </div>
  147. <div>
  148. <span>{{ scope.row.jd4.toolC }}</span><span>工具</span>
  149. </div>
  150. <div>
  151. <span>{{ scope.row.jd4.evalC }}</span><span>评价</span>
  152. </div>
  153. <div>
  154. <span>{{ scope.row.jd4.fontC }}</span><span>字</span>
  155. </div>
  156. </div>
  157. </div>
  158. <div v-else>—</div>
  159. </template>
  160. </el-table-column>
  161. <el-table-column label="阶段5" min-width="15" align="center">
  162. <template slot-scope="scope">
  163. <div v-if="scope.row.jd5">
  164. <div class="cd_d_span">
  165. <div>
  166. <span>{{ scope.row.jd5.taskC }}</span><span>任务</span>
  167. </div>
  168. <div>
  169. <span>{{ scope.row.jd5.toolC }}</span><span>工具</span>
  170. </div>
  171. <div>
  172. <span>{{ scope.row.jd5.evalC }}</span><span>评价</span>
  173. </div>
  174. <div>
  175. <span>{{ scope.row.jd5.fontC }}</span><span>字</span>
  176. </div>
  177. </div>
  178. </div>
  179. <div v-else>—</div>
  180. </template>
  181. </el-table-column>
  182. <el-table-column label="阶段6" min-width="15" align="center">
  183. <template slot-scope="scope">
  184. <div v-if="scope.row.jd6">
  185. <div class="cd_d_span">
  186. <div>
  187. <span>{{ scope.row.jd6.taskC }}</span><span>任务</span>
  188. </div>
  189. <div>
  190. <span>{{ scope.row.jd6.toolC }}</span><span>工具</span>
  191. </div>
  192. <div>
  193. <span>{{ scope.row.jd6.evalC }}</span><span>评价</span>
  194. </div>
  195. <div>
  196. <span>{{ scope.row.jd6.fontC }}</span><span>字</span>
  197. </div>
  198. </div>
  199. </div>
  200. <div v-else>—</div>
  201. </template>
  202. </el-table-column>
  203. <el-table-column label="操作" min-width="15">
  204. <template slot-scope="scope">
  205. <!-- <div
  206. @click="getAll(scope.row)"
  207. >
  208. 查看全部
  209. </div> -->
  210. <el-button v-if="scope.row.course.length" type="primary" size="small" @click="getAll(scope.row)">查看详情</el-button>
  211. <div v-else>—</div>
  212. </template>
  213. </el-table-column>
  214. </el-table>
  215. <div class="student_page">
  216. <el-pagination background layout="prev, pager, next" :page-size="pageSize" :total="total"
  217. v-if="page && tableData.length" style="padding: 0px" @current-change="handleCurrentChange"></el-pagination>
  218. </div>
  219. </div>
  220. <el-dialog title="查看" :visible.sync="dialogVisible" :append-to-body="true" width="620px" :before-close="handleClose"
  221. class="dialog_diy">
  222. <div v-if="dataArray.length">
  223. <div class="cd_d_box">
  224. <span>教师:</span><span>{{ data.username }}</span>
  225. </div>
  226. <div class="cd_d_box">
  227. <span>学校:</span><span>{{ data.school }}</span>
  228. </div>
  229. <div class="cd_d_jd">
  230. <div v-for="(item, index) in dataArray" :key="index" class="cd_d_jd_box">
  231. <div class="cd_d_jd_name">{{ "阶段" + (index + 1) }}</div>
  232. <div class="cd_d_jd_content cd_d_span">
  233. <div>
  234. <span>{{ data[item].taskC }}</span><span>任务</span>
  235. </div>
  236. <div>
  237. <span>{{ data[item].toolC }}</span><span>工具</span>
  238. </div>
  239. <div>
  240. <span>{{ data[item].evalC }}</span><span>评价</span>
  241. </div>
  242. <div>
  243. <span>{{ data[item].fontC }}</span><span>字</span>
  244. </div>
  245. </div>
  246. </div>
  247. <div class="cd_d_jd_box">
  248. <div class="cd_d_jd_name">总计</div>
  249. <div class="cd_d_jd_content cd_d_span" style="background: #d4d4d4">
  250. <div>
  251. <span>{{ data["jdz"].taskC }}</span><span>任务</span>
  252. </div>
  253. <div>
  254. <span>{{ data["jdz"].toolC }}</span><span>工具</span>
  255. </div>
  256. <div>
  257. <span>{{ data["jdz"].evalC }}</span><span>评价</span>
  258. </div>
  259. <div>
  260. <span>{{ data["jdz"].fontC }}</span><span>字</span>
  261. </div>
  262. </div>
  263. </div>
  264. </div>
  265. </div>
  266. <span slot="footer" class="dialog-footer">
  267. <el-button @click="dialogVisible = false">关闭</el-button>
  268. </span>
  269. </el-dialog>
  270. </div>
  271. </template>
  272. <script>
  273. export default {
  274. data() {
  275. return {
  276. tableData: [],
  277. isLoading: false,
  278. org: this.$route.query.org,
  279. oid: this.$route.query.oid,
  280. timer: null,
  281. dialogVisible: false,
  282. data: {},
  283. dataArray: [],
  284. choose: "",
  285. search: "",
  286. total: 0,
  287. page: 1,
  288. pageSize: 10,
  289. };
  290. },
  291. methods: {
  292. jump(cid) {
  293. window.parent.postMessage({ cid: cid, screenType: "3" }, "*");
  294. },
  295. handleClose(done) {
  296. done();
  297. },
  298. tableRowClassName({ row, rowIndex }) {
  299. if ((rowIndex + 1) % 2 === 0) {
  300. return "even_row";
  301. } else {
  302. return "";
  303. }
  304. },
  305. getData() {
  306. let params = {
  307. org: this.org,
  308. oid: this.oid,
  309. page: this.page,
  310. pageSize: this.pageSize
  311. // this.org
  312. };
  313. this.ajax
  314. .get(this.$store.state.api + "selectCase3", params)
  315. .then((res) => {
  316. this.isLoading = false;
  317. let _res = res.data[0];
  318. // let _res2 = res.data[1];
  319. let _res2 = [];
  320. let _user = [];
  321. this.total = res.data[0].length > 0 ? res.data[0][0].num : 0;
  322. for (var i = 0; i < _res.length; i++) {
  323. let taskC = 0;
  324. let toolC = 0;
  325. let evalC = 0;
  326. let fontC = 0;
  327. let course = [];
  328. if (_user.indexOf(_res[i].tuid) == -1) {
  329. _res[i].course = []
  330. _res2.push(_res[i])
  331. _user.push(_res[i].tuid)
  332. }
  333. for (var j = 0; j < _res2.length; j++) {
  334. if (_res[i].tuid == _res2[j].tuid) {
  335. if (_res[i].userid) {
  336. _res2[j].course.push({
  337. title: _res[i].title,
  338. courseId: _res[i].courseId,
  339. });
  340. var _chapter = JSON.parse(_res[i].chapters);
  341. for (var k = 0; k < _chapter.length; k++) {
  342. let taskC2 = 0;
  343. let toolC2 = 0;
  344. let evalC2 = 0;
  345. let fontC2 = 0;
  346. fontC2 += _chapter[k].dyName.length;
  347. taskC2 = _chapter[k].chapterInfo[0].taskJson.length;
  348. let _tasks = _chapter[k].chapterInfo[0].taskJson;
  349. for (var task = 0; task < _tasks.length; task++) {
  350. if (_tasks[task].eList) {
  351. evalC2 += _tasks[task].eList.length;
  352. }
  353. if (_tasks[task].toolChoose[0].tool.length > 0) {
  354. toolC2 += _tasks[task].toolChoose.length;
  355. }
  356. fontC2 += _tasks[task].task.length;
  357. fontC2 += _tasks[task].taskDetail
  358. .replace(/<[^<>]+>/g, "")
  359. .replace(/&nbsp;/gi, "").length;
  360. let _tools = _tasks[task].toolChoose;
  361. for (var tool = 0; tool < _tools.length; tool++) {
  362. fontC2 += _tools[tool].toolDetail.length;
  363. }
  364. }
  365. if (_res2[j]["jd" + (k + 1)]) {
  366. _res2[j]["jd" + (k + 1)].taskC += taskC2;
  367. _res2[j]["jd" + (k + 1)].toolC += toolC2;
  368. _res2[j]["jd" + (k + 1)].evalC += evalC2;
  369. _res2[j]["jd" + (k + 1)].fontC += fontC2;
  370. } else {
  371. _res2[j]["jd" + (k + 1)] = {};
  372. _res2[j]["jd" + (k + 1)].taskC = taskC2;
  373. _res2[j]["jd" + (k + 1)].toolC = toolC2;
  374. _res2[j]["jd" + (k + 1)].evalC = evalC2;
  375. _res2[j]["jd" + (k + 1)].fontC = fontC2;
  376. }
  377. taskC += taskC2;
  378. toolC += toolC2;
  379. evalC += evalC2;
  380. fontC += fontC2;
  381. }
  382. _res2[j]["jdz"] = {};
  383. _res2[j]["jdz"].taskC = taskC;
  384. _res2[j]["jdz"].toolC = toolC;
  385. _res2[j]["jdz"].evalC = evalC;
  386. _res2[j]["jdz"].fontC = fontC;
  387. // _res2[j].course = course;
  388. }else{
  389. _res2[j]["jdz"] = {};
  390. _res2[j]["jdz"].taskC = 0;
  391. _res2[j]["jdz"].toolC = 0;
  392. _res2[j]["jdz"].evalC = 0;
  393. _res2[j]["jdz"].fontC = 0;
  394. }
  395. }
  396. }
  397. }
  398. if (this.search) {
  399. _res2 = _res2.filter((a) => {
  400. return (
  401. a.school.indexOf(this.search) != -1 ||
  402. a.username.indexOf(this.search) != -1
  403. );
  404. });
  405. }
  406. if (this.choose == "school") {
  407. let array = _res2.sort(function (a, b) {
  408. return a.school.localeCompare(b.school);
  409. });
  410. this.tableData = array;
  411. } else if (this.choose == "task") {
  412. let array = _res2.sort(function (a, b) {
  413. // return a.jdz.taskC - b.jdz.taskC;
  414. return b.jdz.taskC - a.jdz.taskC;
  415. });
  416. this.tableData = array;
  417. } else if (this.choose == "font") {
  418. let array = _res2.sort(function (a, b) {
  419. // return a.jdz.fontC - b.jdz.fontC;
  420. return b.jdz.fontC - a.jdz.fontC;
  421. });
  422. this.tableData = array;
  423. } else if (this.choose == "eval") {
  424. let array = _res2.sort(function (a, b) {
  425. // return a.jdz.fontC - b.jdz.fontC;
  426. return b.jdz.evalC - a.jdz.evalC;
  427. });
  428. this.tableData = array;
  429. } else if (this.choose == "tool") {
  430. let array = _res2.sort(function (a, b) {
  431. // return a.jdz.fontC - b.jdz.fontC;
  432. return b.jdz.toolC - a.jdz.toolC;
  433. });
  434. this.tableData = array;
  435. } else {
  436. this.tableData = _res2;
  437. }
  438. })
  439. .catch((err) => {
  440. this.isLoading = false;
  441. console.error(err);
  442. });
  443. },
  444. handleCurrentChange(val) {
  445. // console.log(`当前页: ${val}`);
  446. this.page = val;
  447. this.getData();
  448. },
  449. getAll(res) {
  450. this.data = res;
  451. let a = Object.keys(res);
  452. a = a.filter((el) => {
  453. return el.indexOf("jd") != -1 && el != "jdz";
  454. });
  455. this.dataArray = a;
  456. this.dialogVisible = true;
  457. },
  458. },
  459. beforeDestroy() {
  460. clearInterval(this.timer);
  461. this.timer = null;
  462. },
  463. mounted() {
  464. this.isLoading = true;
  465. this.getData();
  466. this.timer = setInterval(() => {
  467. this.getData();
  468. }, 60000);
  469. },
  470. };
  471. </script>
  472. <style scoped>
  473. .student_input {
  474. width: 190px;
  475. font-size: 13px;
  476. padding: 0 10px;
  477. }
  478. .cd_body {
  479. height: 100%;
  480. width: 100%;
  481. }
  482. .pb_head {
  483. margin: 0 !important;
  484. width: 100% !important;
  485. }
  486. .student_head {
  487. margin-top: 10px;
  488. padding-bottom: 10px;
  489. display: flex;
  490. justify-content: space-between;
  491. }
  492. .head_left {
  493. display: flex;
  494. align-items: center;
  495. }
  496. .cd_title span {
  497. font-size: 25px;
  498. font-weight: 700;
  499. }
  500. .cd_table {
  501. width: 95%;
  502. margin: 0 auto;
  503. padding: 0 0 10px;
  504. }
  505. .el-table>>>.even_row {
  506. background-color: #f1f1f1 !important;
  507. }
  508. .dialog_diy>>>.el-dialog {
  509. background: #fafafa;
  510. }
  511. .dialog_diy>>>.el-dialog__header {
  512. background: #3d67bc !important;
  513. padding: 15px 20px;
  514. }
  515. .dialog_diy>>>.el-dialog__title {
  516. color: #fff;
  517. }
  518. .dialog_diy>>>.el-dialog__headerbtn {
  519. top: 19px;
  520. }
  521. .dialog_diy>>>.el-dialog__headerbtn .el-dialog__close {
  522. color: #fff;
  523. }
  524. .dialog_diy>>>.el-dialog__headerbtn .el-dialog__close:hover {
  525. color: #fff;
  526. }
  527. .cd_d_box {
  528. font-size: 16px;
  529. }
  530. .cd_d_box+.cd_d_box {
  531. margin-top: 10px;
  532. }
  533. .cd_d_jd {
  534. display: flex;
  535. flex-wrap: wrap;
  536. margin-top: 10px;
  537. }
  538. .cd_d_jd_box {
  539. width: 100px;
  540. display: flex;
  541. flex-direction: column;
  542. align-items: center;
  543. /* background: #eee; */
  544. border-radius: 5px;
  545. margin: 10px 15px 0 0;
  546. }
  547. .cd_d_jd_box {}
  548. .cd_d_jd_content {
  549. width: 100px;
  550. display: flex;
  551. flex-direction: column;
  552. align-items: center;
  553. background: #eee;
  554. border-radius: 5px;
  555. padding: 5px 0;
  556. }
  557. .cd_d_jd_content div+div {
  558. margin-top: 5px;
  559. }
  560. .cd_d_jd_content div span+span {
  561. margin-left: 5px;
  562. }
  563. .cd_d_jd_name {
  564. margin-bottom: 5px;
  565. color: #184ebd;
  566. }
  567. .cd_d_span div:nth-child(1) span:nth-child(1) {
  568. color: #3887fe;
  569. }
  570. .cd_d_span div:nth-child(2) span:nth-child(1) {
  571. color: #fe3987;
  572. }
  573. .cd_d_span div:nth-child(3) span:nth-child(1) {
  574. color: #10bb6e;
  575. }
  576. .cd_d_span div:nth-child(4) span:nth-child(1) {
  577. color: #3887fe;
  578. }
  579. .cd_d_span div span:nth-child(1) {
  580. margin-right: 5px;
  581. }
  582. .cd_course {
  583. cursor: pointer;
  584. width: 100%;
  585. display: flex;
  586. }
  587. .cd_course span {
  588. width: 100%;
  589. white-space: nowrap;
  590. overflow: hidden;
  591. text-overflow: ellipsis;
  592. }
  593. .table>>>.cell {
  594. padding: 0px 3px !important;
  595. }
  596. .student_page {
  597. width: 100%;
  598. margin: 20px auto;
  599. }
  600. /* .table >>> .el-table .cell, .table >>> .el-table--border td:first-child .cell, .table >>> .el-table--border th:first-child .cell{
  601. padding: 0 3px;
  602. } */
  603. </style>