import { BasicColumn } from '/@/components/Table' import { FormSchema } from '/@/components/Table' import { getCrops } from '/@/api/sys/user' export const columns: BasicColumn[] = [ { title: '基地名称', dataIndex: 'name', }, { title: '基地负责人', dataIndex: 'person', }, { title: '基地农作物', dataIndex: 'crops', }, { title: '基地经度', dataIndex: 'address_lat', }, { title: '基地纬度', dataIndex: 'address_lng', }, { title: '基地地址', dataIndex: 'address', }, { title: '基地面积', dataIndex: 'areas', }, { title: '基地就业人数', dataIndex: 'workforce', }, { title: '基地描述', dataIndex: 'description', }, { width: 180, title: '操作', dataIndex: 'action', align: 'center', fixed: undefined, }, ] export const searchFormSchema: FormSchema[] = [] export const accountFormSchema: FormSchema[] = [ { field: 'id', label: '基地ID', required: false, dynamicDisabled: true, component: 'Input', ifShow: ({ values }) => { return !!values.id }, }, { field: 'name', label: '基地名称', required: true, component: 'Input', }, { field: 'address', label: '基地地址', required: true, component: 'Input', }, { field: 'person', label: '基地负责人', required: true, component: 'Input', }, { field: 'areas', label: '基地面积', required: true, component: 'Input', }, { field: 'workforce', label: '基地人数', required: true, component: 'Input', }, { field: 'crops_ids', label: '基地农作物', required: true, component: 'ApiSelect', componentProps: { api: async () => { const res = await getCrops({ type: 'all', crop_type: 1 }) return res.map((e) => { return { ...e, disabled: e.is_end === 1, } }) }, labelField: 'name', valueField: 'id', mode: 'multiple', }, }, { field: 'description', label: '基地介绍', required: false, component: 'InputTextArea', }, { field: 'address_lat', label: '基地经度', required: false, component: 'Input', }, { field: 'address_lng', label: '基地纬度', required: false, component: 'Input', }, ]