From ea9f9a9f6dc6dc88f3916d1d25a0cb3be436d1ba Mon Sep 17 00:00:00 2001 From: quanyawei <401863037@qq.com> Date: Wed, 27 Sep 2023 19:40:24 +0800 Subject: [PATCH] fix:立行立改 --- src/views/personnel/index.vue | 50 ++++++++++++++++++++++++++++++++++++++++++++++++-- 1 files changed, 48 insertions(+), 2 deletions(-) diff --git a/src/views/personnel/index.vue b/src/views/personnel/index.vue index bb5aa50..8164ed6 100644 --- a/src/views/personnel/index.vue +++ b/src/views/personnel/index.vue @@ -13,7 +13,11 @@ border style="width: 100%" :stripe="true" - > + ><el-table-column + prop="unitId" + label="������������" + :formatter="unitIdFormatter" + /> <el-table-column prop="account" label="������������" @@ -80,6 +84,16 @@ <el-form-item label="������������" :label-width="formLabelWidth" prop="userName"> <el-input v-model="form.userName" autocomplete="off" /> </el-form-item> + <el-form-item label="������������" :label-width="formLabelWidth"> + <el-select v-model="form.unitId" placeholder="���������" size="small" style="width: 100%;"> + <el-option + v-for="item in unitList" + :key="item.unitId" + :label="item.unitName" + :value="item.unitId" + /> + </el-select> + </el-form-item> <el-form-item label="������" :label-width="formLabelWidth" prop="mobile"> <el-input v-model="form.mobile" autocomplete="off" /> </el-form-item> @@ -114,6 +128,16 @@ </el-form-item> <el-form-item label="������������" :label-width="formLabelWidth" prop="userName"> <el-input v-model="formEdit.userName" autocomplete="off" /> + </el-form-item> + <el-form-item label="������������" :label-width="formLabelWidth"> + <el-select v-model="formEdit.unitId" placeholder="���������" size="small" style="width: 100%;"> + <el-option + v-for="item in unitList" + :key="item.unitId" + :label="item.unitName" + :value="item.unitId" + /> + </el-select> </el-form-item> <el-form-item label="������" :label-width="formLabelWidth" prop="mobile"> <el-input v-model="formEdit.mobile" autocomplete="off" /> @@ -190,6 +214,7 @@ // ������������������ return { options: [], + unitList: [], radio1: '', value: '', value1: '', @@ -202,6 +227,7 @@ dialogEdit: false, dialogRole: false, form: { + unitId: '', account: '', password: '', userName: '', @@ -212,6 +238,7 @@ }, formEdit: { id: 0, + unitId: '', account: '', password: '', userName: '', @@ -260,6 +287,7 @@ }, // ������������ - ��������������������������������� this ��������� created() { + this.getUnitList() this.personnelList() this.roleList() }, @@ -282,6 +310,7 @@ this.form.account = '' this.form.password = '' this.form.userName = '' + this.form.unitId = '' this.form.mobile = '' this.form.email = '' this.form.wechat = '' @@ -314,6 +343,19 @@ }) }) }, + unitIdFormatter(val) { + const data = this.unitList.find(item => item && item.unitId === val.unitId) + return data ? data.unitName : '' + }, + // ������������������list + getUnitList() { + this.$request({ + url: '/allocation/unit', + method: 'get' + }).then((res) => { + this.unitList = res.data + }) + }, // ������������������ personnelAdd() { if (this.form.account && this.form.password && this.form.userName) { @@ -324,6 +366,7 @@ account: this.form.account, password: this.$encrypt(this.form.password), userName: this.form.userName, + unitId: Number(this.form.unitId), mobile: this.form.mobile, email: this.form.email, wechat: this.form.wechat, @@ -384,6 +427,7 @@ this.form.id = row.id this.form.account = row.account this.form.userName = row.userName + this.form.unitId = row.unitId this.form.mobile = row.mobile this.form.email = row.email this.form.wechat = row.wechat @@ -394,6 +438,7 @@ this.formEdit.userName = '' this.formEdit.mobile = '' this.formEdit.email = '' + this.formEdit.unitId = '' this.formEdit.wechat = '' this.formEdit.expireTime = '' this.formEdit.password = '' @@ -403,7 +448,7 @@ // ������������������ personnelEdit() { // return - if (this.formEdit.userName !== this.form.userName || this.formEdit.password !== this.form.password || this.formEdit.mobile !== this.form.mobile || this.formEdit.wechat !== this.form.wechat || this.formEdit.email !== this.form.email || this.formEdit.expireTime !== this.form.expireTime) { + if (this.formEdit.unitId !== this.form.unitId || this.formEdit.userName !== this.form.userName || this.formEdit.password !== this.form.password || this.formEdit.mobile !== this.form.mobile || this.formEdit.wechat !== this.form.wechat || this.formEdit.email !== this.form.email || this.formEdit.expireTime !== this.form.expireTime) { this.$request({ url: '/user/update', method: 'post', @@ -412,6 +457,7 @@ password: this.formEdit.password ? this.$encrypt(this.formEdit.password) : null, userName: this.formEdit.userName ? this.formEdit.userName : null, mobile: this.formEdit.mobile ? this.formEdit.mobile : null, + unitId: Number(this.formEdit.unitId) ? Number(this.formEdit.unitId) : null, email: this.formEdit.email ? this.formEdit.email : null, wechat: this.formEdit.wechat ? this.formEdit.wechat : null, expireTime: this.formEdit.expireTime ? this.formEdit.expireTime : null -- Gitblit v1.8.0