From d6a88f59d6824e542a03544f915ff14112dfd040 Mon Sep 17 00:00:00 2001 From: 龚焕茏 <2842157468@qq.com> Date: 星期四, 30 五月 2024 15:19:02 +0800 Subject: [PATCH] feat:修改用户禁用部门 --- src/views/user/student/edit.vue | 42 ++++++++++++++++++++++++++++++++++-------- 1 files changed, 34 insertions(+), 8 deletions(-) diff --git a/src/views/user/student/edit.vue b/src/views/user/student/edit.vue index f1b4acb..c79ccf1 100644 --- a/src/views/user/student/edit.vue +++ b/src/views/user/student/edit.vue @@ -6,7 +6,7 @@ <el-input v-model="form.userName"></el-input> </el-form-item> <el-form-item label="瀵嗙爜锛�" required> - <el-input v-model="form.password"></el-input> + <el-input v-model="form.password" type="password"></el-input> </el-form-item> <el-form-item label="鐪熷疄濮撳悕锛�" prop="realName" required> <el-input v-model="form.realName"></el-input> @@ -19,15 +19,20 @@ <el-option v-for="item in sexEnum" :key="item.key" :value="item.key" :label="item.value"></el-option> </el-select> </el-form-item> - <el-form-item label="鍑虹敓鏃ユ湡锛�"> - <el-date-picker v-model="form.birthDay" type="date" value-format="yyyy-MM-dd" placeholder="閫夋嫨鏃ユ湡" /> + <el-form-item label="鍑虹敓鏃ユ湡锛�" prop="birthDay"> + <el-date-picker v-model="form.birthDay" required type="date" value-format="yyyy-MM-dd" placeholder="閫夋嫨鏃ユ湡" /> </el-form-item> <el-form-item label="鎵嬫満锛�"> <el-input v-model="form.phone"></el-input> </el-form-item> <el-form-item label="閮ㄩ棬锛�" prop="deptIds" required> - <el-select v-model="form.deptIds" multiple collapse-tags placeholder="閮ㄩ棬"> - <el-option v-for="item in levelEnum" :key="item.key" :value="item.key" :label="item.value"></el-option> + <el-select v-model="form.deptIds" multiple collapse-tags placeholder="閮ㄩ棬" :disabled="this.$route.query.id"> + <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="tagIds"> + <el-select v-model="form.tagIds" multiple collapse-tags placeholder="鏍囩"> + <el-option v-for="item in tags" :key="item.id" :value="item.id" :label="item.name"></el-option> </el-select> </el-form-item> <el-form-item label="鐘舵�侊細" required> @@ -46,10 +51,13 @@ <script> import { mapGetters, mapState, mapActions } from 'vuex' import userApi from '@/api/user' +import departmentApi from '@/api/department' export default { data () { return { + depts: [], + tags: [], value2:[], form: { id: null, @@ -62,7 +70,8 @@ sex: '', birthDay: null, phone: null, - deptIds: [] + deptIds: [], + tagIds: [] }, formLoading: false, rules: { @@ -74,11 +83,17 @@ ], deptIds: [ { required: true, message: '璇烽�夋嫨閮ㄩ棬', trigger: 'change' } + ], + birthDay: [ + { required: true, message: '璇烽�夋嫨鍑虹敓鏃ユ湡', trigger: 'blur' } ] } } }, created () { + this.getTags(); + this.getDepts(); + console.log(this.levelEnum) let id = this.$route.query.id let _this = this @@ -102,9 +117,19 @@ } }, methods: { + getTags () { + userApi.tagList(null).then(data => { + this.tags = data.response + }) + }, + getDepts () { + departmentApi.getDeptAdmins().then(res => { + this.depts = res.response + }) + }, submitForm () { + console.log("this.form", this.form) let _this = this - this.form.deptIds = this.form.deptIds.join(',') this.$refs.form.validate((valid) => { if (valid) { this.formLoading = true @@ -140,7 +165,8 @@ sex: '', birthDay: null, phone: null, - deptIds: [] + deptIds: [], + tagIds: [] } this.form.id = lastId }, -- Gitblit v1.8.0