forked from integrated_whb/integrated_whb_vue
				
			BUG 优化
							parent
							
								
									d51784a22d
								
							
						
					
					
						commit
						a9ae574aff
					
				|  | @ -14,3 +14,11 @@ export const getUserPersonTypeListAll = (params) => | |||
| 
 | ||||
| export const dateteSecurityAllWaybillre = (params) => | ||||
|   post("/waybillregistration/deleteAll", params); // 批量删除
 | ||||
| 
 | ||||
| export const getSafetyWaybillreInfo = (params) => | ||||
|   post("/waybillregistration/goEdit", params); // 获取运单信息
 | ||||
| export const getPrincipalContactList = (params) => | ||||
|   post("/waybillregistration/getPrincipalContactList", params); // 委托方的联系人列表
 | ||||
| 
 | ||||
| export const editSafetyWaybillreInfo = (params) => | ||||
|   upload("/waybillregistration/edit", params); // 修改运单信息
 | ||||
|  |  | |||
|  | @ -18,8 +18,8 @@ | |||
|           </el-form-item> | ||||
|         </el-col> | ||||
|         <el-col :span="8"> | ||||
|           <el-form-item label="调度人" prop="USER_IDS"> | ||||
|             <el-select v-model="data.form.USER_IDS" multiple> | ||||
|           <el-form-item label="调度人" prop="DISPATCHER"> | ||||
|             <el-select v-model="data.form.DISPATCHER" multiple> | ||||
|               <el-option | ||||
|                 v-for="item in data.userList" | ||||
|                 :key="item.USER_ID" | ||||
|  | @ -360,6 +360,9 @@ const rules = { | |||
|   DESTINATIONADDRESS: [ | ||||
|     { required: true, message: "请输入目的地址", trigger: "blur" }, | ||||
|   ], | ||||
|   PRACTITIONER: [ | ||||
|     { required: true, message: "请选择从业人员", trigger: "change" }, | ||||
|   ], | ||||
| }; | ||||
| 
 | ||||
| const data = reactive({ | ||||
|  |  | |||
|  | @ -0,0 +1,687 @@ | |||
| <template> | ||||
|   <layout-card> | ||||
|     <el-form | ||||
|       ref="formRef" | ||||
|       :model="data.form" | ||||
|       :rules="rules" | ||||
|       label-width="175px" | ||||
|     > | ||||
|       <!-- 承运信息 --> | ||||
|       <el-divider content-position="left">承运信息</el-divider> | ||||
|       <el-row :gutter="20"> | ||||
|         <el-col :span="8"> | ||||
|           <el-form-item prop="DEPARTMENT_ID" label="部门"> | ||||
|             <layout-department | ||||
|               v-model="data.form.DEPARTMENT_ID" | ||||
|               @update:model-value="fnDepartmentChange" | ||||
|             /> | ||||
|           </el-form-item> | ||||
|         </el-col> | ||||
|         <el-col :span="8"> | ||||
|           <el-form-item label="调度人" prop="DISPATCHER"> | ||||
|             <el-select v-model="data.form.DISPATCHER" multiple> | ||||
|               <el-option | ||||
|                 v-for="item in data.userList" | ||||
|                 :key="item.USER_ID" | ||||
|                 :label="item.NAME" | ||||
|                 :value="item.USER_ID" | ||||
|               /> | ||||
|             </el-select> | ||||
|           </el-form-item> | ||||
|         </el-col> | ||||
|         <el-col :span="8"> | ||||
|           <el-form-item label="运单编号" prop="WAYBILLNUMBER"> | ||||
|             <el-input | ||||
|               v-model="data.form.WAYBILLNUMBER" | ||||
|               placeholder="请输入运单编号" | ||||
|               clearable | ||||
|             /> | ||||
|           </el-form-item> | ||||
|         </el-col> | ||||
|         <el-col :span="8"> | ||||
|           <el-form-item label="承运日期" prop="SHIPPINGDATE"> | ||||
|             <el-date-picker | ||||
|               v-model="data.form.SHIPPINGDATE" | ||||
|               type="date" | ||||
|               format="YYYY-MM-DD" | ||||
|               value-format="YYYY-MM-DD" | ||||
|               placeholder="选择时间" | ||||
|               clearable | ||||
|             /> | ||||
|           </el-form-item> | ||||
|         </el-col> | ||||
|         <el-col :span="8"> | ||||
|           <el-form-item label="运输车辆" prop="TRANSPORTVEHICLE"> | ||||
|             <el-select | ||||
|               v-model="data.form.TRANSPORTVEHICLE" | ||||
|               placeholder="请选择运输车辆" | ||||
|               clearable | ||||
|             > | ||||
|               <el-option | ||||
|                 v-for="item in data.OperationVehicle" | ||||
|                 :key="item" | ||||
|                 :label="item" | ||||
|                 :value="item" | ||||
|               /> | ||||
|             </el-select> | ||||
|           </el-form-item> | ||||
|         </el-col> | ||||
|         <el-col :span="8"> | ||||
|           <el-form-item label="从业人员" prop="PRACTITIONER"> | ||||
|             <el-select | ||||
|               v-model="data.form.PRACTITIONER" | ||||
|               placeholder="请选择从业人员" | ||||
|               clearable | ||||
|             > | ||||
|               <el-option | ||||
|                 v-for="item in data.userTypeList" | ||||
|                 :key="item.USER_ID" | ||||
|                 :label="item.NAME" | ||||
|                 :value="item.USER_ID" | ||||
|               /> | ||||
|             </el-select> | ||||
|           </el-form-item> | ||||
|         </el-col> | ||||
|         <el-col :span="8"> | ||||
|           <el-form-item label="货运挂车" prop="TRUCKCART"> | ||||
|             <el-select | ||||
|               v-model="data.form.TRUCKCART" | ||||
|               placeholder="请选择货运挂车" | ||||
|               clearable | ||||
|             > | ||||
|               <el-option | ||||
|                 v-for="item in data.OperationTruck" | ||||
|                 :key="item" | ||||
|                 :label="item" | ||||
|                 :value="item" | ||||
|               /> | ||||
|             </el-select> | ||||
|           </el-form-item> | ||||
|         </el-col> | ||||
|       </el-row> | ||||
| 
 | ||||
|       <!-- 客户信息 --> | ||||
|       <el-divider content-position="left">客户信息</el-divider> | ||||
|       <el-row :gutter="20"> | ||||
|         <el-col :span="8"> | ||||
|           <el-form-item label="委托方" prop="CLIENT"> | ||||
|             <el-select | ||||
|               v-model="data.form.CLIENT" | ||||
|               placeholder="请选择委托方" | ||||
|               @update:model-value="fnClientChange" | ||||
|             > | ||||
|               > | ||||
|               <el-option | ||||
|                 v-for="item in data.clientOptionsList" | ||||
|                 :key="item.CUSTOMERNAME_ID" | ||||
|                 :label="item.CUSTOMERNAME" | ||||
|                 :value="item.CUSTOMERNAME_ID" | ||||
|               /> | ||||
|             </el-select> | ||||
|           </el-form-item> | ||||
|         </el-col> | ||||
|         <el-col :span="8"> | ||||
|           <el-form-item label="联系人" prop="CLIENTCONTACTPERSON"> | ||||
|             <el-select | ||||
|               v-model="data.form.CLIENTCONTACTPERSON" | ||||
|               placeholder="请选择委联系人" | ||||
|               clearable | ||||
|               @change="changeCLIENTCONTACTPERSON" | ||||
|             > | ||||
|               <el-option | ||||
|                 v-for="contact in data.clientOptions" | ||||
|                 :key="contact.CONTACT" | ||||
|                 :label="contact.CONTACT" | ||||
|                 :value="contact.CONTACT_ID" | ||||
|               /> | ||||
|             </el-select> | ||||
|           </el-form-item> | ||||
|         </el-col> | ||||
|         <el-col :span="8"> | ||||
|           <el-form-item label="联系电话" prop="CLIENTCONTACTPHONE"> | ||||
|             <el-input | ||||
|               v-model="data.form.CLIENTCONTACTPHONE" | ||||
|               placeholder="请输入联系电话" | ||||
|               clearable | ||||
|             /> | ||||
|           </el-form-item> | ||||
|         </el-col> | ||||
|         <el-col :span="8"> | ||||
|           <el-form-item label="确认方" prop="CONFIRMER"> | ||||
|             <el-select | ||||
|               v-model="data.form.CONFIRMER" | ||||
|               placeholder="请选择确认方" | ||||
|               clearable | ||||
|               @update:model-value="fnConfirmerChange" | ||||
|             > | ||||
|               <el-option | ||||
|                 v-for="item in data.confirmerOptionsList" | ||||
|                 :key="item.CUSTOMERNAME_ID" | ||||
|                 :label="item.CUSTOMERNAME" | ||||
|                 :value="item.CUSTOMERNAME_ID" | ||||
|               /> | ||||
|             </el-select> | ||||
|           </el-form-item> | ||||
|         </el-col> | ||||
|         <el-col :span="8"> | ||||
|           <el-form-item label="联系人" prop="CONFIRMINGPERSON"> | ||||
|             <el-select | ||||
|               v-model="data.form.CONFIRMINGPERSON" | ||||
|               placeholder="请选择确认方联系人" | ||||
|               clearable | ||||
|               @change="changeCONFIRMINGPERSON" | ||||
|             > | ||||
|               <el-option | ||||
|                 v-for="contact in data.confirmerOptions" | ||||
|                 :key="contact.CONTACT_ID" | ||||
|                 :label="contact.CONTACT" | ||||
|                 :value="contact.CONTACT_ID" | ||||
|               /> | ||||
|             </el-select> | ||||
|           </el-form-item> | ||||
|         </el-col> | ||||
|         <el-col :span="8"> | ||||
|           <el-form-item label="联系电话" prop="CONFIRMINGPHONE"> | ||||
|             <el-input | ||||
|               v-model="data.form.CONFIRMINGPHONE" | ||||
|               placeholder="请输入联系电话" | ||||
|               clearable | ||||
|             /> | ||||
|           </el-form-item> | ||||
|         </el-col> | ||||
|       </el-row> | ||||
| 
 | ||||
|       <!-- 地点信息 --> | ||||
|       <el-divider content-position="left">地点信息</el-divider> | ||||
|       <el-row :gutter="20"> | ||||
|         <el-col :span="8"> | ||||
|           <el-form-item label="起运地点" prop="ORIGIN"> | ||||
|             <el-select | ||||
|               v-model="data.form.ORIGIN" | ||||
|               placeholder="请选择起运地点" | ||||
|               clearable | ||||
|               @update:model-value="fnShipmentAddrChange" | ||||
|             > | ||||
|               <el-option | ||||
|                 v-for="item in data.StartOptionsList" | ||||
|                 :key="item.LOCATIONNAME_ID" | ||||
|                 :label="item.LOCATIONNAME" | ||||
|                 :value="item.LOCATIONNAME_ID" | ||||
|               /> | ||||
|             </el-select> | ||||
|           </el-form-item> | ||||
|         </el-col> | ||||
|         <el-col :span="8"> | ||||
|           <el-form-item label="起运地址" prop="SHIPPINGADDRESS"> | ||||
|             <el-select | ||||
|               v-model="data.form.SHIPPINGADDRESS" | ||||
|               placeholder="请选择起运地址" | ||||
|               clearable | ||||
|               @change="changeSHIPPINGADDRESS" | ||||
|             > | ||||
|               <el-option | ||||
|                 v-for="item in data.StartOptions" | ||||
|                 :key="item.ADDRESSDETAILS_ID" | ||||
|                 :label="item.ADDRESSDETAILS" | ||||
|                 :value="item.ADDRESSDETAILS_ID" | ||||
|               /> | ||||
|             </el-select> | ||||
|           </el-form-item> | ||||
|         </el-col> | ||||
|         <el-col :span="8"> | ||||
|           <el-form-item label="行政区域" prop="STARTADMINISTRATIVEAREA"> | ||||
|             <el-input | ||||
|               v-model="data.form.STARTADMINISTRATIVEAREA" | ||||
|               placeholder="请输入行政区域" | ||||
|               clearable | ||||
|             /> | ||||
|           </el-form-item> | ||||
|         </el-col> | ||||
|         <el-col :span="8"> | ||||
|           <el-form-item label="目的地点" prop="DESTINATION"> | ||||
|             <el-select | ||||
|               v-model="data.form.DESTINATION" | ||||
|               placeholder="请选择目的地点" | ||||
|               clearable | ||||
|               @update:model-value="fnGogalAddrChange" | ||||
|             > | ||||
|               <el-option | ||||
|                 v-for="item in data.EndOptionsList" | ||||
|                 :key="item.LOCATIONNAME_ID" | ||||
|                 :label="item.LOCATIONNAME" | ||||
|                 :value="item.LOCATIONNAME_ID" | ||||
|               /> | ||||
|             </el-select> | ||||
|           </el-form-item> | ||||
|         </el-col> | ||||
|         <el-col :span="8"> | ||||
|           <el-form-item label="目的地址" prop="DESTINATIONADDRESS"> | ||||
|             <el-select | ||||
|               v-model="data.form.DESTINATIONADDRESS" | ||||
|               placeholder="请选择起运地址" | ||||
|               clearable | ||||
|               @change="changeDESTINATIONADDRESS" | ||||
|             > | ||||
|               <el-option | ||||
|                 v-for="item in data.EndOptions" | ||||
|                 :key="item.ADDRESSDETAILS_ID" | ||||
|                 :label="item.ADDRESSDETAILS" | ||||
|                 :value="item.ADDRESSDETAILS_ID" | ||||
|               /> | ||||
|             </el-select> | ||||
|           </el-form-item> | ||||
|         </el-col> | ||||
|         <el-col :span="8"> | ||||
|           <el-form-item label="行政区域" prop="ENDDMINISTRATIVEAREA"> | ||||
|             <el-input | ||||
|               v-model="data.form.ENDDMINISTRATIVEAREA" | ||||
|               placeholder="请输入行政区域" | ||||
|               clearable | ||||
|             /> | ||||
|           </el-form-item> | ||||
|         </el-col> | ||||
|       </el-row> | ||||
|     </el-form> | ||||
|     <div class="tc mt-10"> | ||||
|       <el-button type="primary" @click="fnSubmit">确定</el-button> | ||||
|     </div> | ||||
|   </layout-card> | ||||
| </template> | ||||
| 
 | ||||
| <script setup> | ||||
| import { | ||||
|   getSafetyWaybillreInfo, | ||||
|   editSafetyWaybillreInfo, | ||||
|   getUserPersonTypeListAll, | ||||
| } from "@/request/waybill_registration.js"; | ||||
| import { onMounted, reactive, ref, watchEffect } from "vue"; | ||||
| import useFormValidate from "@/assets/js/useFormValidate.js"; | ||||
| import { ElMessage } from "element-plus"; | ||||
| import LayoutDepartment from "@/components/department/index.vue"; | ||||
| import { getUserListAll } from "@/request/data_dictionary.js"; | ||||
| import { getTrafficCustomerSelectList } from "@/request/customer_management.js"; | ||||
| import { getTrafficLocationSelectList } from "@/request/location_management.js"; | ||||
| import { getOperationVehicleList } from "@/request/operation_vehicle.js"; | ||||
| import { useRoute, useRouter } from "vue-router"; | ||||
| import { getFreightTrailerList } from "@/request/enterprise_management.js"; | ||||
| 
 | ||||
| const formRef = ref(null); | ||||
| 
 | ||||
| const route = useRoute(); | ||||
| const WAYBILLREGISTRATION_ID = route.query.WAYBILLREGISTRATION_ID; | ||||
| 
 | ||||
| const rules = { | ||||
|   CORPINFO_ID: [ | ||||
|     { required: true, message: "请输入运输企业名称", trigger: "blur" }, | ||||
|   ], | ||||
|   DISPATCHER: [ | ||||
|     { required: true, message: "请输入调度人姓名", trigger: "blur" }, | ||||
|   ], | ||||
|   SHIPPINGDATE: [ | ||||
|     { required: true, message: "请选择承运日期", trigger: "change" }, | ||||
|   ], | ||||
|   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" }, | ||||
|   ], | ||||
|   CLIENT: [{ required: true, message: "请选择委托方名称", trigger: "change" }], | ||||
|   CLIENTCONTACTPERSON: [ | ||||
|     { required: true, message: "请输入联系人姓名", trigger: "blur" }, | ||||
|   ], | ||||
|   CLIENTCONTACTPHONE: [ | ||||
|     { required: true, message: "请输入联系电话", trigger: "blur" }, | ||||
|     { min: 11, message: "号码格式错误", trigger: "blur" }, | ||||
|   ], | ||||
|   CONFIRMINGPHONE: [ | ||||
|     { required: true, message: "请输入联系电话", trigger: "blur" }, | ||||
|     { min: 11, message: "号码格式错误", trigger: "blur" }, | ||||
|   ], | ||||
|   CONFIRMER: [ | ||||
|     { required: true, message: "请选择确认方名称", trigger: "change" }, | ||||
|   ], | ||||
|   CONFIRMINGPERSON: [ | ||||
|     { required: true, message: "请选择确认方联系人", trigger: "change" }, | ||||
|   ], | ||||
|   ORIGIN: [{ required: true, message: "请选择起运地点", trigger: "change" }], | ||||
|   SHIPPINGADDRESS: [ | ||||
|     { required: true, message: "请输入起运地址", trigger: "blur" }, | ||||
|   ], | ||||
|   DESTINATION: [ | ||||
|     { required: true, message: "请选择目的地点", trigger: "change" }, | ||||
|   ], | ||||
|   DESTINATIONADDRESS: [ | ||||
|     { required: true, message: "请输入目的地址", trigger: "blur" }, | ||||
|   ], | ||||
|   PRACTITIONER: [ | ||||
|     { required: true, message: "请选择从业人员", trigger: "change" }, | ||||
|   ], | ||||
| }; | ||||
| 
 | ||||
| const data = reactive({ | ||||
|   form: { | ||||
|     CORPINFO_ID: "", | ||||
|     DISPATCHER: [], | ||||
|     DEPARTMENT_ID: "", | ||||
|     POST_ID: "", | ||||
|     USER_ID: "", | ||||
|     SHIPPINGDATE: "", | ||||
|     IDENTITYID: "", | ||||
|     TRUCKCART: "", | ||||
|     EMPLOYEEPHONE: "", | ||||
|     PRACTITIONER: "", | ||||
|     TRANSPORTVEHICLE: "", | ||||
|     CLIENT: "", | ||||
|     CLIENTCONTACTPERSON: "", | ||||
|     CLIENTCONTACTPHONE: "", | ||||
|     CONFIRMER: "", | ||||
|     CONFIRMINGPERSON: "", | ||||
|     CONFIRMINGPHONE: "", | ||||
|     ORIGIN: "", | ||||
|     SHIPPINGADDRESS: "", | ||||
|     STARTADMINISTRATIVEAREA: "", | ||||
|     DESTINATION: "", | ||||
|     DESTINATIONADDRESS: "", | ||||
|     ENDDMINISTRATIVEAREA: "", | ||||
|     WAYBILLNUMBER: "", | ||||
|   }, | ||||
|   clientOptions: [], // 委托方选项 | ||||
|   confirmerOptions: [], // 确认方选项 | ||||
|   StartOptions: [], // 起始地 | ||||
|   EndOptions: [], // 目的地 | ||||
|   OperationVehicle: [], // 运输车辆 | ||||
| 
 | ||||
|   StartOptionsList: [], | ||||
|   EndOptionsList: [], | ||||
|   clientOptionsList: [], | ||||
|   confirmerOptionsList: [], | ||||
|   USER: [], | ||||
| }); | ||||
| const router = useRouter(); | ||||
| 
 | ||||
| const fnGetData = async () => { | ||||
|   if (!WAYBILLREGISTRATION_ID) return; | ||||
|   const resData = await getSafetyWaybillreInfo({ WAYBILLREGISTRATION_ID }); | ||||
|   data.form = resData.pd; | ||||
|   data.form.DISPATCHER = data.form.DISPATCHER.split(","); | ||||
|   data.form.CLIENTCONTACTPERSON = data.form.ENTRUST_PERSON; // 委托确认方 | ||||
|   data.form.CONFIRMINGPERSON = data.form.CONFIRM_PERSON; // 确认方地址 | ||||
|   data.form.SHIPPINGADDRESS = data.form.SHIPPING_ADDR; // 起运地址 | ||||
|   data.form.DESTINATIONADDRESS = data.form.DESTINATION_ADDR; // 目的地址 | ||||
|   data.userList = data.form.names; // 获取部门下的或有人员 | ||||
| }; | ||||
| fnGetData(); | ||||
| const fnClientChange = () => { | ||||
|   data.form.CLIENTCONTACTPERSON = ""; | ||||
|   data.form.CLIENTCONTACTPHONE = ""; | ||||
|   data.clientOptions = []; | ||||
| }; | ||||
| 
 | ||||
| const fnConfirmerChange = () => { | ||||
|   data.form.CONFIRMINGPERSON = ""; | ||||
|   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 () => { | ||||
|   const selectedClient = data.clientOptionsList.find( | ||||
|     (item) => item.CUSTOMERNAME_ID === data.form.CLIENT | ||||
|   ); | ||||
|   data.clientOptions = selectedClient ? selectedClient.CONTACTS : []; | ||||
| }; | ||||
| 
 | ||||
| const fnClientConfirmedChange = async () => { | ||||
|   const selectedClient = data.confirmerOptionsList.find( | ||||
|     (item) => item.CUSTOMERNAME_ID === data.form.CONFIRMER | ||||
|   ); | ||||
|   data.confirmerOptions = selectedClient ? selectedClient.CONTACTS : []; | ||||
| }; | ||||
| 
 | ||||
| const fnClientShipmentAddr = async () => { | ||||
|   const selectedLocation = data.StartOptionsList.find( | ||||
|     (location) => location.LOCATIONNAME_ID === data.form.ORIGIN | ||||
|   ); | ||||
|   // 更新地址选项 | ||||
|   data.StartOptions = selectedLocation ? selectedLocation.LOCATION : []; | ||||
| }; | ||||
| 
 | ||||
| const fnGoalAddrChange = async () => { | ||||
| 
 | ||||
|   const selectedDestination = data.EndOptionsList.find( | ||||
|     (location) => location.LOCATIONNAME_ID === data.form.DESTINATION | ||||
|   ); | ||||
| 
 | ||||
|   // 更新目的地址选项 | ||||
|   data.EndOptions = selectedDestination ? selectedDestination.LOCATION : []; | ||||
| }; | ||||
| 
 | ||||
| const changeCLIENTCONTACTPERSON = (contactPersonId) => { | ||||
|   const selectedContact = data.clientOptions.find( | ||||
|     (item) => item.CONTACT_ID === contactPersonId | ||||
|   ); | ||||
| 
 | ||||
|   data.form.CLIENTCONTACTPHONE = selectedContact | ||||
|     ? selectedContact.CONTACTPHONE | ||||
|     : ""; | ||||
| }; | ||||
| const changeCONFIRMINGPERSON = (contactPersonId) => { | ||||
|   // 在联系人列表中找到选中的联系人 | ||||
|   const selectedContact = data.confirmerOptions.find( | ||||
|     (item) => item.CONTACT_ID === contactPersonId | ||||
|   ); | ||||
| 
 | ||||
|   // 设置联系电话 | ||||
|   data.form.CONFIRMINGPHONE = selectedContact | ||||
|     ? selectedContact.CONTACTPHONE | ||||
|     : ""; | ||||
| }; | ||||
| 
 | ||||
| const fnGetUnitsList = async () => { | ||||
|   const resData = await getUserPersonTypeListAll({}); | ||||
|   data.userTypeList = resData.userList; | ||||
| }; | ||||
| fnGetUnitsList(); | ||||
| 
 | ||||
| const fnVehicle = async () => { | ||||
|   const res = await getOperationVehicleList(); | ||||
|   const varList = res.varList || []; | ||||
|   data.OperationVehicle = varList.map((item) => item.PLATE_NUMBER); | ||||
| }; | ||||
| 
 | ||||
| const fnTruck = async () => { | ||||
|   const res = await getFreightTrailerList(); | ||||
|   const varList = res.varList || []; | ||||
|   data.OperationTruck = varList.map((item) => item.PLATE_NUMBER); | ||||
| }; | ||||
| 
 | ||||
| const fnCustomerType = async () => { | ||||
|   const res = await getTrafficCustomerSelectList(); | ||||
|   const varList = res.varList; | ||||
|   const clientMap = new Map(); | ||||
|   varList.forEach((item) => { | ||||
|     if (item.CUSTOMERTYPE === "1") { | ||||
|       if (!clientMap.has(item.CUSTOMERNAME)) { | ||||
|         clientMap.set(item.CUSTOMERNAME, { | ||||
|           CUSTOMERNAME: item.CUSTOMERNAME, | ||||
|           CUSTOMERNAME_ID: item.CUSTOMERNAME_ID, | ||||
|           CONTACTS: [], | ||||
|         }); | ||||
|       } | ||||
|       // 将联系人信息添加到CUSTOMERNAME对应的数组中。 | ||||
|       clientMap.get(item.CUSTOMERNAME).CONTACTS.push({ | ||||
|         CONTACT: item.CONTACT, | ||||
|         CONTACT_ID: item.CONTACT_ID, | ||||
|         CONTACTPHONE: item.CONTACTPHONE, | ||||
|       }); | ||||
|     } | ||||
|   }); | ||||
|   data.clientOptionsList = [...clientMap.values()]; | ||||
| 
 | ||||
|   const confirmerMap = new Map(); | ||||
|   varList.forEach((item) => { | ||||
|     if (item.CUSTOMERTYPE === "2") { | ||||
|       if (!confirmerMap.has(item.CUSTOMERNAME)) { | ||||
|         confirmerMap.set(item.CUSTOMERNAME, { | ||||
|           CUSTOMERNAME: item.CUSTOMERNAME, | ||||
|           CUSTOMERNAME_ID: item.CUSTOMERNAME_ID, | ||||
|           CONTACTS: [], | ||||
|         }); | ||||
|       } | ||||
|       // 将联系人信息添加到CUSTOMERNAME对应的数组中。 | ||||
|       confirmerMap.get(item.CUSTOMERNAME).CONTACTS.push({ | ||||
|         CONTACT: item.CONTACT, | ||||
|         CONTACT_ID: item.CONTACT_ID, | ||||
|         CONTACTPHONE: item.CONTACTPHONE, | ||||
|       }); | ||||
|     } | ||||
|   }); | ||||
|   data.confirmerOptionsList = [...confirmerMap.values()]; | ||||
| }; | ||||
| fnCustomerType(); | ||||
| const fnLocation = async () => { | ||||
|   const res = await getTrafficLocationSelectList(); | ||||
|   const varList = res.varList || []; | ||||
| 
 | ||||
|   const StartOptionstMap = new Map(); | ||||
|   varList.forEach((item) => { | ||||
|     if (item.LOCATIONTYPE === "1") { | ||||
|       if (!StartOptionstMap.has(item.LOCATIONNAME)) { | ||||
|         StartOptionstMap.set(item.LOCATIONNAME, { | ||||
|           LOCATIONNAME: item.LOCATIONNAME, | ||||
|           LOCATIONNAME_ID: item.LOCATIONNAME_ID, | ||||
|           LOCATION: [], | ||||
|         }); | ||||
|       } | ||||
|       // 将联系人信息添加到CUSTOMERNAME对应的数组中。 | ||||
|       StartOptionstMap.get(item.LOCATIONNAME).LOCATION.push({ | ||||
|         ADDRESSDETAILS: item.ADDRESSDETAILS, | ||||
|         ADDRESSDETAILS_ID: item.ADDRESSDETAILS_ID, | ||||
|         ADMINISTRATIVEREGIONS: item.ADMINISTRATIVEREGIONS, | ||||
|       }); | ||||
|     } | ||||
|   }); | ||||
|   data.StartOptionsList = [...StartOptionstMap.values()]; | ||||
| 
 | ||||
|   const EndOptionsMap = new Map(); | ||||
|   varList.forEach((item) => { | ||||
|     if (item.LOCATIONTYPE === "2") { | ||||
|       if (!EndOptionsMap.has(item.LOCATIONNAME)) { | ||||
|         EndOptionsMap.set(item.LOCATIONNAME, { | ||||
|           LOCATIONNAME: item.LOCATIONNAME, | ||||
|           LOCATIONNAME_ID: item.LOCATIONNAME_ID, | ||||
|           LOCATION: [], | ||||
|         }); | ||||
|       } | ||||
|       // 将联系人信息添加到CUSTOMERNAME对应的数组中。 | ||||
|       EndOptionsMap.get(item.LOCATIONNAME).LOCATION.push({ | ||||
|         ADDRESSDETAILS: item.ADDRESSDETAILS, | ||||
|         ADDRESSDETAILS_ID: item.ADDRESSDETAILS_ID, | ||||
|         ADMINISTRATIVEREGIONS: item.ADMINISTRATIVEREGIONS, | ||||
|       }); | ||||
|     } | ||||
|   }); | ||||
|   data.EndOptionsList = [...EndOptionsMap.values()]; | ||||
| }; | ||||
| 
 | ||||
| const changeSHIPPINGADDRESS = (addressDetailsId) => { | ||||
|   // 找到匹配的地址信息 | ||||
|   const matchingAddress = data.StartOptionsList.flatMap( | ||||
|     (item) => item.LOCATION | ||||
|   ).find((address) => address.ADDRESSDETAILS_ID === addressDetailsId); | ||||
| 
 | ||||
|   // 更新表单的行政区域字段 | ||||
|   data.form.STARTADMINISTRATIVEAREA = matchingAddress | ||||
|     ? matchingAddress.ADMINISTRATIVEREGIONS | ||||
|     : ""; | ||||
| }; | ||||
| const changeDESTINATIONADDRESS = (destinationAddressId) => { | ||||
|   // 找到匹配的目的地址信息 | ||||
|   const matchingAddress = data.EndOptionsList.flatMap( | ||||
|     (item) => item.LOCATION | ||||
|   ).find((address) => address.ADDRESSDETAILS_ID === destinationAddressId); | ||||
| 
 | ||||
|   // 更新表单的目的地行政区域字段 | ||||
|   data.form.ENDDMINISTRATIVEAREA = matchingAddress | ||||
|     ? matchingAddress.ADMINISTRATIVEREGIONS | ||||
|     : ""; | ||||
| }; | ||||
| const fnDepartmentChange = async () => { | ||||
|   data.userList = []; | ||||
|   data.form.USER_ID = ""; | ||||
|   data.form.DISPATCHER = ""; | ||||
|   await fnGetUser(data.form.DEPARTMENT_ID); | ||||
| }; | ||||
| const fnGetUser = async (DEPARTMENT_ID) => { | ||||
|   const resData = await getUserListAll({ DEPARTMENT_ID }); | ||||
|   data.userList = resData.userList; | ||||
| }; | ||||
| 
 | ||||
| watchEffect(() => { | ||||
|   if (data.form.CLIENT) fnClientUserChange(); | ||||
|   if (data.form.CONFIRMER) fnClientConfirmedChange(); | ||||
|   if (data.form.ORIGIN) fnClientShipmentAddr(); | ||||
|   if (data.form.DESTINATION) fnGoalAddrChange(); | ||||
| }); | ||||
| 
 | ||||
| onMounted(async () => { | ||||
|   await fnCustomerType(); | ||||
|   await fnLocation(); | ||||
|   await fnVehicle(); | ||||
|   await fnTruck(); | ||||
| }); | ||||
| 
 | ||||
| const fnSubmit = async () => { | ||||
|   await useFormValidate(formRef); | ||||
|   const formData = new FormData(); | ||||
| 
 | ||||
|   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"); | ||||
|   Object.keys(data.form).forEach((key) => { | ||||
|     if (Array.isArray(data.form[key])) { | ||||
|       data.form[key] = []; | ||||
|     } else { | ||||
|       data.form[key] = ""; | ||||
|     } | ||||
|   }); | ||||
| }; | ||||
| </script> | ||||
| 
 | ||||
| <style scoped lang="scss"> | ||||
| .flexBox { | ||||
|   display: flex; | ||||
|   align-items: flex-end; | ||||
| 
 | ||||
|   .addBtn { | ||||
|     margin-left: 12px; | ||||
|   } | ||||
| } | ||||
| </style> | ||||
|  | @ -67,6 +67,19 @@ | |||
|         </el-table-column> | ||||
|         <el-table-column label="操作" width="120"> | ||||
|           <template #default="{ row }"> | ||||
|             <el-button | ||||
|               type="primary" | ||||
|               text | ||||
|               link | ||||
|               @click=" | ||||
|                 router.push({ | ||||
|                   path: '/electronic_waybill_management/waybill_registration/edit', | ||||
|                   query: { WAYBILLREGISTRATION_ID: row.WAYBILLREGISTRATION_ID }, | ||||
|                 }) | ||||
|               " | ||||
|             > | ||||
|               修改 | ||||
|             </el-button> | ||||
|             <el-button | ||||
|               type="danger" | ||||
|               text | ||||
|  |  | |||
|  | @ -209,7 +209,7 @@ const fnSubmit = async () => { | |||
|     type: "success", | ||||
|     duration: 3000, | ||||
|   }); | ||||
|   router.push("/safety_production_related/security_notice"); | ||||
|   router.back(); | ||||
| }; | ||||
| 
 | ||||
| const fnSelectPersonSubmit = (selectionData) => { | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue