This commit is contained in:
曹辉 2023-03-23 10:05:07 +08:00
parent 96809f7f95
commit 0778dce9b0

View File

@ -312,7 +312,7 @@
<el-row> <el-row>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="护理站" prop="nurseStationIds"> <el-form-item label="护理站" prop="nurseStationIds">
<el-select v-model="form.nurseStationIds" placeholder="请选择护理站" multiple> <el-select v-model="form.nurseStationIdstwo" placeholder="请选择护理站" multiple>
<el-option <el-option
v-for="item in nurseStationlist" v-for="item in nurseStationlist"
:key="item.id" :key="item.id"
@ -653,7 +653,9 @@ export default {
status: "0", status: "0",
remark: undefined, remark: undefined,
postIds: [], postIds: [],
roleIds: [] roleIds: [],
nurseStationIdstwo: null,
nurseStationIds: null
}; };
this.resetForm("form"); this.resetForm("form");
}, },
@ -705,12 +707,21 @@ export default {
this.getTreeselect(); this.getTreeselect();
const userId = row.userId || this.ids; const userId = row.userId || this.ids;
getUser(userId).then(response => { getUser(userId).then(response => {
response.data.nurseStationIdstwo = JSON.parse(
JSON.stringify(response.data.nurseStationIds)
);
this.form = response.data; this.form = response.data;
if (this.form.nurseStationIds) { if (this.form.nurseStationIds) {
this.form.nurseStationIds = this.form.nurseStationIds.split(","); this.form.nurseStationIds = this.form.nurseStationIds.split(",");
this.form.nurseStationIds = this.form.nurseStationIds.map(e => { this.form.nurseStationIds = this.form.nurseStationIds.map(e => {
return (e = Number(e)); return (e = Number(e));
}); });
this.form.nurseStationIdstwo = this.form.nurseStationIdstwo.split(
","
);
this.form.nurseStationIdstwo = this.form.nurseStationIdstwo.map(e => {
return (e = Number(e));
});
// this.form.nurseStationIds = []; // this.form.nurseStationIds = [];
} else { } else {
// this.form.nurseStationIds = Number(this.form.nurseStationIds); // this.form.nurseStationIds = Number(this.form.nurseStationIds);
@ -721,7 +732,6 @@ export default {
// this.form.nurseStationIds.length == 0 // this.form.nurseStationIds.length == 0
// ) {getList // ) {getList
// } else { // } else {
// } // }
console.log(this.form); console.log(this.form);
this.postOptions = response.posts; this.postOptions = response.posts;
@ -774,7 +784,9 @@ export default {
}); });
} else { } else {
// this.form.nurseStationIds = Number(this.form.nurseStationIds); // this.form.nurseStationIds = Number(this.form.nurseStationIds);
this.form.nurseStationIds = this.form.nurseStationIds.join(","); this.form.nurseStationIds = this.form.nurseStationIdstwo.join(
","
);
updateUser(this.form).then(response => { updateUser(this.form).then(response => {
this.$modal.msgSuccess("修改成功"); this.$modal.msgSuccess("修改成功");
this.open = false; this.open = false;
@ -783,7 +795,7 @@ export default {
}); });
} }
} else { } else {
this.form.nurseStationIds = this.form.nurseStationIds.join(","); this.form.nurseStationIds = this.form.nurseStationIdstwo.join(",");
addUser(this.form).then(response => { addUser(this.form).then(response => {
this.$modal.msgSuccess("新增成功"); this.$modal.msgSuccess("新增成功");
this.open = false; this.open = false;