Files
admin-vben5/apps/web-antd/src/views/property/costManagement/costMeterWater/data.ts
2025-08-25 17:29:43 +08:00

175 lines
3.8 KiB
TypeScript

import type { FormSchemaGetter } from '#/adapter/form';
import type { VxeGridProps } from '#/adapter/vxe-table';
import { getDictOptions } from '#/utils/dict';
import {renderDict} from "#/utils/render";
export const querySchema: FormSchemaGetter = () => [
{
component: 'Input',
fieldName: 'searchValue',
label: '搜索值',
},
];
// 需要使用i18n注意这里要改成getter形式 否则切换语言不会刷新
// export const columns: () => VxeGridProps['columns'] = () => [
export const columns: VxeGridProps['columns'] = [
{ type: 'checkbox', width: 60 },
{
title: '序号',
field: 'id',
slots: {
default: ({ rowIndex }) => {
return (rowIndex + 1).toString();
},
},
},
{
title: '费用类型',
field: 'costType',
slots: {
default: ({ row }) => {
return renderDict(row.costType, 'wy_cbfylx');
},
},
},
{
title: '抄表类型',
field: 'costTypeName',
},
{
title: '本期度数',
field: 'curDegrees',
},
{
title: '上期度数',
field: 'preDegrees',
},
{
title: '上期读表时间',
field: 'preReadingTime',
},
{
title: '本期读表时间',
field: 'curReadingTime',
},
{
title: '备注',
field: 'remark',
},
{
field: 'action',
fixed: 'right',
slots: { default: 'action' },
title: '操作',
width: 180,
},
];
export const modalSchema: FormSchemaGetter = () => [
{
label: '主键',
fieldName: 'id',
component: 'Input',
dependencies: {
show: () => false,
triggerFields: [''],
},
},
{
label: '抄表地址',
fieldName: 'location',
component: 'TreeSelect',
rules: 'required',
},
{
label: '费用类型',
fieldName: 'costType',
component: 'Select',
rules: 'required',
componentProps: () => ({
options: getDictOptions('wy_cbfylx'),
}),
},
{
label: '收费项目',
fieldName: 'costItemsId',
component: 'ApiSelect',
rules: 'required',
// componentProps: (values)=>{
// const disabled = values.costType === undefined;
// return {
// api: async ()=>{
// console.log(values);
// const rows = await costItemSettingList({pageSize:1000000000,pageNum:1,costType:values.costType});
// return rows;
// },
// resultField:'rows',
// labelField:'chargeItem',
// valueField: 'id',
// disabled,
// }
// }
},
{
label: '抄表类型',
fieldName: 'meterTypeId',
component: 'ApiSelect',
rules: 'required',
// componentProps:(values)=>{
// const disabled = values.costType === undefined;
// return {
// api: async()=>{
// const rows = await meterReadingTypeList({pageSize:1000000000,pageNum:1,costType:values.costType=='5'?0:1});
// return rows;
// },
// resultField:'rows',
// labelField:'name',
// valueField: 'id',
// disabled
// }
// }
},
{
label: '上期度数',
fieldName: 'preDegrees',
component: 'Input',
rules: 'required',
disabled: true,
},
{
label: '本期度数',
fieldName: 'curDegrees',
component: 'Input',
rules: 'required',
},
{
label: '上期读表时间',
fieldName: 'preReadingTime',
component: 'DatePicker',
componentProps: {
showTime: true,
format: 'YYYY-MM-DD HH:mm:ss',
valueFormat: 'YYYY-MM-DD HH:mm:ss',
},
rules: 'required',
},
{
label: '本期读表时间',
fieldName: 'curReadingTime',
component: 'DatePicker',
componentProps: {
showTime: true,
format: 'YYYY-MM-DD HH:mm:ss',
valueFormat: 'YYYY-MM-DD HH:mm:ss',
},
rules: 'required',
},
{
label: '备注',
fieldName: 'remark',
component: 'Textarea',
},
];