Commit 55eb13fd2499f212623caadefc979661f391fd6f

Authored by 梁保满
1 parent 5cfb0264

中天提出的交互优化

src/views/standard/analysis/index.vue
@@ -59,10 +59,12 @@ @@ -59,10 +59,12 @@
59 <span class="s-txt">对比项{{ setBigNum(index) }}:</span> 59 <span class="s-txt">对比项{{ setBigNum(index) }}:</span>
60 <div class="sel-box"> 60 <div class="sel-box">
61 <el-cascader 61 <el-cascader
  62 + :ref="'cascader' + index"
62 size="small" 63 size="small"
63 class="sel sel2" 64 class="sel sel2"
64 clearable 65 clearable
65 placeholder="选择范围" 66 placeholder="选择范围"
  67 + @change="secGraClaSubChange($event, index)"
66 v-model="query.secGraClaSub[index]" 68 v-model="query.secGraClaSub[index]"
67 :options="gradeList" 69 :options="gradeList"
68 :props="props" 70 :props="props"
@@ -79,7 +81,7 @@ @@ -79,7 +81,7 @@
79 icon="el-icon-plus" 81 icon="el-icon-plus"
80 size="small" 82 size="small"
81 round 83 round
82 - @click="query.secGraClaSub.push([])" 84 + @click="addQuery"
83 >添加对比项</el-button 85 >添加对比项</el-button
84 > 86 >
85 <el-button class="btn" round size="small" @click="getData" 87 <el-button class="btn" round size="small" @click="getData"
@@ -97,7 +99,7 @@ @@ -97,7 +99,7 @@
97 99
98 <script> 100 <script>
99 import barChart from "@/components/charts/barChart"; 101 import barChart from "@/components/charts/barChart";
100 -import { formatDate, downloadFile } from "@/utils"; 102 +import { formatDate } from "@/utils";
101 export default { 103 export default {
102 components: { 104 components: {
103 barChart, 105 barChart,
@@ -114,6 +116,7 @@ export default { @@ -114,6 +116,7 @@ export default {
114 endDay: "", 116 endDay: "",
115 day: "", 117 day: "",
116 secGraClaSub: [], 118 secGraClaSub: [],
  119 + secGraClaSubName: [],
117 }, 120 },
118 props: { 121 props: {
119 multiple: false, 122 multiple: false,
@@ -181,6 +184,33 @@ export default { @@ -181,6 +184,33 @@ export default {
181 this._QueryData(); 184 this._QueryData();
182 }, 185 },
183 methods: { 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 setBigNum(num) { 214 setBigNum(num) {
185 let txt = ""; 215 let txt = "";
186 let bigNum = ["一", "二", "三", "四", "五", "六", "七", "八", "九", "十"]; 216 let bigNum = ["一", "二", "三", "四", "五", "六", "七", "八", "九", "十"];
@@ -238,16 +268,17 @@ export default { @@ -238,16 +268,17 @@ export default {
238 removeQuery(index) { 268 removeQuery(index) {
239 let secGraClaSubLen = this.query.secGraClaSub.length; 269 let secGraClaSubLen = this.query.secGraClaSub.length;
240 let xAxisLen = this.xAxis.length; 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 if ( 274 if (
242 secGraClaSubLen == xAxisLen || 275 secGraClaSubLen == xAxisLen ||
243 (secGraClaSubLen > xAxisLen && index < xAxisLen) 276 (secGraClaSubLen > xAxisLen && index < xAxisLen)
244 ) { 277 ) {
245 - this.xAxis.pop();  
246 this.chartData[0].value.splice(index, 1); 278 this.chartData[0].value.splice(index, 1);
247 this.chartData[1].value.splice(index, 1); 279 this.chartData[1].value.splice(index, 1);
248 this.$refs.barChart.initData(this.xAxis, this.chartData); 280 this.$refs.barChart.initData(this.xAxis, this.chartData);
249 } 281 }
250 - this.query.secGraClaSub.splice(index, 1);  
251 }, 282 },
252 handleChangeTimeStart(val) { 283 handleChangeTimeStart(val) {
253 this.query.day = ""; 284 this.query.day = "";
@@ -287,6 +318,7 @@ export default { @@ -287,6 +318,7 @@ export default {
287 ); 318 );
288 return; 319 return;
289 } 320 }
  321 + this.xAxis = [...this.query.secGraClaSubName];
290 this._QueryData(); 322 this._QueryData();
291 }, 323 },
292 setQuery() { 324 setQuery() {
@@ -296,7 +328,7 @@ export default { @@ -296,7 +328,7 @@ export default {
296 query.params = this.query.secGraClaSub.map((item) => { 328 query.params = this.query.secGraClaSub.map((item) => {
297 let jsons = {}; 329 let jsons = {};
298 jsons.section = item[0]; 330 jsons.section = item[0];
299 - item.length > 1 ? (jsons.grade = item[1]) : ""; 331 + item.length > 1 ? (jsons.clazz = item[1]) : "";
300 item.length > 2 ? (jsons.classId = item[2]) : ""; 332 item.length > 2 ? (jsons.classId = item[2]) : "";
301 item.length == 4 ? (jsons.subjectName = item[3]) : ""; 333 item.length == 4 ? (jsons.subjectName = item[3]) : "";
302 return jsons; 334 return jsons;
@@ -327,9 +359,8 @@ export default { @@ -327,9 +359,8 @@ export default {
327 if (status === 0) { 359 if (status === 0) {
328 this.chartData[0].value = []; 360 this.chartData[0].value = [];
329 this.chartData[1].value = []; 361 this.chartData[1].value = [];
330 - this.xAxis = []; 362 + this.xAxis = [...this.query.secGraClaSubName];
331 data?.list.map((item, index) => { 363 data?.list.map((item, index) => {
332 - this.xAxis.push("对比项" + this.setBigNum(index));  
333 this.chartData[0].value.push(item.periodCount); 364 this.chartData[0].value.push(item.periodCount);
334 this.chartData[1].value.push(item.examCount); 365 this.chartData[1].value.push(item.examCount);
335 }); 366 });
@@ -349,6 +380,7 @@ export default { @@ -349,6 +380,7 @@ export default {
349 if (status === 0) { 380 if (status === 0) {
350 if (!!data.list) { 381 if (!!data.list) {
351 this.query.secGraClaSub = []; 382 this.query.secGraClaSub = [];
  383 + this.query.secGraClaSubName = [];
352 if (this.role != "ROLE_JITUAN") { 384 if (this.role != "ROLE_JITUAN") {
353 this.gradeList = 385 this.gradeList =
354 data.list?.map((item) => { 386 data.list?.map((item) => {
@@ -382,8 +414,9 @@ export default { @@ -382,8 +414,9 @@ export default {
382 }; 414 };
383 }); 415 });
384 this.gradeList = this.schoolList.map((item) => { 416 this.gradeList = this.schoolList.map((item) => {
385 - if (this.query.secGraClaSub.length < 10) { 417 + if (this.query.secGraClaSub.length < 6) {
386 this.query.secGraClaSub.push([item.id]); 418 this.query.secGraClaSub.push([item.id]);
  419 + this.query.secGraClaSubName.push(item.schoolName);
387 } 420 }
388 return { 421 return {
389 value: item.id, 422 value: item.id,
@@ -404,6 +437,7 @@ export default { @@ -404,6 +437,7 @@ export default {
404 if (!!data.list) { 437 if (!!data.list) {
405 if (this.role == "ROLE_XUEXIAO") { 438 if (this.role == "ROLE_XUEXIAO") {
406 this.query.secGraClaSub = []; 439 this.query.secGraClaSub = [];
  440 + this.query.secGraClaSubName = [];
407 data.list?.map((item) => { 441 data.list?.map((item) => {
408 let subList = item.subjectNames?.map((items) => { 442 let subList = item.subjectNames?.map((items) => {
409 return { 443 return {
@@ -428,9 +462,12 @@ export default { @@ -428,9 +462,12 @@ export default {
428 }); 462 });
429 }) || []; 463 }) || [];
430 this.gradeList.map((sec) => { 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,6 +590,6 @@ div::-webkit-scrollbar-thumb {
553 } 590 }
554 } 591 }
555 .chart-box { 592 .chart-box {
556 - height: 600px; 593 + height: 400px;
557 } 594 }
558 </style> 595 </style>
559 \ No newline at end of file 596 \ No newline at end of file
src/views/standard/setUp/clazz.vue
@@ -66,12 +66,12 @@ @@ -66,12 +66,12 @@
66 > 66 >
67 <li class="clazz-li" v-for="clazz in item.classList" :key="item.id"> 67 <li class="clazz-li" v-for="clazz in item.classList" :key="item.id">
68 <div class="clazz-item"> 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 {{ clazz.className }} 74 {{ clazz.className }}
71 - <i  
72 - class="el-icon-edit"  
73 - @click.stop="setClass(clazz, item.gradeName)"  
74 - ></i>  
75 </p> 75 </p>
76 <div class="clazz-class"> 76 <div class="clazz-class">
77 <p>学生:{{ clazz.studentCount }}个</p> 77 <p>学生:{{ clazz.studentCount }}个</p>
@@ -566,11 +566,17 @@ export default { @@ -566,11 +566,17 @@ export default {
566 } 566 }
567 567
568 .clazz-item { 568 .clazz-item {
569 - min-width: 100px;  
570 - box-sizing: border-box; 569 + width: 96px;
571 padding: 14px 18px 14px 14px; 570 padding: 14px 18px 14px 14px;
572 border-radius: 10px; 571 border-radius: 10px;
573 box-shadow: 1px 1px 3px #888; 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 .clazz-name { 581 .clazz-name {
576 font-size: 16px; 582 font-size: 16px;
@@ -578,11 +584,6 @@ export default { @@ -578,11 +584,6 @@ export default {
578 line-height: 18px; 584 line-height: 18px;
579 padding-bottom: 6px; 585 padding-bottom: 6px;
580 position: relative; 586 position: relative;
581 - .el-icon-edit {  
582 - position: absolute;  
583 - right: -16px;  
584 - top: -10px;  
585 - }  
586 } 587 }
587 .clazz-class { 588 .clazz-class {
588 // display: flex; 589 // display: flex;
src/views/standard/setUp/teacher.vue
@@ -61,8 +61,8 @@ @@ -61,8 +61,8 @@
61 placeholder="选择类型" 61 placeholder="选择类型"
62 > 62 >
63 <el-option disabled label="请选择" :value="9"></el-option> 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 </el-select> 66 </el-select>
67 <el-input 67 <el-input
68 placeholder="请输入老师姓名" 68 placeholder="请输入老师姓名"
@@ -251,7 +251,12 @@ @@ -251,7 +251,12 @@
251 </div> 251 </div>
252 </div> 252 </div>
253 </div> 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 <up-load 260 <up-load
256 id="downTeacher" 261 id="downTeacher"
257 :url="url" 262 :url="url"
@@ -267,7 +272,8 @@ @@ -267,7 +272,8 @@
267 <el-button @click="diaUp = false">取 消</el-button> 272 <el-button @click="diaUp = false">取 消</el-button>
268 </div> 273 </div>
269 </el-dialog> 274 </el-dialog>
270 - <el-dialog :close-on-click-modal="false" 275 + <el-dialog
  276 + :close-on-click-modal="false"
271 :title=" 277 :title="
272 isAdd ? '添加教师' : setTercherType == 1 ? '编辑教师信息' : '管理班级' 278 isAdd ? '添加教师' : setTercherType == 1 ? '编辑教师信息' : '管理班级'
273 " 279 "
@@ -357,10 +363,10 @@ @@ -357,10 +363,10 @@
357 class="sel-t" 363 class="sel-t"
358 collapse 364 collapse
359 clearable 365 clearable
360 - placeholder="选择班级-科目" 366 + placeholder="选择年级-科目-班级"
361 v-model="item.classId" 367 v-model="item.classId"
362 - :options="classList"  
363 - :props="{ expandTrigger: 'hover' }" 368 + :options="gradeSubListClass"
  369 + :props="{ expandTrigger: 'hover', multiple: true }"
364 ></el-cascader> 370 ></el-cascader>
365 <el-cascader 371 <el-cascader
366 size="small" 372 size="small"
@@ -415,6 +421,7 @@ export default { @@ -415,6 +421,7 @@ export default {
415 gradeList: [], 421 gradeList: [],
416 classList: [], 422 classList: [],
417 gradeClassSubList: [], 423 gradeClassSubList: [],
  424 + gradeSubListClass: [],
418 teacherList: [], 425 teacherList: [],
419 teacherRoleList: [ 426 teacherRoleList: [
420 //角色 427 //角色
@@ -602,12 +609,14 @@ export default { @@ -602,12 +609,14 @@ export default {
602 ?.label || "", 609 ?.label || "",
603 }); 610 });
604 } else if (item.roleId == 7) { 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 } else { 621 } else {
613 gradeGroupList.push({ 622 gradeGroupList.push({
@@ -645,20 +654,25 @@ export default { @@ -645,20 +654,25 @@ export default {
645 ], 654 ],
646 }); 655 });
647 }); 656 });
  657 + let teacherClassId = [];
648 this.formTeacher.teacherCourseList?.map((item) => { 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 this.formTeacher.roleList.push({ 670 this.formTeacher.roleList.push({
650 id: randomWord(true, 16, 20), 671 id: randomWord(true, 16, 20),
651 roleId: 7, 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 this.formTeacher.gradeGroupList?.map((item) => { 676 this.formTeacher.gradeGroupList?.map((item) => {
663 this.formTeacher.roleList.push({ 677 this.formTeacher.roleList.push({
664 id: randomWord(true, 16, 20), 678 id: randomWord(true, 16, 20),
@@ -865,6 +879,23 @@ export default { @@ -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 return { 899 return {
869 value: item.grade, 900 value: item.grade,
870 label: item.gradeName, 901 label: item.gradeName,