|
@@ -4,8 +4,16 @@
|
|
|
<el-col :span="24" class="main animate__animated animate__backInRight" v-loading="loading">
|
|
|
<el-col :span="24" class="one">
|
|
|
<cForm :span="12" :fields="fields" :form="form" :rules="rules" @save="toSave" label-width="auto">
|
|
|
- <template #role>
|
|
|
- <el-option v-for="i in roleList" :key="i._id" :label="i.name" :value="i._id"></el-option>
|
|
|
+ <template #icon>
|
|
|
+ <cUpload
|
|
|
+ :model="`${'icon'}`"
|
|
|
+ :limit="1"
|
|
|
+ listType="picture-card"
|
|
|
+ url="/visit/api/files/information/upload"
|
|
|
+ accept="*"
|
|
|
+ :list="form.icon"
|
|
|
+ @change="onUpload"
|
|
|
+ ></cUpload>
|
|
|
</template>
|
|
|
</cForm>
|
|
|
</el-col>
|
|
@@ -38,14 +46,10 @@ const loading: Ref<any> = ref(false);
|
|
|
let form: Ref<any> = ref({});
|
|
|
let fields: Ref<any[]> = ref([
|
|
|
{ label: '账号', model: 'account', options: { disabled: true } },
|
|
|
- { label: '姓名', model: 'name' },
|
|
|
- { label: '手机号', model: 'phone' },
|
|
|
- { label: '角色', model: 'role', type: 'select' },
|
|
|
+ { label: '姓名', model: 'name' }
|
|
|
]);
|
|
|
const rules = reactive<FormRules>({
|
|
|
- name: [{ required: true, message: '请输入姓名', trigger: 'blur' }],
|
|
|
- phone: [{ required: true, message: '请输入手机号', trigger: 'blur' }],
|
|
|
- role: [{ required: true, message: '请输入角色', trigger: 'blur' }]
|
|
|
+ name: [{ required: true, message: '请输入姓名', trigger: 'blur' }]
|
|
|
});
|
|
|
// 字典表
|
|
|
const roleList: Ref<any> = ref([]);
|
|
@@ -61,11 +65,36 @@ const search = async () => {
|
|
|
if (id) {
|
|
|
let res: IQueryResult;
|
|
|
if (user.value.role == 'Admin') res = await adminAxios.fetch(id);
|
|
|
- else if (user.value.role == 'Doctor') res = await doctorAxios.fetch(id);
|
|
|
- else if (user.value.role == 'Nurse') res = await nurseAxios.fetch(id);
|
|
|
+ else if (user.value.role == 'Doctor') {
|
|
|
+ res = await doctorAxios.fetch(id);
|
|
|
+ fields.value.push(
|
|
|
+ { label: '头像', model: 'icon', custom: true },
|
|
|
+ { label: '手机号', model: 'mobile' },
|
|
|
+ { label: '医院名称', model: 'hos_name' },
|
|
|
+ { label: '科室名称', model: 'dept_name' },
|
|
|
+ { label: '职务', model: 'title' },
|
|
|
+ { label: '职称', model: 'post' },
|
|
|
+ { label: '简介', model: 'content' }
|
|
|
+ );
|
|
|
+ } else if (user.value.role == 'Nurse') {
|
|
|
+ res = await nurseAxios.fetch(id);
|
|
|
+ fields.value.push(
|
|
|
+ { label: '头像', model: 'icon', custom: true },
|
|
|
+ { label: '手机号', model: 'mobile' },
|
|
|
+ { label: '医院名称', model: 'hos_name' },
|
|
|
+ { label: '科室名称', model: 'dept_name' },
|
|
|
+ { label: '职务', model: 'title' },
|
|
|
+ { label: '职称', model: 'post' },
|
|
|
+ { label: '简介', model: 'content' }
|
|
|
+ );
|
|
|
+ }
|
|
|
if (res.errcode == '0') form.value = res.data as {};
|
|
|
}
|
|
|
};
|
|
|
+const onUpload = (e: { model: string; value: Array<[]> }) => {
|
|
|
+ const { model, value } = e;
|
|
|
+ form.value[model] = value;
|
|
|
+};
|
|
|
// 保存
|
|
|
const toSave = async (data: any) => {
|
|
|
let res: IQueryResult;
|