From 454b9913de030f24041a78639005c72bc1d8a0ea Mon Sep 17 00:00:00 2001
From: sen <sen@qq.com>
Date: 星期一, 30 三月 2026 17:57:04 +0800
Subject: [PATCH] 修改调度单

---
 ui/admin-ui3/src/views/tms/tmsDispatchOrder/index.vue |  270 +++++++++++++++++++++++++++++++++++++++--------------
 1 files changed, 196 insertions(+), 74 deletions(-)

diff --git a/ui/admin-ui3/src/views/tms/tmsDispatchOrder/index.vue b/ui/admin-ui3/src/views/tms/tmsDispatchOrder/index.vue
index 022d5cf..617f7c9 100644
--- a/ui/admin-ui3/src/views/tms/tmsDispatchOrder/index.vue
+++ b/ui/admin-ui3/src/views/tms/tmsDispatchOrder/index.vue
@@ -155,7 +155,7 @@
         </el-tooltip>
         <el-tooltip content="鏌ョ湅琛岀▼" placement="top">
           <el-link size="small" type="primary" v-if="![0, 1].includes(row.status)" @click="handleLogItinerary(row)"
-            v-hasPermi="['tms:tmsTrip:list']" class="link-btn" underline="never" icon="el-icon-view">
+            v-hasPermi="['tms:tmsTrip:list']" class="link-btn" underline="never" icon="Finished">
             &nbsp;
           </el-link>
         </el-tooltip>
@@ -165,13 +165,13 @@
             &nbsp;
           </el-link>
         </el-tooltip>
-
+        <!-- 
         <el-tooltip content="瀹屾垚琛岀▼" placement="top">
           <el-link size="small" type="primary" v-if="[2].includes(row.status)" @click="handleOk(row)" class="link-btn"
             v-hasPermi="['tms:tmsDispatchOrder:okOrder']" underline="never" icon="el-icon-circle-check">
             &nbsp;
           </el-link>
-        </el-tooltip>
+        </el-tooltip> -->
 
         <el-tooltip content="鏃ュ織" placement="top">
           <el-link size="small" type="primary" @click="handleFlow(row)" class="link-btn"
@@ -214,7 +214,7 @@
             min="0"></el-input-number>
         </template>
       </avue-crud>
-      <h2 v-if="optionType == 'addFinance'">瀹炴姤瀹為攢璐圭敤1</h2>
+      <h2 v-if="optionType == 'addFinance'">瀹炴姤瀹為攢璐圭敤</h2>
       <avue-form v-if="optionType == 'addItinerary' || optionType == 'addFinance'" v-model="boxForm" ref="boxFormRef"
         :option="boxFormOption">
 
@@ -348,7 +348,7 @@
       </avue-crud>
 
       <div v-if="active === 'tab4'">
-        <h2>瀹炴姤瀹為攢璐圭敤</h2>
+        <h2>瀹炴姤瀹為攢璐圭敤3</h2>
         <!-- <avue-form v-model="boxForm" ref="boxFormRef" :option="boxFormOption">
 
         </avue-form> -->
@@ -357,7 +357,6 @@
             <el-input-number v-model="row.actualFeeAmount" :precision="2" :min="0" controls-position="right"
               placeholder="杈撳叆閲戦" style="width: 100%" />
           </template>
-
           <template #currency="{ row }">
             <el-radio-group v-model="row.currency">
               <el-radio v-for="item in sys_currency" :key="item.value" :label="item.value">
@@ -366,8 +365,19 @@
             </el-radio-group>
           </template>
           <template #voucherUrl="{ row }">
-            <avue-upload v-model="row.voucherUrl" :action="'/common/upload2'" type="upload" accept="image/*"
-              @upload-after="(res, done, loading, column) => handleUploadAfter(res, done, loading, column, row)"></avue-upload>
+            <!-- <avue-upload v-model="row.voucherUrl" :action="'/common/upload2'" type="upload" accept="image/*"
+              @upload-after="(res, done, loading, column) => handleUploadAfter(res, done, loading, column, row)"></avue-upload> -->
+
+            <!-- 鍑瘉鍥剧墖 -->
+            <el-upload class="upload-demo" ref="uploadRef" :limit="1" drag :action="urlApi + '/common/upload2'" multiple
+              :show-file-list="true" :on-success="(res) => handleUploadAfter(res, row)"
+              :on-exceed="(files) => handleExceed(files, row)">
+              <el-icon class="el-icon--upload"><upload-filled /></el-icon>
+              <div class="el-upload__text">
+                鐐瑰嚮鎴栧皢鍥剧墖鎷栨嫿鍒版鍖哄煙涓婁紶
+              </div>
+
+            </el-upload>
           </template>
           <template #remark="{ row }">
             <el-input v-model="row.remark" placeholder="濉啓澶囨敞" clearable />
@@ -503,7 +513,7 @@
         <div class="dialog-footer">
           <el-button @click="print = 0" v-if="print == 1">閲嶆柊濉啓</el-button>
           <el-button type="primary" :loading="pageF.isUploading" @click="submitForm6">
-            {{ pageF.isUploading ? '鎻愪氦涓�' : '纭� 瀹�2' }}
+            {{ pageF.isUploading ? '鎻愪氦涓�' : '纭� 瀹�' }}
           </el-button>
 
           <el-button @click="open6 = false">鍙� 娑�</el-button>
@@ -611,10 +621,11 @@
   printDispatchOrder,
   importTemplateTmsDispatchOrder, ypdddjSumbit,
   tmsTmsDispatchOrderImportLog,
-  saveTmsFinanceDetail2
+  saveTmsFinanceDetail2,
+  getLastLicensePlate
 } from "@/api/tms/tmsDispatchOrder";
 import useCurrentInstance from "@/utils/useCurrentInstance";
-import { computed, onMounted, reactive, ref, toRefs, watch, getCurrentInstance, nextTick } from "vue";
+import { computed, onMounted, onBeforeUnmount, reactive, ref, toRefs, watch, getCurrentInstance, nextTick } from "vue";
 import { PagesInterface, PageQueryInterface } from "@/utils/globalInterface";
 import { usePagePlus } from "@/hooks/usePagePlus";
 import { hasPermission } from "@/utils/permissionUtils";
@@ -743,7 +754,7 @@
   labelWidth: 130,
   searchSpan: 6,
   searchLabelWidth: 150,
-  menuWidth: 300,
+  menuWidth: 350,
   height: 530,
   group: [
     {
@@ -1152,7 +1163,6 @@
             }
           ],
           change: ({ value }: any) => {
-            console.log(value)
             option.value.group.forEach((item: any) => {
               if (item.prop == 'pcxx') {
                 item.column.commissionModel.display = value != 1;
@@ -1275,24 +1285,64 @@
             }
           ],
           change: (val: any) => {
+            // 闃叉閲嶅鎵ц
+            if (data.isChanging) return;
+            data.isChanging = true;
+
             const table = crudRef.value?.getPropRef?.('mainDriverId')?.$refs?.temp;
-            if (!table) return;
+            if (!table) {
+              data.isChanging = false;
+              return;
+            }
+
             let active = table.active;
             if (Array.isArray(active)) active = active[0];
+
             if (active) {
               Object.assign(form.value, {
                 mainDriverId: active.id,
                 mainDriverName: active.driverName,
               });
+
+              // 鑾峰彇杞︾墝鍙峰苟璧嬪��
+              getLastLicensePlate(active.driverName).then(res => {
+                if (res.code == 200) {
+                  form.value.licensePlate = res.data.licensePlate;
+                    form.value.vehicleId = res.data.vehicleId
+                }
+              }).finally(() => {
+                data.isChanging = false;
+              });
+            } else {
+              data.isChanging = false;
             }
           },
+          // change: (val: any) => {
+          //   const table = crudRef.value?.getPropRef?.('mainDriverId')?.$refs?.temp;
+          //   if (!table) return;
+          //   let active = table.active;
+          //   if (Array.isArray(active)) active = active[0];
+          //   console.log(active,'888');
+
+          //   if (active) {
+          //     Object.assign(form.value, {
+          //       mainDriverId: active.id,
+          //       mainDriverName: active.driverName,
+          //     });
+          //     console.log(active.driverName,'44');
+          //     getLastLicensePlate(active.driverName).then(res => { 
+          //       console.log(res);
+
+          //     })
+          //   }
+          // },
           type: 'table', suffixIcon: 'search',
           children: {
             border: true,
             searchMenuSpan: 5,
             column: {
               vehicleProviderName: {
-                label: '杞﹁締鏈嶅姟鍟�', minWidth: 130,
+                label: '杞﹁締鏈嶅姟鍟�1', minWidth: 130,
                 search: true,
               },
               driverName: {
@@ -1403,7 +1453,7 @@
 
         },
         vehicleId: {
-          label: '杞︾墝鍙�', dataType: 'string',
+          label: '杞︾墝鍙�1', dataType: 'string',
           display: true,
           rules: [
             {
@@ -2182,7 +2232,7 @@
     },
   }
 })
-
+const urlApi = ref(import.meta.env.VITE_APP_BASE_API)
 const itineraryTableOption = ref({
   menu: false,
   addBtn: false,
@@ -2261,19 +2311,19 @@
       ],
     },
     currency: {
-      label: '甯佺',
+      label: '甯佸埗',
       display: true,
       type: 'radio', dataType: 'string', dicUrl: '/system/dict/data/type/sys_currency',
       rules: [
         {
           required: true,
-          message: "甯佺涓嶈兘涓虹┖", trigger: "change"
+          message: "甯佸埗涓嶈兘涓虹┖", trigger: "change"
         }
       ],
 
     },
     voucherUrl: {
-      label: '璐圭敤鍑瘉',
+      label: '璐圭敤鍑瘉1',
       display: true,
       accept: 'string', dataType: 'string',
       type: 'upload',
@@ -2324,7 +2374,7 @@
       display: true,
     },
     currency: {
-      label: '甯佺',
+      label: '甯佸埗',
       display: true,
       type: 'radio', dataType: 'string', dicUrl: '/system/dict/data/type/sys_currency',
     },
@@ -3114,48 +3164,46 @@
   getBeginListFunc: (params = {}) => {
     // 1. 鏃ユ湡杞崲
     let newParams = <any>{ ...params };
-    console.log(newParams, '2');
-   if (newParams) {
-  // 1. 瀹氫箟鏃ユ湡瀛楁鏄犲皠 (鏁扮粍鍚� : 鎺ュ彛闇�瑕佺殑鍓嶇紑)
-  // 杩欐牱鍐欑殑濂藉鏄細濡傛灉浣犳湁澶氫釜鏃ユ湡锛岀洿鎺ュ湪杩欓噷娣诲姞涓�琛屽嵆鍙�
-  const dateMap = {
-    confirmTimeRangeArray: 'confirmTimeRange',
-    createTimeRangeArray: 'createTime',
-    updateTimeRangeArray: 'updateTimeRange',
-    okTimeRangeArray: 'okTime',
-    orderTimeRangeArray: 'orderTime'
-  };
+    if (newParams) {
+      // 1. 瀹氫箟鏃ユ湡瀛楁鏄犲皠 (鏁扮粍鍚� : 鎺ュ彛闇�瑕佺殑鍓嶇紑)
+      // 杩欐牱鍐欑殑濂藉鏄細濡傛灉浣犳湁澶氫釜鏃ユ湡锛岀洿鎺ュ湪杩欓噷娣诲姞涓�琛屽嵆鍙�
+      const dateMap = {
+        confirmTimeRangeArray: 'confirmTimeRange',
+        createTimeRangeArray: 'createTime',
+        updateTimeRangeArray: 'updateTimeRange',
+        okTimeRangeArray: 'okTime',
+        orderTimeRangeArray: 'orderTime'
+      };
 
-  // 2. 閬嶅巻澶勭悊鏃ユ湡
-  Object.keys(dateMap).forEach(arrayKey => {
-    const prefix = dateMap[arrayKey];
-    const range = newParams[arrayKey];
+      // 2. 閬嶅巻澶勭悊鏃ユ湡
+      Object.keys(dateMap).forEach(arrayKey => {
+        const prefix = dateMap[arrayKey];
+        const range = newParams[arrayKey];
 
-    if (Array.isArray(range) && range.length > 0) {
-      // 璧嬪�� Begin 鍜� End
-      newParams[`${prefix}Begin`] = range[0];
-      newParams[`${prefix}End`] = range[1];
+        if (Array.isArray(range) && range.length > 0) {
+          // 璧嬪�� Begin 鍜� End
+          newParams[`${prefix}Begin`] = range[0];
+          newParams[`${prefix}End`] = range[1];
+        }
+
+        // 銆愭牳蹇冩敼鍔ㄣ�戯細鏃犺鏄惁鏈夊�硷紝澶勭悊瀹屽悗閮芥妸鍘熷鐨� Array 瀛楁鍒犳帀
+        // 杩欐牱璇锋眰閲屽氨涓嶄細鍑虹幇 confirmTimeRangeArray: [...]
+        delete newParams[arrayKey];
+      });
+
+      // 3. 閫氱敤娓呮礂锛氬垹闄ゆ墍鏈夌┖瀛楃涓层�乶ull 鎴� undefined 鐨勫叾浠栧瓧娈�
+      Object.keys(newParams).forEach(key => {
+        const val = newParams[key];
+        if (val === '' || val === null || val === undefined) {
+          delete newParams[key];
+        }
+      });
+
+    } else {
+      newParams = {};
     }
-    
-    // 銆愭牳蹇冩敼鍔ㄣ�戯細鏃犺鏄惁鏈夊�硷紝澶勭悊瀹屽悗閮芥妸鍘熷鐨� Array 瀛楁鍒犳帀
-    // 杩欐牱璇锋眰閲屽氨涓嶄細鍑虹幇 confirmTimeRangeArray: [...]
-    delete newParams[arrayKey];
-  });
 
-  // 3. 閫氱敤娓呮礂锛氬垹闄ゆ墍鏈夌┖瀛楃涓层�乶ull 鎴� undefined 鐨勫叾浠栧瓧娈�
-  Object.keys(newParams).forEach(key => {
-    const val = newParams[key];
-    if (val === '' || val === null || val === undefined) {
-      delete newParams[key];
-    }
-  });
-
-} else {
-  newParams = {};
-}
-
-console.log('鏈�缁堝彂閫佺粰鎺ュ彛鐨勫弬鏁帮細', newParams);
-return newParams;
+    return newParams;
     // newParams = proxy.addDateRangeNew(queryParams.value, queryParams.value?.createTimeRangeArray, 'createTime');
     // newParams = proxy.addDateRangeNew(queryParams.value, queryParams.value?.updateTimeRangeArray, 'updateTime');
     // newParams = proxy.addDateRangeNew(queryParams.value, queryParams.value?.confirmTimeRangeArray, 'confirmTime');
@@ -3240,7 +3288,6 @@
 const handleUploadItinerary = (row: any) => {
   optionType.value = 'addItinerary';
   boxFormOption.value = itineraryOption.value;
-  console.log(itineraryOption.value);
 
   boxTableOption.value = itineraryTableOption.value;
   listTmsTrip({ dispatchOrderId: row.id, pageNum: 1, pageSize: 999 }).then(res => {
@@ -3256,7 +3303,6 @@
       vehicleNumber: row.licensePlate,
       vehicleId: row.vehicleId,
     }
-    console.log(boxForm.value);
 
   })
 }
@@ -3900,7 +3946,6 @@
                   form2.value.districtId = districtCode;
                   form2.value.streetId = townshipCode;
                   form2.value.dispatchTransportArea = params.regeocode.formatted_address || params.regeocode.formattedAddress;
-                  console.log(form2.value, "form2")
                 }
               });
             }
@@ -4109,7 +4154,6 @@
 getQuotationItems();
 
 const getTabData = (val: string) => {
-  console.log(val)
   let filter = quotationItems.value.filter((item: any) => {
     return item.remark == val;
   });
@@ -4127,9 +4171,7 @@
     dispatchOrderId: form.value.id, financeType: 2,
     pageNum: 1, pageSize: 999
   }).then(async res => {
-
     boxTableData.value = res.rows || [];
-
     boxForm.value = {
       dispatchOrderId: form.value.id,
       dataSource: 0,
@@ -4173,8 +4215,12 @@
 
     // 3. 澶勭悊鍑瘉 URL (濡傛灉鏈夊崟寮犳垨澶氬紶涓婁紶鐨勯�昏緫)
     // 鍋囪鍚庣闇�瑕佺殑鏄�楀彿鍒嗛殧鐨勫瓧绗︿覆
-    const submitData = validDetails.map(item => {
+    const submitData = validDetails.map((item: any) => {
       let url = item.voucherUrl;
+      item.dispatchOrderId = form.value.id;
+      item.financeType = 2;
+      item.status = 0;
+      item.dataSource = 1;
       if (Array.isArray(url)) {
         url = url.join(',');
       }
@@ -4735,13 +4781,12 @@
     },
     {
 
-      label: '璐圭敤鍑瘉',
+      label: '璐圭敤鍑瘉2',
       display: true,
       span: 24,
       accept: 'string', dataType: 'object',
       type: 'upload',
       // action: '/common/upload2',
-
       prop: 'voucherUrl', // 杩欓噷鏀规垚 prop 灞炴��
       slot: true,        // 寮�鍚彃妲�
       width: 200
@@ -4755,6 +4800,7 @@
 });
 // 3. 鍥炴樉鍒濆鍖�
 const initExpenditureData = () => {
+  tmsFinanceDetails.value = []
   if (fee_type.value && fee_type.value.length > 0 && tmsFinanceDetails.value.length === 0) {
     tmsFinanceDetails.value = fee_type.value.map(item => ({
       feeType: item.value,
@@ -4772,19 +4818,25 @@
     initExpenditureData();
   }
 });
-const handleUploadAfter = (res, done, loading, column, row) => {
+const handleUploadAfter = (res: any, row: any) => {
   // res 鏄帴鍙h繑鍥炵殑瀹屾暣鏁版嵁
-  if (res && res.url) {
+  if (res.code === 200) {
     // 鎵嬪姩缁欒繖涓�琛岀殑鏁版嵁璧嬪��
-    row.voucherUrl = res.url;
-    console.log('涓婁紶鎴愬姛锛屽綋鍓嶈鏁版嵁锛�', row);
+    row.voucherUrl = res.data.url;
   } else if (res.data && res.data.url) {
     // 濡傛灉杩斿洖鐨勬暟鎹寘瑁瑰湪 data 閲�
     row.voucherUrl = res.data.url;
   }
-  done(); // 蹇呴』璋冪敤 done 缁撴潫涓婁紶鐘舵��
 };
-
+/** 褰撴枃浠惰秴鍑洪檺鍒舵椂锛堝疄鐜拌嚜鍔ㄦ浛鎹㈤�昏緫锛� */
+const handleExceed = (files: any, row: any) => {
+  // 1. 娓呴櫎褰撳墠鏄剧ず鐨勬枃浠跺垪琛�
+  uploadRef.value.clearFiles();
+  // 2. 鎵嬪姩鎶婃柊閫夋嫨鐨勬枃浠舵坊鍔犺繘鍘婚噸鏂颁笂浼�
+  const file = files[0];
+  uploadRef.value.handleStart(file);
+  uploadRef.value.submit();
+};
 
 const flowLogIshow = ref()
 const flowParams = ref([])
@@ -4874,4 +4926,74 @@
 .link-btn {
   font-size: 18px;
 }
+
+/*  */
+/* 鐜版湁鐨勬牱寮忎繚鎸佷笉鍙�... */
+.specific-drag-area {
+  width: 100%;
+
+  :deep(.full-width-drag) {
+
+    // 1. 鏍稿績锛氶殣钘� Avue 榛樿鍦� dragger 涓嬫柟鐢熸垚鐨勯偅涓�滅偣鍑讳笂浼犫�濇寜閽�
+    // 鍦� 3.x 鐗堟湰涓紝瀹冩槸 el-upload 鍚庣殑涓�涓厔寮熻妭鐐规垨鑰呮槸鍐呴儴鑺傜偣
+    .el-button--primary {
+      display: none !important;
+    }
+
+    .el-upload {
+      width: 100%;
+      display: block; // 纭繚鍧楃骇鏄剧ず
+
+      .el-upload-dragger {
+        width: 100%;
+        height: 120px;
+        background-color: #fcfdfe;
+        border: 2px dashed #dcdfe6;
+        border-radius: 8px;
+        display: flex;
+        flex-direction: column;
+        align-items: center;
+        justify-content: center;
+        padding: 0 !important;
+
+        // 瑕嗙洊 Element Plus 榛樿鐨勫唴閮ㄦ枃瀛楁帓鐗堬紝闃叉鍐茬獊
+        .el-upload__text {
+          display: none !important;
+        }
+
+        &:hover {
+          border-color: #409eff;
+          background-color: #f5f7fa;
+        }
+      }
+    }
+  }
+
+  // 3. 鑷畾涔夊唴瀹圭殑鏍峰紡锛堢‘淇濆畠涓嶈 display:none 褰卞搷锛�
+  .drag-zone-inner {
+    pointer-events: none;
+    text-align: center;
+
+    .upload-icon {
+      font-size: 32px !important;
+      color: #909399;
+      margin-bottom: 8px;
+    }
+
+    .drag-text {
+      .main-title {
+        font-size: 14px;
+        color: #606266;
+        font-weight: bold;
+        line-height: 1.5;
+      }
+
+      .sub-title {
+        font-size: 12px;
+        color: #a8abb2;
+        margin-top: 4px;
+      }
+    }
+  }
+}
 </style>

--
Gitblit v1.8.0