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

schema医院id属性抽出

上级 47bfb141
......@@ -3,6 +3,7 @@
*/
import * as DistributorApi from '/@/api/system/distributorApi';
import get from 'lodash.get';
import * as HospitalApi from '/@/api/system/hospitalApi';
const getDistributorId = ({ colProps }) => {
return {
......@@ -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 @@
import { BasicColumn } from '/@/components/Table';
import { FormSchema } from '/@/components/Table';
import get from 'lodash.get';
import * as HospitalApi from '/@/api/system/hospitalApi';
import { getDistributorId } from '/@/commonSchemaProperty';
import { getDistributorId, getHospitalId } from '/@/commonSchemaProperty';
export enum SexEnum {
MALE = '男',
......@@ -60,29 +58,7 @@ export const schema = {
table: {},
},
getDistributorId({ 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,
},
},
getHospitalId({ colProps }),
{
field: 'name',
label: '医生名称',
......
......@@ -303,7 +303,7 @@ export const schema = {
};
const queryFields = [
'distributorId',
// 'distributorId',
'name',
'abbreviationName',
'code',
......@@ -335,7 +335,7 @@ const editFields = [
'status',
];
const tableFields = [
'distributorId',
// 'distributorId',
'name',
'abbreviationName',
'code',
......@@ -355,7 +355,7 @@ const tableFields = [
];
const descriptionFields = [
'id',
'distributorId',
// 'distributorId',
'name',
'abbreviationName',
'code',
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论