From 88dac9c2f9b83c627fa94d6b035b332a2f0e3d15 Mon Sep 17 00:00:00 2001 From: xiangpei <xiangpei@timesnew.cn> Date: 星期一, 08 七月 2024 18:22:09 +0800 Subject: [PATCH] 标签增加部门、子管理员也有标签管理 --- src/views/exam/personalRandomTemplate/edit.vue | 52 +++++++++++++++++++++++++++++++++++++++------------- 1 files changed, 39 insertions(+), 13 deletions(-) diff --git a/src/views/exam/personalRandomTemplate/edit.vue b/src/views/exam/personalRandomTemplate/edit.vue index 763f87d..b559b0d 100644 --- a/src/views/exam/personalRandomTemplate/edit.vue +++ b/src/views/exam/personalRandomTemplate/edit.vue @@ -8,15 +8,21 @@ :key="item.id"></el-option> </el-select> </el-form-item> + <el-form-item label="閮ㄩ棬锛�" prop="deptId" required> + <!-- <el-select v-model="form.deptId" collapse-tags @change="getSubject" placeholder="閮ㄩ棬"> + <el-option v-for="item in depts" :key="item.id" :value="item.id" :label="item.name"></el-option> + </el-select> --> + <el-cascader + clearable + v-model="form.deptId" + :options="depts" + :props="{ emitPath: false, value: 'id', label: 'name', checkStrictly: true }" + ></el-cascader> + </el-form-item> <el-form-item label="璇剧洰锛�" prop="subjectId" required> - <el-select ref="subjectIdRef" v-model="form.subjectId" placeholder="璇剧洰" multiple collapse-tags + <el-select ref="subjectIdRef" v-model="form.subjectId" :disabled="! form.deptId" placeholder="璇剧洰" multiple collapse-tags @visible-change="subjectIdEvent"> <el-option v-for="item in subjectFilter" :key="item.id" :value="item.id" :label="item.name + ' '"></el-option> - </el-select> - </el-form-item> - <el-form-item label="閮ㄩ棬锛�" prop="deptId" required> - <el-select v-model="form.deptId" collapse-tags placeholder="閮ㄩ棬"> - <el-option v-for="item in depts" :key="item.id" :value="item.id" :label="item.name"></el-option> </el-select> </el-form-item> <el-form-item label="璇曞嵎绫诲瀷锛�" prop="paperType" required> @@ -147,16 +153,22 @@ </el-select> </el-form-item> <el-form-item label="閮ㄩ棬锛�"> - <el-select v-model="student.deptIds" clearable multiple> + <!-- <el-select v-model="student.deptIds" clearable multiple> <el-option v-for="item in depts" :key="item.id" :value="item.id" :label="item.name"></el-option> - </el-select> + </el-select> --> + <el-cascader + clearable + v-model="student.deptIds" + :options="depts" + :props="{ multiple: true, emitPath: false, value: 'id', label: 'name', checkStrictly: true }" + ></el-cascader> </el-form-item> <el-form-item> <el-button type="primary" @click="selectStudent">鏌ヨ</el-button> </el-form-item> </el-form> <el-table ref="multipleTable" v-loading="student.listLoading" :data="tableData" border fit highlight-current-row - style="width: 100%" @selection-change="handleSelection" row-key="id"> + style="width: 100%" @selection-change="handleSelection" row-key="id" @select-all="selectAll"> <el-table-column type="selection" :reserve-selection="true"></el-table-column> <el-table-column prop="realName" label="瀛﹀憳" /> </el-table> @@ -176,6 +188,7 @@ import Pagination from '@/components/Pagination'; import QuestionShow from '../question/components/Show'; import examPaperApi from '@/api/examPaper'; +import subjectApi from '@/api/subject'; import userApi from '@/api/user'; import questionApi from '@/api/question'; import departmentApi from '@/api/department'; @@ -270,7 +283,7 @@ questionType: null, subjectId: 1, pageIndex: 1, - pageSize: 5 + pageSize: 500000000 }, listLoading: true, tableData: [], @@ -284,7 +297,7 @@ console.log(res); this.subjectFilter = res.response; }); - departmentApi.getDeptAdmins().then(res => { + departmentApi.list().then(res => { this.depts = res.response; }); }, @@ -326,13 +339,26 @@ }; }); }); - - // this.subjectIdEvent(false) }, methods: { + getSubject(deptId) { + // 鑾峰彇瀵瑰簲閮ㄩ棬鐨勮鐩� + subjectApi.selectByDeptId(deptId).then(res => { + this.form.subjectId = null + this.subjectFilter = res.response + }) + }, handleSelection(val) { + console.log('val', val); this.student.multipleSelection = val; }, + selectAll() { + let param = { ...this.student }; + param.pageSize = 999999; + examPaperApi.selectStudent(param).then(res => { + this.handleSelection(res.response.list); + }); + }, confirmStudentSelect() { this.form.userIds = this.student.multipleSelection.map((item) => item.id); this.form.examineeList = this.student.multipleSelection.map((item) => { -- Gitblit v1.8.0