From de1a42d853176d83805c1290d7381235a9780a2d Mon Sep 17 00:00:00 2001
From: zhangback <zhangback@163.com>
Date: 星期二, 18 十一月 2025 11:58:57 +0800
Subject: [PATCH] 提交

---
 ui/admin-ui3/src/views/tms/tmsDispatchOrder/index.vue |  419 +++++++++++++++++++++++++++++++++++++++++++++++++++--------
 1 files changed, 359 insertions(+), 60 deletions(-)

diff --git a/ui/admin-ui3/src/views/tms/tmsDispatchOrder/index.vue b/ui/admin-ui3/src/views/tms/tmsDispatchOrder/index.vue
index 756235d..97756c2 100644
--- a/ui/admin-ui3/src/views/tms/tmsDispatchOrder/index.vue
+++ b/ui/admin-ui3/src/views/tms/tmsDispatchOrder/index.vue
@@ -46,11 +46,27 @@
         </el-button>
         <el-button
             type="success"
-            icon="Delete"
+            icon="Promotion"
             :disabled="pageF.multiple"
             @click="handleGenerate"
             v-hasPermi="['tms:tmsDispatchOrder:generate']"
         >鐢熸垚搴旀敹搴斾粯璐圭敤
+        </el-button>
+        <el-button
+            type="warning"
+            icon="Female"
+            :disabled="pageF.single"
+            @click="handleDropHook"
+            v-hasPermi="['tms:tmsDispatchOrder:dropHook']"
+        >鐢╂寕
+        </el-button>
+        <el-button
+            type="primary"
+            icon="Male"
+            :disabled="pageF.single"
+            @click="handleConnectHang"
+            v-hasPermi="['tms:tmsDispatchOrder:connectHang']"
+        >鎺ユ寕
         </el-button>
 
       </template>
@@ -103,6 +119,45 @@
       </template>
     </el-dialog>
 
+    <el-dialog :title="title" v-model="open" class="avue-dialog avue-dialog--top" width="40%">
+      <div v-if="optionType === 'dropHook'">
+        <el-descriptions
+            :column="2"
+            border
+        >
+          <el-descriptions-item label="璋冨害鍗曞彿">{{ form.dispatchNo }}</el-descriptions-item>
+          <el-descriptions-item label="瀹㈡埛" >{{ form.customerName }}</el-descriptions-item>
+          <el-descriptions-item label="瀹為檯杩愯緭宸ュ叿绫诲瀷" >{{ form.$actualVehicleType}}</el-descriptions-item>
+          <el-descriptions-item label="杩愯緭宸ュ叿鍙风爜" >{{ form.licensePlate }}</el-descriptions-item>
+          <el-descriptions-item label="鎵樻灦鍙�" >{{ form.shelfCode }}</el-descriptions-item>
+          <el-descriptions-item label="涓婚┚椹跺憳" >{{ form.mainDriverName }}</el-descriptions-item>
+          <el-descriptions-item label="鍓┚椹跺憳" >{{ form.assistantDriverName }}</el-descriptions-item>
+        </el-descriptions>
+      </div>
+      <div  v-if="optionType == 'connectHang'">
+        <el-descriptions style="margin-bottom: 20px"
+            :column="2"
+            border
+        >
+          <el-descriptions-item label="璋冨害鍗曞彿">{{ form.dispatchNo }}</el-descriptions-item>
+          <el-descriptions-item label="瀹㈡埛" >{{ form.customerName }}</el-descriptions-item>
+          <el-descriptions-item label="瀹為檯杩愯緭宸ュ叿绫诲瀷" >{{ form.$actualVehicleType}}</el-descriptions-item>
+          <el-descriptions-item label="鎵樻灦鍙�" >{{ form.shelfCode }}</el-descriptions-item>
+        </el-descriptions>
+        <avue-form v-model="form" ref="boxFormRef" :option="boxFormOption">
+
+        </avue-form>
+      </div>
+      <template #footer>
+        <div class="dialog-footer">
+          <el-button type="primary"  :loading="pageF.isUploading" @click="submitForm2">
+            {{ pageF.isUploading ? '鎻愪氦涓�' : '纭� 瀹�' }}
+          </el-button>
+          <el-button @click="cancelBox2">鍙� 娑�</el-button>
+        </div>
+      </template>
+    </el-dialog>
+
 
 
   </basicContainer>
@@ -117,7 +172,7 @@
   getTmsDispatchOrder,
   listTmsDispatchOrder,
   updateTmsDispatchOrder,
-  confirmOrder, copyOrder, okOrder
+  confirmOrder, copyOrder, okOrder, initGenerate, generateTmsDispatchOrder, dropHook, connectHang
 } from "@/api/tms/tmsDispatchOrder";
 import useCurrentInstance from "@/utils/useCurrentInstance";
 import {computed, onMounted, reactive, ref, toRefs, watch} from "vue";
@@ -168,11 +223,13 @@
   boxTableData: <any>[],
   boxForm: <any>{},
   boxFormOption: <any>{},
-  boxTableOption: <any>{}
+  boxTableOption: <any>{},
+  title: '',
+  open: false,
 })
 const {queryParams, form, page, selectionList,
   boxTableData, optionType,
-  boxFormOption,boxForm,boxTableOption
+  boxFormOption,boxForm,boxTableOption,title,open
 } = toRefs(data);
 const option = ref({
   pageKey: 'TmsDispatchOrder',
@@ -205,6 +262,7 @@
                 projectName: active.projectName,
                 customerId: active.relatedCustomerId,
                 customerName: active.relatedCustomerName,
+                customerCode: active.relatedCustomerCode,
                 contractId: active.relatedContractId,
                 contractName: active.relatedContractName,
               });
@@ -598,7 +656,7 @@
               licenseType: {
                 label: '鍑嗛┚杞﹀瀷', minWidth: 120,
                 type: 'select', dataType: 'string', dicUrl: '/system/dict/data/type/license_type',
-                search: true,
+                search: true,multiple:true,
               },
             },
 
@@ -658,7 +716,7 @@
                 search: true,
               },
               licenseType: {
-                label: '鍑嗛┚杞﹀瀷', minWidth: 120,
+                label: '鍑嗛┚杞﹀瀷', minWidth: 120,multiple:true,
                 type: 'select', dataType: 'string', dicUrl: '/system/dict/data/type/license_type',
                 search: true,
               },
@@ -691,7 +749,7 @@
 
         },
         requiredVehicleTypes: {
-          label: '瑕佹眰杞﹀瀷', multiple: true,
+          label: '瑕佹眰杞﹀瀷',
           display: true, type: 'select', dicUrl: '/system/dict/data/type/license_type', dataType: 'string',
           rules: [
             {
@@ -917,7 +975,7 @@
       prop: 'shffxrxx',
       column: {
         shipperId: {
-          label: '鍙戣揣浜�',
+          label: '鍙戣揣浜�',dataType:'string',
           display: true,
           change: (val: any) => {
             const table = crudRef.value?.getPropRef?.('shipperId')?.$refs?.temp;
@@ -925,15 +983,31 @@
             let active = table.active;
             if (Array.isArray(active)) active = active[0];
             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(form.value, {
                 shipperId: active.id,
                 shipperName: active.consignorName,
-                shipperRegionCode: active.regionLabel,
+                shipperRegionLabel: active.regionLabel,
                 shipperAddress: active.addressDetail,
                 shipperMobile: active.contactPhone,
+                shipperRegionCode:shipperRegionCode
               });
-              form.value.transportLine = form.value.shipperRegionCode
-                  + (form.value.receiverRegionCode ? '>' + form.value.receiverRegionCode : '');
+              form.value.transportLine = form.value.shipperRegionLabel
+                  + (form.value.receiverRegionLabel ? '>' + form.value.receiverRegionLabel : '');
             }
           },
           rules: [
@@ -1009,7 +1083,7 @@
           }
 
         },
-        shipperRegionCode: {
+        shipperRegionLabel: {
           label: '鍙戣揣浜鸿鏀垮尯鍩�',
           display: true, disabled: true
 
@@ -1024,7 +1098,7 @@
         },
         receiverId: {
           label: '鏀惰揣浜�',
-          display: true,
+          display: true, dataType:'string',
           rules: [
             {
               required: true,
@@ -1037,15 +1111,32 @@
             let active = table.active;
             if (Array.isArray(active)) active = active[0];
             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(form.value, {
                 receiverId: active.id,
                 receiverName: active.consignorName,
-                receiverRegionCode: active.regionLabel,
+                receiverRegionLabel: active.regionLabel,
                 receiverAddress: active.addressDetail,
                 receiverMobile: active.contactPhone,
+                receiverRegionCode:receiverRegionCode,
               });
               form.value.transportLine =
-                  (form.value.shipperRegionCode ? form.value.shipperRegionCode + '>' : '') + form.value.receiverRegionCode;
+                  (form.value.shipperRegionLabel ? form.value.shipperRegionLabel + '>' : '') + form.value.receiverRegionLabel;
 
             }
           },
@@ -1116,7 +1207,7 @@
           }
 
         },
-        receiverRegionCode: {
+        receiverRegionLabel: {
           label: '鏀惰揣浜鸿鏀垮尯鍩�',
           display: true, disabled: true
         },
@@ -1140,22 +1231,30 @@
       column: {
         earliestDeparture: {
           label: '瑕佹眰鏈�鏃╁嚭鍙戞椂闂�',
-          type: 'date', valueFormat: 'YYYY-MM-DD',
+          type: 'datetime',  // 鏀逛负 datetime 绫诲瀷
+          format: 'YYYY-MM-DD HH:mm:ss',
+          valueFormat: 'YYYY-MM-DD HH:mm:ss',
           display: true,
         },
         latestDeparture: {
           label: '瑕佹眰鏈�鏅氬嚭鍙戞椂闂�',
-          type: 'date', valueFormat: 'YYYY-MM-DD',
+          type: 'datetime',  // 鏀逛负 datetime 绫诲瀷
+          format: 'YYYY-MM-DD HH:mm:ss',
+          valueFormat: 'YYYY-MM-DD HH:mm:ss',
           display: true,
         },
         earliestArrival: {
           label: '瑕佹眰鏈�鏃╁埌杈炬椂闂�',
-          type: 'date', valueFormat: 'YYYY-MM-DD',
+          type: 'datetime',  // 鏀逛负 datetime 绫诲瀷
+          format: 'YYYY-MM-DD HH:mm:ss',
+          valueFormat: 'YYYY-MM-DD HH:mm:ss',
           display: true,
         },
         latestArrival: {
           label: '瑕佹眰鏈�鏅氬埌杈炬椂闂�',
-          type: 'date', valueFormat: 'YYYY-MM-DD',
+          type: 'datetime',  // 鏀逛负 datetime 绫诲瀷
+          format: 'YYYY-MM-DD HH:mm:ss',
+          valueFormat: 'YYYY-MM-DD HH:mm:ss',
           display: true,
         },
       }
@@ -1310,24 +1409,16 @@
       display: false,
       hide: false,
       search: true,
-      rules: [
-        {
-          required: true,
-          message: "搴旀敹璐圭敤鐢熸垚鐘舵�佷笉鑳戒负绌�", trigger: "blur"
-        }
-      ],
+      type: 'select', dataType: 'string', dicUrl: '/system/dict/data/type/accounts_status',
+
     },
     accountsPayableStatus: {
       label: '搴斾粯璐圭敤鐢熸垚鐘舵��', minWidth: 160,
       display: false,
       hide: false,
       search: true,
-      rules: [
-        {
-          required: true,
-          message: "搴斾粯璐圭敤鐢熸垚鐘舵�佷笉鑳戒负绌�", trigger: "blur"
-        }
-      ]
+      type: 'select', dataType: 'string', dicUrl: '/system/dict/data/type/accounts_status',
+
     },
 
     status: {
@@ -1424,13 +1515,13 @@
     voucherUrl: {
       label: '琛岀▼鍑瘉',
       display: true,
-      type: 'upload',
-      multiple: true,
       span: 24,
-      propsHttp: {
-        url: 'url',
-        name: 'name',
-        res: 'data'
+      accept:'string',dataType: 'string',
+      type: 'upload',
+      action: '/common/upload2',
+      propsHttp:{
+        home:'url',
+        name:'newFileName',
       },
     },
     dataSource: {
@@ -1484,6 +1575,14 @@
     voucherUrl: {
       label: '琛岀▼鍑瘉',
       display: true,
+      span: 24,
+      accept:'string',dataType: 'string',
+      type: 'upload',
+      action: '/common/upload2',
+      propsHttp:{
+        home:'url',
+        name:'newFileName',
+      },
     },
 
   }
@@ -1518,13 +1617,13 @@
     voucherUrl: {
       label: '琛岀▼鍑瘉',
       display: true,
-      type: 'upload',
-      multiple: true,
       span: 24,
-      propsHttp: {
-        url: 'url',
-        name: 'name',
-        res: 'data'
+      accept:'string',dataType: 'string',
+      type: 'upload',
+      action: '/common/upload2',
+      propsHttp:{
+        home:'url',
+        name:'newFileName',
       },
     },
     dataSource: {
@@ -1569,6 +1668,14 @@
     feeVoucherUrl: {
       label: '璐圭敤鍑瘉',
       display: true,
+      span: 24,
+      accept:'string',dataType: 'string',
+      type: 'upload',
+      action: '/common/upload2',
+      propsHttp:{
+        home:'url',
+        name:'newFileName',
+      },
     },
 
   }
@@ -1579,19 +1686,20 @@
   addBtn: false,
   header: false, selection: false,
   column: {
-    accountsReceivableName: {
+    collectionPlanName: {
       label: '鍖归厤搴旀敹鏂规鍚嶇О', minWidth: 160,
-    },
-    accountsPayableName: {
-      label: '鍖归厤搴斾粯鏂规鍚嶇О', minWidth: 160,
     },
     accountsReceivableStatus: {
       label: '搴旀敹璐圭敤鐢熸垚鐘舵��', minWidth: 160,
-      type: 'select', dataType: 'string', dicUrl: '/system/dict/data/type/tms_dispatch_order_status',
+      type: 'select', dataType: 'string', dicUrl: '/system/dict/data/type/accounts_status',
     },
+    paymentPlanName: {
+      label: '鍖归厤搴斾粯鏂规鍚嶇О', minWidth: 160,
+    },
+
     accountsPayableStatus: {
       label: '搴斾粯璐圭敤鐢熸垚鐘舵��', minWidth: 160,
-      type: 'select', dataType: 'string', dicUrl: '/system/dict/data/type/tms_dispatch_order_status',
+      type: 'select', dataType: 'string', dicUrl: '/system/dict/data/type/accounts_status',
     },
     dispatchNo: {
       label: '璋冨害鍗曞彿', minWidth: 120,
@@ -1630,7 +1738,133 @@
 
   }
 })
+const connectHangOption = ref({
+  menuBtn: false,
+  labelWidth: 120,
+  column: {
+    vehicleId: {
+      label: '鎺ユ寕杞﹁締鍙风爜',
+      display: true,
+      rules: [
+        {
+          required: true,
+          message: "鎺ユ寕杞﹁締鍙风爜涓嶈兘涓虹┖", trigger: "change"
+        }
+      ],
+      type: 'table', suffixIcon: 'search',dataType: 'string',
+      children: {
+        border: true,
+        searchLabelWidth: 100,
+        searchMenuSpan: 5,
+        column: {
+          serviceProviderName: {
+            label: '杞﹁締鏈嶅姟鍟�', minWidth: 130,
+            search: true,
+          },
+          vehicleType: {
+            label: '杞﹁締绫诲瀷', minWidth: 120,
+            search: true,
+          },
+          internalCode: {
+            label: '杞﹁締鍐呴儴缂栫爜', minWidth: 120,
+            search: true,
+          },
+          licensePlate: {
+            label: '杞︾墝鍙�', minWidth: 120,
+            search: true,
+          },
+          licenseHk: {
+            label: '棣欐腐鐗岀収', minWidth: 120,
+            search: true,
+          },
+          licenseMo: {
+            label: '婢抽棬鐗岀収', minWidth: 120,
+            search: true,
+          },
+        },
 
+      },
+      props: {
+        label: 'licensePlate',
+        value: 'id'
+      },
+      onLoad: ({page, value, data}: { page: any, value: any, data: any }, callback: any) => {
+        if (value) {
+          let id = value;
+          if (Array.isArray(value)) {
+            id = value[0]
+          }
+          getTmsVehicle(id).then(res => {
+            return callback(res.data || {})
+          })
+        } else {
+          listTmsVehicle({pageSize: page.pageSize, pageNum: page.currentPage, ...data}).then(res => {
+            return callback({
+              total: res.total,
+              data: res.rows || [],
+            })
+          })
+        }
+
+      }
+    },
+    driverId: {
+      label: '鎺ユ寕鍙告満',
+      display: true,
+      rules: [
+        {
+          required: true,
+          message: "鎺ユ寕鍙告満涓嶈兘涓虹┖", trigger: "change"
+        }
+      ],
+      type: 'table', suffixIcon: 'search',dataType: 'string',
+      children: {
+        border: true,
+        searchMenuSpan: 5,
+        column: {
+          vehicleProviderName: {
+            label: '杞﹁締鏈嶅姟鍟�', minWidth: 130,
+            search: true,
+          },
+          driverName: {
+            label: '椹鹃┒鍛樺鍚�', minWidth: 120,
+            search: true,
+          },
+          licenseType: {
+            label: '鍑嗛┚杞﹀瀷', minWidth: 120,
+            type: 'select', dataType: 'string', dicUrl: '/system/dict/data/type/license_type',
+            search: true,multiple:true,
+          },
+        },
+
+      },
+      props: {
+        label: 'driverName',
+        value: 'id'
+      },
+      onLoad: ({page, value, data}: { page: any, value: any, data: any }, callback: any) => {
+        if (value) {
+          let id = value;
+          if (Array.isArray(value)) {
+            id = value[0]
+          }
+          getTmsDriver(id).then(res => {
+            return callback(res.data || {})
+          })
+        } else {
+          listTmsDriver({pageSize: page.pageSize, pageNum: page.currentPage, ...data}).then(res => {
+            return callback({
+              total: res.total,
+              data: res.rows || [],
+            })
+          })
+        }
+
+      }
+    },
+
+  }
+})
 
 const {
   tableData,
@@ -1808,20 +2042,85 @@
 }
 
 const handleGenerate = () => {
-  optionType.value = 'generate';
-  pageF.open = true;
-  pageF.title = '鐢熸垚搴旀敹搴斾粯璐圭敤鏁版嵁';
-  boxTableOption.value = generateTableOption.value;
+  let ids = selectionList.value.map((item:any) => item.id);
+  initGenerate(ids).then(res => {
+    boxTableData.value = res.data|| [];
+    optionType.value = 'generate';
+    pageF.open = true;
+    pageF.title = '鐢熸垚搴旀敹搴斾粯璐圭敤鏁版嵁';
+    boxTableOption.value = generateTableOption.value;
+  })
 }
 
 const submitGenerate = () => {
-  
+  pageF.isUploading = true;
+  let ids = selectionList.value.map((item:any) => item.id);
+
+  generateTmsDispatchOrder(ids).then(res => {
+    pageF.isUploading = false;
+    ElMessage({
+      message: "鎿嶄綔鎴愬姛锛�",
+      type: 'success'
+    })
+    cancelBox();
+    onLoad(page.value);
+  }).finally(()=>{
+    pageF.isUploading = false;
+  })
+}
+/**
+ * 鐢╂寕
+ */
+const handleDropHook = () => {
+    title.value = '璋冨害鍗曠敥鎸�';
+  open.value = true;
+  form.value = selectionList.value[0];
+  optionType.value = 'dropHook';
+
+}
+/**
+ * 鎺ユ寕
+ */
+const handleConnectHang = () => {
+  title.value = '璋冨害鍗曟帴鎸�';
+  open.value = true;
+  form.value = selectionList.value[0];
+  optionType.value = 'connectHang';
+  boxFormOption.value = connectHangOption.value;
+}
+const submitForm2 = () => {
+  pageF.isUploading = true;
+  if (optionType.value === 'dropHook') {
+    dropHook(form.value.id).then(res => {
+      ElMessage({
+        message: "鎻愪氦鎴愬姛锛�",
+        type: 'success'
+      })
+      cancelBox2();
+      onLoad(page.value);
+    }).finally(()=>{
+      pageF.isUploading = false;
+    })
+  }else{
+    connectHang({
+      dispatchId:form.value.id,
+      vehicleId:form.value.vehicleId,
+      driverId:form.value.driverId
+    }).then(res => {
+      ElMessage({
+        message: "鎻愪氦鎴愬姛锛�",
+        type: 'success'
+      })
+      cancelBox2();
+      onLoad(page.value);
+    }).finally(()=>{
+      pageF.isUploading = false
+    })
+  }
 }
 
 
-
-onMounted(() => {
-
-
-});
+const cancelBox2 = () => {
+  open.value = false;
+}
 </script>
\ No newline at end of file

--
Gitblit v1.8.0