From f67945d53b20f6a45ae50b27d74c966eb1355bb4 Mon Sep 17 00:00:00 2001
From: wlzboy <66905212@qq.com>
Date: 星期日, 16 十一月 2025 22:53:54 +0800
Subject: [PATCH] feat: 增加分段GPS计算行程距离

---
 ruoyi-ui/src/views/system/vehicle/index.vue |   52 ++++++++++++++++++++++++++++++++++++++++------------
 1 files changed, 40 insertions(+), 12 deletions(-)

diff --git a/ruoyi-ui/src/views/system/vehicle/index.vue b/ruoyi-ui/src/views/system/vehicle/index.vue
index 30bfde2..40e9ca5 100644
--- a/ruoyi-ui/src/views/system/vehicle/index.vue
+++ b/ruoyi-ui/src/views/system/vehicle/index.vue
@@ -14,7 +14,7 @@
         <el-select v-model="queryParams.vehicleType" placeholder="璇烽�夋嫨杞﹁締绫诲瀷" clearable size="small">
           <el-option
             v-for="dict in dict.type.sys_vehicle_type"
-            :key="dict.value"
+            :key="'vtype-' + dict.value"
             :label="dict.label"
             :value="dict.value"
           />
@@ -24,7 +24,7 @@
         <el-select v-model="queryParams.status" placeholder="璇烽�夋嫨鐘舵��" clearable size="small">
           <el-option
             v-for="dict in dict.type.sys_normal_disable"
-            :key="dict.value"
+            :key="'status-' + dict.value"
             :label="dict.label"
             :value="dict.value"
           />
@@ -34,7 +34,7 @@
         <el-select v-model="queryParams.platformCode" placeholder="璇烽�夋嫨骞冲彴" clearable size="small">
           <el-option
             v-for="dict in dict.type.sys_platform"
-            :key="dict.value"
+            :key="'platform-' + dict.value"
             :label="dict.label"
             :value="dict.value"
           />
@@ -118,12 +118,19 @@
           <dict-tag :options="dict.type.sys_platform" :value="scope.row.platformCode"/>
         </template>
       </el-table-column>
+      <el-table-column label="褰掑睘鍒嗗叕鍙�" align="center" prop="deptNames" width="200">
+        <template slot-scope="scope">
+          <span v-if="scope.row.deptNames && scope.row.deptNames.length > 0">
+            {{ scope.row.deptNames.join('銆�') }}
+          </span>
+          <span v-else>-</span>
+        </template>
+      </el-table-column>
       <el-table-column label="鐘舵��" align="center" prop="status">
         <template slot-scope="scope">
           <dict-tag :options="dict.type.sys_normal_disable" :value="scope.row.status"/>
         </template>
       </el-table-column>
-      <el-table-column label="褰掑睘閮ㄩ棬" align="center" prop="deptName" />
       <el-table-column label="鍒涘缓鏃堕棿" align="center" prop="createTime" width="180">
         <template slot-scope="scope">
           <span>{{ parseTime(scope.row.createTime) }}</span>
@@ -167,7 +174,7 @@
           <el-select v-model="form.vehicleType" placeholder="璇烽�夋嫨杞﹁締绫诲瀷" clearable style="width: 100%">
             <el-option
               v-for="dict in dict.type.sys_vehicle_type"
-              :key="dict.value"
+              :key="'form-vtype-' + dict.value"
               :label="dict.label"
               :value="dict.value"
             />
@@ -183,7 +190,7 @@
           <el-select v-model="form.platformCode" placeholder="璇烽�夋嫨骞冲彴" clearable>
             <el-option
               v-for="dict in dict.type.sys_platform"
-              :key="dict.value"
+              :key="'form-platform-' + dict.value"
               :label="dict.label"
               :value="dict.value"
             />
@@ -193,13 +200,13 @@
           <el-radio-group v-model="form.status">
             <el-radio
               v-for="dict in dict.type.sys_normal_disable"
-              :key="dict.value"
+              :key="'form-status-' + dict.value"
               :label="dict.value"
             >{{dict.label}}</el-radio>
           </el-radio-group>
         </el-form-item>
-        <el-form-item label="褰掑睘閮ㄩ棬" prop="deptId">
-          <el-select v-model="form.deptId" placeholder="璇烽�夋嫨褰掑睘閮ㄩ棬" clearable style="width: 100%">
+        <el-form-item label="褰掑睘鍒嗗叕鍙�" prop="deptIds">
+          <el-select v-model="form.deptIds" placeholder="璇烽�夋嫨褰掑睘鍒嗗叕鍙�" multiple clearable style="width: 100%">
             <el-option
               v-for="dept in deptList"
               :key="dept.deptId"
@@ -271,7 +278,8 @@
         status: "0",
         remark: null,
         platformCode: null,
-        deptId: null
+        deptId: null,
+        deptIds: []  // 澶氫釜鍒嗗叕鍙窱D鏁扮粍
       },
       // 琛ㄥ崟鏍¢獙
       rules: {
@@ -283,6 +291,9 @@
         ],
         platformCode: [
           { required: true, message: "骞冲彴鏍囪瘑涓嶈兘涓虹┖", trigger: "change" }
+        ],
+        deptIds: [
+          { required: true, message: "褰掑睘鍒嗗叕鍙镐笉鑳戒负绌�", trigger: "change", type: 'array' }
         ]
       }
     };
@@ -304,9 +315,12 @@
     /** 鑾峰彇閮ㄩ棬鍒楄〃锛堝彧鏄剧ず鍒嗗叕鍙革細parent_id=100锛� */
     getDeptList() {
       listDept({ parentId: 100 }).then(response => {
+        
         // 杩囨护鍑哄垎鍏徃锛坧arent_id=100鐨勯儴闂級
         if (response.data) {
-          this.deptList = response.data.filter(dept => dept.parentId === 100);
+
+          this.deptList = response.data.filter(dept => dept.parentId === "100");
+          // console.log("deptList: ",this.deptList,response.data.filter(dept => dept.parentId === "100"));
         } else {
           this.deptList = [];
         }
@@ -328,7 +342,8 @@
         status: "0",
         remark: null,
         platformCode: null,
-        deptId: null
+        deptId: null,
+        deptIds: []  // 閲嶇疆涓虹┖鏁扮粍
       };
       this.resetForm("form");
     },
@@ -360,6 +375,14 @@
       const vehicleId = row.vehicleId || this.ids
       getVehicle(vehicleId).then(response => {
         this.form = response.data;
+        // 纭繚deptIds鏄竴涓暟缁�
+        if (!this.form.deptIds) {
+          this.form.deptIds = [];
+        }
+        // 濡傛灉deptIds涓虹┖鏁扮粍锛屼絾deptId鏈夊�硷紝鍒欐坊鍔燿eptId鍒癲eptIds涓�
+        if (this.form.deptIds.length === 0 && this.form.deptId) {
+          this.form.deptIds = [this.form.deptId];
+        }
         this.open = true;
         this.title = "淇敼杞﹁締淇℃伅";
       });
@@ -368,6 +391,11 @@
     submitForm() {
       this.$refs["form"].validate(valid => {
         if (valid) {
+          // 濡傛灉閫夋嫨浜嗗涓垎鍏徃锛屽皢绗竴涓缃负deptId锛堜富鍒嗗叕鍙革級
+          if (this.form.deptIds && this.form.deptIds.length > 0) {
+            this.form.deptId = this.form.deptIds[0];
+          }
+          
           if (this.form.vehicleId != null) {
             updateVehicle(this.form).then(response => {
               this.$modal.msgSuccess("淇敼鎴愬姛");

--
Gitblit v1.9.1