BUG 优化

dev
xiepeng 2024-04-16 09:47:06 +08:00
parent f4518ef360
commit 7b37c0fcf1
2 changed files with 8 additions and 15 deletions

View File

@ -18,3 +18,6 @@ export const getTrafficCustomerSelectView = (params) =>
export const editSafetyCustomerInfo = (params) => export const editSafetyCustomerInfo = (params) =>
upload("/securitycustomer/edit", params); // 添加 upload("/securitycustomer/edit", params); // 添加
export const deleteContactInfo = (params) =>
upload("/securitycustomer/deleteContactInfo", params); // 删除

View File

@ -52,7 +52,6 @@
:label="'联系人' + (index + 1)" :label="'联系人' + (index + 1)"
:prop="`contacts.${index}.CONTACT`" :prop="`contacts.${index}.CONTACT`"
:rules="{ required: true, message: '请输入联系人' }" :rules="{ required: true, message: '请输入联系人' }"
@change="fnChangeContacts(contact.CUSTOMERCONTACT_ID)"
> >
<el-input <el-input
v-model="contact.CONTACT" v-model="contact.CONTACT"
@ -84,7 +83,6 @@
v-model="contact.CONTACTPHONE" v-model="contact.CONTACTPHONE"
placeholder="请输入联系电话" placeholder="请输入联系电话"
clearable clearable
@change="fnChangeContacts(contact.CUSTOMERCONTACT_ID)"
/> />
</el-form-item> </el-form-item>
</el-col> </el-col>
@ -98,7 +96,6 @@
v-model="contact.CUSTOMERADDRESS" v-model="contact.CUSTOMERADDRESS"
placeholder="请输入客户地址" placeholder="请输入客户地址"
clearable clearable
@change="fnChangeContacts(contact.CUSTOMERCONTACT_ID)"
/> />
</el-form-item> </el-form-item>
</el-col> </el-col>
@ -106,7 +103,7 @@
<el-button <el-button
v-if="index !== 0" v-if="index !== 0"
type="danger" type="danger"
@click="removeContact(index)" @click="removeContact(index,contact.CUSTOMERCONTACT_ID)"
> >
删除 删除
<!-- 添加的删除文字 --> <!-- 添加的删除文字 -->
@ -129,6 +126,7 @@ import { ElMessage } from "element-plus";
import { import {
getTrafficCustomerSelectView, getTrafficCustomerSelectView,
editSafetyCustomerInfo, editSafetyCustomerInfo,
deleteContactInfo,
} from "@/request/customer_management.js"; } from "@/request/customer_management.js";
import { useRoute, useRouter } from "vue-router"; import { useRoute, useRouter } from "vue-router";
const route = useRoute(); const route = useRoute();
@ -153,6 +151,7 @@ const data = reactive({
CUSTOMERNAME: "", CUSTOMERNAME: "",
contacts: [ contacts: [
{ {
CUSTOMERCONTACT_ID: "",
CONTACT: "", CONTACT: "",
CONTACTPHONE: "", CONTACTPHONE: "",
CUSTOMERADDRESS: "", CUSTOMERADDRESS: "",
@ -180,31 +179,22 @@ const addContact = () => {
}); });
}; };
// //
const removeContact = (index) => { const removeContact = async (index, CUSTOMERCONTACT_ID) => {
if (index > 0) { if (index > 0) {
// //
data.form.contacts.splice(index, 1); 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 () => { const fnSubmit = async () => {
await useFormValidate(formRef); await useFormValidate(formRef);
const formData = new FormData(); 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("TRANSPORTATIONCOMPANY", data.form.TRANSPORTATIONCOMPANY);
formData.append("CUSTOMERTYPE", data.form.CUSTOMERTYPE); formData.append("CUSTOMERTYPE", data.form.CUSTOMERTYPE);
formData.append("CUSTOMERNAME", data.form.CUSTOMERNAME); formData.append("CUSTOMERNAME", data.form.CUSTOMERNAME);
formData.append("CUSTOMERCONTACT_ID", data.form.CUSTOMERCONTACT_ID);
// contactsJSON // contactsJSON
const contactsJson = JSON.stringify(data.form.contacts); const contactsJson = JSON.stringify(data.form.contacts);
// 使JSONcontacts // 使JSONcontacts