BUG 优化

dev
xiepeng 2024-04-15 18:00:07 +08:00
parent 57487151d6
commit f4518ef360
7 changed files with 78 additions and 36 deletions

View File

@ -17,3 +17,4 @@ export const getTrafficCustomerSelectView = (params) =>
export const editSafetyCustomerInfo = (params) => export const editSafetyCustomerInfo = (params) =>
upload("/securitycustomer/edit", params); // 添加 upload("/securitycustomer/edit", params); // 添加

View File

@ -51,6 +51,7 @@
<el-form-item <el-form-item
:label="'联系人' + (index + 1)" :label="'联系人' + (index + 1)"
:prop="`contacts.${index}.CONTACT`" :prop="`contacts.${index}.CONTACT`"
:rules="{ required: true, message: '请输入联系人' }"
> >
<el-input <el-input
v-model="contact.CONTACT" v-model="contact.CONTACT"
@ -63,6 +64,20 @@
<el-form-item <el-form-item
:label="'联系电话' + (index + 1)" :label="'联系电话' + (index + 1)"
:prop="`contacts.${index}.CONTACTPHONE`" :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 <el-input
v-model="contact.CONTACTPHONE" v-model="contact.CONTACTPHONE"
@ -75,6 +90,7 @@
<el-form-item <el-form-item
:label="'客户地址' + (index + 1)" :label="'客户地址' + (index + 1)"
:prop="`contacts.${index}.CUSTOMERADDRESS`" :prop="`contacts.${index}.CUSTOMERADDRESS`"
:rules="{ required: true, message: '请输入客户地址' }"
> >
<el-input <el-input
v-model="contact.CUSTOMERADDRESS" v-model="contact.CUSTOMERADDRESS"

View File

@ -51,6 +51,8 @@
<el-form-item <el-form-item
:label="'联系人' + (index + 1)" :label="'联系人' + (index + 1)"
:prop="`contacts.${index}.CONTACT`" :prop="`contacts.${index}.CONTACT`"
:rules="{ required: true, message: '请输入联系人' }"
@change="fnChangeContacts(contact.CUSTOMERCONTACT_ID)"
> >
<el-input <el-input
v-model="contact.CONTACT" v-model="contact.CONTACT"
@ -63,11 +65,26 @@
<el-form-item <el-form-item
:label="'联系电话' + (index + 1)" :label="'联系电话' + (index + 1)"
:prop="`contacts.${index}.CONTACTPHONE`" :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 <el-input
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>
@ -75,11 +92,13 @@
<el-form-item <el-form-item
:label="'客户地址' + (index + 1)" :label="'客户地址' + (index + 1)"
:prop="`contacts.${index}.CUSTOMERADDRESS`" :prop="`contacts.${index}.CUSTOMERADDRESS`"
:rules="{ required: true, message: '请输入客户地址' }"
> >
<el-input <el-input
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>
@ -107,7 +126,10 @@ import { CUSTOMERTYPEMENU } from "@/assets/js/constant";
import { reactive, ref } from "vue"; import { reactive, ref } from "vue";
import useFormValidate from "@/assets/js/useFormValidate.js"; import useFormValidate from "@/assets/js/useFormValidate.js";
import { ElMessage } from "element-plus"; 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"; import { useRoute, useRouter } from "vue-router";
const route = useRoute(); const route = useRoute();
const CUSTOMERMANAGEMENT_ID = route.query.CUSTOMERMANAGEMENT_ID; const CUSTOMERMANAGEMENT_ID = route.query.CUSTOMERMANAGEMENT_ID;
@ -136,6 +158,8 @@ const data = reactive({
CUSTOMERADDRESS: "", CUSTOMERADDRESS: "",
}, },
], ],
CUSTOMERCONTACT_IDS: [],
CUSTOMERCONTACT_ID: "",
}, },
}); });
const router = useRouter(); const router = useRouter();
@ -143,8 +167,8 @@ const router = useRouter();
const fnGetData = async () => { const fnGetData = async () => {
if (!CUSTOMERMANAGEMENT_ID) return; if (!CUSTOMERMANAGEMENT_ID) return;
const resData = await getTrafficCustomerSelectView({ CUSTOMERMANAGEMENT_ID }); const resData = await getTrafficCustomerSelectView({ CUSTOMERMANAGEMENT_ID });
data.form = resData.pd data.form = resData.pd;
data.form.contacts = resData.pd.customercontactList data.form.contacts = resData.pd.customercontactList;
}; };
fnGetData(); fnGetData();
@ -162,20 +186,30 @@ const removeContact = (index) => {
data.form.contacts.splice(index, 1); 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 () => { 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
formData.append("contacts", contactsJson); formData.append("contacts", contactsJson);
formData.append("CUSTOMERMANAGEMENT_ID",CUSTOMERMANAGEMENT_ID); formData.append("CUSTOMERMANAGEMENT_ID", CUSTOMERMANAGEMENT_ID);
await editSafetyCustomerInfo(formData); await editSafetyCustomerInfo(formData);
ElMessage.success("修改成功"); ElMessage.success("修改成功");

View File

@ -99,7 +99,6 @@
</template> </template>
<script setup> <script setup>
import { serialNumber } from "@/assets/js/utils";
import useListData from "@/assets/js/useListData.js"; import useListData from "@/assets/js/useListData.js";
import { ref } from "vue"; import { ref } from "vue";
import { import {
@ -108,6 +107,7 @@ import {
} from "@/request/customer_management.js"; } from "@/request/customer_management.js";
import { useRouter } from "vue-router"; import { useRouter } from "vue-router";
import { ElMessage, ElMessageBox } from "element-plus"; import { ElMessage, ElMessageBox } from "element-plus";
import { serialNumber } from "../../../assets/js/utils.js";
const router = useRouter(); const router = useRouter();
const tableRef = ref(null); const tableRef = ref(null);

View File

@ -139,7 +139,9 @@ const fnSubmit = async () => {
await useFormValidate(formRef); await useFormValidate(formRef);
data.form.ADMINISTRATIVEREGIONS = data.form.ADMINISTRATIVEREGIONS =
territoryCascaderRef.value.getCheckedNodes(); 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); await addSafetyLocationView(data.form);
ElMessage.success("添加成功"); ElMessage.success("添加成功");
router.back(); router.back();
@ -150,7 +152,7 @@ const fnSubmit = async () => {
data.form[key] = ""; data.form[key] = "";
} }
}); });
} };
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">

View File

@ -130,7 +130,6 @@ const fnGetData = async () => {
data.form = resData.pd; data.form = resData.pd;
data.form.ADMINISTRATIVEREGIONS_ARR = data.form.ADMINISTRATIVEREGIONS_ARR =
data.form.ADMINISTRATIVEREGIONS_ID.split(","); data.form.ADMINISTRATIVEREGIONS_ID.split(",");
console.log(data.form);
}; };
fnGetData(); fnGetData();
@ -154,7 +153,6 @@ const router = useRouter();
const fnSubmit = async () => { const fnSubmit = async () => {
await useFormValidate(formRef); await useFormValidate(formRef);
console.log(data.form.ADMINISTRATIVEREGIONS_ARR);
data.form.ADMINISTRATIVEREGIONS_ID = data.form.ADMINISTRATIVEREGIONS_ID =
data.form.ADMINISTRATIVEREGIONS_ARR.join(","); data.form.ADMINISTRATIVEREGIONS_ARR.join(",");
data.form.ADMINISTRATIVEREGIONS = data.form.ADMINISTRATIVEREGIONS =

View File

@ -121,16 +121,16 @@
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="8"> <el-col :span="8">
<el-form-item label="联系人" prop="CLIENTCONTACTPERSON"> <el-form-item label="联系人" prop="ENTRUST_PERSON">
<el-select <el-select
v-model="data.form.CLIENTCONTACTPERSON" v-model="data.form.ENTRUST_PERSON"
placeholder="请选择委联系人" placeholder="请选择委联系人"
clearable clearable
@change="changeCLIENTCONTACTPERSON" @change="changeCLIENTCONTACTPERSON"
> >
<el-option <el-option
v-for="contact in data.clientOptions" v-for="contact in data.clientOptions"
:key="contact.CONTACT" :key="contact.CONTACT_ID"
:label="contact.CONTACT" :label="contact.CONTACT"
:value="contact.CONTACT_ID" :value="contact.CONTACT_ID"
/> />
@ -164,9 +164,9 @@
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="8"> <el-col :span="8">
<el-form-item label="联系人" prop="CONFIRMINGPERSON"> <el-form-item label="联系人" prop="CONFIRM_PERSON">
<el-select <el-select
v-model="data.form.CONFIRMINGPERSON" v-model="data.form.CONFIRM_PERSON"
placeholder="请选择确认方联系人" placeholder="请选择确认方联系人"
clearable clearable
@change="changeCONFIRMINGPERSON" @change="changeCONFIRMINGPERSON"
@ -233,6 +233,7 @@
<el-input <el-input
v-model="data.form.STARTADMINISTRATIVEAREA" v-model="data.form.STARTADMINISTRATIVEAREA"
placeholder="请输入行政区域" placeholder="请输入行政区域"
disabled
clearable clearable
/> />
</el-form-item> </el-form-item>
@ -276,6 +277,7 @@
<el-input <el-input
v-model="data.form.ENDDMINISTRATIVEAREA" v-model="data.form.ENDDMINISTRATIVEAREA"
placeholder="请输入行政区域" placeholder="请输入行政区域"
disabled
clearable clearable
/> />
</el-form-item> </el-form-item>
@ -322,17 +324,6 @@ const rules = {
], ],
WAYBILLNUMBER: [ WAYBILLNUMBER: [
{ required: true, message: "请输入运单编号", trigger: "blur" }, { 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: [ TRANSPORTVEHICLE: [
{ required: true, message: "请选择运营车辆", trigger: "change" }, { required: true, message: "请选择运营车辆", trigger: "change" },
@ -418,31 +409,32 @@ const fnGetData = async () => {
data.form.DISPATCHER = data.form.DISPATCHER.split(","); data.form.DISPATCHER = data.form.DISPATCHER.split(",");
data.form.SHIPPINGADDRESS = data.form.SHIPPING_ADDR; // data.form.SHIPPINGADDRESS = data.form.SHIPPING_ADDR; //
data.form.DESTINATIONADDRESS = data.form.DESTINATION_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(); fnGetData();
const fnClientChange = () => { const fnClientChange = () => {
data.form.CLIENTCONTACTPERSON = ""; data.form.ENTRUST_PERSON = "";
data.form.CLIENTCONTACTPHONE = ""; data.form.CLIENTCONTACTPHONE = "";
data.clientOptions = [];
}; };
const fnConfirmerChange = () => { const fnConfirmerChange = () => {
data.form.CONFIRMINGPERSON = ""; data.form.CONFIRM_PERSON = "";
data.form.CONFIRMINGPHONE = ""; data.form.CONFIRMINGPHONE = "";
data.confirmerOptions = [];
}; };
const fnShipmentAddrChange = () => { const fnShipmentAddrChange = () => {
data.form.SHIPPINGADDRESS = ""; data.form.SHIPPINGADDRESS = "";
data.form.STARTADMINISTRATIVEAREA = ""; data.form.STARTADMINISTRATIVEAREA = "";
data.StartOptions = [];
}; };
const fnGogalAddrChange = () => { const fnGogalAddrChange = () => {
data.form.DESTINATIONADDRESS = ""; data.form.DESTINATIONADDRESS = "";
data.form.ENDDMINISTRATIVEAREA = ""; data.form.ENDDMINISTRATIVEAREA = "";
data.EndOptions = [];
}; };
const fnClientUserChange = async () => { const fnClientUserChange = async () => {
@ -658,10 +650,9 @@ const fnSubmit = async () => {
Object.keys(data.form).forEach((key) => { Object.keys(data.form).forEach((key) => {
formData.append(key, data.form[key]); formData.append(key, data.form[key]);
}); });
await editSafetyWaybillreInfo(formData); await editSafetyWaybillreInfo(formData);
ElMessage.success("修改成功"); ElMessage.success("修改成功");
await router.push("/electronic_waybill_management/waybill_registration"); router.back();
}; };
</script> </script>