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.
217 lines
5.4 KiB
217 lines
5.4 KiB
import { BasicColumn } from '/@/components/Table'; |
|
import { FormSchema } from '/@/components/Table'; |
|
import {h, watch} from 'vue'; |
|
import {Tag} from 'ant-design-vue'; |
|
import { list as hospitalList } from '/@/api/platform/system/controller/hospital'; |
|
import { list as institutionList } from '/@/api/platform/system/controller/institution'; |
|
import {deepMerge} from '/@/utils'; |
|
|
|
|
|
export const columns: BasicColumn[] = [ |
|
{ |
|
title: 'ID', |
|
dataIndex: 'id', |
|
width: 120, |
|
}, |
|
{ |
|
title: '科室名称', |
|
dataIndex: 'name', |
|
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: 'organName', |
|
// width: 120, |
|
// }, |
|
{ |
|
title: '主任名称', |
|
dataIndex: 'directorName', |
|
width: 120, |
|
}, |
|
{ |
|
title: '主任电话', |
|
dataIndex: 'directorTel', |
|
width: 120, |
|
}, |
|
{ |
|
title: '地址', |
|
dataIndex: 'detailAddress', |
|
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: 'organType', |
|
label: '组织类型', |
|
component: 'Select', |
|
|
|
componentProps: { |
|
options: [ |
|
{label: '医院',value: '1'}, |
|
{label: '医检',value: '2'} |
|
] |
|
}, |
|
colProps: {span: 5} |
|
}, |
|
{ |
|
field: 'dateRange', |
|
label: '创建时间', |
|
component: 'RangePicker', |
|
componentProps: { |
|
style: { width:'100%' }, |
|
valueFormat: 'YYYY-MM-DD', |
|
placeholder: ['开始日期','结束日期'] |
|
}, |
|
colProps: { span: 8 } |
|
} |
|
]; |
|
|
|
export const officeFormSchema: FormSchema[] = [ |
|
{ |
|
field: 'id', |
|
label: 'ID', |
|
component: 'Input', |
|
show: false, |
|
}, |
|
{ |
|
field: 'name', |
|
label: '科室名称', |
|
component: 'Input', |
|
required: true |
|
}, |
|
{ |
|
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: 'directorTel', |
|
label: '主任电话', |
|
component: 'Input', |
|
rules: [ |
|
{ |
|
pattern: new RegExp('^1[3|4|5|6|7|8|9][0-9]\\d{8}$'), |
|
message: '请输入正确的手机号', |
|
validateTrigger: 'change', |
|
required: true |
|
} |
|
], |
|
}, |
|
{ |
|
field: 'directorName', |
|
label: '主任名称', |
|
component: 'Input', |
|
required: false |
|
}, |
|
|
|
{ |
|
field: 'detailAddress', |
|
label: '科室地址', |
|
component: 'Input', |
|
required: false |
|
}, |
|
{ |
|
field: 'status', |
|
label: '状态', |
|
component: 'RadioButtonGroup', |
|
defaultValue: '0', |
|
componentProps: { |
|
options: [ |
|
{ label: '启用', value: '0' }, |
|
{ label: '禁用', value: '1' }, |
|
], |
|
}, |
|
}, |
|
{ |
|
label: '备注', |
|
field: 'remarks', |
|
component: 'InputTextArea', |
|
} |
|
];
|
|
|