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