From e2d9978fe885d7855ad873d7f05cc98d00b4dcf0 Mon Sep 17 00:00:00 2001
From: 龚焕茏 <2842157468@qq.com>
Date: 星期二, 16 七月 2024 14:14:36 +0800
Subject: [PATCH] feat:默认选中当前部门

---
 src/views/exam/personalRandomTemplate/edit.vue |   13 ++++++++++---
 1 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/src/views/exam/personalRandomTemplate/edit.vue b/src/views/exam/personalRandomTemplate/edit.vue
index 80e6559..7a0c84b 100644
--- a/src/views/exam/personalRandomTemplate/edit.vue
+++ b/src/views/exam/personalRandomTemplate/edit.vue
@@ -159,6 +159,7 @@
           </el-select> -->
           <el-cascader
           clearable
+          collapse-tags
           v-model="student.deptIds"
           :options="depts"
           :props="{ multiple: true, emitPath: false, value: 'id', label: 'name',  checkStrictly: true }"
@@ -168,7 +169,7 @@
           <el-button type="primary" @click="selectStudent">鏌ヨ</el-button>
         </el-form-item>
       </el-form>
-      <el-button type="primary" @click="selectAllBoolean ? selectAll() : unselectAll()">{{ selectAllBoolean ? '鍏ㄩ��' : '鍙栨秷鍏ㄩ��' }}</el-button>
+      <el-button type="danger" @click="selectAllBoolean ? selectAll() : unselectAll()" size="small" style="margin-bottom: 3px">{{ selectAllBoolean ? '鍏ㄩ��' : '鍙栨秷鍏ㄩ��' }}</el-button>
       <el-table ref="multipleTable" v-loading="student.listLoading" :data="tableData" border fit highlight-current-row
         style="width: 100%" @selection-change="handleSelection" row-key="id">
         <el-table-column type="selection" :reserve-selection="true"></el-table-column>
@@ -238,6 +239,7 @@
       },
       subjectIdList: [],
       form: {
+        deptId: '',
         aggregateSource: '100',
         id: null,
         departmentIds: [],
@@ -308,6 +310,11 @@
     });
   },
   async mounted() {
+    departmentApi.getCurrentDeptId().then(res => {
+      if (res.response && res.response[0]) {
+        this.form.deptId = res.response[0];
+      }
+    });
 
     let id = this.$route.query.id;
     let _this = this;
@@ -360,20 +367,20 @@
     },
     selectAll () {
       this.preSelectAll();
-      this.selectAllBoolean = false;
       let param = { ...this.student };
       param.pageSize = 999999;
       examPaperApi.selectStudent(param).then(res => {
         this.handleSelection(res.response.list);
         res.response.list.forEach(item => {
           this.$refs.multipleTable.toggleRowSelection(item, true);
+          this.selectAllBoolean = false;
         })
         this.getStudent();
       });
     },
     unselectAll () {
-      this.selectAllBoolean = true;
       this.$refs.multipleTable.clearSelection();
+      this.selectAllBoolean = true;
     },
     confirmStudentSelect() {
       this.form.userIds = this.student.multipleSelection.map((item) => item.id);

--
Gitblit v1.8.0