From 9f5a532c9213a34c7da9271cffd0ec2eb90461b4 Mon Sep 17 00:00:00 2001 From: ZhangXianQiang <1135831638@qq.com> Date: 星期五, 17 五月 2024 15:03:31 +0800 Subject: [PATCH] Merge branch 'dev-zhang' --- src/views/exam/personalRandomTemplate/edit.vue | 43 ++++++++++++++++++++++++++++++++++++------- 1 files changed, 36 insertions(+), 7 deletions(-) diff --git a/src/views/exam/personalRandomTemplate/edit.vue b/src/views/exam/personalRandomTemplate/edit.vue index 4d955fb..b662d7b 100644 --- a/src/views/exam/personalRandomTemplate/edit.vue +++ b/src/views/exam/personalRandomTemplate/edit.vue @@ -2,8 +2,12 @@ <div class="app-container"> <el-form :model="form" ref="form" label-width="200px" v-loading="formLoading" :rules="rules"> <el-form-item label="鑰冪敓锛�" prop="menuIds" required> - <el-cascader v-model="form.menuIds" :options="options" :props="props" clearable collapse-tags> - </el-cascader> +<!-- <el-cascader v-model="form.menuIds" :options="options" @change="cascaderChangeFun" :props="props" clearable collapse-tags>--> +<!-- </el-cascader>--> + <all-cascader :options="options" + :optionsData = "optionsData" + @change="cascaderChangeFun" + :width="200"></all-cascader> </el-form-item> <el-form-item label="璇剧洰锛�" prop="subjectId" required > <el-select ref="subjectIdRef" v-model="form.subjectId" placeholder="璇剧洰" multiple @@ -12,13 +16,18 @@ :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 > <el-select v-model="form.paperType" placeholder="璇曞嵎绫诲瀷" @visible-change="subjectIdEvent" disabled> <el-option v-for="item in paperTypeEnum" :key="item.key" :value="item.key" :label="item.value" ></el-option> </el-select> </el-form-item> - <el-form-item label="鏃堕棿闄愬埗锛�""> + <el-form-item label="鏃堕棿闄愬埗锛�"> <el-date-picker v-model="form.limitDateTime" value-format="yyyy-MM-dd HH:mm:ss" type="datetimerange" range-separator="鑷�" start-placeholder="寮�濮嬫棩鏈�" end-placeholder="缁撴潫鏃ユ湡"> </el-date-picker> @@ -132,9 +141,9 @@ import examPaperApi from '@/api/examPaper' import questionApi from '@/api/question' import departmentApi from '@/api/department' - +import allCascader from '@/components/Cascader' export default { - components: { Pagination, QuestionShow }, + components: { Pagination, QuestionShow ,allCascader}, data () { return { @@ -153,7 +162,9 @@ // }) // } }, + depts: [], options: [], + optionsData:[], departCascaderProps:{ multiple: true }, @@ -162,7 +173,7 @@ aggregateSource:'100', id: null, departmentIds: [], - + menuIds:[], subjectId: [], paperType: 7, limitDateTime: [], @@ -175,9 +186,11 @@ subjectFilter: null, formLoading: false, rules: { - subjectId: [ { required: true, message: '璇烽�夋嫨璇剧洰', trigger: 'change' } + ], + deptId: [ + { required: true, message: '璇烽�夋嫨閮ㄩ棬', trigger: 'change' } ], paperType: [ { required: true, message: '璇烽�夋嫨璇曞嵎绫诲瀷', trigger: 'change' } @@ -211,6 +224,9 @@ console.log(res) this.subjectFilter = res.response }) + departmentApi.getDeptAdmins().then(res => { + this.depts = res.response + }) }, async mounted () { @@ -225,7 +241,9 @@ await examPaperApi.selfselect(id).then(re => { _this.form = re.response _this.form.menuIds = JSON.parse(re.response.menuIds) + _this.optionsData = _this.form.menuIds console.log(_this.form) + _this.formLoading = false }) } @@ -244,6 +262,10 @@ // this.subjectIdEvent(false) }, methods: { + cascaderChangeFun(event){ + console.log(event) + this.form.menuIds = event + }, titlejs(val){ console.log(val) let str = '' @@ -320,6 +342,13 @@ if (this.subjectIdList.length == 1){ this.form.subjectId= this.form.subjectId }; + + let lastHasAll = this.form.menuIds.find(arr => { + return arr[0] === 'all'; + }); + if (lastHasAll){ + this.form.menuIds = this.form.menuIds.slice(1) + } let op = []; for(var ele of this.form.menuIds){ op.push(ele[1]) -- Gitblit v1.8.0