修改用户管理 关联医生

This commit is contained in:
lxd 2024-12-11 11:23:42 +08:00
parent 564c5dfe34
commit f079845eb0

View File

@ -15,14 +15,7 @@
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="医生编码" prop="doctorID"> <el-form-item label="医生编码" prop="doctorID">
<el-select v-model="formData.doctorID" placeholder="医生" clearable> <el-input disabled v-model="formData.doctorID" />
<el-option
v-for="item in doctorList"
:key="item.doctorID"
:label="item.doctorName"
:value="item.doctorID"
/>
</el-select>
</el-form-item> </el-form-item>
<!-- <el-form-item label="归属部门" prop="deptId"> <!-- <el-form-item label="归属部门" prop="deptId">
<el-tree-select <el-tree-select
@ -44,7 +37,20 @@
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="医生名称" prop="doctorname"> <el-form-item label="医生名称" prop="doctorname">
<el-input disabled v-model="formData.doctorname" /> <el-select
v-model="formData.doctorname"
placeholder="医生"
clearable
@change="handleDoctorChange"
@clear="handleClear"
>
<el-option
v-for="item in doctorList"
:key="item.doctorName"
:label="item.doctorName"
:value="item.doctorName"
/>
</el-select>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
@ -237,15 +243,32 @@ function handleOrgChange(newVal) {
} }
// formData.doctorID // formData.doctorID
const selectedDoctorName = computed(() => { const selectedDoctorName = computed(() => {
const selectedDoctor = doctorList.value.find(doctor => doctor.doctorID === formData.value.doctorID); const selectedDoctor = doctorList.value.find(
return selectedDoctor ? selectedDoctor.doctorName : ''; (doctor) => doctor.doctorID === formData.value.doctorID
}); )
return selectedDoctor ? selectedDoctor.doctorName : ''
})
// ID // ID
async function loadRelatedOptions(orgId) { async function loadRelatedOptions(orgId) {
// //
doctorList.value = await UserApi.getDoctorList(orgId) doctorList.value = await UserApi.getDoctorList(orgId)
} }
function handleDoctorChange(selectedDoctorName) {
const selectedDoctor = doctorList.value.find((doctor) => doctor.doctorName === selectedDoctorName)
if(selectedDoctor)
{
formData.value.doctorID = selectedDoctor.doctorID
}
}
function handleClear() {
formData.value.doctorID=''
}
/** 提交表单 */ /** 提交表单 */
const emit = defineEmits(['success']) // success const emit = defineEmits(['success']) // success
const submitForm = async () => { const submitForm = async () => {
@ -253,7 +276,7 @@ const submitForm = async () => {
if (!formRef) return if (!formRef) return
const valid = await formRef.value.validate() const valid = await formRef.value.validate()
if (!valid) return if (!valid) return
formData.value.doctorname=selectedDoctorName.value // formData.value.doctorname=
// //
formLoading.value = true formLoading.value = true
try { try {