用户编辑单位信息问题修改

main
wangxiaoshuang 2024-05-08 17:36:02 +08:00
parent bb34a67b07
commit 13c55a3648
2 changed files with 32 additions and 22 deletions

View File

@ -80,6 +80,7 @@
style="width: 100%" style="width: 100%"
:disabled="user.CanEditUserType === false" :disabled="user.CanEditUserType === false"
clearable clearable
@change="userTypeChange"
> >
<template v-for="(userType, key) of userTypeOptions"> <template v-for="(userType, key) of userTypeOptions">
<el-option <el-option
@ -282,36 +283,41 @@ export default {
IsZhiZhunDisabled: false, IsZhiZhunDisabled: false,
}; };
}, },
watch: {
"user.UserTypeId": {
handler() {
if (this.user.UserTypeId) {
let name = this.getUserType(this.user.UserTypeId);
if (["PM", "PI", "SR", "OA"].includes(name)) {
this.user.IsZhiZhun = true;
this.user.OrganizationName = this.hospitalName;
return (this.IsZhiZhunDisabled = true);
}
}
this.user.IsZhiZhun = false;
this.user.OrganizationName = null;
this.IsZhiZhunDisabled = false;
},
deep: true,
immediate: true,
},
},
created() { created() {
this.getUserTypeList();
if (this.userId !== "") { if (this.userId !== "") {
this.getUserInfo();
this.type = 1; this.type = 1;
} else { } else {
this.type = 0; this.type = 0;
} }
this.getUserTypeList();
this.getInfo(); this.getInfo();
}, },
methods: { methods: {
//
userTypeChange() {
this.AffiliationChange();
},
//
AffiliationChange(isFirstInfo = false) {
if (this.user.UserTypeId) {
let name = this.getUserType(this.user.UserTypeId);
if (["PM", "PI", "SR", "OA"].includes(name)) {
if (!isFirstInfo) {
this.user.IsZhiZhun = true;
this.user.OrganizationName = this.hospitalName;
}
if (this.user.IsZhiZhun) {
this.IsZhiZhunDisabled = true;
}
return;
}
if (!isFirstInfo) {
this.user.IsZhiZhun = false;
this.user.OrganizationName = null;
}
this.IsZhiZhunDisabled = false;
}
},
getUserType(id) { getUserType(id) {
let obj = this.userTypeOptions.find((item) => item.Id === id); let obj = this.userTypeOptions.find((item) => item.Id === id);
return obj.UserTypeShortName; return obj.UserTypeShortName;
@ -381,6 +387,9 @@ export default {
return item; return item;
} }
}).filter((item) => item); }).filter((item) => item);
if (this.type === 1) {
this.getUserInfo();
}
} }
}); });
}, },
@ -388,6 +397,7 @@ export default {
getUser(this.userId).then((res) => { getUser(this.userId).then((res) => {
this.user = res.Result; this.user = res.Result;
this.user.Status = parseFloat(this.user.Status); this.user.Status = parseFloat(this.user.Status);
this.AffiliationChange(true);
}); });
}, },
OrgnizationTypeChanged(val) { OrgnizationTypeChanged(val) {

View File

@ -60,7 +60,7 @@
<el-input v-model="form.OrganizationName" clearable /> <el-input v-model="form.OrganizationName" clearable />
</el-form-item> </el-form-item>
</el-form> </el-form>
<div v-if="errorMsg" style="font-size: 12px; color: #f66"> <div v-if="errorMsg" style="font-size: 12px; color: #f66;text-align:center">
{{ errorMsg }} {{ errorMsg }}
</div> </div>
</template> </template>