Browse Source

代码优化

master
lizhi 3 years ago
parent
commit
1b97dd371a
  1. 59
      src/views/institution/doctor/doctor.data.ts
  2. 59
      src/views/institution/office/office.data.ts

59
src/views/institution/doctor/doctor.data.ts

@ -117,6 +117,19 @@ export const searchFormSchema: FormSchema[] = [
}, },
colProps: { span: 5 }, colProps: { span: 5 },
}, },
{
field: 'organType',
label: '组织类型',
component: 'Select',
componentProps: {
options: [
{label: '医院',value: '1'},
{label: '医检',value: '2'}
]
},
colProps: {span: 5}
},
{ {
field: 'dateRange', field: 'dateRange',
label: '创建时间', label: '创建时间',
@ -199,29 +212,29 @@ export const doctorFormSchema: FormSchema[] = [
}, },
required: true, required: true,
}, },
{ // {
field: 'organId', // field: 'organId',
label: '所属组织', // label: '所属组织',
component: 'ApiSelect', // component: 'ApiSelect',
required: true, // required: true,
renderComponentContent: ({ schema, values, model, field }) => { // renderComponentContent: ({ schema, values, model, field }) => {
const organType = model.organType; // const organType = model.organType;
watch(organType, // watch(organType,
() => { // () => {
const dataApi = organType=='1' ? hospitalList : institutionList; // const dataApi = organType=='1' ? hospitalList : institutionList;
console.log(schema); // console.log(schema);
schema.componentProps = deepMerge({ // schema.componentProps = deepMerge({
api: dataApi, // api: dataApi,
labelField: 'name', // labelField: 'name',
valueField: 'id' // valueField: 'id'
}); // });
}, // },
{ // {
immediate: true, // immediate: true,
} // }
); // );
} // }
}, // },
// { // {
// field: 'officeId', // field: 'officeId',
// label: '所属科室', // label: '所属科室',

59
src/views/institution/office/office.data.ts

@ -97,6 +97,19 @@ export const searchFormSchema: FormSchema[] = [
}, },
colProps: { span: 5 }, colProps: { span: 5 },
}, },
{
field: 'organType',
label: '组织类型',
component: 'Select',
componentProps: {
options: [
{label: '医院',value: '1'},
{label: '医检',value: '2'}
]
},
colProps: {span: 5}
},
{ {
field: 'dateRange', field: 'dateRange',
label: '创建时间', label: '创建时间',
@ -135,29 +148,29 @@ export const officeFormSchema: FormSchema[] = [
}, },
required: true, required: true,
}, },
{ // {
field: 'organId', // field: 'organId',
label: '所属组织', // label: '所属组织',
component: 'ApiSelect', // component: 'ApiSelect',
required: true, // required: true,
renderComponentContent: ({ schema, values, model, field }) => { // renderComponentContent: ({ schema, values, model, field }) => {
const organType = model.organType; // const organType = model.organType;
watch(organType, // watch(organType,
() => { // () => {
const dataApi = organType=='1' ? hospitalList : institutionList; // const dataApi = organType=='1' ? hospitalList : institutionList;
console.log(schema); // console.log(schema);
schema.componentProps = deepMerge({ // schema.componentProps = deepMerge({
api: dataApi, // api: dataApi,
labelField: 'name', // labelField: 'name',
valueField: 'id' // valueField: 'id'
}); // });
}, // },
{ // {
immediate: true, // immediate: true,
} // }
); // );
}, // },
}, // },
{ {
field: 'directorTel', field: 'directorTel',
label: '主任电话', label: '主任电话',

Loading…
Cancel
Save