You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
242 lines
5.9 KiB
242 lines
5.9 KiB
import { BasicColumn } from '/@/components/Table'; |
|
import { FormSchema } from '/@/components/Table'; |
|
import {h, watch, watchEffect, watchSyncEffect} from 'vue'; |
|
import {Tag} from 'ant-design-vue'; |
|
import { list as hospitalList } from '/@/api/platform/system/controller/hospital'; |
|
import {list as institutionList, list as institutalList} from '/@/api/platform/system/controller/institution'; |
|
import { list as officeList } from '/@/api/platform/system/controller/office'; |
|
import {deepMerge} from "/@/utils"; |
|
|
|
|
|
export const columns: BasicColumn[] = [ |
|
{ |
|
title: 'ID', |
|
dataIndex: 'id', |
|
width: 120, |
|
}, |
|
{ |
|
title: '医生姓名', |
|
dataIndex: 'name', |
|
width: 120, |
|
}, |
|
{ |
|
title: '医生职称', |
|
dataIndex: 'title', |
|
width: 120, |
|
}, |
|
{ |
|
title: '医生性别', |
|
dataIndex: 'sex', |
|
width: 120, |
|
customRender: ({ record }) => { |
|
switch (record.sex) { |
|
case 'M': return '男'; |
|
case 'F': return '女'; |
|
default: return '未知'; |
|
} |
|
} |
|
}, |
|
{ |
|
title: '医生电话', |
|
dataIndex: 'phone', |
|
width: 120, |
|
}, |
|
{ |
|
title: '医生邮箱', |
|
dataIndex: 'email', |
|
width: 120, |
|
}, |
|
{ |
|
title: '地址', |
|
dataIndex: 'detailAddress', |
|
width: 120, |
|
}, |
|
{ |
|
title: '所属组织类型', |
|
dataIndex: 'organType', |
|
width: 120, |
|
customRender: ({ record }) => { |
|
const organType = record.organType; |
|
let text = ''; |
|
let color = ''; |
|
switch (organType) { |
|
case '1': |
|
text = '医院'; |
|
color = 'green'; |
|
break; |
|
case '2': |
|
text = '医检'; |
|
color = 'blue'; |
|
break; |
|
default: |
|
text = '未知'; |
|
color = 'gray'; |
|
break; |
|
|
|
} |
|
|
|
return h(Tag, { color: color }, () => text); |
|
} |
|
}, |
|
// { |
|
// title: '科室名称', |
|
// dataIndex: 'officeName', |
|
// width: 120, |
|
// }, |
|
{ |
|
title: '状态', |
|
dataIndex: 'status', |
|
width: 100, |
|
customRender: ({ record }) => { |
|
const status = record.status; |
|
const enable = status === '0'; |
|
const color = enable ? 'green' : 'red'; |
|
const text = enable ? '启用' : '禁用'; |
|
return h(Tag, { color: color }, () => text); |
|
}, |
|
}, |
|
{ |
|
title: '创建人', |
|
dataIndex: 'createByName', |
|
width: 180, |
|
}, |
|
{ |
|
title: '创建时间', |
|
dataIndex: 'createTime', |
|
width: 180, |
|
} |
|
]; |
|
|
|
export const searchFormSchema: FormSchema[] = [ |
|
{ |
|
field: 'name', |
|
label: '医生姓名', |
|
component: 'Input', |
|
componentProps: { |
|
placeholder: '请输入医生姓名', |
|
}, |
|
colProps: { span: 5 }, |
|
}, |
|
{ |
|
field: 'beginTime', |
|
label: '起始时间', |
|
component: 'DatePicker', |
|
colProps: { span: 5 }, |
|
}, |
|
{ |
|
field: 'endTime', |
|
label: '截止时间', |
|
component: 'DatePicker', |
|
colProps: { span: 5 }, |
|
}, |
|
]; |
|
|
|
export const doctorFormSchema: FormSchema[] = [ |
|
{ |
|
field: 'id', |
|
label: 'ID', |
|
component: 'Input', |
|
show: false, |
|
}, |
|
{ |
|
field: 'name', |
|
label: '医生姓名', |
|
component: 'Input', |
|
required: true |
|
}, |
|
{ |
|
field: 'title', |
|
label: '医生职称', |
|
component: 'Input', |
|
required: false, |
|
}, |
|
{ |
|
field: 'sex', |
|
label: '医生性别', |
|
component: 'Select', |
|
required: false, |
|
defaultValue: 'M', |
|
componentProps: { |
|
options: [ |
|
{ label: '男', value: 'M' }, |
|
{ label: '女', value: 'F' }, |
|
] |
|
} |
|
}, |
|
{ |
|
field: 'phone', |
|
label: '医生电话', |
|
component: 'Input', |
|
required: false, |
|
}, |
|
{ |
|
field: 'email', |
|
label: '医生邮箱', |
|
component: 'Input', |
|
required: false, |
|
}, |
|
{ |
|
field: 'detailAddress', |
|
label: '地址', |
|
component: 'Input', |
|
required: false, |
|
}, |
|
{ |
|
field: 'organType', |
|
label: '所属组织类型', |
|
component: 'Select', |
|
componentProps: { |
|
options: [ |
|
{ label: '医院', value: '1' }, |
|
{ label: '医检', value: '2' } |
|
] |
|
}, |
|
required: true, |
|
}, |
|
{ |
|
field: 'organId', |
|
label: '所属组织', |
|
component: 'ApiSelect', |
|
required: true, |
|
renderComponentContent: ({ schema, values, model, field }) => { |
|
const organType = model.organType; |
|
watch(organType, |
|
() => { |
|
const dataApi = organType=='1' ? hospitalList : institutionList; |
|
console.log(schema); |
|
schema.componentProps = deepMerge({ |
|
api: dataApi, |
|
labelField: 'name', |
|
valueField: 'id' |
|
}); |
|
}, |
|
{ |
|
immediate: true, |
|
} |
|
); |
|
} |
|
}, |
|
// { |
|
// field: 'officeId', |
|
// label: '所属科室', |
|
// component: 'ApiSelect', |
|
// required: true, |
|
// }, |
|
{ |
|
field: 'status', |
|
label: '状态', |
|
component: 'RadioButtonGroup', |
|
defaultValue: '0', |
|
componentProps: { |
|
options: [ |
|
{ label: '启用', value: '0' }, |
|
{ label: '禁用', value: '1' }, |
|
], |
|
}, |
|
}, |
|
{ |
|
label: '备注', |
|
field: 'remarks', |
|
component: 'InputTextArea', |
|
} |
|
];
|
|
|