提交 d46b853a authored 作者: leon's avatar leon

schema医院id属性抽出

上级 47bfb141
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
*/ */
import * as DistributorApi from '/@/api/system/distributorApi'; import * as DistributorApi from '/@/api/system/distributorApi';
import get from 'lodash.get'; import get from 'lodash.get';
import * as HospitalApi from '/@/api/system/hospitalApi';
const getDistributorId = ({ colProps }) => { const getDistributorId = ({ colProps }) => {
return { return {
...@@ -30,4 +31,30 @@ const getDistributorId = ({ colProps }) => { ...@@ -30,4 +31,30 @@ const getDistributorId = ({ colProps }) => {
}; };
}; };
export { getDistributorId }; const getHospitalId = ({ colProps }) => {
return {
field: 'hospitalId',
label: '医院',
defaultValue: undefined,
form: {
componentProps: {
labelInValue: true,
api: HospitalApi.all,
params: {},
resultField: 'records',
labelField: 'name',
valueField: 'id',
allowClear: false,
placeholder: '医院',
},
colProps,
component: 'ApiSelect',
rules: [{ required: true, type: 'object', message: '请输入医院!' }],
},
table: {
customRender: ({ text, record }) => get(record, 'hospital.name') || text,
},
};
};
export { getDistributorId, getHospitalId };
...@@ -8,9 +8,7 @@ ...@@ -8,9 +8,7 @@
import { BasicColumn } from '/@/components/Table'; import { BasicColumn } from '/@/components/Table';
import { FormSchema } from '/@/components/Table'; import { FormSchema } from '/@/components/Table';
import get from 'lodash.get'; import { getDistributorId, getHospitalId } from '/@/commonSchemaProperty';
import * as HospitalApi from '/@/api/system/hospitalApi';
import { getDistributorId } from '/@/commonSchemaProperty';
export enum SexEnum { export enum SexEnum {
MALE = '男', MALE = '男',
...@@ -60,29 +58,7 @@ export const schema = { ...@@ -60,29 +58,7 @@ export const schema = {
table: {}, table: {},
}, },
getDistributorId({ colProps }), getDistributorId({ colProps }),
{ getHospitalId({ colProps }),
field: 'hospitalId',
label: '医院id',
defaultValue: undefined,
form: {
componentProps: {
labelInValue: true,
api: HospitalApi.all,
params: {},
resultField: 'records',
labelField: 'name',
valueField: 'id',
allowClear: false,
placeholder: '医院id',
},
colProps,
component: 'ApiSelect',
rules: [{ required: true, type: 'object', message: '请输入医院id!' }],
},
table: {
customRender: ({ text, record }) => get(record, 'hospital.name') || text,
},
},
{ {
field: 'name', field: 'name',
label: '医生名称', label: '医生名称',
......
...@@ -303,7 +303,7 @@ export const schema = { ...@@ -303,7 +303,7 @@ export const schema = {
}; };
const queryFields = [ const queryFields = [
'distributorId', // 'distributorId',
'name', 'name',
'abbreviationName', 'abbreviationName',
'code', 'code',
...@@ -335,7 +335,7 @@ const editFields = [ ...@@ -335,7 +335,7 @@ const editFields = [
'status', 'status',
]; ];
const tableFields = [ const tableFields = [
'distributorId', // 'distributorId',
'name', 'name',
'abbreviationName', 'abbreviationName',
'code', 'code',
...@@ -355,7 +355,7 @@ const tableFields = [ ...@@ -355,7 +355,7 @@ const tableFields = [
]; ];
const descriptionFields = [ const descriptionFields = [
'id', 'id',
'distributorId', // 'distributorId',
'name', 'name',
'abbreviationName', 'abbreviationName',
'code', 'code',
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论