feat:费用项设置
This commit is contained in:
@@ -71,6 +71,7 @@ export interface CostItemSettingVO {
|
||||
*/
|
||||
searchValue: string;
|
||||
chargeNo: string;
|
||||
unit: string;
|
||||
|
||||
}
|
||||
|
||||
|
@@ -57,9 +57,9 @@ async function handleOpenChange(open: boolean) {
|
||||
:is="renderDict(costItemSettingDetail.paymentType,'pro_payment_type')"
|
||||
/>
|
||||
</DescriptionsItem>
|
||||
<DescriptionsItem label="费用周期(月)">
|
||||
{{ costItemSettingDetail.chargeCycle }}
|
||||
</DescriptionsItem>
|
||||
<!-- <DescriptionsItem label="费用周期(月)">-->
|
||||
<!-- {{ costItemSettingDetail.chargeCycle }}-->
|
||||
<!-- </DescriptionsItem>-->
|
||||
<DescriptionsItem label="单位">
|
||||
{{ costItemSettingDetail.unit }}
|
||||
</DescriptionsItem>
|
||||
@@ -83,15 +83,15 @@ async function handleOpenChange(open: boolean) {
|
||||
:is="renderDict(costItemSettingDetail.state,'wy_state')"
|
||||
/>
|
||||
</DescriptionsItem>
|
||||
<DescriptionsItem label="计算公式" v-if="costItemSettingDetail.formula!=null">
|
||||
<DescriptionsItem label="计算公式" v-if="costItemSettingDetail.formula!=null" :span="2">
|
||||
<component
|
||||
:is="renderDict(costItemSettingDetail.formula,'pro_calculation_formula')"
|
||||
/>
|
||||
</DescriptionsItem>
|
||||
<DescriptionsItem label="计费单价">
|
||||
<DescriptionsItem :label="costItemSettingDetail.formula=='1'?'费用':'计费单价'" v-if="costItemSettingDetail.unitPrice!=null">
|
||||
{{ costItemSettingDetail.unitPrice }}
|
||||
</DescriptionsItem>
|
||||
<DescriptionsItem label="附加费用">
|
||||
<DescriptionsItem label="附加费用" v-if="costItemSettingDetail.surcharge!=null">
|
||||
{{ costItemSettingDetail.surcharge }}
|
||||
</DescriptionsItem>
|
||||
</Descriptions>
|
||||
|
@@ -10,6 +10,7 @@ import { costItemSettingAdd, costItemSettingInfo, costItemSettingUpdate } from '
|
||||
import { defaultFormValueGetter, useBeforeCloseDiff } from '#/utils/popup';
|
||||
|
||||
import { modalSchema } from './data';
|
||||
import {getDictOptions} from "#/utils/dict";
|
||||
|
||||
const emit = defineEmits<{ reload: [] }>();
|
||||
|
||||
@@ -53,7 +54,7 @@ const [BasicModal, modalApi] = useVbenModal({
|
||||
return null;
|
||||
}
|
||||
modalApi.modalLoading(true);
|
||||
|
||||
initCostTypeOptions()
|
||||
const { id } = modalApi.getData() as { id?: number | string };
|
||||
isUpdate.value = !!id;
|
||||
|
||||
@@ -67,6 +68,39 @@ const [BasicModal, modalApi] = useVbenModal({
|
||||
},
|
||||
});
|
||||
|
||||
/**
|
||||
* 初始化费用类型
|
||||
*/
|
||||
async function initCostTypeOptions() {
|
||||
formApi.updateSchema([
|
||||
{
|
||||
componentProps: {
|
||||
// 费用类型不要保洁、会议、绿植
|
||||
options: getDictOptions('pro_expense_type'),
|
||||
onChange: async (value: string) => {
|
||||
if (value) {
|
||||
//水费、电费、气费
|
||||
if(['5','6','8'].includes(value)){
|
||||
await formApi.setFieldValue('formula', '5');//(本层本次读数-上次读数)*单价/本层实际使用面积*本单位面积
|
||||
//停车费、租金、押金
|
||||
}else if(['2','7','9'].includes(value)){
|
||||
await formApi.setFieldValue('formula', '1');//固定费用
|
||||
//会议室使用费、绿植租赁费、保洁服务费
|
||||
}else if(['1','3','4'].includes(value)){
|
||||
await formApi.setFieldValue('formula', null);
|
||||
//物业管理费
|
||||
}else{
|
||||
await formApi.setFieldValue('formula', '0');//建筑面积*单价
|
||||
}
|
||||
|
||||
}
|
||||
},
|
||||
},
|
||||
fieldName: 'costType',
|
||||
},
|
||||
]);
|
||||
}
|
||||
|
||||
async function handleConfirm() {
|
||||
try {
|
||||
modalApi.lock(true);
|
||||
@@ -76,6 +110,18 @@ async function handleConfirm() {
|
||||
}
|
||||
// getValues获取为一个readonly的对象 需要修改必须先深拷贝一次
|
||||
const data = cloneDeep(await formApi.getValues());
|
||||
//会议室使用费、绿植租赁费、保洁服务费
|
||||
if(['1','3','4'].includes(data.costType)){
|
||||
data.roundingMode=null;
|
||||
data.currencyDecimals=null;
|
||||
data.formula=null;
|
||||
data.unitPrice=null;
|
||||
data.surcharge=null;
|
||||
}
|
||||
//固定费用
|
||||
if(data.formula=='1'){
|
||||
data.surcharge=null;
|
||||
}
|
||||
await (isUpdate.value ? costItemSettingUpdate(data) : costItemSettingAdd(data));
|
||||
resetInitialized();
|
||||
emit('reload');
|
||||
|
@@ -32,6 +32,7 @@ export const columns: VxeGridProps['columns'] = [
|
||||
{
|
||||
title: '费用编号',
|
||||
field: 'chargeNo',
|
||||
width: 180,
|
||||
},
|
||||
{
|
||||
title: '费用类型',
|
||||
@@ -41,10 +42,12 @@ export const columns: VxeGridProps['columns'] = [
|
||||
return renderDict(row.costType, 'pro_expense_type');
|
||||
},
|
||||
},
|
||||
width: 150,
|
||||
},
|
||||
{
|
||||
title: '收费项目',
|
||||
field: 'chargeItem',
|
||||
minWidth: 180,
|
||||
},
|
||||
{
|
||||
title: '费用标识',
|
||||
@@ -54,6 +57,7 @@ export const columns: VxeGridProps['columns'] = [
|
||||
return renderDict(row.costMark, 'pro_cost_identification');
|
||||
},
|
||||
},
|
||||
width: 180,
|
||||
},
|
||||
{
|
||||
title: '付费类型',
|
||||
@@ -63,33 +67,18 @@ export const columns: VxeGridProps['columns'] = [
|
||||
return renderDict(row.paymentType, 'pro_payment_type');
|
||||
},
|
||||
},
|
||||
width: 180,
|
||||
},
|
||||
{
|
||||
title: '费用周期(月)',
|
||||
field: 'chargeCycle',
|
||||
},
|
||||
{
|
||||
title: '计算公式',
|
||||
field: 'formula',
|
||||
slots: {
|
||||
default: ({ row }) => {
|
||||
return renderDict(row.formula, 'pro_calculation_formula');
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
title: '计费单价',
|
||||
field: 'unitPrice',
|
||||
},
|
||||
{
|
||||
title: '附加费用',
|
||||
field: 'surcharge',
|
||||
title: '单位',
|
||||
field: 'unit',
|
||||
minWidth: 120,
|
||||
},
|
||||
{
|
||||
title: '状态',
|
||||
field: 'state',
|
||||
slots: { default: 'state' },
|
||||
width: 100,
|
||||
width: 120,
|
||||
},
|
||||
{
|
||||
field: 'action',
|
||||
@@ -114,9 +103,6 @@ export const modalSchema: FormSchemaGetter = () => [
|
||||
label: '费用类型',
|
||||
fieldName: 'costType',
|
||||
component: 'Select',
|
||||
componentProps: {
|
||||
options: getDictOptions('pro_expense_type'),
|
||||
},
|
||||
rules: 'selectRequired',
|
||||
},
|
||||
{
|
||||
@@ -143,12 +129,6 @@ export const modalSchema: FormSchemaGetter = () => [
|
||||
},
|
||||
rules: 'selectRequired',
|
||||
},
|
||||
{
|
||||
label: '费用周期(月)',
|
||||
fieldName: 'chargeCycle',
|
||||
component: 'Input',
|
||||
rules: 'required',
|
||||
},
|
||||
{
|
||||
label: '单位',
|
||||
fieldName: 'unit',
|
||||
@@ -158,15 +138,6 @@ export const modalSchema: FormSchemaGetter = () => [
|
||||
placeholder: '请输入(如:元)',
|
||||
},
|
||||
},
|
||||
// {
|
||||
// label: '付费方式',
|
||||
// fieldName: 'paymentMode',
|
||||
// component: 'Select',
|
||||
// componentProps: {
|
||||
// options: getDictOptions('wy_fffs'),
|
||||
// },
|
||||
// rules: 'selectRequired',
|
||||
// },
|
||||
{
|
||||
label: '进位方式',
|
||||
fieldName: 'roundingMode',
|
||||
@@ -175,6 +146,10 @@ export const modalSchema: FormSchemaGetter = () => [
|
||||
},
|
||||
component: 'Select',
|
||||
rules: 'selectRequired',
|
||||
dependencies: {
|
||||
show: (fromValue) => !(['1','3','4'].includes(fromValue.costType)),
|
||||
triggerFields: ['costType'],
|
||||
},
|
||||
},
|
||||
{
|
||||
label: '保留小数',
|
||||
@@ -184,6 +159,10 @@ export const modalSchema: FormSchemaGetter = () => [
|
||||
options: getDictOptions('pro_keep_decimals'),
|
||||
},
|
||||
rules: 'selectRequired',
|
||||
dependencies: {
|
||||
show: (fromValue) => !(['1','3','4'].includes(fromValue.costType)),
|
||||
triggerFields: ['costType'],
|
||||
},
|
||||
},
|
||||
{
|
||||
component: 'Select',
|
||||
@@ -201,18 +180,42 @@ export const modalSchema: FormSchemaGetter = () => [
|
||||
componentProps: {
|
||||
options: getDictOptions('pro_calculation_formula'),
|
||||
},
|
||||
rules: 'selectRequired',
|
||||
disabled:true,
|
||||
defaultValue:'1',
|
||||
dependencies: {
|
||||
show: (fromValue) => !(['1','3','4'].includes(fromValue.costType)),
|
||||
triggerFields: ['costType'],
|
||||
},
|
||||
formItemClass:'col-span-2'
|
||||
},
|
||||
{
|
||||
label: '计费单价',
|
||||
fieldName: 'unitPrice',
|
||||
component: 'InputNumber',
|
||||
rules: 'required',
|
||||
dependencies: {
|
||||
show: (fromValue) => ['0','5','6','8'].includes(fromValue.costType),
|
||||
triggerFields: ['costType'],
|
||||
},
|
||||
},
|
||||
{
|
||||
label: '费用',
|
||||
fieldName: 'unitPrice',
|
||||
component: 'InputNumber',
|
||||
rules: 'required',
|
||||
dependencies: {
|
||||
show: (fromValue) => ['2','7','9'].includes(fromValue.costType),
|
||||
triggerFields: ['costType'],
|
||||
},
|
||||
},
|
||||
{
|
||||
label: '附加费',
|
||||
fieldName: 'surcharge',
|
||||
component: 'InputNumber',
|
||||
rules: 'required',
|
||||
dependencies: {
|
||||
show: (fromValue) => ['0','5','6','8'].includes(fromValue.costType),
|
||||
triggerFields: ['costType'],
|
||||
},
|
||||
},
|
||||
];
|
||||
|
@@ -63,10 +63,11 @@ export const columns: VxeGridProps['columns'] = [
|
||||
{
|
||||
title: '单位',
|
||||
field: 'residentUnitText',
|
||||
minWidth: 150,
|
||||
minWidth: 180,
|
||||
},
|
||||
{
|
||||
title: '费用类型',
|
||||
width: 150,
|
||||
field: 'costType',
|
||||
slots: {
|
||||
default: ({ row }) => {
|
||||
|
Reference in New Issue
Block a user