forked from integrated_whb/integrated_whb_vue
BUG 优化
parent
f4518ef360
commit
7b37c0fcf1
|
@ -18,3 +18,6 @@ export const getTrafficCustomerSelectView = (params) =>
|
|||
export const editSafetyCustomerInfo = (params) =>
|
||||
upload("/securitycustomer/edit", params); // 添加
|
||||
|
||||
export const deleteContactInfo = (params) =>
|
||||
upload("/securitycustomer/deleteContactInfo", params); // 删除
|
||||
|
||||
|
|
|
@ -52,7 +52,6 @@
|
|||
:label="'联系人' + (index + 1)"
|
||||
:prop="`contacts.${index}.CONTACT`"
|
||||
:rules="{ required: true, message: '请输入联系人' }"
|
||||
@change="fnChangeContacts(contact.CUSTOMERCONTACT_ID)"
|
||||
>
|
||||
<el-input
|
||||
v-model="contact.CONTACT"
|
||||
|
@ -84,7 +83,6 @@
|
|||
v-model="contact.CONTACTPHONE"
|
||||
placeholder="请输入联系电话"
|
||||
clearable
|
||||
@change="fnChangeContacts(contact.CUSTOMERCONTACT_ID)"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
@ -98,7 +96,6 @@
|
|||
v-model="contact.CUSTOMERADDRESS"
|
||||
placeholder="请输入客户地址"
|
||||
clearable
|
||||
@change="fnChangeContacts(contact.CUSTOMERCONTACT_ID)"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
@ -106,7 +103,7 @@
|
|||
<el-button
|
||||
v-if="index !== 0"
|
||||
type="danger"
|
||||
@click="removeContact(index)"
|
||||
@click="removeContact(index,contact.CUSTOMERCONTACT_ID)"
|
||||
>
|
||||
删除
|
||||
<!-- 添加的删除文字 -->
|
||||
|
@ -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的值
|
||||
|
|
Loading…
Reference in New Issue