修改用户管理 关联医生
This commit is contained in:
parent
564c5dfe34
commit
f079845eb0
@ -15,14 +15,7 @@
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="医生编码" prop="doctorID">
|
||||
<el-select v-model="formData.doctorID" placeholder="医生" clearable>
|
||||
<el-option
|
||||
v-for="item in doctorList"
|
||||
:key="item.doctorID"
|
||||
:label="item.doctorName"
|
||||
:value="item.doctorID"
|
||||
/>
|
||||
</el-select>
|
||||
<el-input disabled v-model="formData.doctorID" />
|
||||
</el-form-item>
|
||||
<!-- <el-form-item label="归属部门" prop="deptId">
|
||||
<el-tree-select
|
||||
@ -44,7 +37,20 @@
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<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-col>
|
||||
</el-row>
|
||||
@ -237,15 +243,32 @@ function handleOrgChange(newVal) {
|
||||
}
|
||||
// 计算属性,根据formData.doctorID获取医生名称
|
||||
const selectedDoctorName = computed(() => {
|
||||
const selectedDoctor = doctorList.value.find(doctor => doctor.doctorID === formData.value.doctorID);
|
||||
return selectedDoctor ? selectedDoctor.doctorName : '';
|
||||
});
|
||||
const selectedDoctor = doctorList.value.find(
|
||||
(doctor) => doctor.doctorID === formData.value.doctorID
|
||||
)
|
||||
return selectedDoctor ? selectedDoctor.doctorName : ''
|
||||
})
|
||||
|
||||
// 根据机构ID加载相关选项的方法
|
||||
async function loadRelatedOptions(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 submitForm = async () => {
|
||||
@ -253,7 +276,7 @@ const submitForm = async () => {
|
||||
if (!formRef) return
|
||||
const valid = await formRef.value.validate()
|
||||
if (!valid) return
|
||||
formData.value.doctorname=selectedDoctorName.value
|
||||
// formData.value.doctorname=
|
||||
// 提交请求
|
||||
formLoading.value = true
|
||||
try {
|
||||
|
Loading…
Reference in New Issue
Block a user