forked from integrated_whb/integrated_whb_vue
BUG 优化
parent
57487151d6
commit
f4518ef360
|
@ -17,3 +17,4 @@ export const getTrafficCustomerSelectView = (params) =>
|
|||
|
||||
export const editSafetyCustomerInfo = (params) =>
|
||||
upload("/securitycustomer/edit", params); // 添加
|
||||
|
||||
|
|
|
@ -51,6 +51,7 @@
|
|||
<el-form-item
|
||||
:label="'联系人' + (index + 1)"
|
||||
:prop="`contacts.${index}.CONTACT`"
|
||||
:rules="{ required: true, message: '请输入联系人' }"
|
||||
>
|
||||
<el-input
|
||||
v-model="contact.CONTACT"
|
||||
|
@ -63,6 +64,20 @@
|
|||
<el-form-item
|
||||
:label="'联系电话' + (index + 1)"
|
||||
:prop="`contacts.${index}.CONTACTPHONE`"
|
||||
:rules="[
|
||||
{ required: true, message: '请输入联系电话' },
|
||||
{
|
||||
min: 11,
|
||||
max: 11,
|
||||
message: '请输入11位手机号码',
|
||||
trigger: 'blur',
|
||||
},
|
||||
{
|
||||
pattern:
|
||||
/^(?:(?:\+|00)86)?1(?:(?:3[\d])|(?:4[5-79])|(?:5[0-35-9])|(?:6[5-7])|(?:7[0-8])|(?:8[\d])|(?:9[189]))\d{8}$/,
|
||||
message: '请输入正确的手机号码',
|
||||
},
|
||||
]"
|
||||
>
|
||||
<el-input
|
||||
v-model="contact.CONTACTPHONE"
|
||||
|
@ -75,6 +90,7 @@
|
|||
<el-form-item
|
||||
:label="'客户地址' + (index + 1)"
|
||||
:prop="`contacts.${index}.CUSTOMERADDRESS`"
|
||||
:rules="{ required: true, message: '请输入客户地址' }"
|
||||
>
|
||||
<el-input
|
||||
v-model="contact.CUSTOMERADDRESS"
|
||||
|
|
|
@ -51,6 +51,8 @@
|
|||
<el-form-item
|
||||
:label="'联系人' + (index + 1)"
|
||||
:prop="`contacts.${index}.CONTACT`"
|
||||
:rules="{ required: true, message: '请输入联系人' }"
|
||||
@change="fnChangeContacts(contact.CUSTOMERCONTACT_ID)"
|
||||
>
|
||||
<el-input
|
||||
v-model="contact.CONTACT"
|
||||
|
@ -63,11 +65,26 @@
|
|||
<el-form-item
|
||||
:label="'联系电话' + (index + 1)"
|
||||
:prop="`contacts.${index}.CONTACTPHONE`"
|
||||
:rules="[
|
||||
{ required: true, message: '请输入联系电话' },
|
||||
{
|
||||
min: 11,
|
||||
max: 11,
|
||||
message: '请输入11位手机号码',
|
||||
trigger: 'blur',
|
||||
},
|
||||
{
|
||||
pattern:
|
||||
/^(?:(?:\+|00)86)?1(?:(?:3[\d])|(?:4[5-79])|(?:5[0-35-9])|(?:6[5-7])|(?:7[0-8])|(?:8[\d])|(?:9[189]))\d{8}$/,
|
||||
message: '请输入正确的手机号码',
|
||||
},
|
||||
]"
|
||||
>
|
||||
<el-input
|
||||
v-model="contact.CONTACTPHONE"
|
||||
placeholder="请输入联系电话"
|
||||
clearable
|
||||
@change="fnChangeContacts(contact.CUSTOMERCONTACT_ID)"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
@ -75,11 +92,13 @@
|
|||
<el-form-item
|
||||
:label="'客户地址' + (index + 1)"
|
||||
:prop="`contacts.${index}.CUSTOMERADDRESS`"
|
||||
:rules="{ required: true, message: '请输入客户地址' }"
|
||||
>
|
||||
<el-input
|
||||
v-model="contact.CUSTOMERADDRESS"
|
||||
placeholder="请输入客户地址"
|
||||
clearable
|
||||
@change="fnChangeContacts(contact.CUSTOMERCONTACT_ID)"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
@ -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,15 +186,25 @@ 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的值
|
||||
|
|
|
@ -99,7 +99,6 @@
|
|||
</template>
|
||||
|
||||
<script setup>
|
||||
import { serialNumber } from "@/assets/js/utils";
|
||||
import useListData from "@/assets/js/useListData.js";
|
||||
import { ref } from "vue";
|
||||
import {
|
||||
|
@ -108,6 +107,7 @@ import {
|
|||
} from "@/request/customer_management.js";
|
||||
import { useRouter } from "vue-router";
|
||||
import { ElMessage, ElMessageBox } from "element-plus";
|
||||
import { serialNumber } from "../../../assets/js/utils.js";
|
||||
|
||||
const router = useRouter();
|
||||
const tableRef = ref(null);
|
||||
|
|
|
@ -139,7 +139,9 @@ const fnSubmit = async () => {
|
|||
await useFormValidate(formRef);
|
||||
data.form.ADMINISTRATIVEREGIONS =
|
||||
territoryCascaderRef.value.getCheckedNodes();
|
||||
data.form.ADMINISTRATIVEREGIONS_ID = JSON.stringify(data.form.ADMINISTRATIVEREGIONS_ID);
|
||||
data.form.ADMINISTRATIVEREGIONS_ID = JSON.stringify(
|
||||
data.form.ADMINISTRATIVEREGIONS_ID
|
||||
);
|
||||
await addSafetyLocationView(data.form);
|
||||
ElMessage.success("添加成功");
|
||||
router.back();
|
||||
|
@ -150,7 +152,7 @@ const fnSubmit = async () => {
|
|||
data.form[key] = "";
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
|
|
|
@ -130,7 +130,6 @@ const fnGetData = async () => {
|
|||
data.form = resData.pd;
|
||||
data.form.ADMINISTRATIVEREGIONS_ARR =
|
||||
data.form.ADMINISTRATIVEREGIONS_ID.split(",");
|
||||
console.log(data.form);
|
||||
};
|
||||
fnGetData();
|
||||
|
||||
|
@ -154,7 +153,6 @@ const router = useRouter();
|
|||
|
||||
const fnSubmit = async () => {
|
||||
await useFormValidate(formRef);
|
||||
console.log(data.form.ADMINISTRATIVEREGIONS_ARR);
|
||||
data.form.ADMINISTRATIVEREGIONS_ID =
|
||||
data.form.ADMINISTRATIVEREGIONS_ARR.join(",");
|
||||
data.form.ADMINISTRATIVEREGIONS =
|
||||
|
|
|
@ -121,16 +121,16 @@
|
|||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="联系人" prop="CLIENTCONTACTPERSON">
|
||||
<el-form-item label="联系人" prop="ENTRUST_PERSON">
|
||||
<el-select
|
||||
v-model="data.form.CLIENTCONTACTPERSON"
|
||||
v-model="data.form.ENTRUST_PERSON"
|
||||
placeholder="请选择委联系人"
|
||||
clearable
|
||||
@change="changeCLIENTCONTACTPERSON"
|
||||
>
|
||||
<el-option
|
||||
v-for="contact in data.clientOptions"
|
||||
:key="contact.CONTACT"
|
||||
:key="contact.CONTACT_ID"
|
||||
:label="contact.CONTACT"
|
||||
:value="contact.CONTACT_ID"
|
||||
/>
|
||||
|
@ -164,9 +164,9 @@
|
|||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="联系人" prop="CONFIRMINGPERSON">
|
||||
<el-form-item label="联系人" prop="CONFIRM_PERSON">
|
||||
<el-select
|
||||
v-model="data.form.CONFIRMINGPERSON"
|
||||
v-model="data.form.CONFIRM_PERSON"
|
||||
placeholder="请选择确认方联系人"
|
||||
clearable
|
||||
@change="changeCONFIRMINGPERSON"
|
||||
|
@ -233,6 +233,7 @@
|
|||
<el-input
|
||||
v-model="data.form.STARTADMINISTRATIVEAREA"
|
||||
placeholder="请输入行政区域"
|
||||
disabled
|
||||
clearable
|
||||
/>
|
||||
</el-form-item>
|
||||
|
@ -276,6 +277,7 @@
|
|||
<el-input
|
||||
v-model="data.form.ENDDMINISTRATIVEAREA"
|
||||
placeholder="请输入行政区域"
|
||||
disabled
|
||||
clearable
|
||||
/>
|
||||
</el-form-item>
|
||||
|
@ -322,17 +324,6 @@ const rules = {
|
|||
],
|
||||
WAYBILLNUMBER: [
|
||||
{ required: true, message: "请输入运单编号", trigger: "blur" },
|
||||
/* { min: 7, message: "运单编号不能少于7位", trigger: "blur" },
|
||||
{
|
||||
validator: (rule, value, callback) => {
|
||||
if (!/^[A-Za-z0-9]+$/.test(value)) {
|
||||
callback(new Error("运单编号只能包含大小写英文字符和数字"));
|
||||
} else {
|
||||
callback();
|
||||
}
|
||||
},
|
||||
trigger: "blur",
|
||||
}, */
|
||||
],
|
||||
TRANSPORTVEHICLE: [
|
||||
{ required: true, message: "请选择运营车辆", trigger: "change" },
|
||||
|
@ -418,31 +409,32 @@ const fnGetData = async () => {
|
|||
data.form.DISPATCHER = data.form.DISPATCHER.split(",");
|
||||
data.form.SHIPPINGADDRESS = data.form.SHIPPING_ADDR; // 起运地址
|
||||
data.form.DESTINATIONADDRESS = data.form.DESTINATION_ADDR; // 目的地址
|
||||
data.userList = data.form.names; // 获取部门下的或有人员
|
||||
data.userList = data.form.names; // 获取部门下的|或有人员
|
||||
data.form.CLIENTCONTACTPHONE = data.form.ENTRUST_PHONE;
|
||||
data.form.CONFIRMINGPHONE = data.form.CONFIRM_PHONE;
|
||||
data.form.STARTADMINISTRATIVEAREA = data.form.DEPARTURE_ADDR;
|
||||
data.form.ENDDMINISTRATIVEAREA = data.form.GOAL_ADDR;
|
||||
console.log(data.form);
|
||||
};
|
||||
fnGetData();
|
||||
const fnClientChange = () => {
|
||||
data.form.CLIENTCONTACTPERSON = "";
|
||||
data.form.ENTRUST_PERSON = "";
|
||||
data.form.CLIENTCONTACTPHONE = "";
|
||||
data.clientOptions = [];
|
||||
};
|
||||
|
||||
const fnConfirmerChange = () => {
|
||||
data.form.CONFIRMINGPERSON = "";
|
||||
data.form.CONFIRM_PERSON = "";
|
||||
data.form.CONFIRMINGPHONE = "";
|
||||
data.confirmerOptions = [];
|
||||
};
|
||||
|
||||
const fnShipmentAddrChange = () => {
|
||||
data.form.SHIPPINGADDRESS = "";
|
||||
data.form.STARTADMINISTRATIVEAREA = "";
|
||||
data.StartOptions = [];
|
||||
};
|
||||
|
||||
const fnGogalAddrChange = () => {
|
||||
data.form.DESTINATIONADDRESS = "";
|
||||
data.form.ENDDMINISTRATIVEAREA = "";
|
||||
data.EndOptions = [];
|
||||
};
|
||||
|
||||
const fnClientUserChange = async () => {
|
||||
|
@ -658,10 +650,9 @@ const fnSubmit = async () => {
|
|||
Object.keys(data.form).forEach((key) => {
|
||||
formData.append(key, data.form[key]);
|
||||
});
|
||||
|
||||
await editSafetyWaybillreInfo(formData);
|
||||
ElMessage.success("修改成功");
|
||||
await router.push("/electronic_waybill_management/waybill_registration");
|
||||
router.back();
|
||||
};
|
||||
</script>
|
||||
|
||||
|
|
Loading…
Reference in New Issue