12 changed files with 479 additions and 454 deletions
@ -1,216 +1,212 @@
@@ -1,216 +1,212 @@
|
||||
import { BasicColumn } from '/@/components/Table'; |
||||
import { FormSchema } from '/@/components/Table'; |
||||
import {h} from 'vue'; |
||||
import {Tag} from 'ant-design-vue'; |
||||
|
||||
import { h } from 'vue'; |
||||
import { Tag } from 'ant-design-vue'; |
||||
import { listRegionCascade } from '/@/api/platform/system/controller/region'; |
||||
|
||||
export const columns: BasicColumn[] = [ |
||||
{ |
||||
title: 'ID', |
||||
dataIndex: 'id', |
||||
width: 120, |
||||
}, |
||||
{ |
||||
title: '机构名称', |
||||
dataIndex: 'name', |
||||
width: 120, |
||||
}, |
||||
{ |
||||
title: '机构类型', |
||||
dataIndex: 'type', |
||||
width: 120, |
||||
customRender: ({ record }) =>{ |
||||
console.log(record); |
||||
const type = record.type; |
||||
let text = ''; |
||||
let color = ''; |
||||
switch (type) { |
||||
case '1': |
||||
text = '医检机构'; |
||||
color = 'green'; |
||||
break; |
||||
case '2': |
||||
text = '三甲机构'; |
||||
color = 'blue'; |
||||
break; |
||||
case '0': |
||||
text = '其他机构'; |
||||
color = 'gray'; |
||||
break; |
||||
default: |
||||
text = '其他医院'; |
||||
color = 'gray'; |
||||
break; |
||||
} |
||||
|
||||
return h(Tag, { color: color }, () => text); |
||||
} |
||||
}, |
||||
{ |
||||
title: '联系人', |
||||
dataIndex: 'contactsName', |
||||
width: 120, |
||||
}, |
||||
{ |
||||
title: '联系人电话', |
||||
dataIndex: 'contactsTel', |
||||
width: 120, |
||||
}, |
||||
{ |
||||
title: '联系人职称', |
||||
dataIndex: 'contactsTitle', |
||||
width: 120, |
||||
}, |
||||
{ |
||||
title: '详细地址', |
||||
dataIndex: 'detailAddress', |
||||
width: 180, |
||||
}, |
||||
{ |
||||
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, |
||||
{ |
||||
title: 'ID', |
||||
dataIndex: 'id', |
||||
width: 120, |
||||
}, |
||||
{ |
||||
title: '机构名称', |
||||
dataIndex: 'name', |
||||
width: 120, |
||||
}, |
||||
{ |
||||
title: '机构类型', |
||||
dataIndex: 'type', |
||||
width: 120, |
||||
customRender: ({ record }) =>{ |
||||
const type = record.type; |
||||
let text = '', color = ''; |
||||
switch (type) { |
||||
case '1': |
||||
text = '医检机构'; |
||||
color = 'green'; |
||||
break; |
||||
case '2': |
||||
text = '三甲机构'; |
||||
color = 'blue'; |
||||
break; |
||||
case '0': |
||||
text = '其他机构'; |
||||
color = 'gray'; |
||||
break; |
||||
} |
||||
return h(Tag, { color: color }, () => text); |
||||
} |
||||
}, |
||||
{ |
||||
title: '联系人', |
||||
dataIndex: 'contactName', |
||||
width: 120, |
||||
}, |
||||
{ |
||||
title: '联系人电话', |
||||
dataIndex: 'contactPhone', |
||||
width: 120, |
||||
}, |
||||
{ |
||||
title: '联系人职称', |
||||
dataIndex: 'contactTitle', |
||||
width: 120, |
||||
}, |
||||
{ |
||||
title: '详细地址', |
||||
dataIndex: 'detailAddress', |
||||
width: 180, |
||||
}, |
||||
{ |
||||
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: 'type', |
||||
label: '机构类型', |
||||
component: 'Select', |
||||
|
||||
componentProps: { |
||||
options: [ |
||||
{label: '医检机构',value: '1'}, |
||||
{label: '三甲机构',value: '2'}, |
||||
{label: '其他机构',value: '0'}, |
||||
] |
||||
}, |
||||
colProps: {span: 5} |
||||
}, |
||||
{ |
||||
field: 'dateRange', |
||||
label: '创建时间', |
||||
component: 'RangePicker', |
||||
componentProps: { |
||||
style: { width:'100%' }, |
||||
valueFormat: 'YYYY-MM-DD', |
||||
placeholder: ['开始日期','结束日期'] |
||||
}, |
||||
colProps: { span: 8 } |
||||
} |
||||
{ |
||||
field: 'name', |
||||
label: '机构名称' , |
||||
component: 'Input', |
||||
componentProps: { |
||||
placeholder: '请输入机构名称', |
||||
}, |
||||
colProps: { span: 5 }, |
||||
}, |
||||
{ |
||||
field: 'type', |
||||
label: '机构类型', |
||||
component: 'Select', |
||||
defaultValue: '1', |
||||
componentProps: { |
||||
options: [ |
||||
{label: '医检机构',value: '1'}, |
||||
{label: '三甲机构',value: '2'}, |
||||
{label: '其他机构',value: '0'} |
||||
] |
||||
}, |
||||
colProps: {span: 5} |
||||
}, |
||||
{ |
||||
field: 'dateRange', |
||||
label: '创建时间', |
||||
component: 'RangePicker', |
||||
componentProps: { |
||||
style: { width:'100%' }, |
||||
valueFormat: 'YYYY-MM-DD', |
||||
placeholder: ['开始日期','结束日期'] |
||||
}, |
||||
colProps: { span: 8 } |
||||
} |
||||
]; |
||||
|
||||
export const institutionFormSchema: FormSchema[] = [ |
||||
{ |
||||
field: 'id', |
||||
label: 'ID', |
||||
component: 'Input', |
||||
show: false, |
||||
}, |
||||
{ |
||||
field: 'name', |
||||
label: '机构名称', |
||||
component: 'Input', |
||||
required: true |
||||
}, |
||||
{ |
||||
field: 'type', |
||||
label: '机构类型', |
||||
component: 'Select', |
||||
defaultValue: '0', |
||||
componentProps: { |
||||
options: [ |
||||
{label: '医检机构',value: '1'}, |
||||
{label: '三甲机构',value: '2'}, |
||||
{label: '其他机构',value: '0'}, |
||||
] |
||||
}, |
||||
required: true, |
||||
}, |
||||
{ |
||||
field: 'contactsName', |
||||
label: '联系人名称', |
||||
component: 'Input', |
||||
required: true |
||||
}, |
||||
{ |
||||
field: 'contactsTel', |
||||
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: 'contactsTitle', |
||||
label: '联系人职称', |
||||
component: 'Input', |
||||
{ |
||||
field: 'id', |
||||
label: 'ID', |
||||
component: 'Input', |
||||
show: false, |
||||
}, |
||||
{ |
||||
field: 'name', |
||||
label: '机构名称', |
||||
component: 'Input', |
||||
required: true |
||||
}, |
||||
{ |
||||
field: 'type', |
||||
label: '机构类型', |
||||
component: 'Select', |
||||
defaultValue: '0', |
||||
componentProps: { |
||||
options: [ |
||||
{ label: '医检机构', value: '1' }, |
||||
{ label: '三甲机构', value: '2' }, |
||||
{ label: '其他机构', value: '0' }, |
||||
] |
||||
}, |
||||
required: true |
||||
}, |
||||
{ |
||||
field: 'contactName', |
||||
label: '联系人名称', |
||||
component: 'Input', |
||||
required: true |
||||
}, |
||||
{ |
||||
field: 'contactPhone', |
||||
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: 'addressIds', |
||||
label: '地址', |
||||
component: 'ApiAddressCascader', |
||||
componentProps: { |
||||
api: addressList |
||||
} |
||||
},*/ |
||||
{ |
||||
field: 'detailAddress', |
||||
label: '详细地址', |
||||
component: 'Input', |
||||
required: true |
||||
}, |
||||
{ |
||||
field: 'status', |
||||
label: '状态', |
||||
component: 'RadioButtonGroup', |
||||
defaultValue: '0', |
||||
componentProps: { |
||||
options: [ |
||||
{ label: '启用', value: '0' }, |
||||
{ label: '禁用', value: '1' }, |
||||
], |
||||
}, |
||||
}, |
||||
{ |
||||
label: '备注', |
||||
field: 'remarks', |
||||
component: 'InputTextArea', |
||||
} |
||||
], |
||||
}, |
||||
{ |
||||
field: 'contactTitle', |
||||
label: '联系人职称', |
||||
component: 'Input', |
||||
required: true |
||||
}, |
||||
{ |
||||
field: 'addressIds', |
||||
label: '城市地址', |
||||
component: 'ApiCascader', |
||||
componentProps: { |
||||
api: listRegionCascade, |
||||
asyncFetchParamKey: 'parentId', |
||||
labelField: 'name', |
||||
valueField: 'id', |
||||
initFetchParams: { |
||||
parentId: '0' |
||||
} |
||||
} |
||||
}, |
||||
{ |
||||
field: 'detailAddress', |
||||
label: '详细地址', |
||||
component: 'Input', |
||||
required: true |
||||
}, |
||||
{ |
||||
field: 'status', |
||||
label: '状态', |
||||
component: 'RadioButtonGroup', |
||||
defaultValue: '0', |
||||
componentProps: { |
||||
options: [ |
||||
{ label: '启用', value: '0' }, |
||||
{ label: '禁用', value: '1' }, |
||||
], |
||||
}, |
||||
}, |
||||
{ |
||||
label: '备注', |
||||
field: 'remarks', |
||||
component: 'InputTextArea', |
||||
} |
||||
]; |
Loading…
Reference in new issue