From 09e6dc3fb7266620fafb5e341808a8eb36e080a1 Mon Sep 17 00:00:00 2001
From: wlzboy <66905212@qq.com>
Date: 星期六, 13 十二月 2025 22:51:52 +0800
Subject: [PATCH] feat:增加企业微信消息提醒

---
 ruoyi-ui/src/views/task/general/index.vue |  194 ++++++++++++++++++++++++++++++++++++++++++++----
 1 files changed, 176 insertions(+), 18 deletions(-)

diff --git a/ruoyi-ui/src/views/task/general/index.vue b/ruoyi-ui/src/views/task/general/index.vue
index 9feb3cb..382cc4a 100644
--- a/ruoyi-ui/src/views/task/general/index.vue
+++ b/ruoyi-ui/src/views/task/general/index.vue
@@ -29,6 +29,14 @@
           />
         </el-select>
       </el-form-item>
+      <el-form-item label="杞︾墝鍙�" prop="vehicleNo">
+        <el-input
+          v-model="queryParams.vehicleNo"
+          placeholder="璇疯緭鍏ヨ溅鐗屽彿"
+          clearable
+          @keyup.enter.native="handleQuery"
+        />
+      </el-form-item>
       <el-form-item label="璁″垝寮�濮嬫椂闂�">
         <el-date-picker
           v-model="dateRange"
@@ -94,32 +102,46 @@
 
     <el-table v-loading="loading" :data="taskList" @selection-change="handleSelectionChange">
       <el-table-column type="selection" width="55" align="center" />
-      <el-table-column label="浠诲姟缂栧彿" align="center" prop="taskCode" />
-      <el-table-column label="浠诲姟绫诲瀷" align="center" prop="taskType">
+      <el-table-column label="浠诲姟缂栧彿" align="center" prop="showTaskCode" min-width="120">
         <template slot-scope="scope">
-          <dict-tag :options="dict.type.sys_task_type" :value="scope.row.taskType"/>
+          <el-button
+            type="text"
+            @click="handleView(scope.row)"
+            v-hasPermi="['task:general:query']"
+            style="font-family: 'Courier New', monospace; font-size: 13px;"
+          >{{ scope.row.showTaskCode }}</el-button>
         </template>
       </el-table-column>
+      <el-table-column label="浠诲姟绫诲瀷" align="center" prop="taskType" width="120">
+        <template slot-scope="scope">
+          <dict-tag :options="dict.type.sys_task_type" :value="scope.row.taskType"/>
+          
+        </template>
+      </el-table-column>
+   
       <el-table-column label="浠诲姟鐘舵��" align="center" prop="taskStatus">
         <template slot-scope="scope">
           <dict-tag :options="dict.type.sys_task_status" :value="scope.row.taskStatus"/>
         </template>
       </el-table-column>
-      <el-table-column label="浠诲姟鎻忚堪" align="center" prop="taskDescription" show-overflow-tooltip />
-      <el-table-column label="鍑哄彂鍦板潃" align="center" prop="departureAddress" show-overflow-tooltip />
-      <el-table-column label="鐩殑鍦板潃" align="center" prop="destinationAddress" show-overflow-tooltip />
-      <el-table-column label="璁″垝寮�濮嬫椂闂�" align="center" prop="plannedStartTime" width="180">
+      <el-table-column label="杞︾墝鍙�" align="center" prop="vehicleNo" width="120">
         <template slot-scope="scope">
-          <span>{{ parseTime(scope.row.plannedStartTime, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
+          <span v-if="scope.row.vehicleNo">{{ scope.row.vehicleNo }}</span>
+          <span v-else style="color: #C0C4CC;">--</span>
         </template>
       </el-table-column>
-      <el-table-column label="璁″垝缁撴潫鏃堕棿" align="center" prop="plannedEndTime" width="180">
+      
+      <!-- <el-table-column label="鐩殑鍦板潃" align="center" prop="destinationAddress" show-overflow-tooltip /> -->
+      <el-table-column label="棰勮鍏噷鏁�" align="center" prop="estimatedDistance" width="120">
         <template slot-scope="scope">
-          <span>{{ parseTime(scope.row.plannedEndTime, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
+          <span v-if="scope.row.estimatedDistance">{{ scope.row.estimatedDistance }} km</span>
+          <span v-else style="color: #C0C4CC;">--</span>
         </template>
       </el-table-column>
+ 
+     
       <el-table-column label="鍒涘缓浜�" align="center" prop="creatorName" />
-      <el-table-column label="鎵ц浜�" align="center" prop="assigneeName" />
+      
       <el-table-column label="鍒涘缓鏃堕棿" align="center" prop="createTime" width="180">
         <template slot-scope="scope">
           <span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
@@ -134,27 +156,27 @@
             @click="handleView(scope.row)"
             v-hasPermi="['task:general:query']"
           >鏌ョ湅</el-button>
-          <el-button
+          <!-- <el-button
             size="mini"
             type="text"
             icon="el-icon-edit"
             @click="handleUpdate(scope.row)"
             v-hasPermi="['task:general:edit']"
-          >淇敼</el-button>
-          <el-button
+          >淇敼</el-button> -->
+          <!-- <el-button
             size="mini"
             type="text"
             icon="el-icon-user"
             @click="handleAssign(scope.row)"
             v-hasPermi="['task:general:assign']"
-          >鍒嗛厤</el-button>
-          <el-button
+          >鍒嗛厤</el-button> -->
+          <!-- <el-button
             size="mini"
             type="text"
             icon="el-icon-refresh"
             @click="handleStatusChange(scope.row)"
             v-hasPermi="['task:general:status']"
-          >鐘舵��</el-button>
+          >鐘舵��</el-button> -->
           <el-button
             size="mini"
             type="text"
@@ -175,7 +197,7 @@
     />
 
     <!-- 娣诲姞鎴栦慨鏀逛换鍔$鐞嗗璇濇 -->
-    <el-dialog :title="title" :visible.sync="open" width="600px" append-to-body>
+    <el-dialog :title="title" :visible.sync="open" width="800px" append-to-body>
       <el-form ref="form" :model="form" :rules="rules" label-width="80px">
         <el-form-item label="浠诲姟绫诲瀷" prop="taskType">
           <el-select v-model="form.taskType" placeholder="璇烽�夋嫨浠诲姟绫诲瀷">
@@ -195,6 +217,86 @@
         </el-form-item>
         <el-form-item label="鐩殑鍦板潃" prop="destinationAddress">
           <el-input v-model="form.destinationAddress" placeholder="璇疯緭鍏ョ洰鐨勫湴鍧�" />
+        </el-form-item>
+        
+        <!-- GPS鍧愭爣淇℃伅 -->
+        <el-divider content-position="left">GPS鍧愭爣淇℃伅</el-divider>
+        
+        <el-row :gutter="20">
+          <el-col :span="12">
+            <el-form-item label="鍑哄彂鍦扮粡搴�" prop="departureLongitude">
+              <el-input-number 
+                v-model="form.departureLongitude" 
+                :precision="7" 
+                :step="0.0000001" 
+                :min="-180" 
+                :max="180"
+                placeholder="璇疯緭鍏ョ粡搴�"
+                style="width: 100%"
+                @change="calculateDistance"
+              />
+            </el-form-item>
+          </el-col>
+          <el-col :span="12">
+            <el-form-item label="鍑哄彂鍦扮含搴�" prop="departureLatitude">
+              <el-input-number 
+                v-model="form.departureLatitude" 
+                :precision="7" 
+                :step="0.0000001" 
+                :min="-90" 
+                :max="90"
+                placeholder="璇疯緭鍏ョ含搴�"
+                style="width: 100%"
+                @change="calculateDistance"
+              />
+            </el-form-item>
+          </el-col>
+        </el-row>
+        
+        <el-row :gutter="20">
+          <el-col :span="12">
+            <el-form-item label="鐩殑鍦扮粡搴�" prop="destinationLongitude">
+              <el-input-number 
+                v-model="form.destinationLongitude" 
+                :precision="7" 
+                :step="0.0000001" 
+                :min="-180" 
+                :max="180"
+                placeholder="璇疯緭鍏ョ粡搴�"
+                style="width: 100%"
+                @change="calculateDistance"
+              />
+            </el-form-item>
+          </el-col>
+          <el-col :span="12">
+            <el-form-item label="鐩殑鍦扮含搴�" prop="destinationLatitude">
+              <el-input-number 
+                v-model="form.destinationLatitude" 
+                :precision="7" 
+                :step="0.0000001" 
+                :min="-90" 
+                :max="90"
+                placeholder="璇疯緭鍏ョ含搴�"
+                style="width: 100%"
+                @change="calculateDistance"
+              />
+            </el-form-item>
+          </el-col>
+        </el-row>
+        
+        <el-form-item label="棰勮鍏噷鏁�" prop="estimatedDistance">
+          <el-input-number 
+            v-model="form.estimatedDistance" 
+            :precision="2" 
+            :step="0.01" 
+            :min="0"
+            placeholder="鑷姩璁$畻"
+            style="width: 200px"
+            :disabled="true"
+          />
+          <span style="margin-left: 10px; color: #909399; font-size: 12px;">
+            <i class="el-icon-info"></i> 鏍规嵁GPS鍧愭爣鑷姩璁$畻
+          </span>
         </el-form-item>
         <el-form-item label="璁″垝寮�濮嬫椂闂�" prop="plannedStartTime">
           <el-date-picker clearable
@@ -304,6 +406,8 @@
       total: 0,
       // 浠诲姟绠$悊琛ㄦ牸鏁版嵁
       taskList: [],
+      // 鏄惁鏈夋�ユ晳杞繍浠诲姟锛堢敤浜庢帶鍒跺悓姝ョ姸鎬佸垪鏄剧ず锛�
+      hasEmergencyTask: false,
       // 寮瑰嚭灞傛爣棰�
       title: "",
       // 鏄惁鏄剧ず寮瑰嚭灞�
@@ -321,6 +425,7 @@
         taskCode: null,
         taskType: null,
         taskStatus: null,
+        vehicleNo: null,
         plannedStartTimeBegin: null,
         plannedStartTimeEnd: null,
       },
@@ -376,6 +481,8 @@
       listTask(this.queryParams).then(response => {
         this.taskList = response.rows;
         this.total = response.total;
+        // 妫�鏌ユ槸鍚︽湁鎬ユ晳杞繍浠诲姟锛岀敤浜庢帶鍒跺悓姝ョ姸鎬佺浉鍏冲垪鐨勬樉绀�
+        this.hasEmergencyTask = this.taskList.some(task => task.taskType === 'EMERGENCY_TRANSFER');
         this.loading = false;
       });
     },
@@ -398,6 +505,11 @@
         taskDescription: null,
         departureAddress: null,
         destinationAddress: null,
+        departureLongitude: null,
+        departureLatitude: null,
+        destinationLongitude: null,
+        destinationLatitude: null,
+        estimatedDistance: null,
         plannedStartTime: null,
         plannedEndTime: null,
         assigneeId: null,
@@ -529,6 +641,52 @@
     cancelStatusChange() {
       this.statusOpen = false;
       this.statusForm = {};
+    },
+    
+    /** 璁$畻GPS鍧愭爣璺濈 */
+    calculateDistance() {
+      if (this.form.departureLongitude && this.form.departureLatitude && 
+          this.form.destinationLongitude && this.form.destinationLatitude) {
+        
+        // 楠岃瘉鍧愭爣鏈夋晥鎬�
+        if (this.isValidCoordinate(this.form.departureLatitude, this.form.departureLongitude) &&
+            this.isValidCoordinate(this.form.destinationLatitude, this.form.destinationLongitude)) {
+          
+          // 浣跨敤Haversine鍏紡璁$畻璺濈
+          const distance = this.calculateHaversineDistance(
+            this.form.departureLatitude, this.form.departureLongitude,
+            this.form.destinationLatitude, this.form.destinationLongitude
+          );
+          
+          this.form.estimatedDistance = Math.round(distance * 100) / 100; // 淇濈暀2浣嶅皬鏁�
+        } else {
+          this.form.estimatedDistance = 0;
+        }
+      } else {
+        this.form.estimatedDistance = 0;
+      }
+    },
+    
+    /** 楠岃瘉GPS鍧愭爣鏄惁鏈夋晥 */
+    isValidCoordinate(latitude, longitude) {
+      return latitude >= -90 && latitude <= 90 && longitude >= -180 && longitude <= 180;
+    },
+    
+    /** 浣跨敤Haversine鍏紡璁$畻涓ょ偣闂磋窛绂� */
+    calculateHaversineDistance(lat1, lon1, lat2, lon2) {
+      const R = 6371; // 鍦扮悆鍗婂緞锛堝叕閲岋級
+      const dLat = this.toRadians(lat2 - lat1);
+      const dLon = this.toRadians(lon2 - lon1);
+      const a = Math.sin(dLat / 2) * Math.sin(dLat / 2) +
+                Math.cos(this.toRadians(lat1)) * Math.cos(this.toRadians(lat2)) *
+                Math.sin(dLon / 2) * Math.sin(dLon / 2);
+      const c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));
+      return R * c;
+    },
+    
+    /** 瑙掑害杞姬搴� */
+    toRadians(degrees) {
+      return degrees * (Math.PI / 180);
     }
   }
 };

--
Gitblit v1.9.1