2025-06-29 18:42:50 +08:00
|
|
|
import { rulesHelper } from '@/common';
|
|
|
|
|
import { Apis } from '@/gen/Apis';
|
|
|
|
|
import { ProColumns, ProFormColumnsType } from '@ant-design/pro-components';
|
|
|
|
|
|
|
|
|
|
type ReturnType = ProColumns<any, 'text'> & ProFormColumnsType<any, 'text'>;
|
|
|
|
|
type PropsType = { required?: boolean } & ReturnType;
|
|
|
|
|
|
|
|
|
|
export const SysSelects = {
|
|
|
|
|
Companies(props?: PropsType): ReturnType {
|
|
|
|
|
const {
|
|
|
|
|
title = '机构',
|
|
|
|
|
key = 'parent_id',
|
|
|
|
|
required = false,
|
|
|
|
|
hideInTable = true,
|
|
|
|
|
...rest
|
|
|
|
|
} = props ?? {};
|
|
|
|
|
|
|
|
|
|
return {
|
|
|
|
|
title: title,
|
|
|
|
|
key: key,
|
|
|
|
|
valueType: 'select',
|
|
|
|
|
hideInTable: hideInTable,
|
|
|
|
|
formItemProps: { ...(required ? rulesHelper.number : {}) },
|
|
|
|
|
fieldProps: {
|
|
|
|
|
showSearch: true,
|
|
|
|
|
fieldNames: {
|
|
|
|
|
label: 'label',
|
|
|
|
|
value: 'value',
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
request: async (params) =>
|
|
|
|
|
(
|
|
|
|
|
await Apis.Company.Companies.Select({
|
|
|
|
|
keywords: params?.KeyWords,
|
|
|
|
|
...params,
|
|
|
|
|
})
|
|
|
|
|
).data,
|
|
|
|
|
...rest,
|
|
|
|
|
};
|
|
|
|
|
},
|
2025-06-30 14:20:46 +08:00
|
|
|
// 楼栋下拉框
|
|
|
|
|
AssetBuildings(props?: PropsType): ReturnType {
|
|
|
|
|
const {
|
|
|
|
|
title = '楼栋',
|
|
|
|
|
key = 'asset_buildings_id',
|
|
|
|
|
required = false,
|
|
|
|
|
hideInTable = true,
|
|
|
|
|
...rest
|
|
|
|
|
} = props ?? {};
|
|
|
|
|
|
|
|
|
|
return {
|
|
|
|
|
title: title,
|
|
|
|
|
key: key,
|
|
|
|
|
valueType: 'select',
|
|
|
|
|
hideInTable: hideInTable,
|
|
|
|
|
formItemProps: { ...(required ? rulesHelper.number : {}) },
|
|
|
|
|
fieldProps: {
|
|
|
|
|
showSearch: true,
|
|
|
|
|
fieldNames: {
|
|
|
|
|
label: 'label',
|
|
|
|
|
value: 'value',
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
request: async (params) =>
|
|
|
|
|
(
|
|
|
|
|
await Apis.Asset.AssetBuildings.Select({
|
|
|
|
|
keywords: params?.KeyWords,
|
|
|
|
|
asset_projects_id: params?.asset_projects_id,
|
|
|
|
|
...params,
|
|
|
|
|
})
|
|
|
|
|
).data,
|
|
|
|
|
...rest,
|
|
|
|
|
};
|
|
|
|
|
},
|
|
|
|
|
// 单元下拉框
|
|
|
|
|
AssetUnits(props?: PropsType): ReturnType {
|
|
|
|
|
const {
|
|
|
|
|
title = '单元',
|
|
|
|
|
key = 'asset_buildings_id',
|
|
|
|
|
required = false,
|
|
|
|
|
hideInTable = true,
|
|
|
|
|
...rest
|
|
|
|
|
} = props ?? {};
|
|
|
|
|
|
|
|
|
|
return {
|
|
|
|
|
title: title,
|
|
|
|
|
key: key,
|
|
|
|
|
valueType: 'select',
|
|
|
|
|
hideInTable: hideInTable,
|
|
|
|
|
formItemProps: { ...(required ? rulesHelper.number : {}) },
|
|
|
|
|
fieldProps: {
|
|
|
|
|
showSearch: true,
|
|
|
|
|
fieldNames: {
|
|
|
|
|
label: 'label',
|
|
|
|
|
value: 'value',
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
request: async (params) =>
|
|
|
|
|
(
|
|
|
|
|
await Apis.Asset.AssetUnits.Select({
|
|
|
|
|
keywords: params?.KeyWords,
|
|
|
|
|
asset_projects_id: params?.asset_projects_id,
|
|
|
|
|
asset_buildings_id: params?.asset_buildings_id,
|
|
|
|
|
...params,
|
|
|
|
|
})
|
|
|
|
|
).data,
|
|
|
|
|
...rest,
|
|
|
|
|
};
|
|
|
|
|
},
|
2025-06-29 18:42:50 +08:00
|
|
|
};
|