From 54e07b96bd7fdae9915fcf06de2a16bcb613aa74 Mon Sep 17 00:00:00 2001
From: wujianwei <wjw@11.com>
Date: 星期五, 06 三月 2026 16:28:37 +0800
Subject: [PATCH] 新增备注日志

---
 ui/admin-ui3/src/views/tms/tmsDispatchOrder/index.vue |  496 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 490 insertions(+), 6 deletions(-)

diff --git a/ui/admin-ui3/src/views/tms/tmsDispatchOrder/index.vue b/ui/admin-ui3/src/views/tms/tmsDispatchOrder/index.vue
index 72a52fa..051f5ba 100644
--- a/ui/admin-ui3/src/views/tms/tmsDispatchOrder/index.vue
+++ b/ui/admin-ui3/src/views/tms/tmsDispatchOrder/index.vue
@@ -44,6 +44,11 @@
             v-hasPermi="['tms:tmsDispatchOrder:export']"
         >瀵煎嚭
         </el-button>
+        <el-button
+            type="info"
+            icon="Upload"
+            @click="handleImport"
+            v-hasPermi="['tms:tmsDispatchOrder:import']">瀵煎叆</el-button>
 <!--        <el-button-->
 <!--            type="success"-->
 <!--            icon="Promotion"-->
@@ -100,6 +105,14 @@
             @click="handlePrint"
             v-hasPermi="['tms:tmsDispatchOrder:print']"
         >鎵胯繍鍗曟墦鍗�
+        </el-button>
+        <el-button
+            type="primary"
+            icon="UserFilled"
+            :disabled="!zxhdjSingle"
+            @click="handleZXHDJ"
+            v-hasPermi="['tms:tmsDispatchOrder:zzdj']"
+        >瑁呭嵏璐х偣鐧昏
         </el-button>
       </template>
       <template #menu-before="{row}">
@@ -269,7 +282,7 @@
       </div>
       <template #footer>
         <div class="dialog-footer">
-          <el-button type="primary" :loading="pageF.isUploading" @click="submitForm2">
+          <el-button type="primary" v-if="optionType != 'view'" :loading="pageF.isUploading" @click="submitForm2">
             {{ pageF.isUploading ? '鎻愪氦涓�' : '纭� 瀹�' }}
           </el-button>
           <el-button @click="cancelBox2">鍙� 娑�</el-button>
@@ -493,6 +506,91 @@
         </div>
       </template>
     </el-dialog>
+
+    <!-- 鐢ㄦ埛瀵煎叆瀵硅瘽妗� -->
+    <el-dialog title="璋冨害鍗曞鍏�" v-model="upload.open" width="400px" append-to-body>
+      <el-upload
+          ref="uploadRef"
+          :limit="1"
+          accept=".xlsx, .xls"
+          :headers="upload.headers"
+          :action="upload.url + '?updateSupport=' + upload.updateSupport"
+          :disabled="upload.isUploading"
+          :on-progress="handleFileUploadProgress"
+          :on-success="handleFileSuccess"
+          :auto-upload="false"
+          drag
+      >
+        <el-icon class="el-icon--upload"><upload-filled /></el-icon>
+        <div class="el-upload__text">灏嗘枃浠舵嫋鍒版澶勶紝鎴�<em>鐐瑰嚮涓婁紶</em></div>
+        <template #tip>
+          <div class="el-upload__tip text-center">
+            <span>浠呭厑璁稿鍏ls銆亁lsx鏍煎紡鏂囦欢銆�</span>
+            <el-link type="primary" :underline="false" style="font-size:12px;vertical-align: baseline;" @click="importTemplate">涓嬭浇妯℃澘</el-link>
+          </div>
+        </template>
+      </el-upload>
+      <template #footer>
+        <div class="dialog-footer">
+          <el-button type="primary" @click="submitFileForm">纭� 瀹�</el-button>
+          <el-button @click="upload.open = false">鍙� 娑�</el-button>
+        </div>
+      </template>
+    </el-dialog>
+
+
+    <el-dialog title="棰勯厤璁㈠崟瑁呭嵏璐х偣鐧昏" v-model="open7" class="avue-dialog avue-dialog--top" width="80%">
+      <avue-form v-model="shipperReceiverForm"
+                 ref="shipperReceiverFormRef"
+                 :option="shipperReceiverFormOption">
+        <template #dispatchNos="{disabled}">
+            <div class="dispatchNos">
+              <el-tag
+                  v-for="tag in shipperReceiverForm.dispatchNos"
+                  :key="tag"
+                  closable
+                  @close="handleCloseDispatchNo(tag)"
+              >
+                {{ tag }}
+              </el-tag>
+            </div>
+
+        </template>
+        <template #shipperId="{disabled}">
+          <div style="display:flex; align-items: center;justify-content: space-between">
+            <avue-input-table :props="consignorProps" dataType="string"
+                              :children="consignorOption" :disabled="disabled"
+                              :on-load="onShipperLoad" suffixIcon="search"
+                              v-model="shipperReceiverForm.shipperId" style="width: 80%"
+                              @change="changeShipper2"
+                              placeholder="璇烽�夋嫨瑁呰揣鐐�"></avue-input-table>
+            <el-button icon="plus"  :disabled="disabled" @click="handleAddShipper2"></el-button>
+          </div>
+        </template>
+        <template #receiverId="{disabled}">
+          <div style="display:flex; align-items: center;justify-content: space-between">
+            <avue-input-table :props="consignorProps"
+                              :children="consignorOption" dataType="string"
+                              :on-load="onConsignorLoad" suffixIcon="search"
+                              v-model="shipperReceiverForm.receiverId"  :disabled="disabled"
+                              @change="changeReceiver2" style="width: 80%"
+                              placeholder="璇烽�夋嫨鍗歌揣鐐�"></avue-input-table>
+            <el-button icon="plus"  :disabled="disabled" @click="handleAddReceiver2"></el-button>
+          </div>
+        </template>
+      </avue-form>
+      <template #footer>
+        <div class="dialog-footer">
+          <el-button type="primary"
+                     :loading="pageF.isUploading" @click="submitZxForm">
+            {{ pageF.isUploading ? '鎻愪氦涓�' : '纭� 瀹�' }}
+          </el-button>
+
+          <el-button @click="open7 = false">鍙� 娑�</el-button>
+        </div>
+      </template>
+    </el-dialog>
+
   </basicContainer>
 </template>
 
@@ -505,8 +603,19 @@
   getTmsDispatchOrder,
   listTmsDispatchOrder,
   updateTmsDispatchOrder,
-  confirmOrder, copyOrder, okOrder, initGenerate, generateTmsDispatchOrder, dropHook,
-  connectHang,customsOrder,loadingOrder,checkCloseOrder,closeOrder,printDispatchOrder
+  confirmOrder,
+  copyOrder,
+  okOrder,
+  initGenerate,
+  generateTmsDispatchOrder,
+  dropHook,
+  connectHang,
+  customsOrder,
+  loadingOrder,
+  checkCloseOrder,
+  closeOrder,
+  printDispatchOrder,
+  importTemplateTmsDispatchOrder,ypdddjSumbit
 } from "@/api/tms/tmsDispatchOrder";
 import useCurrentInstance from "@/utils/useCurrentInstance";
 import {computed, onMounted, reactive, ref, toRefs, watch, getCurrentInstance, nextTick} from "vue";
@@ -522,7 +631,7 @@
 import {getTmsContainer, listTmsContainer} from "@/api/tms/tmsContainer";
 import {getTmsShelf, listTmsShelf} from "@/api/tms/tmsShelf";
 import {addTmsConsignor, getTmsConsignor, listTmsConsignor} from "@/api/tms/tmsConsignor";
-import {ElMessage, ElMessageBox} from "element-plus";
+import {ElMessage, ElMessageBox, type ElUpload} from "element-plus";
 import {addTmsTrip, listTmsTrip} from "@/api/tms/tmsTrip";
 import {
   addTmsFinanceDetail,
@@ -541,6 +650,7 @@
 import {getDicts} from "@/api/system/dict/data";
 import {pushTmsQuoteFee} from "@/api/tms/tmsQuoteFee";
 import { $Print } from '@smallwei/avue'
+import {getToken} from "@/utils/auth";
 
 const {appContext} = getCurrentInstance();
 
@@ -590,12 +700,14 @@
   isLoad: -1,
   open5:false,
   open6:false,
+  open7:false,
+  zxhdjSingle:false,
 })
 const {
   queryParams, form, page, selectionList, open3,
   boxTableData, optionType,
   boxFormOption, boxForm, boxTableOption, title, open, open2,
-  goodsTableData, goodsForm, actualForm, selectionList2,isCustoms,isLoad,open5,open6
+  goodsTableData, goodsForm, actualForm, selectionList2,isCustoms,isLoad,open5,open6,open7,zxhdjSingle
 } = toRefs(data);
 const option = ref({
   pageKey: 'TmsDispatchOrder',
@@ -2870,7 +2982,13 @@
     }
     isCustoms.value = isCustoms.value == 0 && !pageF.single ? 0 : -1;
     isLoad.value = isLoad.value == 0 && !pageF.single ? 0 : -1;
-    console.log(pageF.single)
+    zxhdjSingle.value = pageF.multiple|| true;
+    let yp = selection.filter((item:any) =>{
+      return item.orderType == 0
+    });
+    if(yp.length > 0){
+      zxhdjSingle.value = false;
+    }
   },
   getBeginListFunc: (params = {}) => {
     queryParams.value = proxy.addDateRangeNew(queryParams.value, queryParams.value?.createTimeRange, 'createTime') || {};
@@ -3256,6 +3374,9 @@
       if (districtId) data.districtId = districtId;
       if (streetId) data.streetId = streetId;
     }
+    if (shipperReceiverForm.value.customerId ){
+      form.value.customerId = shipperReceiverForm.value.customerId;
+    }
     listTmsConsignor({pageSize: page.pageSize, pageNum: page.currentPage, ...data,customerId: form.value.customerId}).then(res => {
       return callback({
         total: res.total,
@@ -3282,6 +3403,9 @@
       if (cityId) data.cityId = cityId;
       if (districtId) data.districtId = districtId;
       if (streetId) data.streetId = streetId;
+    }
+    if (shipperReceiverForm.value.customerId ){
+      form.value.customerId = shipperReceiverForm.value.customerId;
     }
     listTmsConsignor({pageSize: page.pageSize, pageNum: page.currentPage, ...data,customerId: form.value.customerId}).then(res => {
       return callback({
@@ -3949,6 +4073,359 @@
 
 
 }
+const upload = reactive({
+  // 鏄惁鏄剧ず寮瑰嚭灞傦紙鐢ㄦ埛瀵煎叆锛�
+  open: false,
+  // 鏄惁绂佺敤涓婁紶
+  isUploading: false,
+  // 鏄惁鏇存柊宸茬粡瀛樺湪鐨勭敤鎴锋暟鎹�
+  updateSupport: 0,
+  // 璁剧疆涓婁紶鐨勮姹傚ご閮�
+  headers: { Authorization: "Bearer " + getToken() },
+  // 涓婁紶鐨勫湴鍧�
+  url: import.meta.env.VITE_APP_BASE_API + "/tms/tmsDispatchOrder/importData"
+});
+
+
+const uploadRef = ref();
+
+function handleImport() {
+  upload.open = true;
+}
+
+
+/** 涓嬭浇妯℃澘鎿嶄綔 */
+function importTemplate() {
+  importTemplateTmsDispatchOrder();
+
+}
+const handleFileUploadProgress = (event:any, file:any) => {
+  upload.isUploading = true;
+};
+/** 鏂囦欢涓婁紶鎴愬姛澶勭悊 */
+const handleFileSuccess = (response:any, file:any) => {
+  upload.open = false;
+  upload.isUploading = false;
+  uploadRef.value!.clearFiles();
+  proxy.$alert("<div style='overflow: auto;overflow-x: hidden;max-height: 70vh;padding: 10px 20px 0;'>" + response.msg + "</div>", "瀵煎叆缁撴灉", { dangerouslyUseHTMLString: true });
+  onLoad(page.value);
+};
+/** 鎻愪氦涓婁紶鏂囦欢 */
+function submitFileForm() {
+  uploadRef.value!.submit();
+}
+const shipperReceiverForm = ref<any>({});
+const shipperReceiverFormRef = ref();
+const shipperReceiverFormOption = ref({
+  menuBtn: false, labelWidth: 140,
+  column: {
+    dispatchNos:{
+      label: '璋冨害鍗曞彿',span:24,
+      rules: [
+        {
+          required: true,
+          message: "璋冨害鍗曞彿涓嶈兘涓虹┖", trigger: "change"
+        }
+      ],
+    },
+    shipperId: {
+      label: '瑁呰揣鐐�', dataType: 'string',disabled:false,
+      display: true,
+      rules: [
+        {
+          required: true,
+          message: "瑁呰揣鐐逛笉鑳戒负绌�", trigger: "change"
+        }
+      ],
+
+    },
+    shipperRegionLabel: {
+      label: '瑁呰揣鐐硅鏀垮尯鍩�',
+      display: true, disabled: true
+
+    },
+    shipperAddress: {
+      label: '瑁呰揣鐐硅缁嗗湴鍧�',
+      display: true, disabled: true
+    },
+    shipperMobile: {
+      label: '瑁呰揣鐐硅仈绯绘柟寮�',
+      display: true, disabled: true
+    },
+    receiverId: {
+      label: '鍗歌揣鐐�',
+      display: true, dataType: 'string',disabled:false,
+      rules: [
+        {
+          required: true,
+          message: "鍗歌揣鐐逛笉鑳戒负绌�", trigger: "change"
+        }
+      ],
+    },
+    receiverRegionLabel: {
+      label: '鍗歌揣鐐硅鏀垮尯鍩�',
+      display: true, disabled: true
+    },
+    receiverAddress: {
+      label: '鍗歌揣鐐硅缁嗗湴鍧�',
+      display: true, disabled: true
+    },
+    receiverMobile: {
+      label: '鍗歌揣鐐硅仈绯绘柟寮�',
+      display: true, disabled: true
+    },
+  }
+});
+
+const changeShipper2 = ({value}: any) => {
+
+  if (value) {
+    let id = value;
+    if (Array.isArray(value)) {
+      id = value[0]
+    }
+    getTmsConsignor(id).then(res => {
+      let active = res.data || {};
+      let shipperRegionCode = '';
+      if (active.provinceId) {
+        shipperRegionCode = active.provinceId;
+      }
+      if (active.cityId) {
+        shipperRegionCode = shipperRegionCode + "," + active.cityId;
+
+      }
+      if (active.districtId) {
+        shipperRegionCode = shipperRegionCode + "," + active.districtId;
+
+      }
+      if (active.streetId) {
+        shipperRegionCode = shipperRegionCode + "," + active.streetId;
+      }
+      Object.assign(shipperReceiverForm.value, {
+        shipperId: active.id,
+        shipperName: active.consignorName,
+        shipperRegionLabel: active.regionLabel,
+        shipperAddress: active.addressDetail,
+        shipperMobile: active.contactPhone,
+        shipperRegionCode: shipperRegionCode
+      });
+    })
+  }
+}
+const changeReceiver2 = ({value}: any) => {
+
+  if (value) {
+    let id = value;
+    if (Array.isArray(value)) {
+      id = value[0]
+    }
+    getTmsConsignor(id).then(res => {
+      let active = res.data || {};
+      let receiverRegionCode = '';
+      if (active.provinceId) {
+        receiverRegionCode = active.provinceId;
+      }
+      if (active.cityId) {
+        receiverRegionCode = receiverRegionCode + "," + active.cityId;
+
+      }
+      if (active.districtId) {
+        receiverRegionCode = receiverRegionCode + "," + active.districtId;
+
+      }
+      if (active.streetId) {
+        receiverRegionCode = receiverRegionCode + "," + active.streetId;
+      }
+
+      Object.assign(shipperReceiverForm.value, {
+        receiverId: active.id,
+        receiverName: active.consignorName,
+        receiverRegionLabel: active.regionLabel,
+        receiverAddress: active.addressDetail,
+        receiverMobile: active.contactPhone,
+        receiverRegionCode: receiverRegionCode,
+      });
+    })
+  }
+}
+
+const hasDifferentCustomer = (() => {
+  const customerSet = new Set(
+      selectionList.value.map((item:any) => item.customerId)
+  );
+  return customerSet.size > 1;
+})();
+const handleZXHDJ = ()=>{
+  if(hasDifferentCustomer){
+    ElMessage.error('鍗曟鎿嶄綔鍙兘鎿嶄綔涓�涓鎴风殑鏁版嵁');
+    return;
+  }
+  let filter = selectionList.value.filter((item:any)=> !item.shipperId);
+  let filter2 = selectionList.value.filter((item:any)=> !item.receiverId);
+  let zLen = filter.length || 0;
+  let xLen = filter2.length || 0;
+  if (zLen == 0 && xLen == 0){
+    ElMessage.error('閫夋嫨鐨勬暟鎹凡瀹屾垚瀵硅鍗歌揣鐐圭櫥璁�');
+    return;
+  }
+  if(zLen >0 && xLen >0){
+    if (zLen > xLen){
+      ElMessage.error('閫夋嫨鐨勬暟鎹凡濉啓鍗歌揣鐐规暟鎹紝璇峰崟鐙紪杈�');
+      return;
+    }
+    if (zLen < xLen){
+      ElMessage.error('閫夋嫨鐨勬暟鎹凡濉啓瑁呰揣鐐规暟鎹紝璇峰崟鐙紪杈�');
+      return;
+    }
+  }
+  let item:any = selectionList.value[0];
+  shipperReceiverForm.value.customerId = item?.customerId
+  shipperReceiverForm.value.customerCode = item?.customerCode
+  shipperReceiverForm.value.customerName = item?.customerName;
+  shipperReceiverForm.value.dispatchNos = selectionList.value.map((item:any)=> item.dispatchNo) || [];
+
+  shipperReceiverFormOption.value.column.shipperId.disabled = zLen ==0;
+  shipperReceiverFormOption.value.column.shipperId.rules[0].required  = zLen !=0;
+  shipperReceiverFormOption.value.column.receiverId.disabled = xLen ==0;
+  shipperReceiverFormOption.value.column.receiverId.rules[0].required  = xLen !=0;
+
+
+  open7.value = true;
+}
+
+const handleAddShipper2 = () => {
+
+  form2.value = {
+    customerId: shipperReceiverForm.value.customerId,
+    customerSysCode: shipperReceiverForm.value.customerCode,
+    customerName: shipperReceiverForm.value.customerName,
+  };
+  dialForm.value = $DialogForm(appContext)({
+    title: '鏂板瑁呰揣鍦�',
+    data:form2.value,
+    width: '80%',
+    option: consignorAddOption.value,
+    menuPosition: 'right',
+    callback: (res:any,) => {
+      let data1 = res.data;
+      if (data1.mapLocationDetail){
+        data1.mapLocation = data1.mapLocationDetail[0]+','+data1.mapLocationDetail[1];
+        data1.addressDetail = data1.mapLocationDetail[2]
+      }
+      addTmsConsignor({...form2.value,...data1}).then(res2=>{
+        let active = res2.data || {};
+        if (active) {
+          let shipperRegionCode = '';
+          if (active.provinceId){
+            shipperRegionCode = active.provinceId;
+          }
+          if (active.cityId){
+            shipperRegionCode =shipperRegionCode+ ","+active.cityId;
+
+          }
+          if (active.districtId){
+            shipperRegionCode =shipperRegionCode+ ","+active.districtId;
+
+          }
+          if (active.streetId){
+            shipperRegionCode =shipperRegionCode+ ","+active.streetId;
+          }
+          Object.assign(shipperReceiverForm.value, {
+            shipperId: active.id,
+            shipperName: active.consignorName,
+            shipperRegionLabel: active.regionLabel,
+            shipperAddress: active.addressDetail,
+            shipperMobile: active.contactPhone,
+            shipperRegionCode:shipperRegionCode
+          });
+        }
+        dialForm.value.close();
+        res.done();
+      }).catch(err=>{
+        res.done();
+      })
+    },
+  })
+}
+
+const handleAddReceiver2 = () => {
+  if (!form.value.customerId){
+    return ElMessage.error('璇峰厛閫夋嫨杩愯緭璺嚎');
+  }
+  form2.value = {
+    customerId: shipperReceiverForm.value.customerId,
+    customerSysCode: shipperReceiverForm.value.customerCode,
+    customerName: shipperReceiverForm.value.customerName,
+  };
+  dialForm.value = $DialogForm(appContext)({
+    title: '鏂板鍗歌揣鍦�',
+    data:form2.value,
+    width: '80%',
+    option: consignorAddOption.value,
+    menuPosition: 'right',
+    callback: (res:any,) => {
+      let data1 = res.data;
+      if (data1.mapLocationDetail){
+        data1.mapLocation = data1.mapLocationDetail[0]+','+data1.mapLocationDetail[1];
+        data1.addressDetail = data1.mapLocationDetail[2]
+      }
+      addTmsConsignor({...form2.value,...data1}).then(res2=>{
+        let active = res2.data || {};
+        if (active) {
+          let receiverRegionCode = '';
+          if (active.provinceId){
+            receiverRegionCode = active.provinceId;
+          }
+          if (active.cityId){
+            receiverRegionCode =receiverRegionCode+ ","+active.cityId;
+
+          }
+          if (active.districtId){
+            receiverRegionCode =receiverRegionCode+ ","+active.districtId;
+
+          }
+          if (active.streetId){
+            receiverRegionCode =receiverRegionCode+ ","+active.streetId;
+          }
+
+          Object.assign(shipperReceiverForm.value, {
+            receiverId: active.id,
+            receiverName: active.consignorName,
+            receiverRegionLabel: active.regionLabel,
+            receiverAddress: active.addressDetail,
+            receiverMobile: active.contactPhone,
+            receiverRegionCode:receiverRegionCode,
+          });
+        }
+        dialForm.value.close();
+        res.done();
+      }).catch(err=>{
+        res.done();
+      })
+    },
+  })
+}
+
+const handleCloseDispatchNo = (tag:string)=>{
+  let indexOf = shipperReceiverForm.value.dispatchNos.indexOf(tag);
+  shipperReceiverForm.value.dispatchNos.splice(indexOf,1);
+}
+
+const submitZxForm = ()=>{
+  shipperReceiverFormRef.value.validate((valid: boolean,done:any) => {
+    if(valid){
+      ypdddjSumbit(shipperReceiverForm.value).then(res=>{
+        ElMessage.success('鐧昏鎴愬姛');
+        open7.value = false;
+        onLoad(page.value);
+
+        done();
+      }).catch(err=>{
+        done();
+      })
+    }
+  })
+}
 
 </script>
 <style lang="scss" scoped>
@@ -4004,4 +4481,11 @@
     word-break: break-all;
   }
 }
+.dispatchNos{
+  //border: 1px solid #ebeef5;
+  border-radius: 4px;
+  min-height: 73px;
+  padding: 1px 11px;
+  box-shadow: 0 0 0 1px var(--el-disabled-border-color) inset;
+}
 </style>
\ No newline at end of file

--
Gitblit v1.8.0