|
@@ -2,8 +2,14 @@
|
|
|
<div id="detail">
|
|
|
<el-row>
|
|
|
<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">
|
|
|
+ <el-col :span="24" class="one" v-if="user.role != 'Admin'">
|
|
|
+ <el-button type="primary" @click="toCode">微信绑定</el-button>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="24" class="two">
|
|
|
+ <cForm :span="12" :fields="fields" :form="form" :rules="rules" @save="toSave" label-width="80px">
|
|
|
+ <template #doctor>
|
|
|
+ <el-option v-for="i in doctorList" :key="i._id" :label="i.name" :value="i._id"></el-option>
|
|
|
+ </template>
|
|
|
<template #icon>
|
|
|
<cUpload
|
|
|
:model="`${'icon'}`"
|
|
@@ -49,10 +55,17 @@ let fields: Ref<any[]> = ref([
|
|
|
{ label: '姓名', model: 'name' }
|
|
|
]);
|
|
|
const rules = reactive<FormRules>({
|
|
|
- name: [{ required: true, message: '请输入姓名', trigger: 'blur' }]
|
|
|
+ account: [{ required: true, message: '请输入账号', trigger: 'blur' }],
|
|
|
+ name: [{ required: true, message: '请输入姓名', trigger: 'blur' }],
|
|
|
+ mobile: [{ required: true, message: '请输入手机号', trigger: 'blur' }],
|
|
|
+ hos_name: [{ required: true, message: '请输入医院名称', trigger: 'blur' }],
|
|
|
+ dept_name: [{ required: true, message: '请输入科室名称', trigger: 'blur' }],
|
|
|
+ title: [{ required: true, message: '请输入职务', trigger: 'blur' }],
|
|
|
+ post: [{ required: true, message: '请输入职称', trigger: 'blur' }]
|
|
|
});
|
|
|
// 字典表
|
|
|
const roleList: Ref<any> = ref([]);
|
|
|
+const doctorList: Ref<any> = ref([]);
|
|
|
// 请求
|
|
|
onMounted(async () => {
|
|
|
loading.value = true;
|
|
@@ -68,24 +81,25 @@ const search = async () => {
|
|
|
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' }
|
|
|
+ { label: '简介', model: 'content', type: 'textarea' },
|
|
|
+ { label: '头像', model: 'icon', custom: true }
|
|
|
);
|
|
|
} else if (user.value.role == 'Nurse') {
|
|
|
res = await nurseAxios.fetch(id);
|
|
|
fields.value.push(
|
|
|
- { label: '头像', model: 'icon', custom: true },
|
|
|
+ { label: '所属医生', model: 'doctor', type: 'select', options: { disabled: true } },
|
|
|
{ label: '手机号', model: 'mobile' },
|
|
|
{ label: '医院名称', model: 'hos_name' },
|
|
|
{ label: '科室名称', model: 'dept_name' },
|
|
|
{ label: '职务', model: 'title' },
|
|
|
{ label: '职称', model: 'post' },
|
|
|
- { label: '简介', model: 'content' }
|
|
|
+ { label: '简介', model: 'content', type: 'textarea' },
|
|
|
+ { label: '头像', model: 'icon', custom: true }
|
|
|
);
|
|
|
}
|
|
|
if (res.errcode == '0') form.value = res.data as {};
|
|
@@ -95,6 +109,10 @@ const onUpload = (e: { model: string; value: Array<[]> }) => {
|
|
|
const { model, value } = e;
|
|
|
form.value[model] = value;
|
|
|
};
|
|
|
+// 绑定微信
|
|
|
+const toCode = async () => {
|
|
|
+ console.log(user.value);
|
|
|
+};
|
|
|
// 保存
|
|
|
const toSave = async (data: any) => {
|
|
|
let res: IQueryResult;
|
|
@@ -111,10 +129,26 @@ const searchOther = async () => {
|
|
|
// 角色
|
|
|
res = await roleAxios.query({ is_use: '0' });
|
|
|
if (res.errcode == '0') roleList.value = res.data;
|
|
|
+ // 医生
|
|
|
+ let user = store.state.user;
|
|
|
+ if (user.role == 'Admin') {
|
|
|
+ res = await doctorAxios.query({});
|
|
|
+ if (res.errcode == '0') doctorList.value = res.data;
|
|
|
+ return;
|
|
|
+ } else if (user.role == 'Doctor') res = await doctorAxios.fetch(user._id);
|
|
|
+ else if (user.role == 'Nurse') res = await doctorAxios.fetch(user.doctor);
|
|
|
+ if (res.errcode == '0') doctorList.value = [res.data];
|
|
|
};
|
|
|
// 返回上一页
|
|
|
const toBack = () => {
|
|
|
window.history.go(-1);
|
|
|
};
|
|
|
</script>
|
|
|
-<style scoped lang="scss"></style>
|
|
|
+<style scoped lang="scss">
|
|
|
+.main {
|
|
|
+ .one {
|
|
|
+ text-align: center;
|
|
|
+ padding: 2vw 0;
|
|
|
+ }
|
|
|
+}
|
|
|
+</style>
|