diff --git a/src/request/customer_management.js b/src/request/customer_management.js index 8530070..65c500c 100644 --- a/src/request/customer_management.js +++ b/src/request/customer_management.js @@ -17,3 +17,4 @@ export const getTrafficCustomerSelectView = (params) => export const editSafetyCustomerInfo = (params) => upload("/securitycustomer/edit", params); // 添加 + diff --git a/src/views/electronic_waybill_management/customer_management/add.vue b/src/views/electronic_waybill_management/customer_management/add.vue index 53b0a0f..48a4c55 100644 --- a/src/views/electronic_waybill_management/customer_management/add.vue +++ b/src/views/electronic_waybill_management/customer_management/add.vue @@ -51,6 +51,7 @@ @@ -75,11 +92,13 @@ @@ -107,7 +126,10 @@ import { CUSTOMERTYPEMENU } from "@/assets/js/constant"; import { reactive, ref } from "vue"; import useFormValidate from "@/assets/js/useFormValidate.js"; import { ElMessage } from "element-plus"; -import { getTrafficCustomerSelectView, editSafetyCustomerInfo } from "@/request/customer_management.js"; +import { + getTrafficCustomerSelectView, + editSafetyCustomerInfo, +} from "@/request/customer_management.js"; import { useRoute, useRouter } from "vue-router"; const route = useRoute(); const CUSTOMERMANAGEMENT_ID = route.query.CUSTOMERMANAGEMENT_ID; @@ -136,6 +158,8 @@ const data = reactive({ CUSTOMERADDRESS: "", }, ], + CUSTOMERCONTACT_IDS: [], + CUSTOMERCONTACT_ID: "", }, }); const router = useRouter(); @@ -143,8 +167,8 @@ const router = useRouter(); const fnGetData = async () => { if (!CUSTOMERMANAGEMENT_ID) return; const resData = await getTrafficCustomerSelectView({ CUSTOMERMANAGEMENT_ID }); - data.form = resData.pd - data.form.contacts = resData.pd.customercontactList + data.form = resData.pd; + data.form.contacts = resData.pd.customercontactList; }; fnGetData(); @@ -162,20 +186,30 @@ const removeContact = (index) => { data.form.contacts.splice(index, 1); } }; + +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的值 formData.append("contacts", contactsJson); - formData.append("CUSTOMERMANAGEMENT_ID",CUSTOMERMANAGEMENT_ID); + formData.append("CUSTOMERMANAGEMENT_ID", CUSTOMERMANAGEMENT_ID); await editSafetyCustomerInfo(formData); ElMessage.success("修改成功"); diff --git a/src/views/electronic_waybill_management/customer_management/index.vue b/src/views/electronic_waybill_management/customer_management/index.vue index 945bb70..781874a 100644 --- a/src/views/electronic_waybill_management/customer_management/index.vue +++ b/src/views/electronic_waybill_management/customer_management/index.vue @@ -99,7 +99,6 @@