Commit 53424e83366f877003ee875c886a3f634d93ea61
1 parent
dc56294d
教师管理筛选条件
Showing
3 changed files
with
124 additions
and
42 deletions
router
src/views/standard/down/index.vue
| ... | ... | @@ -12,12 +12,16 @@ |
| 12 | 12 | </p> |
| 13 | 13 | <el-button plan round @click="links">授课端下载</el-button> |
| 14 | 14 | </div> |
| 15 | - <div class="down-item" v-loading="loading"> | |
| 15 | + <div class="down-item" v-loading="loading" v-if="role != 'ROLE_JIAOSHI'"> | |
| 16 | 16 | <p class="txt"> |
| 17 | 17 | 配合发卡器硬件,方便学校管理员进行发卡补卡操作的软件。 |
| 18 | 18 | </p> |
| 19 | 19 | <el-button plan round @click="downCard">发卡软件下载</el-button> |
| 20 | 20 | </div> |
| 21 | + <div class="down-item" v-loading="loading"> | |
| 22 | + <p class="txt">。</p> | |
| 23 | + <el-button plan round @click="downNet">.Net环境下载</el-button> | |
| 24 | + </div> | |
| 21 | 25 | </div> |
| 22 | 26 | </div> |
| 23 | 27 | </template> |
| ... | ... | @@ -26,9 +30,16 @@ |
| 26 | 30 | export default { |
| 27 | 31 | data() { |
| 28 | 32 | return { |
| 33 | + role: "", | |
| 29 | 34 | loading: false, |
| 35 | + loadingNet: false, | |
| 30 | 36 | }; |
| 31 | 37 | }, |
| 38 | + created() { | |
| 39 | + this.role = | |
| 40 | + this.$store.getters.info.showRole || | |
| 41 | + this.$store.getters.info.permissions[0].role; | |
| 42 | + }, | |
| 32 | 43 | methods: { |
| 33 | 44 | links() { |
| 34 | 45 | this.$router.push({ |
| ... | ... | @@ -51,6 +62,22 @@ export default { |
| 51 | 62 | this.$message.error(info); |
| 52 | 63 | } |
| 53 | 64 | }, |
| 65 | + async downNet() { | |
| 66 | + if (this.loadingNet == true) return; | |
| 67 | + this.loadingNet = true; | |
| 68 | + const { data, status, info } = await this.$request.latestClickersApp(); | |
| 69 | + this.loadingNet = false; | |
| 70 | + if (status == 0) { | |
| 71 | + const a = document.createElement("a"); | |
| 72 | + a.href = data.downloadUrl; | |
| 73 | + a.download = data.appName; | |
| 74 | + document.body.appendChild(a); | |
| 75 | + a.click(); | |
| 76 | + a.remove(); | |
| 77 | + } else { | |
| 78 | + this.$message.error(info); | |
| 79 | + } | |
| 80 | + }, | |
| 54 | 81 | }, |
| 55 | 82 | }; |
| 56 | 83 | </script> |
| ... | ... | @@ -62,7 +89,7 @@ export default { |
| 62 | 89 | .page-content { |
| 63 | 90 | display: flex; |
| 64 | 91 | padding-top: 50px; |
| 65 | - margin-left: 240px; | |
| 92 | + margin-left: 160px; | |
| 66 | 93 | .down-item { |
| 67 | 94 | width: 200px; |
| 68 | 95 | padding: 50px 20px; | ... | ... |
src/views/standard/setUp/teacher.vue
| ... | ... | @@ -40,26 +40,30 @@ |
| 40 | 40 | |
| 41 | 41 | <div class="answer-header"> |
| 42 | 42 | <div class="sel-box"> |
| 43 | - <el-select | |
| 44 | - class="sel" | |
| 45 | - v-model="query.gradeName" | |
| 46 | - placeholder="选择年级" | |
| 47 | - @change="_QueryData(1)" | |
| 48 | - > | |
| 49 | - <el-option | |
| 50 | - v-for="item in gradeList" | |
| 51 | - :key="item.value" | |
| 52 | - :label="item.label" | |
| 53 | - :value="item.value" | |
| 54 | - > | |
| 55 | - </el-option> | |
| 56 | - <el-option label="未分配教师" value="未分配教师"> </el-option> | |
| 43 | + <el-cascader | |
| 44 | + size="small" | |
| 45 | + class="sel sel2" | |
| 46 | + clearable | |
| 47 | + placeholder="选择范围" | |
| 48 | + v-model="query.gradeClassSub" | |
| 49 | + :options="gradeClassSubList" | |
| 50 | + :props="{ | |
| 51 | + multiple: true, | |
| 52 | + checkStrictly: true, | |
| 53 | + }" | |
| 54 | + collapse-tags | |
| 55 | + :show-all-levels="false" | |
| 56 | + ></el-cascader> | |
| 57 | + <el-select class="sel" v-model="query.type" placeholder="选择类型"> | |
| 58 | + <el-option label="已分配教师" :value="0"></el-option> | |
| 59 | + <el-option label="未分配教师" :value="1"></el-option> | |
| 57 | 60 | </el-select> |
| 58 | 61 | <el-input |
| 59 | 62 | placeholder="请输入老师姓名" |
| 60 | 63 | v-model="query.teacherName" |
| 61 | 64 | class="input-with-select" |
| 62 | 65 | maxlength="30" |
| 66 | + clearable | |
| 63 | 67 | @keyup.enter.native="_QueryData(2)" |
| 64 | 68 | > |
| 65 | 69 | <el-button |
| ... | ... | @@ -73,6 +77,7 @@ |
| 73 | 77 | oninput="if(value.length > 11) value = value.slice(0,11)" |
| 74 | 78 | placeholder="请输入老师手机号" |
| 75 | 79 | v-model="query.phone" |
| 80 | + clearable | |
| 76 | 81 | class="input-with-select" |
| 77 | 82 | @keyup.enter.native="_QueryData(3)" |
| 78 | 83 | > |
| ... | ... | @@ -82,6 +87,9 @@ |
| 82 | 87 | @click="_QueryData(3)" |
| 83 | 88 | ></el-button> |
| 84 | 89 | </el-input> |
| 90 | + <el-button class="serach-box" round @click="_QueryData(1)" | |
| 91 | + >筛选</el-button | |
| 92 | + > | |
| 85 | 93 | </div> |
| 86 | 94 | </div> |
| 87 | 95 | <div class="page-content"> |
| ... | ... | @@ -222,9 +230,7 @@ |
| 222 | 230 | </el-popconfirm> |
| 223 | 231 | <div class="grade-item"> |
| 224 | 232 | <p class="grade-name"> |
| 225 | - {{ item.gradeName }}({{ | |
| 226 | - item.subjectName | |
| 227 | - }}) | |
| 233 | + {{ item.gradeName }}({{ item.subjectName }}) | |
| 228 | 234 | </p> |
| 229 | 235 | </div> |
| 230 | 236 | </li> |
| ... | ... | @@ -388,15 +394,15 @@ export default { |
| 388 | 394 | isAdd: false, |
| 389 | 395 | setTercherType: 1, |
| 390 | 396 | query: { |
| 391 | - gradeName: "", | |
| 397 | + gradeClassSub: [], | |
| 398 | + type: 0, | |
| 392 | 399 | teacherName: "", |
| 393 | 400 | phone: "", |
| 394 | 401 | }, |
| 395 | 402 | subjectList: [], |
| 396 | 403 | gradeList: [], |
| 397 | 404 | classList: [], |
| 398 | - gradeClassList: [], | |
| 399 | - gradeSubList: [], | |
| 405 | + gradeClassSubList: [], | |
| 400 | 406 | teacherList: [], |
| 401 | 407 | teacherRoleList: [ |
| 402 | 408 | //角色 |
| ... | ... | @@ -446,6 +452,7 @@ export default { |
| 446 | 452 | }, |
| 447 | 453 | async created() { |
| 448 | 454 | this.code = localStorage.getItem("csCode") || ""; |
| 455 | + await this._QuerySubject(); | |
| 449 | 456 | await this._QueryDataGrade(); |
| 450 | 457 | this._QueryData(1); |
| 451 | 458 | this._RoleList(); |
| ... | ... | @@ -693,20 +700,16 @@ export default { |
| 693 | 700 | this.$message.error(info); |
| 694 | 701 | } |
| 695 | 702 | }, |
| 696 | - async _QueryData(type) { | |
| 703 | + setQuery(type) { | |
| 697 | 704 | let query = {}; |
| 698 | - if (type == 1) { | |
| 699 | - query.gradeName = this.query.gradeName; | |
| 700 | - this.query.teacherName = ""; | |
| 701 | - this.query.phone = ""; | |
| 702 | - } else if (type == 2) { | |
| 705 | + if (type == 2) { | |
| 703 | 706 | if (this.query.teacherName == "") { |
| 704 | 707 | this.$message.warning("请输入老师姓名"); |
| 705 | 708 | return; |
| 706 | 709 | } |
| 707 | 710 | query.teacherName = this.query.teacherName; |
| 708 | - this.query.gradeName = ""; | |
| 709 | 711 | this.query.phone = ""; |
| 712 | + this.query.gradeClassSub = []; | |
| 710 | 713 | } else if (type == 3) { |
| 711 | 714 | if (this.query.phone == "") { |
| 712 | 715 | this.$message.warning("请输入老师手机"); |
| ... | ... | @@ -714,16 +717,47 @@ export default { |
| 714 | 717 | } |
| 715 | 718 | query.phone = this.query.phone; |
| 716 | 719 | this.query.teacherName = ""; |
| 717 | - this.query.gradeName = ""; | |
| 718 | - } else if (type == 10) { | |
| 719 | - query = { ...this.query }; | |
| 720 | - } | |
| 721 | - if (query.gradeName == "未分配教师") { | |
| 722 | - query.type = 1; | |
| 720 | + this.query.gradeClassSub = []; | |
| 723 | 721 | } else { |
| 724 | - query.type = 0; | |
| 722 | + query = { ...this.query }; | |
| 723 | + query.gradeNames = []; | |
| 724 | + query.classIds = []; | |
| 725 | + query.subjectNames = []; | |
| 726 | + this.query.gradeClassSub?.map((item) => { | |
| 727 | + if (item.length == 1) { | |
| 728 | + if (!query.gradeNames.includes(item[0])) { | |
| 729 | + query.gradeNames.push(item[0]); | |
| 730 | + } | |
| 731 | + } else if (item.length == 2) { | |
| 732 | + if (!query.classIds.includes(item[1])) { | |
| 733 | + query.classIds.push(item[1]); | |
| 734 | + } | |
| 735 | + query.gradeNames.includes(item[0]) && | |
| 736 | + query.gradeNames.remove(item[0]); | |
| 737 | + } else if (item.length == 3) { | |
| 738 | + if (!query.subjectNames.includes(item[2])) { | |
| 739 | + query.subjectNames.push(item[2]); | |
| 740 | + } | |
| 741 | + query.gradeNames.includes(item[0]) && | |
| 742 | + query.gradeNames.remove(item[0]); | |
| 743 | + query.classIds.includes(item[0]) && query.classIds.remove(item[0]); | |
| 744 | + } | |
| 745 | + }); | |
| 746 | + | |
| 747 | + delete query.gradeClassSub; | |
| 748 | + query.gradeNames.length ? "" : delete query.gradeNames; | |
| 749 | + query.classIds.length ? "" : delete query.classIds; | |
| 750 | + query.subjectNames.length ? "" : delete query.subjectNames; | |
| 751 | + query.teacherName.length ? "" : delete query.teacherName; | |
| 752 | + query.phone.length ? "" : delete query.phone; | |
| 725 | 753 | } |
| 754 | + | |
| 755 | + return query; | |
| 756 | + }, | |
| 757 | + async _QueryData(type) { | |
| 758 | + if (this.loading) return; | |
| 726 | 759 | this.loading = true; |
| 760 | + let query = this.setQuery(); | |
| 727 | 761 | this.teacherList = []; |
| 728 | 762 | const { data, status, info } = await this.$request.teacherList({ |
| 729 | 763 | ...query, |
| ... | ... | @@ -746,26 +780,46 @@ export default { |
| 746 | 780 | this.$message.error(info); |
| 747 | 781 | } |
| 748 | 782 | }, |
| 783 | + async _QuerySubject() { | |
| 784 | + const { data, status, info } = await this.$request.subjectList(); | |
| 785 | + if (status === 0) { | |
| 786 | + this.subjectList = [...data?.subjectNames] || []; | |
| 787 | + } else { | |
| 788 | + this.$message.error(info); | |
| 789 | + } | |
| 790 | + }, | |
| 749 | 791 | async _QueryDataGrade() { |
| 750 | 792 | //年级数据 |
| 751 | 793 | const { data, status, info } = await this.$request.gradeList(); |
| 752 | 794 | if (status === 0) { |
| 753 | 795 | this.gradeList = |
| 754 | 796 | data.list?.map((item) => { |
| 755 | - return { | |
| 797 | + let subList = item.subjectNames?.map((items) => { | |
| 798 | + return { | |
| 799 | + value: items, | |
| 800 | + label: items, | |
| 801 | + }; | |
| 802 | + }); | |
| 803 | + this.gradeClassSubList.push({ | |
| 756 | 804 | value: item.gradeName, |
| 757 | 805 | label: item.gradeName, |
| 758 | 806 | id: item.grade, |
| 759 | - children: item.subjectNames?.map((items) => { | |
| 807 | + children: item.classList.map((clazz) => { | |
| 760 | 808 | return { |
| 761 | - value: items, | |
| 762 | - label: items, | |
| 809 | + value: clazz.id, | |
| 810 | + label: clazz.className, | |
| 811 | + id: clazz.id, | |
| 812 | + children: [...subList], | |
| 763 | 813 | }; |
| 764 | 814 | }), |
| 815 | + }); | |
| 816 | + return { | |
| 817 | + value: item.gradeName, | |
| 818 | + label: item.gradeName, | |
| 819 | + id: item.grade, | |
| 820 | + children: [...subList], | |
| 765 | 821 | }; |
| 766 | 822 | }) || []; |
| 767 | - | |
| 768 | - this.query.gradeName = this.gradeList[0]?.value; | |
| 769 | 823 | } else { |
| 770 | 824 | this.$message.error(info); |
| 771 | 825 | } | ... | ... |