diff --git a/src/pages/asset/components/modals/ChargeStandardCreate.tsx b/src/pages/asset/components/modals/ChargeStandardCreate.tsx index d0e80da..ba9e2af 100644 --- a/src/pages/asset/components/modals/ChargeStandardCreate.tsx +++ b/src/pages/asset/components/modals/ChargeStandardCreate.tsx @@ -76,9 +76,17 @@ export default function Create(props: MyBetaModalFormProps) { // 避免计费模式切换导致的价格异常 price: values?.price_algorithm === - HouseChargeStandardsPriceAlgorithmEnum.Fixed.value + HouseChargeStandardsPriceAlgorithmEnum.Fixed.value || + values?.calculation_mode === + HouseChargeStandardsCalculationModeEnum.FixedAmount.value ? values.price : 0, + + is_tiered: + values?.price_algorithm === + HouseChargeStandardsPriceAlgorithmEnum.Fixed.value + ? 0 + : 1, }) .then(() => { props.reload?.(); @@ -148,6 +156,12 @@ export default function Create(props: MyBetaModalFormProps) { return obj; }, required: true, + fieldProps: { + onChange: () => { + // 切换计量单位时清空计费模式 + form.setFieldValue('calculation_mode', undefined); + }, + }, }), ] : charge_type === HouseBillsTypeEnum.WaterFee.value || @@ -172,6 +186,12 @@ export default function Create(props: MyBetaModalFormProps) { return obj; }, required: true, + fieldProps: { + onChange: () => { + // 切换计量单位时清空计费模式 + form.setFieldValue('calculation_mode', undefined); + }, + }, }), ] : []; @@ -203,7 +223,14 @@ export default function Create(props: MyBetaModalFormProps) { key: 'calculation_mode', title: '计费模式', colProps: { span: 12 }, - valueEnum: HouseChargeStandardsCalculationModeEnum, + // valueEnum: HouseChargeStandardsCalculationModeEnum, + valueEnum: () => { + let obj: any = JSON.parse( + JSON.stringify(HouseChargeStandardsCalculationModeEnum), + ); + delete obj.FixedAmount; + return obj; + }, required: true, }), ]; @@ -256,6 +283,7 @@ export default function Create(props: MyBetaModalFormProps) { colProps: { span: 10 }, fieldProps: { addonAfter: '元', + max: 99, }, formItemProps: { ...rulesHelper.number }, }, @@ -270,8 +298,8 @@ export default function Create(props: MyBetaModalFormProps) { formItemProps: { ...rulesHelper.array }, initialValue: [ { - start: 0, - end: null, + min_quantity: 0, + max_quantity: null, price: null, }, ], @@ -287,38 +315,40 @@ export default function Create(props: MyBetaModalFormProps) { columns: [ { key: 'min_quantity', - colProps: { span: 10 }, - title: '起始值', + colProps: { span: 9 }, + // title: '起始值', valueType: 'number', fieldProps: { min: 0, - addonBefore: ( - _: any, - { - field, - }: { field: { index: number[] } }, - ) => `第${field.index[1] + 1}阶梯`, + addonBefore: '阶梯范围', + placeholder: '起始值', }, width: '100%', formItemProps: { ...rulesHelper.number }, }, { key: 'max_quantity', - colProps: { span: 6 }, - title: '结束值', + colProps: { span: 5 }, + // title: '结束值', valueType: 'number', width: '100%', formItemProps: { ...rulesHelper.number }, - fieldProps: { maxLength: 12 }, + fieldProps: { + min: 0, + max: 999, + placeholder: '结束值', + }, }, { key: 'price', - colProps: { span: 8 }, - title: '阶梯单价', + colProps: { span: 10 }, + // title: '阶梯单价', valueType: 'number', fieldProps: { + addonBefore: '阶梯单价', addonAfter: '元', min: 0, + max: 999, }, formItemProps: { ...rulesHelper.number }, }, @@ -337,8 +367,8 @@ export default function Create(props: MyBetaModalFormProps) { formItemProps: { ...rulesHelper.array }, initialValue: [ { - start: 0, - end: null, + min_quantity: 0, + max_quantity: null, price: null, }, ], @@ -354,38 +384,40 @@ export default function Create(props: MyBetaModalFormProps) { columns: [ { key: 'min_quantity', - colProps: { span: 10 }, - title: '起始值', + colProps: { span: 9 }, + // title: '起始值', valueType: 'number', fieldProps: { min: 0, - addonBefore: ( - _: any, - { - field, - }: { field: { name: number[] } }, - ) => `第${field.name[1] + 1}阶梯`, + addonBefore: '阶梯范围', + placeholder: '起始值', }, width: '100%', formItemProps: { ...rulesHelper.number }, }, { key: 'max_quantity', - colProps: { span: 6 }, - title: '结束值', + colProps: { span: 5 }, + // title: '结束值', valueType: 'number', width: '100%', formItemProps: { ...rulesHelper.number }, - fieldProps: { maxLength: 12 }, + fieldProps: { + min: 0, + max: 999, + placeholder: '结束值', + }, }, { key: 'price', - colProps: { span: 8 }, - title: '阶梯单价', + colProps: { span: 10 }, + // title: '阶梯单价', valueType: 'number', fieldProps: { + addonBefore: '阶梯单价', addonAfter: '元', min: 0, + max: 999, }, formItemProps: { ...rulesHelper.number }, }, diff --git a/src/pages/asset/components/modals/ChargeStandardUpdate.tsx b/src/pages/asset/components/modals/ChargeStandardUpdate.tsx index 24bc14e..faad195 100644 --- a/src/pages/asset/components/modals/ChargeStandardUpdate.tsx +++ b/src/pages/asset/components/modals/ChargeStandardUpdate.tsx @@ -76,9 +76,16 @@ export default function Update(props: MyBetaModalFormProps) { // 避免计费模式切换导致的价格异常 price: values?.price_algorithm === - HouseChargeStandardsPriceAlgorithmEnum.Fixed.value + HouseChargeStandardsPriceAlgorithmEnum.Fixed.value || + values?.calculation_mode === + HouseChargeStandardsCalculationModeEnum.FixedAmount.value ? values.price : 0, + is_tiered: + values?.price_algorithm === + HouseChargeStandardsPriceAlgorithmEnum.Fixed.value + ? 0 + : 1, }) .then(() => { props.reload?.(); @@ -142,6 +149,12 @@ export default function Update(props: MyBetaModalFormProps) { return obj; }, required: true, + fieldProps: { + onChange: () => { + // 切换计量单位时清空计费模式 + form.setFieldValue('calculation_mode', undefined); + }, + }, }), ] : charge_type === HouseBillsTypeEnum.WaterFee.value || @@ -166,6 +179,12 @@ export default function Update(props: MyBetaModalFormProps) { return obj; }, required: true, + fieldProps: { + onChange: () => { + // 切换计量单位时清空计费模式 + form.setFieldValue('calculation_mode', undefined); + }, + }, }), ] : []; @@ -197,7 +216,14 @@ export default function Update(props: MyBetaModalFormProps) { key: 'calculation_mode', title: '计费模式', colProps: { span: 12 }, - valueEnum: HouseChargeStandardsCalculationModeEnum, + // valueEnum: HouseChargeStandardsCalculationModeEnum, + valueEnum: () => { + let obj: any = JSON.parse( + JSON.stringify(HouseChargeStandardsCalculationModeEnum), + ); + delete obj.FixedAmount; + return obj; + }, required: true, }), ]; @@ -281,38 +307,40 @@ export default function Update(props: MyBetaModalFormProps) { columns: [ { key: 'min_quantity', - colProps: { span: 10 }, - title: '起始值', + colProps: { span: 9 }, + // title: '起始值', valueType: 'number', fieldProps: { min: 0, - addonBefore: ( - _: any, - { - field, - }: { field: { index: number[] } }, - ) => `第${field.index[1] + 1}阶梯`, + addonBefore: '阶梯范围', + placeholder: '起始值', }, width: '100%', formItemProps: { ...rulesHelper.number }, }, { key: 'max_quantity', - colProps: { span: 6 }, - title: '结束值', + colProps: { span: 5 }, + // title: '结束值', valueType: 'number', width: '100%', formItemProps: { ...rulesHelper.number }, - fieldProps: { maxLength: 12 }, + fieldProps: { + min: 0, + max: 999, + placeholder: '结束值', + }, }, { key: 'price', - colProps: { span: 8 }, - title: '阶梯单价', + colProps: { span: 10 }, + // title: '阶梯单价', valueType: 'number', fieldProps: { + addonBefore: '阶梯单价', addonAfter: '元', min: 0, + max: 999, }, formItemProps: { ...rulesHelper.number }, }, @@ -348,38 +376,40 @@ export default function Update(props: MyBetaModalFormProps) { columns: [ { key: 'min_quantity', - colProps: { span: 10 }, - title: '起始值', + colProps: { span: 9 }, + // title: '起始值', valueType: 'number', fieldProps: { min: 0, - addonBefore: ( - _: any, - { - field, - }: { field: { name: number[] } }, - ) => `第${field.name[1] + 1}阶梯`, + addonBefore: '阶梯范围', + placeholder: '起始值', }, width: '100%', formItemProps: { ...rulesHelper.number }, }, { key: 'max_quantity', - colProps: { span: 6 }, - title: '结束值', + colProps: { span: 5 }, + // title: '结束值', valueType: 'number', width: '100%', formItemProps: { ...rulesHelper.number }, - fieldProps: { maxLength: 12 }, + fieldProps: { + min: 0, + max: 999, + placeholder: '结束值', + }, }, { key: 'price', - colProps: { span: 8 }, - title: '阶梯单价', + colProps: { span: 10 }, + // title: '阶梯单价', valueType: 'number', fieldProps: { + addonBefore: '阶梯单价', addonAfter: '元', min: 0, + max: 999, }, formItemProps: { ...rulesHelper.number }, }, diff --git a/src/pages/banner_space/index.tsx b/src/pages/banner_space/index.tsx index 8671939..2060480 100644 --- a/src/pages/banner_space/index.tsx +++ b/src/pages/banner_space/index.tsx @@ -63,17 +63,17 @@ export default function Index({ title = '点位管理' }) { MyColumns.Option({ render: (_, item: any, index, action) => ( - { - navigate(`/banner_space/${item.id}`); - }} - /> + { + navigate(`/banner_space/${item.id}`); + }} + /> Apis.Banner.BannerSpaces.Delete({ id: item.id }).then(() =>