From 7b37c0fcf199a03a361f913bea5064faa393234d Mon Sep 17 00:00:00 2001 From: xiepeng Date: Tue, 16 Apr 2024 09:47:06 +0800 Subject: [PATCH] =?UTF-8?q?BUG=20=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/request/customer_management.js | 3 +++ .../customer_management/edit.vue | 20 +++++-------------- 2 files changed, 8 insertions(+), 15 deletions(-) diff --git a/src/request/customer_management.js b/src/request/customer_management.js index 65c500c..5dd4a8f 100644 --- a/src/request/customer_management.js +++ b/src/request/customer_management.js @@ -18,3 +18,6 @@ export const getTrafficCustomerSelectView = (params) => export const editSafetyCustomerInfo = (params) => upload("/securitycustomer/edit", params); // 添加 +export const deleteContactInfo = (params) => + upload("/securitycustomer/deleteContactInfo", params); // 删除 + diff --git a/src/views/electronic_waybill_management/customer_management/edit.vue b/src/views/electronic_waybill_management/customer_management/edit.vue index a36465e..3b945b5 100644 --- a/src/views/electronic_waybill_management/customer_management/edit.vue +++ b/src/views/electronic_waybill_management/customer_management/edit.vue @@ -52,7 +52,6 @@ :label="'联系人' + (index + 1)" :prop="`contacts.${index}.CONTACT`" :rules="{ required: true, message: '请输入联系人' }" - @change="fnChangeContacts(contact.CUSTOMERCONTACT_ID)" > @@ -98,7 +96,6 @@ v-model="contact.CUSTOMERADDRESS" placeholder="请输入客户地址" clearable - @change="fnChangeContacts(contact.CUSTOMERCONTACT_ID)" /> @@ -106,7 +103,7 @@ 删除 @@ -129,6 +126,7 @@ import { ElMessage } from "element-plus"; import { getTrafficCustomerSelectView, editSafetyCustomerInfo, + deleteContactInfo, } from "@/request/customer_management.js"; import { useRoute, useRouter } from "vue-router"; const route = useRoute(); @@ -153,6 +151,7 @@ const data = reactive({ CUSTOMERNAME: "", contacts: [ { + CUSTOMERCONTACT_ID: "", CONTACT: "", CONTACTPHONE: "", CUSTOMERADDRESS: "", @@ -180,31 +179,22 @@ const addContact = () => { }); }; // 删除指定索引的联系人信息 -const removeContact = (index) => { +const removeContact = async (index, CUSTOMERCONTACT_ID) => { if (index > 0) { // 防止删除初始化的那一组数据 data.form.contacts.splice(index, 1); + await deleteContactInfo({CUSTOMERCONTACT_ID}); } }; -const fnChangeContacts = async (CUSTOMERCONTACTID) => { - data.form.CUSTOMERCONTACT_IDS = - data.form.CUSTOMERCONTACT_IDS + CUSTOMERCONTACTID + ","; - data.form.CUSTOMERCONTACT_ID = data.form.CUSTOMERCONTACT_IDS; -}; const fnSubmit = async () => { await useFormValidate(formRef); const formData = new FormData(); - data.form.CUSTOMERCONTACT_ID = data.form.CUSTOMERCONTACT_ID.substring( - 0, - data.form.CUSTOMERCONTACT_ID.lastIndexOf(",") - ); formData.append("TRANSPORTATIONCOMPANY", data.form.TRANSPORTATIONCOMPANY); formData.append("CUSTOMERTYPE", data.form.CUSTOMERTYPE); formData.append("CUSTOMERNAME", data.form.CUSTOMERNAME); - formData.append("CUSTOMERCONTACT_ID", data.form.CUSTOMERCONTACT_ID); // 将contacts数组转换为JSON字符串 const contactsJson = JSON.stringify(data.form.contacts); // 使用JSON字符串作为contacts的值