Commit 55eb13fd2499f212623caadefc979661f391fd6f
1 parent
5cfb0264
中天提出的交互优化
Showing
3 changed files
with
115 additions
and
46 deletions
src/views/standard/analysis/index.vue
... | ... | @@ -59,10 +59,12 @@ |
59 | 59 | <span class="s-txt">对比项{{ setBigNum(index) }}:</span> |
60 | 60 | <div class="sel-box"> |
61 | 61 | <el-cascader |
62 | + :ref="'cascader' + index" | |
62 | 63 | size="small" |
63 | 64 | class="sel sel2" |
64 | 65 | clearable |
65 | 66 | placeholder="选择范围" |
67 | + @change="secGraClaSubChange($event, index)" | |
66 | 68 | v-model="query.secGraClaSub[index]" |
67 | 69 | :options="gradeList" |
68 | 70 | :props="props" |
... | ... | @@ -79,7 +81,7 @@ |
79 | 81 | icon="el-icon-plus" |
80 | 82 | size="small" |
81 | 83 | round |
82 | - @click="query.secGraClaSub.push([])" | |
84 | + @click="addQuery" | |
83 | 85 | >添加对比项</el-button |
84 | 86 | > |
85 | 87 | <el-button class="btn" round size="small" @click="getData" |
... | ... | @@ -97,7 +99,7 @@ |
97 | 99 | |
98 | 100 | <script> |
99 | 101 | import barChart from "@/components/charts/barChart"; |
100 | -import { formatDate, downloadFile } from "@/utils"; | |
102 | +import { formatDate } from "@/utils"; | |
101 | 103 | export default { |
102 | 104 | components: { |
103 | 105 | barChart, |
... | ... | @@ -114,6 +116,7 @@ export default { |
114 | 116 | endDay: "", |
115 | 117 | day: "", |
116 | 118 | secGraClaSub: [], |
119 | + secGraClaSubName: [], | |
117 | 120 | }, |
118 | 121 | props: { |
119 | 122 | multiple: false, |
... | ... | @@ -181,6 +184,33 @@ export default { |
181 | 184 | this._QueryData(); |
182 | 185 | }, |
183 | 186 | methods: { |
187 | + addQuery() { | |
188 | + this.query.secGraClaSub.push([]); | |
189 | + this.query.secGraClaSubName.push(""); | |
190 | + }, | |
191 | + filterObj(arr, value) { | |
192 | + return arr.filter((item) => { | |
193 | + return value == item.value; | |
194 | + })[0]; | |
195 | + }, | |
196 | + secGraClaSubChange(event, index) { | |
197 | + console.log(event) | |
198 | + let txt = ""; | |
199 | + let xx = this.filterObj(this.gradeList, event[0]); | |
200 | + txt += xx.label; | |
201 | + if (event.length > 1) { | |
202 | + let grade = this.filterObj(xx.children, event[1]); | |
203 | + txt += "/" + grade.label; | |
204 | + if (event.length > 2) { | |
205 | + let clazz = this.filterObj(grade.children, event[2]); | |
206 | + txt += "/" + clazz.label; | |
207 | + if (event.length > 3) { | |
208 | + txt += "/" + event[3]; | |
209 | + } | |
210 | + } | |
211 | + } | |
212 | + this.query.secGraClaSubName[index] = txt; | |
213 | + }, | |
184 | 214 | setBigNum(num) { |
185 | 215 | let txt = ""; |
186 | 216 | let bigNum = ["一", "二", "三", "四", "五", "六", "七", "八", "九", "十"]; |
... | ... | @@ -238,16 +268,17 @@ export default { |
238 | 268 | removeQuery(index) { |
239 | 269 | let secGraClaSubLen = this.query.secGraClaSub.length; |
240 | 270 | let xAxisLen = this.xAxis.length; |
271 | + this.query.secGraClaSub.splice(index, 1); | |
272 | + this.query.secGraClaSubName.splice(index, 1); | |
273 | + this.xAxis.splice(index, 1); | |
241 | 274 | if ( |
242 | 275 | secGraClaSubLen == xAxisLen || |
243 | 276 | (secGraClaSubLen > xAxisLen && index < xAxisLen) |
244 | 277 | ) { |
245 | - this.xAxis.pop(); | |
246 | 278 | this.chartData[0].value.splice(index, 1); |
247 | 279 | this.chartData[1].value.splice(index, 1); |
248 | 280 | this.$refs.barChart.initData(this.xAxis, this.chartData); |
249 | 281 | } |
250 | - this.query.secGraClaSub.splice(index, 1); | |
251 | 282 | }, |
252 | 283 | handleChangeTimeStart(val) { |
253 | 284 | this.query.day = ""; |
... | ... | @@ -287,6 +318,7 @@ export default { |
287 | 318 | ); |
288 | 319 | return; |
289 | 320 | } |
321 | + this.xAxis = [...this.query.secGraClaSubName]; | |
290 | 322 | this._QueryData(); |
291 | 323 | }, |
292 | 324 | setQuery() { |
... | ... | @@ -296,7 +328,7 @@ export default { |
296 | 328 | query.params = this.query.secGraClaSub.map((item) => { |
297 | 329 | let jsons = {}; |
298 | 330 | jsons.section = item[0]; |
299 | - item.length > 1 ? (jsons.grade = item[1]) : ""; | |
331 | + item.length > 1 ? (jsons.clazz = item[1]) : ""; | |
300 | 332 | item.length > 2 ? (jsons.classId = item[2]) : ""; |
301 | 333 | item.length == 4 ? (jsons.subjectName = item[3]) : ""; |
302 | 334 | return jsons; |
... | ... | @@ -327,9 +359,8 @@ export default { |
327 | 359 | if (status === 0) { |
328 | 360 | this.chartData[0].value = []; |
329 | 361 | this.chartData[1].value = []; |
330 | - this.xAxis = []; | |
362 | + this.xAxis = [...this.query.secGraClaSubName]; | |
331 | 363 | data?.list.map((item, index) => { |
332 | - this.xAxis.push("对比项" + this.setBigNum(index)); | |
333 | 364 | this.chartData[0].value.push(item.periodCount); |
334 | 365 | this.chartData[1].value.push(item.examCount); |
335 | 366 | }); |
... | ... | @@ -349,6 +380,7 @@ export default { |
349 | 380 | if (status === 0) { |
350 | 381 | if (!!data.list) { |
351 | 382 | this.query.secGraClaSub = []; |
383 | + this.query.secGraClaSubName = []; | |
352 | 384 | if (this.role != "ROLE_JITUAN") { |
353 | 385 | this.gradeList = |
354 | 386 | data.list?.map((item) => { |
... | ... | @@ -382,8 +414,9 @@ export default { |
382 | 414 | }; |
383 | 415 | }); |
384 | 416 | this.gradeList = this.schoolList.map((item) => { |
385 | - if (this.query.secGraClaSub.length < 10) { | |
417 | + if (this.query.secGraClaSub.length < 6) { | |
386 | 418 | this.query.secGraClaSub.push([item.id]); |
419 | + this.query.secGraClaSubName.push(item.schoolName); | |
387 | 420 | } |
388 | 421 | return { |
389 | 422 | value: item.id, |
... | ... | @@ -404,6 +437,7 @@ export default { |
404 | 437 | if (!!data.list) { |
405 | 438 | if (this.role == "ROLE_XUEXIAO") { |
406 | 439 | this.query.secGraClaSub = []; |
440 | + this.query.secGraClaSubName = []; | |
407 | 441 | data.list?.map((item) => { |
408 | 442 | let subList = item.subjectNames?.map((items) => { |
409 | 443 | return { |
... | ... | @@ -428,9 +462,12 @@ export default { |
428 | 462 | }); |
429 | 463 | }) || []; |
430 | 464 | this.gradeList.map((sec) => { |
431 | - sec.gradeIds.map((items) => { | |
432 | - if (this.query.secGraClaSub.length < 10) { | |
433 | - this.query.secGraClaSub.push([sec.value, items]); | |
465 | + sec.children.map((items) => { | |
466 | + if (this.query.secGraClaSub.length < 6) { | |
467 | + this.query.secGraClaSub.push([sec.value, items.value]); | |
468 | + this.query.secGraClaSubName.push( | |
469 | + `${sec.label}/${items.label}` | |
470 | + ); | |
434 | 471 | } |
435 | 472 | }); |
436 | 473 | }); |
... | ... | @@ -553,6 +590,6 @@ div::-webkit-scrollbar-thumb { |
553 | 590 | } |
554 | 591 | } |
555 | 592 | .chart-box { |
556 | - height: 600px; | |
593 | + height: 400px; | |
557 | 594 | } |
558 | 595 | </style> |
559 | 596 | \ No newline at end of file | ... | ... |
src/views/standard/setUp/clazz.vue
... | ... | @@ -66,12 +66,12 @@ |
66 | 66 | > |
67 | 67 | <li class="clazz-li" v-for="clazz in item.classList" :key="item.id"> |
68 | 68 | <div class="clazz-item"> |
69 | - <p class="clazz-name"> | |
69 | + <i | |
70 | + class="el-icon-edit" | |
71 | + @click.stop="setClass(clazz, item.gradeName)" | |
72 | + ></i> | |
73 | + <p class="clazz-name ellipsis"> | |
70 | 74 | {{ clazz.className }} |
71 | - <i | |
72 | - class="el-icon-edit" | |
73 | - @click.stop="setClass(clazz, item.gradeName)" | |
74 | - ></i> | |
75 | 75 | </p> |
76 | 76 | <div class="clazz-class"> |
77 | 77 | <p>学生:{{ clazz.studentCount }}个</p> |
... | ... | @@ -566,11 +566,17 @@ export default { |
566 | 566 | } |
567 | 567 | |
568 | 568 | .clazz-item { |
569 | - min-width: 100px; | |
570 | - box-sizing: border-box; | |
569 | + width: 96px; | |
571 | 570 | padding: 14px 18px 14px 14px; |
572 | 571 | border-radius: 10px; |
573 | 572 | box-shadow: 1px 1px 3px #888; |
573 | + box-sizing: content-box; | |
574 | + position: relative; | |
575 | + } | |
576 | + .el-icon-edit { | |
577 | + position: absolute; | |
578 | + right: 5px; | |
579 | + top: 5px; | |
574 | 580 | } |
575 | 581 | .clazz-name { |
576 | 582 | font-size: 16px; |
... | ... | @@ -578,11 +584,6 @@ export default { |
578 | 584 | line-height: 18px; |
579 | 585 | padding-bottom: 6px; |
580 | 586 | position: relative; |
581 | - .el-icon-edit { | |
582 | - position: absolute; | |
583 | - right: -16px; | |
584 | - top: -10px; | |
585 | - } | |
586 | 587 | } |
587 | 588 | .clazz-class { |
588 | 589 | // display: flex; | ... | ... |
src/views/standard/setUp/teacher.vue
... | ... | @@ -61,8 +61,8 @@ |
61 | 61 | placeholder="选择类型" |
62 | 62 | > |
63 | 63 | <el-option disabled label="请选择" :value="9"></el-option> |
64 | - <el-option label="已分配教师" :value="0"></el-option> | |
65 | - <el-option label="未分配教师" :value="1"></el-option> | |
64 | + <el-option label="已分配任课信息" :value="0"></el-option> | |
65 | + <el-option label="未分配任课信息" :value="1"></el-option> | |
66 | 66 | </el-select> |
67 | 67 | <el-input |
68 | 68 | placeholder="请输入老师姓名" |
... | ... | @@ -251,7 +251,12 @@ |
251 | 251 | </div> |
252 | 252 | </div> |
253 | 253 | </div> |
254 | - <el-dialog :close-on-click-modal="false" title="导入教师名单" :visible.sync="diaUp" width="600"> | |
254 | + <el-dialog | |
255 | + :close-on-click-modal="false" | |
256 | + title="导入教师名单" | |
257 | + :visible.sync="diaUp" | |
258 | + width="600" | |
259 | + > | |
255 | 260 | <up-load |
256 | 261 | id="downTeacher" |
257 | 262 | :url="url" |
... | ... | @@ -267,7 +272,8 @@ |
267 | 272 | <el-button @click="diaUp = false">取 消</el-button> |
268 | 273 | </div> |
269 | 274 | </el-dialog> |
270 | - <el-dialog :close-on-click-modal="false" | |
275 | + <el-dialog | |
276 | + :close-on-click-modal="false" | |
271 | 277 | :title=" |
272 | 278 | isAdd ? '添加教师' : setTercherType == 1 ? '编辑教师信息' : '管理班级' |
273 | 279 | " |
... | ... | @@ -357,10 +363,10 @@ |
357 | 363 | class="sel-t" |
358 | 364 | collapse |
359 | 365 | clearable |
360 | - placeholder="选择班级-科目" | |
366 | + placeholder="选择年级-科目-班级" | |
361 | 367 | v-model="item.classId" |
362 | - :options="classList" | |
363 | - :props="{ expandTrigger: 'hover' }" | |
368 | + :options="gradeSubListClass" | |
369 | + :props="{ expandTrigger: 'hover', multiple: true }" | |
364 | 370 | ></el-cascader> |
365 | 371 | <el-cascader |
366 | 372 | size="small" |
... | ... | @@ -415,6 +421,7 @@ export default { |
415 | 421 | gradeList: [], |
416 | 422 | classList: [], |
417 | 423 | gradeClassSubList: [], |
424 | + gradeSubListClass: [], | |
418 | 425 | teacherList: [], |
419 | 426 | teacherRoleList: [ |
420 | 427 | //角色 |
... | ... | @@ -602,12 +609,14 @@ export default { |
602 | 609 | ?.label || "", |
603 | 610 | }); |
604 | 611 | } else if (item.roleId == 7) { |
605 | - teacherCourseList.push({ | |
606 | - classId: item.classId[0], | |
607 | - className: | |
608 | - this.classList.find((items) => items.value == item.classId[0]) | |
609 | - ?.label || "", | |
610 | - subjectName: item.classId[1], | |
612 | + item.classId.map((clazz) => { | |
613 | + teacherCourseList.push({ | |
614 | + classId: clazz[2], | |
615 | + className: | |
616 | + this.classList.find((items) => items.value == clazz[2]) | |
617 | + ?.label || "", | |
618 | + subjectName: clazz[1], | |
619 | + }); | |
611 | 620 | }); |
612 | 621 | } else { |
613 | 622 | gradeGroupList.push({ |
... | ... | @@ -645,20 +654,25 @@ export default { |
645 | 654 | ], |
646 | 655 | }); |
647 | 656 | }); |
657 | + let teacherClassId = []; | |
648 | 658 | this.formTeacher.teacherCourseList?.map((item) => { |
659 | + teacherClassId.push([ | |
660 | + item.grade, | |
661 | + item.subjectName, | |
662 | + this.classList.find( | |
663 | + (items) => | |
664 | + items.value == item.classId || | |
665 | + items.label.includes(item.className) | |
666 | + ).value, | |
667 | + ]); | |
668 | + }); | |
669 | + if (teacherClassId.length) { | |
649 | 670 | this.formTeacher.roleList.push({ |
650 | 671 | id: randomWord(true, 16, 20), |
651 | 672 | roleId: 7, |
652 | - classId: [ | |
653 | - this.classList.find( | |
654 | - (items) => | |
655 | - items.value == item.classId || | |
656 | - items.label.includes(item.className) | |
657 | - ).value, | |
658 | - item.subjectName, | |
659 | - ], | |
673 | + classId: [...teacherClassId], | |
660 | 674 | }); |
661 | - }); | |
675 | + } | |
662 | 676 | this.formTeacher.gradeGroupList?.map((item) => { |
663 | 677 | this.formTeacher.roleList.push({ |
664 | 678 | id: randomWord(true, 16, 20), |
... | ... | @@ -865,6 +879,23 @@ export default { |
865 | 879 | }; |
866 | 880 | }), |
867 | 881 | }); |
882 | + this.gradeSubListClass.push({ | |
883 | + value: item.grade, | |
884 | + label: item.gradeName, | |
885 | + id: item.grade, | |
886 | + children: item.subjectNames.map((items) => { | |
887 | + return { | |
888 | + value: items, | |
889 | + label: items, | |
890 | + children: item.classList.map((clazz) => { | |
891 | + return { | |
892 | + value: clazz.id, | |
893 | + label: clazz.className, | |
894 | + }; | |
895 | + }), | |
896 | + }; | |
897 | + }), | |
898 | + }); | |
868 | 899 | return { |
869 | 900 | value: item.grade, |
870 | 901 | label: item.gradeName, | ... | ... |