diff --git a/src/views/oa/erp/contractInfo/edit.vue b/src/views/oa/erp/contractInfo/edit.vue
index ccb9943..b334aa6 100644
--- a/src/views/oa/erp/contractInfo/edit.vue
+++ b/src/views/oa/erp/contractInfo/edit.vue
@@ -245,8 +245,8 @@
- 编辑
- 删除
+ 编辑
+ 删除
@@ -643,6 +643,7 @@ const submitFormData = ref({
const taskVariables = ref>({});
const flowInstanceBizExtBo = ref>({});
+const type = ref(0);
const dialog = reactive({
visible: false,
title: ''
@@ -757,6 +758,7 @@ const paymentMethodDialog = reactive({
visible: false,
title: ''
});
+const editingPaymentMethodIndex = ref(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);
- 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;