1.0.70 合同付款方式优化存储

dev
yinq 5 days ago
parent 92444bf5fb
commit 0003abe10f

@ -245,8 +245,8 @@
<el-table-column label="付款条款" align="center" prop="paymentDescription" min-width="120" />
<el-table-column label="操作" align="center" fixed="right" width="150" v-if="!isFormDisabled">
<template #default="scope">
<el-button link type="primary" icon="Edit" @click="handleEditPaymentMethod(scope.row)"></el-button>
<el-button link type="danger" icon="Delete" @click="handleDeletePaymentMethod(scope.row)"></el-button>
<el-button link type="primary" icon="Edit" @click="handleEditPaymentMethod(scope.row, scope.$index)">编辑</el-button>
<el-button link type="danger" icon="Delete" @click="handleDeletePaymentMethod(scope.$index)"></el-button>
</template>
</el-table-column>
</el-table>
@ -643,6 +643,7 @@ const submitFormData = ref<StartProcessBo>({
const taskVariables = ref<Record<string, any>>({});
const flowInstanceBizExtBo = ref<Record<string, any>>({});
const type = ref(0);
const dialog = reactive<DialogOption>({
visible: false,
title: ''
@ -757,6 +758,7 @@ const paymentMethodDialog = reactive({
visible: false,
title: ''
});
const editingPaymentMethodIndex = ref<number | null>(null);
//
const initPaymentMethodFormData: ContractPaymentMethodForm = {
@ -1182,6 +1184,7 @@ const cancelMaterial = () => {
// = + 1
const handleAddPaymentMethod = () => {
resetPaymentMethodForm();
editingPaymentMethodIndex.value = null;
paymentMethodForm.value.contractId = form.value.contractId as any;
const list = (form.value as any).contractPaymentMethodList || [];
paymentMethodForm.value.sortOrder = list.length + 1;
@ -1190,28 +1193,34 @@ const handleAddPaymentMethod = () => {
};
//
const handleEditPaymentMethod = (row: any) => {
const handleEditPaymentMethod = (row: any, rowIndex: number) => {
resetPaymentMethodForm();
editingPaymentMethodIndex.value = rowIndex;
paymentMethodForm.value = { ...row };
paymentMethodDialog.visible = true;
paymentMethodDialog.title = '编辑付款方式';
};
//
const handleDeletePaymentMethod = async (row: any) => {
//
const handleDeletePaymentMethod = async (rowIndex: number) => {
await proxy?.$modal.confirm('是否确认删除该付款方式?');
if (!(form.value as any).contractPaymentMethodList) {
(form.value as any).contractPaymentMethodList = [];
try {
if (!(form.value as any).contractPaymentMethodList) {
(form.value as any).contractPaymentMethodList = [];
}
const list = (form.value as any).contractPaymentMethodList;
if (rowIndex >= 0 && rowIndex < list.length) {
list.splice(rowIndex, 1);
list.forEach((item: any, i: number) => {
item.sortOrder = i + 1;
});
}
proxy?.$modal.msgSuccess('删除成功');
} catch (error) {
console.error('删除付款方式失败:', error);
}
const list = (form.value as any).contractPaymentMethodList;
const index = list.findIndex((item: any) => item.paymentMethodId === row.paymentMethodId);
if (index !== -1) {
list.splice(index, 1);
list.forEach((item: any, i: number) => {
item.sortOrder = i + 1;
});
}
proxy?.$modal.msgSuccess('删除成功');
};
//
@ -1224,6 +1233,7 @@ const resetPaymentMethodForm = () => {
//
const cancelPaymentMethod = () => {
resetPaymentMethodForm();
editingPaymentMethodIndex.value = null;
paymentMethodDialog.visible = false;
};
@ -1238,14 +1248,19 @@ const submitPaymentMethodForm = () => {
const data = { ...paymentMethodForm.value };
//
data.paymentDescription = applyPaymentDescription(data.paymentDescription || '', data as Record<string, any>);
if (data.paymentMethodId) {
const editIndex = editingPaymentMethodIndex.value;
if (editIndex !== null && editIndex >= 0 && editIndex < list.length) {
list[editIndex] = data;
} else if (data.paymentMethodId) {
const index = list.findIndex((item: any) => item.paymentMethodId === data.paymentMethodId);
if (index !== -1) {
list[index] = data;
}
} else {
//
list.push({ ...data, paymentMethodId: undefined });
}
editingPaymentMethodIndex.value = null;
// {}
list.forEach((item: any, index: number) => {
item.sortOrder = index + 1;

Loading…
Cancel
Save