From 49921150cbdcf2ec681486f36bc78411ea1ff035 Mon Sep 17 00:00:00 2001
From: liu <2021943741@qq.com>
Date: 星期二, 03 十一月 2026 13:28:57 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/dev_tide_wrzs_xinlan' into dev_tide_wrzs_xinlan

---
 src/views/environmentAccess/intelligentInspectionManagement/index.vue | 1386 ++++++++++++++++++++++++++++++++++++---------------------
 1 files changed, 871 insertions(+), 515 deletions(-)

diff --git a/src/views/environmentAccess/intelligentInspectionManagement/index.vue b/src/views/environmentAccess/intelligentInspectionManagement/index.vue
index a1317de..0fb8862 100644
--- a/src/views/environmentAccess/intelligentInspectionManagement/index.vue
+++ b/src/views/environmentAccess/intelligentInspectionManagement/index.vue
@@ -1,575 +1,931 @@
 <template>
   <div class="app-container inspection-page">
-    <!-- 椤靛ご -->
-    <div class="page-head">
-      <div class="head-text">
-        <h2>鏅鸿兘宸℃绠$悊</h2>
-        <p>瑙勫垝宸℃璺緞锛岃仈鍔ㄨ棰戙�佹棤浜烘満鎴栨満鍣ㄤ汉鍥炰紶锛屽畬鎴愬悗鑷姩鐢熸垚宸℃鎶ュ憡銆�</p>
-      </div>
-      <el-button type="primary" :icon="Plus" @click="openForm()">鏂板缓宸℃浠诲姟</el-button>
-    </div>
-
-    <!-- 姒傝 -->
-    <div class="stat-row">
-      <div v-for="s in summary" :key="s.label" class="stat" :class="s.tone">
-        <div class="stat-top">
-          <span class="stat-label">{{ s.label }}</span>
-          <el-icon class="stat-icon"><component :is="s.icon" /></el-icon>
+    <el-tabs v-model="activeTab" @tab-change="handleTabChange">
+      <!-- ==================== 宸℃璺緞瑙勫垝 ==================== -->
+      <el-tab-pane label="宸℃璺緞瑙勫垝" name="route">
+        <div class="search_form">
+          <div>
+            <span class="search_title">璺嚎鍚嶇О锛�</span>
+            <el-input v-model="routeQuery.routeName" style="width: 200px" placeholder="璇疯緭鍏ヨ矾绾垮悕绉�" clearable
+                      @keyup.enter="loadRoute" />
+            <span class="search_title ml10">鎵ц鏂瑰紡锛�</span>
+            <el-select v-model="routeQuery.inspectMode" style="width: 160px" placeholder="鍏ㄩ儴" clearable
+                       @change="loadRoute">
+              <el-option v-for="item in inspectModeList" :key="item" :label="item" :value="item" />
+            </el-select>
+            <el-button type="primary" style="margin-left: 10px" @click="loadRoute">鎼滅储</el-button>
+          </div>
+          <div>
+            <el-button type="primary" @click="openRouteForm()">鏂板宸℃璺緞</el-button>
+          </div>
         </div>
-        <div class="stat-value">{{ s.value }}<i>椤�</i></div>
-      </div>
-    </div>
+        <el-table :data="routeList" border stripe v-loading="routeLoading" style="width: 100%">
+          <el-table-column type="index" label="搴忓彿" width="60" align="center" />
+          <el-table-column prop="routeCode" label="璺嚎缂栧彿" width="140" align="center" />
+          <el-table-column prop="routeName" label="璺嚎鍚嶇О" min-width="160" show-overflow-tooltip />
+          <el-table-column prop="routeType" label="宸℃绫诲瀷" width="110" align="center" />
+          <el-table-column prop="inspectMode" label="鎵ц鏂瑰紡" width="110" align="center" />
+          <el-table-column prop="areaName" label="宸℃鍖哄煙" width="120" />
+          <el-table-column prop="pointTotal" label="鐐逛綅鏁�" width="80" align="center" />
+          <el-table-column prop="pointNames" label="宸℃椤哄簭" min-width="240" show-overflow-tooltip />
+          <el-table-column prop="cycleType" label="宸℃鍛ㄦ湡" width="100" align="center" />
+          <el-table-column prop="cycleTime" label="鎵ц鏃堕棿" width="100" align="center" />
+          <el-table-column prop="executorName" label="宸℃浜哄憳" width="100" />
+          <el-table-column label="鐘舵��" width="80" align="center">
+            <template #default="{ row }">
+              <el-tag :type="row.status === '0' ? 'success' : 'info'" size="small">
+                {{ row.status === '0' ? '鍚敤' : '鍋滅敤' }}
+              </el-tag>
+            </template>
+          </el-table-column>
+          <el-table-column label="鎿嶄綔" width="200" align="center" fixed="right">
+            <template #default="{ row }">
+              <el-button link type="primary" @click="openRouteForm(row)">缂栬緫</el-button>
+              <el-button link type="primary" @click="createTaskFromRoute(row)">涓嬪彂浠诲姟</el-button>
+              <el-button link type="danger" @click="removeRoute(row)">鍒犻櫎</el-button>
+            </template>
+          </el-table-column>
+        </el-table>
+      </el-tab-pane>
 
-    <!-- 鏌ヨ -->
-    <div class="filter-card">
-      <el-input
-        v-model="query.taskName"
-        placeholder="浠诲姟鍚嶇О"
-        clearable
-        :prefix-icon="Search"
-        style="width: 200px"
-        @keyup.enter="handleSearch"
-      />
-      <el-input
-        v-model="query.inspectionLocation"
-        placeholder="宸℃鍖哄煙"
-        clearable
-        style="width: 180px"
-        @keyup.enter="handleSearch"
-      />
-      <el-select v-model="query.taskStatus" placeholder="鐘舵��" clearable style="width: 140px">
-        <el-option label="寰呮墽琛�" value="pending" />
-        <el-option label="鎵ц涓�" value="running" />
-        <el-option label="宸插畬鎴�" value="finished" />
-      </el-select>
-      <el-select v-model="query.deviceSource" placeholder="閲囬泦缁堢" clearable style="width: 150px">
-        <el-option label="瑙嗛鍒嗘瀽" value="video" />
-        <el-option label="鏃犱汉鏈�" value="drone" />
-        <el-option label="宸℃鏈哄櫒浜�" value="robot" />
-        <el-option label="浜哄伐缁堢" value="manual" />
-      </el-select>
-      <el-button type="primary" :icon="Search" @click="handleSearch">鏌ヨ</el-button>
-      <el-button :icon="Refresh" @click="resetQuery">閲嶇疆</el-button>
-    </div>
+      <!-- ==================== 宸℃浠诲姟 ==================== -->
+      <el-tab-pane label="宸℃浠诲姟" name="task">
+        <div class="search_form">
+          <div>
+            <span class="search_title">璺嚎鍚嶇О锛�</span>
+            <el-input v-model="taskQuery.routeName" style="width: 180px" placeholder="璇疯緭鍏�" clearable
+                      @keyup.enter="loadTask" />
+            <span class="search_title ml10">浠诲姟鐘舵�侊細</span>
+            <el-select v-model="taskQuery.taskStatus" style="width: 140px" placeholder="鍏ㄩ儴" clearable
+                       @change="loadTask">
+              <el-option label="寰呮墽琛�" value="0" />
+              <el-option label="鎵ц涓�" value="1" />
+              <el-option label="宸插畬鎴�" value="2" />
+              <el-option label="宸茬粓姝�" value="3" />
+            </el-select>
+            <el-button type="primary" style="margin-left: 10px" @click="loadTask">鎼滅储</el-button>
+          </div>
+          <div>
+            <el-button type="primary" @click="openTaskForm">涓嬪彂宸℃浠诲姟</el-button>
+          </div>
+        </div>
+        <el-table :data="taskList" border stripe v-loading="taskLoading" style="width: 100%">
+          <el-table-column type="index" label="搴忓彿" width="60" align="center" />
+          <el-table-column prop="taskCode" label="浠诲姟缂栧彿" width="170" align="center" />
+          <el-table-column prop="routeName" label="宸℃璺嚎" min-width="150" show-overflow-tooltip />
+          <el-table-column prop="inspectMode" label="鎵ц鏂瑰紡" width="110" align="center" />
+          <el-table-column prop="deviceCode" label="鎵ц璁惧" width="120" align="center" />
+          <el-table-column prop="executorName" label="宸℃浜哄憳" width="100" align="center" />
+          <el-table-column label="璁″垝鏃堕棿" width="180" align="center">
+            <template #default="{ row }">
+              <div>{{ formatDateTime(row.planStartTime) }}</div>
+              <div class="sub-text">鑷� {{ formatDateTime(row.planEndTime) }}</div>
+            </template>
+          </el-table-column>
+          <el-table-column label="鐐逛綅鏁�" width="120" align="center">
+            <template #default="{ row }">
+              <span>{{ row.pointNormal || 0 }}/{{ row.pointTotal || 0 }}</span>
+              <el-tag v-if="row.pointAbnormal > 0" type="danger" size="small" style="margin-left: 6px">
+                寮傚父{{ row.pointAbnormal }}
+              </el-tag>
+            </template>
+          </el-table-column>
+          <el-table-column label="浠诲姟鐘舵��" width="100" align="center">
+            <template #default="{ row }">
+              <el-tag :type="taskStatusType(row.taskStatus)" size="small">{{ taskStatusText(row.taskStatus) }}</el-tag>
+            </template>
+          </el-table-column>
+          <el-table-column label="鎿嶄綔" width="300" align="center" fixed="right">
+            <template #default="{ row }">
+              <el-button v-if="row.taskStatus === '0'" link type="primary" @click="startTask(row)">寮�濮�</el-button>
+              <el-button link type="primary" @click="openRecordDialog(row)">宸℃鏄庣粏</el-button>
+              <el-button link type="primary" @click="analyzeTask(row)">瑙嗛鍒嗘瀽鐢熸垚鎶ュ憡</el-button>
+              <el-button v-if="row.taskStatus !== '2'" link type="primary" @click="finishTask(row)">瀹屾垚骞跺嚭鎶ュ憡</el-button>
+              <el-button link type="danger" @click="removeTask(row)">鍒犻櫎</el-button>
+            </template>
+          </el-table-column>
+        </el-table>
+      </el-tab-pane>
 
-    <!-- 琛ㄦ牸 -->
-    <div class="table-card">
-      <el-table :data="tasks" v-loading="loading" border stripe row-key="id">
-        <el-table-column prop="taskName" label="浠诲姟鍚嶇О" min-width="160" show-overflow-tooltip />
-        <el-table-column prop="inspectionLocation" label="宸℃鍖哄煙" min-width="120" show-overflow-tooltip />
-        <el-table-column label="瑙勫垝璺緞" min-width="240" show-overflow-tooltip>
-          <template #default="{ row }">
-            <span class="route-text">{{ row.inspectionRoute || '鈥�' }}</span>
-          </template>
-        </el-table-column>
-        <el-table-column label="閲囬泦缁堢" width="130">
-          <template #default="{ row }">
-            <el-tag effect="plain" size="small" :type="sourceType(row.deviceSource)">
-              {{ sourceText(row.deviceSource) }}
-            </el-tag>
-          </template>
-        </el-table-column>
-        <el-table-column prop="inspector" label="宸℃浜�" width="110" />
-        <el-table-column label="鐘舵��" width="100" align="center">
-          <template #default="{ row }">
-            <el-tag :type="statusType(row.taskStatus)" size="small">{{ statusText(row.taskStatus) }}</el-tag>
-          </template>
-        </el-table-column>
-        <el-table-column prop="actualStartTime" label="寮�濮嬫椂闂�" width="165" />
-        <el-table-column prop="reportTime" label="鎶ュ憡鏃堕棿" width="165" />
-        <el-table-column label="鎿嶄綔" width="230" fixed="right" align="center">
-          <template #default="{ row }">
-            <el-button link type="primary" :icon="Edit" :disabled="row.taskStatus === 'running' || row.taskStatus === 'finished'" @click="openForm(row)">缂栬緫</el-button>
-            <el-button v-if="!row.taskStatus || row.taskStatus === 'pending'" link type="success" :icon="VideoPlay" @click="start(row)">寮�濮�</el-button>
-            <el-button v-if="row.taskStatus === 'running'" link type="warning" :icon="CircleCheck" @click="finish(row)">瀹屾垚</el-button>
-            <el-button v-if="row.reportContent" link :icon="Document" @click="showReport(row)">鎶ュ憡</el-button>
-            <el-button link type="danger" :icon="Delete" @click="remove(row)">鍒犻櫎</el-button>
-          </template>
-        </el-table-column>
-        <template #empty>
-          <div class="table-empty">鏆傛棤宸℃浠诲姟锛岀偣鍑诲彸涓婅鈥滄柊寤哄贰妫�浠诲姟鈥濆紑濮嬭鍒�</div>
-        </template>
-      </el-table>
+      <!-- ==================== 宸℃鎶ュ憡 ==================== -->
+      <el-tab-pane label="宸℃鎶ュ憡" name="report">
+        <div class="search_form">
+          <div>
+            <span class="search_title">鎶ュ憡鏍囬锛�</span>
+            <el-input v-model="reportQuery.reportTitle" style="width: 200px" placeholder="璇疯緭鍏�" clearable
+                      @keyup.enter="loadReport" />
+            <el-button type="primary" style="margin-left: 10px" @click="loadReport">鎼滅储</el-button>
+          </div>
+          <div class="tip-text">鎶ュ憡鐢辫棰戝垎鏋� / 鏃犱汉鏈� / 鏈哄櫒浜哄洖浼犵粨鏋滆嚜鍔ㄦ眹鎬荤敓鎴�</div>
+        </div>
+        <el-table :data="reportList" border stripe v-loading="reportLoading" style="width: 100%">
+          <el-table-column type="index" label="搴忓彿" width="60" align="center" />
+          <el-table-column prop="reportCode" label="鎶ュ憡缂栧彿" width="170" align="center" />
+          <el-table-column prop="reportTitle" label="鎶ュ憡鏍囬" min-width="180" show-overflow-tooltip />
+          <el-table-column prop="routeName" label="宸℃璺嚎" width="150" show-overflow-tooltip />
+          <el-table-column prop="inspectMode" label="鎵ц鏂瑰紡" width="110" align="center" />
+          <el-table-column label="鐐逛綅鏁�" width="110" align="center">
+            <template #default="{ row }">
+              {{ row.pointNormal }}/{{ row.pointTotal }}
+            </template>
+          </el-table-column>
+          <el-table-column label="姝e父鐜�" width="100" align="center">
+            <template #default="{ row }">
+              <span :class="Number(row.normalRate) >= 90 ? 'text-success' : 'text-warning'">
+                {{ row.normalRate }}%
+              </span>
+            </template>
+          </el-table-column>
+          <el-table-column label="寮傚父鐐逛綅" width="90" align="center">
+            <template #default="{ row }">
+              <el-tag :type="row.pointAbnormal > 0 ? 'danger' : 'success'" size="small">
+                {{ row.pointAbnormal || 0 }}
+              </el-tag>
+            </template>
+          </el-table-column>
+          <el-table-column prop="generateType" label="鐢熸垚鏂瑰紡" width="110" align="center">
+            <template #default="{ row }">
+              {{ row.generateType === '0' ? '鑷姩鐢熸垚' : '鎵嬪姩鐢熸垚' }}
+            </template>
+          </el-table-column>
+          <el-table-column prop="reportTime" label="鐢熸垚鏃堕棿" width="170" align="center">
+            <template #default="{ row }">{{ formatDateTime(row.reportTime) }}</template>
+          </el-table-column>
+          <el-table-column label="鎿嶄綔" width="140" align="center" fixed="right">
+            <template #default="{ row }">
+              <el-button link type="primary" @click="viewReport(row)">鏌ョ湅鎶ュ憡</el-button>
+              <el-button link type="danger" @click="removeReport(row)">鍒犻櫎</el-button>
+            </template>
+          </el-table-column>
+        </el-table>
+      </el-tab-pane>
 
-      <el-pagination
-        v-model:current-page="query.current"
-        v-model:page-size="query.size"
-        :total="total"
-        :page-sizes="[10, 20, 50]"
-        layout="total, sizes, prev, pager, next"
-        class="pager"
-        @current-change="load"
-        @size-change="handleSearch"
-      />
-    </div>
+      <!-- ==================== 宸℃鐐逛綅 ==================== -->
+      <el-tab-pane label="宸℃鐐逛綅" name="point">
+        <div class="search_form">
+          <div>
+            <span class="search_title">鐐逛綅鍚嶇О锛�</span>
+            <el-input v-model="pointQuery.pointName" style="width: 180px" placeholder="璇疯緭鍏�" clearable
+                      @keyup.enter="loadPoint" />
+            <span class="search_title ml10">鎵�灞炲尯鍩燂細</span>
+            <el-input v-model="pointQuery.areaName" style="width: 150px" placeholder="璇疯緭鍏�" clearable
+                      @keyup.enter="loadPoint" />
+            <el-button type="primary" style="margin-left: 10px" @click="loadPoint">鎼滅储</el-button>
+          </div>
+          <div>
+            <el-button type="primary" @click="openPointForm()">鏂板鐐逛綅</el-button>
+          </div>
+        </div>
+        <el-table :data="pointList" border stripe v-loading="pointLoading" style="width: 100%">
+          <el-table-column type="index" label="搴忓彿" width="60" align="center" />
+          <el-table-column prop="pointCode" label="鐐逛綅缂栧彿" width="140" align="center" />
+          <el-table-column prop="pointName" label="鐐逛綅鍚嶇О" min-width="150" />
+          <el-table-column prop="areaName" label="鎵�灞炲尯鍩�" width="130" />
+          <el-table-column prop="deviceType" label="閲囬泦璁惧绫诲瀷" width="140" align="center" />
+          <el-table-column prop="deviceCode" label="閲囬泦璁惧缂栧彿" width="140" align="center" />
+          <el-table-column prop="analyzeItem" label="瑙嗛鍒嗘瀽璇嗗埆椤�" min-width="200" show-overflow-tooltip />
+          <el-table-column label="鐘舵��" width="80" align="center">
+            <template #default="{ row }">
+              <el-tag :type="row.status === '0' ? 'success' : 'info'" size="small">
+                {{ row.status === '0' ? '鍚敤' : '鍋滅敤' }}
+              </el-tag>
+            </template>
+          </el-table-column>
+          <el-table-column label="鎿嶄綔" width="140" align="center" fixed="right">
+            <template #default="{ row }">
+              <el-button link type="primary" @click="openPointForm(row)">缂栬緫</el-button>
+              <el-button link type="danger" @click="removePoint(row)">鍒犻櫎</el-button>
+            </template>
+          </el-table-column>
+        </el-table>
+      </el-tab-pane>
+    </el-tabs>
 
-    <!-- 鏂板缓/缂栬緫 -->
-    <el-dialog v-model="dialog" :title="form.id ? '缂栬緫宸℃浠诲姟' : '鏂板缓宸℃浠诲姟'" width="700px" destroy-on-close>
-      <el-form ref="formRef" :model="form" :rules="rules" label-width="100px">
-        <el-form-item label="浠诲姟鍚嶇О" prop="taskName">
-          <el-input v-model="form.taskName" placeholder="渚嬪锛氬師鏂欏簱鏃ュ父宸℃" />
-        </el-form-item>
-        <el-row :gutter="16">
-          <el-col :span="12">
-            <el-form-item label="宸℃鍖哄煙" prop="inspectionLocation">
-              <el-input v-model="form.inspectionLocation" placeholder="渚嬪锛氬師鏂欏簱" />
+    <!-- ==================== 璺緞缂栬緫寮圭獥 ==================== -->
+    <el-dialog v-model="routeDialog" :title="routeForm.id ? '缂栬緫宸℃璺緞' : '鏂板宸℃璺緞'" width="70%"
+               @close="resetRouteForm">
+      <el-form ref="routeFormRef" :model="routeForm" :rules="routeRules" label-position="top">
+        <el-row :gutter="24">
+          <el-col :span="8">
+            <el-form-item label="璺嚎鍚嶇О锛�" prop="routeName">
+              <el-input v-model="routeForm.routeName" placeholder="璇疯緭鍏ヨ矾绾垮悕绉�" clearable />
             </el-form-item>
           </el-col>
-          <el-col :span="12">
-            <el-form-item label="閲囬泦缁堢" prop="deviceSource">
-              <el-select v-model="form.deviceSource" style="width: 100%">
-                <el-option label="瑙嗛鍒嗘瀽" value="video" />
-                <el-option label="鏃犱汉鏈�" value="drone" />
-                <el-option label="宸℃鏈哄櫒浜�" value="robot" />
-                <el-option label="浜哄伐缁堢" value="manual" />
+          <el-col :span="8">
+            <el-form-item label="宸℃绫诲瀷锛�" prop="routeType">
+              <el-select v-model="routeForm.routeType" style="width: 100%" placeholder="璇烽�夋嫨">
+                <el-option v-for="item in routeTypeList" :key="item" :label="item" :value="item" />
+              </el-select>
+            </el-form-item>
+          </el-col>
+          <el-col :span="8">
+            <el-form-item label="鎵ц鏂瑰紡锛�" prop="inspectMode">
+              <el-select v-model="routeForm.inspectMode" style="width: 100%" placeholder="璇烽�夋嫨">
+                <el-option v-for="item in inspectModeList" :key="item" :label="item" :value="item" />
               </el-select>
             </el-form-item>
           </el-col>
         </el-row>
-        <el-form-item label="瑙勫垝璺緞" prop="inspectionRoute">
-          <el-input v-model="form.inspectionRoute" type="textarea" :rows="3" placeholder="渚嬪锛氬寳闂� 鈫� 鍘熸枡搴� 鈫� 1鍙蜂骇绾� 鈫� 鍦扮鎴� 鈫� 鍖楅棬" />
-          <div class="route-templates">
-            <span>蹇嵎妯℃澘锛�</span>
-            <el-button v-for="t in routeTemplates" :key="t.label" link type="primary" size="small" @click="form.inspectionRoute = t.value">{{ t.label }}</el-button>
+        <el-row :gutter="24">
+          <el-col :span="8">
+            <el-form-item label="宸℃鍖哄煙锛�">
+              <el-input v-model="routeForm.areaName" placeholder="璇疯緭鍏ュ贰妫�鍖哄煙" clearable />
+            </el-form-item>
+          </el-col>
+          <el-col :span="8">
+            <el-form-item label="宸℃鍛ㄦ湡锛�">
+              <el-select v-model="routeForm.cycleType" style="width: 100%" placeholder="璇烽�夋嫨" clearable>
+                <el-option label="姣忓ぉ" value="姣忓ぉ" />
+                <el-option label="姣忓懆" value="姣忓懆" />
+                <el-option label="姣忔湀" value="姣忔湀" />
+                <el-option label="涓嶉噸澶�" value="涓嶉噸澶�" />
+              </el-select>
+            </el-form-item>
+          </el-col>
+          <el-col :span="8">
+            <el-form-item label="鎵ц鏃堕棿锛�">
+              <el-time-picker v-model="routeForm.cycleTime" style="width: 100%" value-format="HH:mm"
+                              format="HH:mm" placeholder="閫夋嫨鏃堕棿" />
+            </el-form-item>
+          </el-col>
+        </el-row>
+        <el-row :gutter="24">
+          <el-col :span="8">
+            <el-form-item label="棰勮鑰楁椂(鍒嗛挓)锛�">
+              <el-input-number v-model="routeForm.planDuration" :min="0" style="width: 100%" />
+            </el-form-item>
+          </el-col>
+          <el-col :span="8">
+            <el-form-item label="榛樿宸℃浜哄憳锛�">
+              <el-input v-model="routeForm.executorName" placeholder="璇疯緭鍏�" clearable />
+            </el-form-item>
+          </el-col>
+          <el-col :span="8">
+            <el-form-item label="鎵ц璁惧(鏃犱汉鏈�/鏈哄櫒浜虹紪鍙�)锛�">
+              <el-input v-model="routeForm.deviceCode" placeholder="濡� WRJ-001 / JQR-002" clearable />
+            </el-form-item>
+          </el-col>
+        </el-row>
+        <el-form-item label="宸℃鐐逛綅(鎸夊簭鍙蜂緷娆″贰妫�锛屽彲涓婁笅璋冩暣椤哄簭)锛�">
+          <el-select v-model="routePointIds" multiple filterable style="width: 100%"
+                     placeholder="璇烽�夋嫨宸℃鐐逛綅">
+            <el-option v-for="item in allPointList" :key="item.id"
+                       :label="`${item.pointName}锛�${item.areaName || '鏈垎鍖�'}锛塦" :value="item.id" />
+          </el-select>
+          <div class="point-order-editor">
+            <div v-for="(name, index) in selectedPointNames" :key="index" class="order-item">
+              <span class="seq">{{ index + 1 }}</span>
+              <span class="name">{{ name }}</span>
+              <span class="ops">
+                <el-button link type="primary" :disabled="index === 0" @click="movePoint(index, -1)">涓婄Щ</el-button>
+                <el-button link type="primary" :disabled="index === routePointIds.length - 1"
+                           @click="movePoint(index, 1)">涓嬬Щ</el-button>
+                <el-button link type="danger" @click="removePointAt(index)">绉婚櫎</el-button>
+              </span>
+            </div>
+            <span v-if="selectedPointNames.length === 0" class="sub-text">灏氭湭閫夋嫨鐐逛綅</span>
           </div>
         </el-form-item>
-        <el-row :gutter="16">
-          <el-col :span="12">
-            <el-form-item label="鎵ц棰戞">
-              <el-select v-model="form.frequencyType" style="width: 100%">
-                <el-option label="鍗曟" value="once" />
-                <el-option label="姣忔棩" value="daily" />
-                <el-option label="姣忓懆" value="weekly" />
-              </el-select>
+        <el-row :gutter="24">
+          <el-col :span="8">
+            <el-form-item label="鐘舵�侊細">
+              <el-radio-group v-model="routeForm.status">
+                <el-radio value="0">鍚敤</el-radio>
+                <el-radio value="1">鍋滅敤</el-radio>
+              </el-radio-group>
             </el-form-item>
           </el-col>
-          <el-col :span="12">
-            <el-form-item label="宸℃浜哄憳">
-              <el-input v-model="form.inspector" placeholder="鎵ц浜哄鍚�" />
+          <el-col :span="16">
+            <el-form-item label="澶囨敞锛�">
+              <el-input v-model="routeForm.remark" placeholder="璇疯緭鍏ュ娉�" clearable />
             </el-form-item>
           </el-col>
         </el-row>
-        <el-form-item label="璁″垝鏃堕棿">
-          <el-input v-model="form.frequencyDetail" placeholder="濡傦細姣忔棩 08:00" />
-        </el-form-item>
-        <el-form-item label="澶囨敞">
-          <el-input v-model="form.remarks" type="textarea" :rows="2" />
-        </el-form-item>
       </el-form>
       <template #footer>
-        <el-button @click="dialog = false">鍙栨秷</el-button>
-        <el-button type="primary" :loading="saving" @click="save">淇濆瓨</el-button>
+        <el-button @click="routeDialog = false">鍙栨秷</el-button>
+        <el-button type="primary" @click="submitRoute">纭</el-button>
       </template>
     </el-dialog>
 
-    <!-- 鎶ュ憡 -->
-    <el-dialog v-model="reportDialog" title="鑷姩宸℃鎶ュ憡" width="680px">
-      <el-descriptions :column="2" border>
-        <el-descriptions-item label="浠诲姟">{{ current.taskName }}</el-descriptions-item>
-        <el-descriptions-item label="閲囬泦缁堢">{{ sourceText(current.deviceSource) }}</el-descriptions-item>
-        <el-descriptions-item label="宸℃鍖哄煙">{{ current.inspectionLocation || '鈥�' }}</el-descriptions-item>
-        <el-descriptions-item label="宸℃浜哄憳">{{ current.inspector || '鈥�' }}</el-descriptions-item>
-        <el-descriptions-item label="寮�濮嬫椂闂�">{{ current.actualStartTime || '鈥�' }}</el-descriptions-item>
-        <el-descriptions-item label="缁撴潫鏃堕棿">{{ current.actualEndTime || '鈥�' }}</el-descriptions-item>
-      </el-descriptions>
-      <pre class="report-content">{{ current.reportContent }}</pre>
+    <!-- ==================== 浠诲姟涓嬪彂寮圭獥 ==================== -->
+    <el-dialog v-model="taskDialog" title="涓嬪彂宸℃浠诲姟" width="620px" @close="resetTaskForm">
+      <el-form ref="taskFormRef" :model="taskForm" :rules="taskRules" label-position="top">
+        <el-form-item label="宸℃璺嚎锛�" prop="routeId">
+          <el-select v-model="taskForm.routeId" style="width: 100%" placeholder="璇烽�夋嫨宸℃璺嚎"
+                     @change="onTaskRouteChange">
+            <el-option v-for="item in routeOptions" :key="item.id" :label="item.routeName" :value="item.id" />
+          </el-select>
+        </el-form-item>
+        <el-row :gutter="20">
+          <el-col :span="12">
+            <el-form-item label="璁″垝寮�濮嬫椂闂达細" prop="planStartTime">
+              <el-date-picker v-model="taskForm.planStartTime" type="datetime" style="width: 100%"
+                              value-format="YYYY-MM-DD HH:mm:ss" placeholder="閫夋嫨鏃堕棿" />
+            </el-form-item>
+          </el-col>
+          <el-col :span="12">
+            <el-form-item label="璁″垝缁撴潫鏃堕棿锛�">
+              <el-date-picker v-model="taskForm.planEndTime" type="datetime" style="width: 100%"
+                              value-format="YYYY-MM-DD HH:mm:ss" placeholder="閫夋嫨鏃堕棿" />
+            </el-form-item>
+          </el-col>
+        </el-row>
+        <el-row :gutter="20">
+          <el-col :span="12">
+            <el-form-item label="鎵ц鏂瑰紡锛�">
+              <el-select v-model="taskForm.inspectMode" style="width: 100%" placeholder="璇烽�夋嫨">
+                <el-option v-for="item in inspectModeList" :key="item" :label="item" :value="item" />
+              </el-select>
+            </el-form-item>
+          </el-col>
+          <el-col :span="12">
+            <el-form-item label="宸℃浜哄憳锛�">
+              <el-input v-model="taskForm.executorName" placeholder="璇疯緭鍏�" clearable />
+            </el-form-item>
+          </el-col>
+        </el-row>
+        <el-form-item label="鎵ц璁惧(鏃犱汉鏈�/鏈哄櫒浜虹紪鍙�)锛�">
+          <el-input v-model="taskForm.deviceCode" placeholder="濡� WRJ-001 / JQR-002" clearable />
+        </el-form-item>
+        <el-form-item label="澶囨敞锛�">
+          <el-input v-model="taskForm.remark" type="textarea" :rows="2" placeholder="璇疯緭鍏ュ娉�" />
+        </el-form-item>
+      </el-form>
       <template #footer>
-        <el-button :icon="CopyDocument" @click="copyReport">澶嶅埗鎶ュ憡</el-button>
-        <el-button type="primary" @click="reportDialog = false">鍏抽棴</el-button>
+        <el-button @click="taskDialog = false">鍙栨秷</el-button>
+        <el-button type="primary" @click="submitTask">纭涓嬪彂</el-button>
+      </template>
+    </el-dialog>
+
+    <!-- ==================== 宸℃鏄庣粏寮圭獥 ==================== -->
+    <el-dialog v-model="recordDialog" title="宸℃鏄庣粏(瑙嗛鍒嗘瀽 / 璁惧鍥炰紶)" width="80%">
+      <div class="record-summary">
+        浠诲姟锛歿{ currentTask.taskCode }} 锝� 璺嚎锛歿{ currentTask.routeName }} 锝� 鎵ц鏂瑰紡锛歿{ currentTask.inspectMode }}
+      </div>
+      <el-table :data="recordList" border stripe style="width: 100%" max-height="440">
+        <el-table-column type="index" label="搴忓彿" width="60" align="center" />
+        <el-table-column prop="pointName" label="鐐逛綅" width="140" />
+        <el-table-column prop="areaName" label="鍖哄煙" width="110" />
+        <el-table-column prop="collectSource" label="鏁版嵁鏉ユ簮" width="110" align="center" />
+        <el-table-column prop="collectDevice" label="閲囬泦璁惧" width="120" align="center" />
+        <el-table-column prop="collectTime" label="閲囬泦鏃堕棿" width="170" align="center">
+          <template #default="{ row }">{{ formatDateTime(row.collectTime) }}</template>
+        </el-table-column>
+        <el-table-column prop="analyzeItem" label="璇嗗埆椤�" width="140" show-overflow-tooltip />
+        <el-table-column label="鍒嗘瀽缁撴灉" width="100" align="center">
+          <template #default="{ row }">
+            <el-tag :type="row.analyzeResult === '1' ? 'danger' : 'success'" size="small">
+              {{ row.analyzeResult === '1' ? '寮傚父' : '姝e父' }}
+            </el-tag>
+          </template>
+        </el-table-column>
+        <el-table-column prop="confidence" label="缃俊搴�" width="90" align="center" />
+        <el-table-column prop="description" label="璇嗗埆鎻忚堪" min-width="220" show-overflow-tooltip />
+      </el-table>
+      <template #footer>
+        <el-button @click="recordDialog = false">鍏抽棴</el-button>
+      </template>
+    </el-dialog>
+
+    <!-- ==================== 宸℃鎶ュ憡寮圭獥 ==================== -->
+    <el-dialog v-model="reportDialog" title="宸℃鎶ュ憡" width="80%">
+      <div class="report-head">
+        <h3>{{ currentReport.reportTitle }}</h3>
+        <div class="report-meta">
+          <span>鎶ュ憡缂栧彿锛歿{ currentReport.reportCode }}</span>
+          <span>宸℃璺嚎锛歿{ currentReport.routeName }}</span>
+          <span>鎵ц鏂瑰紡锛歿{ currentReport.inspectMode }}</span>
+          <span>鐢熸垚鏃堕棿锛歿{ formatDateTime(currentReport.reportTime) }}</span>
+        </div>
+        <el-alert :title="currentReport.summary" type="info" :closable="false" show-icon />
+        <el-alert v-if="currentReport.pointAbnormal > 0" :title="currentReport.abnormalDesc" type="error"
+                  :closable="false" show-icon style="margin-top: 10px" />
+      </div>
+      <el-table :data="reportDetails" border stripe style="width: 100%" max-height="380">
+        <el-table-column type="index" label="搴忓彿" width="60" align="center" />
+        <el-table-column prop="pointName" label="鐐逛綅" width="150" />
+        <el-table-column prop="areaName" label="鍖哄煙" width="120" />
+        <el-table-column prop="collectSource" label="鏁版嵁鏉ユ簮" width="110" align="center" />
+        <el-table-column prop="analyzeResult" label="鍒嗘瀽缁撴灉" width="100" align="center" />
+        <el-table-column prop="analyzeItem" label="璇嗗埆椤�" width="140" show-overflow-tooltip />
+        <el-table-column prop="collectTime" label="閲囬泦鏃堕棿" width="170" align="center" />
+        <el-table-column prop="description" label="璇嗗埆鎻忚堪" min-width="220" show-overflow-tooltip />
+      </el-table>
+      <template #footer>
+        <el-button @click="reportDialog = false">鍏抽棴</el-button>
+      </template>
+    </el-dialog>
+
+    <!-- ==================== 鐐逛綅缂栬緫寮圭獥 ==================== -->
+    <el-dialog v-model="pointDialog" :title="pointForm.id ? '缂栬緫宸℃鐐逛綅' : '鏂板宸℃鐐逛綅'" width="640px"
+               @close="resetPointForm">
+      <el-form ref="pointFormRef" :model="pointForm" :rules="pointRules" label-position="top">
+        <el-row :gutter="20">
+          <el-col :span="12">
+            <el-form-item label="鐐逛綅鍚嶇О锛�" prop="pointName">
+              <el-input v-model="pointForm.pointName" placeholder="璇疯緭鍏ョ偣浣嶅悕绉�" clearable />
+            </el-form-item>
+          </el-col>
+          <el-col :span="12">
+            <el-form-item label="鎵�灞炲尯鍩燂細">
+              <el-input v-model="pointForm.areaName" placeholder="璇疯緭鍏ユ墍灞炲尯鍩�" clearable />
+            </el-form-item>
+          </el-col>
+        </el-row>
+        <el-row :gutter="20">
+          <el-col :span="12">
+            <el-form-item label="閲囬泦璁惧绫诲瀷锛�">
+              <el-select v-model="pointForm.deviceType" style="width: 100%" placeholder="璇烽�夋嫨" clearable>
+                <el-option v-for="item in deviceTypeList" :key="item" :label="item" :value="item" />
+              </el-select>
+            </el-form-item>
+          </el-col>
+          <el-col :span="12">
+            <el-form-item label="閲囬泦璁惧缂栧彿锛�">
+              <el-input v-model="pointForm.deviceCode" placeholder="鎽勫儚澶�/鏈哄櫒浜�/鏃犱汉鏈虹紪鍙�" clearable />
+            </el-form-item>
+          </el-col>
+        </el-row>
+        <el-form-item label="瑙嗛鍒嗘瀽璇嗗埆椤癸細">
+          <el-input v-model="pointForm.analyzeItem" placeholder="濡� 鐨甫璺戝亸,浜哄憳鏈埓瀹夊叏甯�,璁惧婕忔补" clearable />
+        </el-form-item>
+        <el-row :gutter="20">
+          <el-col :span="12">
+            <el-form-item label="骞抽潰鍧愭爣X锛�">
+              <el-input v-model="pointForm.positionX" placeholder="鍙��" clearable />
+            </el-form-item>
+          </el-col>
+          <el-col :span="12">
+            <el-form-item label="骞抽潰鍧愭爣Y锛�">
+              <el-input v-model="pointForm.positionY" placeholder="鍙��" clearable />
+            </el-form-item>
+          </el-col>
+        </el-row>
+        <el-row :gutter="20">
+          <el-col :span="12">
+            <el-form-item label="鐘舵�侊細">
+              <el-radio-group v-model="pointForm.status">
+                <el-radio value="0">鍚敤</el-radio>
+                <el-radio value="1">鍋滅敤</el-radio>
+              </el-radio-group>
+            </el-form-item>
+          </el-col>
+          <el-col :span="12">
+            <el-form-item label="澶囨敞锛�">
+              <el-input v-model="pointForm.remark" placeholder="璇疯緭鍏ュ娉�" clearable />
+            </el-form-item>
+          </el-col>
+        </el-row>
+      </el-form>
+      <template #footer>
+        <el-button @click="pointDialog = false">鍙栨秷</el-button>
+        <el-button type="primary" @click="submitPoint">纭</el-button>
       </template>
     </el-dialog>
   </div>
 </template>
 
 <script setup>
-import { computed, getCurrentInstance, onBeforeUnmount, onMounted, reactive, ref } from "vue";
+import { computed, onMounted, reactive, ref } from "vue";
+import { ElMessageBox, ElNotification } from "element-plus";
 import {
-  Plus, Search, Refresh, Edit, Delete, VideoPlay, CircleCheck,
-  Document, CopyDocument, List, Clock, Loading, Tickets
-} from "@element-plus/icons-vue";
-import {
-  deleteInspectionTasks, finishInspectionTask, listInspectionTasks,
-  saveInspectionTask, startInspectionTask
-} from "@/api/environmentAccess/intelligentInspection";
+  addInspectionPoint,
+  addInspectionTask,
+  addInspectionRoute,
+  analyzeInspectionTask,
+  delInspectionPoint,
+  delInspectionReport,
+  delInspectionRoute,
+  delInspectionTask,
+  finishInspectionTask,
+  getInspectionReport,
+  listAllInspectionPoint,
+  listAllInspectionRoute,
+  listInspectionPoint,
+  listInspectionRecord,
+  listInspectionReport,
+  listInspectionRoute,
+  listInspectionTask,
+  startInspectionTask,
+  updateInspectionPoint,
+  updateInspectionRoute,
+} from "@/api/environmentAccess/inspection.js";
 
 const { proxy } = getCurrentInstance();
-const tasks = ref([]);
-const total = ref(0);
-const loading = ref(false);
-const saving = ref(false);
-const dialog = ref(false);
-const reportDialog = ref(false);
-const current = ref({});
-const formRef = ref(null);
-const query = reactive({
-  taskName: "", inspectionLocation: "", taskStatus: "", deviceSource: "",
-  current: 1, size: 10,
+
+const activeTab = ref("route");
+const inspectModeList = ["瑙嗛鍒嗘瀽", "鏃犱汉鏈�", "宸℃鏈哄櫒浜�", "浜哄伐"];
+const routeTypeList = ["鏃ュ父宸℃", "涓撻」宸℃", "涓存椂宸℃"];
+const deviceTypeList = ["鎽勫儚澶�", "娓╁害浼犳劅鍣�", "鍘嬪姏浼犳劅鍣�", "浜哄伐鐐逛綅"];
+
+const formatDateTime = (val) => {
+  if (!val) return "-";
+  return String(val).replace("T", " ").substring(0, 19);
+};
+const taskStatusText = (status) => {
+  return { "0": "寰呮墽琛�", "1": "鎵ц涓�", "2": "宸插畬鎴�", "3": "宸茬粓姝�" }[status] || "-";
+};
+const taskStatusType = (status) => {
+  return { "0": "info", "1": "warning", "2": "success", "3": "danger" }[status] || "info";
+};
+
+// ==================== 宸℃鐐逛綅 ====================
+const pointQuery = reactive({ pointName: "", areaName: "" });
+const pointList = ref([]);
+const pointLoading = ref(false);
+const allPointList = ref([]);
+const pointDialog = ref(false);
+const pointFormRef = ref();
+const pointForm = ref({});
+const pointRules = {
+  pointName: [{ required: true, message: "璇疯緭鍏ョ偣浣嶅悕绉�", trigger: "blur" }],
+};
+
+const loadPoint = () => {
+  pointLoading.value = true;
+  listInspectionPoint({ ...pointQuery, current: 1, size: 500 })
+    .then((res) => {
+      pointList.value = res.data?.records || [];
+    })
+    .finally(() => {
+      pointLoading.value = false;
+    });
+};
+const loadAllPoint = () => {
+  listAllInspectionPoint().then((res) => {
+    allPointList.value = res.data || [];
+  });
+};
+const openPointForm = (row) => {
+  pointForm.value = row ? { ...row } : { status: "0" };
+  pointDialog.value = true;
+};
+const resetPointForm = () => {
+  pointFormRef.value?.resetFields();
+  pointForm.value = {};
+};
+const submitPoint = () => {
+  pointFormRef.value.validate((valid) => {
+    if (!valid) return;
+    const api = pointForm.value.id ? updateInspectionPoint : addInspectionPoint;
+    api(pointForm.value).then(() => {
+      proxy.$modal.msgSuccess("淇濆瓨鎴愬姛");
+      pointDialog.value = false;
+      loadPoint();
+      loadAllPoint();
+    });
+  });
+};
+const removePoint = (row) => {
+  ElMessageBox.confirm(`纭畾鍒犻櫎鐐逛綅銆�${row.pointName}銆嶅悧锛焋, "鍒犻櫎鎻愮ず", { type: "warning" }).then(() => {
+    delInspectionPoint([row.id]).then(() => {
+      proxy.$modal.msgSuccess("鍒犻櫎鎴愬姛");
+      loadPoint();
+      loadAllPoint();
+    });
+  }).catch(() => {});
+};
+
+// ==================== 宸℃璺緞 ====================
+const routeQuery = reactive({ routeName: "", inspectMode: "" });
+const routeList = ref([]);
+const routeOptions = ref([]);
+const routeLoading = ref(false);
+const routeDialog = ref(false);
+const routeFormRef = ref();
+const routeForm = ref({});
+const routePointIds = ref([]);
+const routeRules = {
+  routeName: [{ required: true, message: "璇疯緭鍏ヨ矾绾垮悕绉�", trigger: "blur" }],
+  inspectMode: [{ required: true, message: "璇烽�夋嫨鎵ц鏂瑰紡", trigger: "change" }],
+};
+
+const selectedPointNames = computed(() => {
+  return routePointIds.value.map((id) => {
+    const target = allPointList.value.find((item) => item.id === id);
+    return target ? target.pointName : id;
+  });
 });
-const empty = {
-  id: null, taskName: "", inspectionLocation: "", inspectionRoute: "",
-  deviceSource: "video", frequencyType: "once", frequencyDetail: "",
-  inspector: "", remarks: "", taskStatus: "pending",
-};
-const form = reactive({ ...empty });
-const rules = {
-  taskName: [{ required: true, message: "璇疯緭鍏ヤ换鍔″悕绉�", trigger: "blur" }],
-  inspectionLocation: [{ required: true, message: "璇疯緭鍏ュ贰妫�鍖哄煙", trigger: "blur" }],
-  inspectionRoute: [{ required: true, message: "璇疯鍒掑贰妫�璺緞", trigger: "blur" }],
-  deviceSource: [{ required: true, message: "璇烽�夋嫨閲囬泦缁堢", trigger: "change" }],
+
+/** 璋冩暣宸℃椤哄簭锛歞irection = -1 涓婄Щ / 1 涓嬬Щ */
+const movePoint = (index, direction) => {
+  const list = [...routePointIds.value];
+  const target = index + direction;
+  if (target < 0 || target >= list.length) {
+    return;
+  }
+  const tmp = list[index];
+  list[index] = list[target];
+  list[target] = tmp;
+  routePointIds.value = list;
 };
 
-const routeTemplates = [
-  { label: "鍘熸枡搴�", value: "鍖楅棬 鈫� 鍘熸枡搴� 鈫� 1鍙蜂骇绾� 鈫� 鍦扮鎴� 鈫� 鍖楅棬" },
-  { label: "浜х嚎", value: "鎺у埗瀹� 鈫� 1鍙蜂骇绾� 鈫� 閰嶇數鎴� 鈫� 1鍙蜂骇绾�" },
-  { label: "鍦扮鍖�", value: "鍦扮鎴� 鈫� 绉伴噸鍙� 鈫� 绾㈠瀵瑰皠 鈫� 鍑哄彛閬撻椄" },
-  { label: "缃愬尯", value: "鍌ㄧ綈鍖� 鈫� 娉垫埧 鈫� 娑堥槻鏍� 鈫� 鍌ㄧ綈鍖�" },
-];
+/** 浠庡贰妫�椤哄簭涓Щ闄ゆ煇涓偣浣� */
+const removePointAt = (index) => {
+  const list = [...routePointIds.value];
+  list.splice(index, 1);
+  routePointIds.value = list;
+};
 
-const summary = computed(() => [
-  { label: "鍏ㄩ儴浠诲姟", value: total.value, icon: List, tone: "tone-brand" },
-  { label: "寰呮墽琛�", value: tasks.value.filter(x => !x.taskStatus || x.taskStatus === "pending").length, icon: Clock, tone: "" },
-  { label: "鎵ц涓�", value: tasks.value.filter(x => x.taskStatus === "running").length, icon: Loading, tone: "tone-warn" },
-  { label: "宸茬敓鎴愭姤鍛�", value: tasks.value.filter(x => x.reportContent).length, icon: Tickets, tone: "tone-signal" },
-]);
-
-const rows = r => r?.data?.records || r?.records || r?.data || [];
-let timer = null;
-
-async function load() {
-  loading.value = true;
-  try {
-    const res = await listInspectionTasks({ ...query });
-    tasks.value = rows(res);
-    total.value = Number(res?.data?.total ?? res?.total ?? tasks.value.length) || tasks.value.length;
-  } catch (e) {
-    tasks.value = [];
-    total.value = 0;
-  } finally {
-    loading.value = false;
-  }
-}
-
-function handleSearch() {
-  query.current = 1;
-  load();
-}
-
-function resetQuery() {
-  query.taskName = "";
-  query.inspectionLocation = "";
-  query.taskStatus = "";
-  query.deviceSource = "";
-  handleSearch();
-}
-
-function openForm(row = {}) {
-  Object.assign(form, empty, row);
-  dialog.value = true;
-}
-
-async function save() {
-  try {
-    await formRef.value.validate();
-  } catch (e) {
-    return;
-  }
-  saving.value = true;
-  try {
-    await saveInspectionTask({ ...form });
-    dialog.value = false;
-    proxy.$modal.msgSuccess("浠诲姟宸蹭繚瀛�");
-    load();
-  } catch (e) {
-    proxy.$modal.msgError("淇濆瓨澶辫触");
-  } finally {
-    saving.value = false;
-  }
-}
-
-async function start(row) {
-  try {
-    await startInspectionTask(row.id);
-    proxy.$modal.msgSuccess("宸℃宸插惎鍔紝閲囬泦缁堢寮�濮嬪洖浼�");
-    load();
-  } catch (e) {
-    // 閿欒淇℃伅宸茬敱璇锋眰鎷︽埅鍣ㄦ彁绀�
-  }
-}
-
-async function finish(row) {
-  try {
-    await finishInspectionTask(row.id);
-    proxy.$modal.msgSuccess("宸℃瀹屾垚锛屾姤鍛婂凡鑷姩鐢熸垚");
-    load();
-  } catch (e) {
-    // 閿欒淇℃伅宸茬敱璇锋眰鎷︽埅鍣ㄦ彁绀�
-  }
-}
-
-async function remove(row) {
-  try {
-    await proxy.$modal.confirm(`纭鍒犻櫎鈥�${row.taskName}鈥濓紵`);
-  } catch (e) {
-    return;
-  }
-  try {
-    await deleteInspectionTasks([row.id]);
-    proxy.$modal.msgSuccess("鍒犻櫎鎴愬姛");
-    load();
-  } catch (e) {
-    proxy.$modal.msgError("鍒犻櫎澶辫触");
-  }
-}
-
-function showReport(row) {
-  current.value = row;
-  reportDialog.value = true;
-}
-
-async function copyReport() {
-  const text = String(current.value.reportContent || "");
-  if (!text) {
-    proxy.$modal.msgWarning("鏆傛棤鍙鍒剁殑鎶ュ憡鍐呭");
-    return;
-  }
-  if (await copyText(text)) {
-    proxy.$modal.msgSuccess("鎶ュ憡宸插鍒�");
+const loadRoute = () => {
+  routeLoading.value = true;
+  listInspectionRoute({ ...routeQuery, current: 1, size: 500 })
+    .then((res) => {
+      routeList.value = res.data?.records || [];
+    })
+    .finally(() => {
+      routeLoading.value = false;
+    });
+};
+const loadRouteOptions = () => {
+  listAllInspectionRoute().then((res) => {
+    routeOptions.value = res.data || [];
+  });
+};
+const openRouteForm = (row) => {
+  loadAllPoint();
+  if (row) {
+    routeForm.value = { ...row };
+    routePointIds.value = row.pointIds ? row.pointIds.split(",").filter(Boolean).map(Number) : [];
   } else {
-    proxy.$modal.msgError("澶嶅埗澶辫触锛岃妫�鏌ユ祻瑙堝櫒鍓创鏉挎潈闄�");
+    routeForm.value = { status: "0", inspectMode: "瑙嗛鍒嗘瀽", routeType: "鏃ュ父宸℃" };
+    routePointIds.value = [];
   }
-}
-
-async function copyText(text) {
-  // HTTPS/localhost 浼樺厛浣跨敤鏍囧噯鍓创鏉挎帴鍙c��
-  if (window.isSecureContext && navigator.clipboard?.writeText) {
-    try {
-      await navigator.clipboard.writeText(text);
-      return true;
-    } catch (e) {
-      // 鏉冮檺琚嫆缁濇椂缁х画浣跨敤鍏煎鏂规銆�
+  routeDialog.value = true;
+};
+const resetRouteForm = () => {
+  routeFormRef.value?.resetFields();
+  routeForm.value = {};
+  routePointIds.value = [];
+};
+const submitRoute = () => {
+  routeFormRef.value.validate((valid) => {
+    if (!valid) return;
+    if (routePointIds.value.length === 0) {
+      proxy.$modal.msgWarning("璇疯嚦灏戦�夋嫨涓�涓贰妫�鐐逛綅");
+      return;
     }
-  }
+    const payload = { ...routeForm.value };
+    payload.pointIds = routePointIds.value.join(",");
+    payload.pointNames = selectedPointNames.value.join(" -> ");
+    payload.pointTotal = routePointIds.value.length;
+    const api = payload.id ? updateInspectionRoute : addInspectionRoute;
+    api(payload).then(() => {
+      proxy.$modal.msgSuccess("淇濆瓨鎴愬姛");
+      routeDialog.value = false;
+      loadRoute();
+      loadRouteOptions();
+    });
+  });
+};
+const removeRoute = (row) => {
+  ElMessageBox.confirm(`纭畾鍒犻櫎璺嚎銆�${row.routeName}銆嶅悧锛焋, "鍒犻櫎鎻愮ず", { type: "warning" }).then(() => {
+    delInspectionRoute([row.id]).then(() => {
+      proxy.$modal.msgSuccess("鍒犻櫎鎴愬姛");
+      loadRoute();
+      loadRouteOptions();
+    });
+  }).catch(() => {});
+};
 
-  const textarea = document.createElement("textarea");
-  const activeElement = document.activeElement;
-  textarea.value = text;
-  textarea.setAttribute("readonly", "");
-  textarea.style.position = "fixed";
-  textarea.style.left = "-9999px";
-  textarea.style.top = "0";
-  textarea.style.opacity = "0";
-  document.body.appendChild(textarea);
-  textarea.focus();
-  textarea.select();
-  textarea.setSelectionRange(0, textarea.value.length);
-  let copied = false;
-  try {
-    copied = document.execCommand("copy");
-  } catch (e) {
-    copied = false;
-  } finally {
-    document.body.removeChild(textarea);
-    activeElement?.focus?.();
-  }
-  return copied;
-}
+// ==================== 宸℃浠诲姟 ====================
+const taskQuery = reactive({ routeName: "", taskStatus: "" });
+const taskList = ref([]);
+const taskLoading = ref(false);
+const taskDialog = ref(false);
+const taskFormRef = ref();
+const taskForm = ref({});
+const taskRules = {
+  routeId: [{ required: true, message: "璇烽�夋嫨宸℃璺嚎", trigger: "change" }],
+  planStartTime: [{ required: true, message: "璇烽�夋嫨璁″垝寮�濮嬫椂闂�", trigger: "change" }],
+};
 
-const sourceText = v => ({ video: "瑙嗛鍒嗘瀽", drone: "鏃犱汉鏈�", robot: "宸℃鏈哄櫒浜�", manual: "浜哄伐缁堢" }[v] || "浜哄伐缁堢");
-const sourceType = v => ({ video: "primary", drone: "success", robot: "warning", manual: "info" }[v] || "info");
-const statusText = v => ({ pending: "寰呮墽琛�", running: "鎵ц涓�", finished: "宸插畬鎴�" }[v] || "寰呮墽琛�");
-const statusType = v => ({ pending: "info", running: "warning", finished: "success" }[v] || "info");
+const loadTask = () => {
+  taskLoading.value = true;
+  listInspectionTask({ ...taskQuery, current: 1, size: 500 })
+    .then((res) => {
+      taskList.value = res.data?.records || [];
+    })
+    .finally(() => {
+      taskLoading.value = false;
+    });
+};
+const openTaskForm = () => {
+  loadRouteOptions();
+  taskForm.value = { inspectMode: "瑙嗛鍒嗘瀽" };
+  taskDialog.value = true;
+};
+const createTaskFromRoute = (row) => {
+  loadRouteOptions();
+  taskForm.value = {
+    routeId: row.id,
+    inspectMode: row.inspectMode,
+    executorName: row.executorName,
+    deviceCode: row.deviceCode,
+  };
+  taskDialog.value = true;
+};
+const resetTaskForm = () => {
+  taskFormRef.value?.resetFields();
+  taskForm.value = {};
+};
+const onTaskRouteChange = (routeId) => {
+  const route = routeOptions.value.find((item) => item.id === routeId);
+  if (route) {
+    taskForm.value.inspectMode = route.inspectMode;
+    taskForm.value.executorName = route.executorName;
+    taskForm.value.deviceCode = route.deviceCode;
+  }
+};
+const submitTask = () => {
+  taskFormRef.value.validate((valid) => {
+    if (!valid) return;
+    addInspectionTask(taskForm.value).then(() => {
+      proxy.$modal.msgSuccess("宸℃浠诲姟宸蹭笅鍙�");
+      taskDialog.value = false;
+      activeTab.value = "task";
+      loadTask();
+    });
+  });
+};
+const startTask = (row) => {
+  startInspectionTask(row.id).then(() => {
+    proxy.$modal.msgSuccess("宸℃宸插紑濮�");
+    loadTask();
+  });
+};
+const analyzeTask = (row) => {
+  ElMessageBox.confirm(
+    "灏嗘寜宸℃璺緞閫愮偣浣嶆墽琛岃棰戝垎鏋�/璁惧鍥炰紶锛屽苟鑷姩姹囨�荤敓鎴愬贰妫�鎶ュ憡锛屾槸鍚︾户缁紵",
+    "瑙嗛鍒嗘瀽",
+    { type: "info" }
+  ).then(() => {
+    analyzeInspectionTask(row.id).then((res) => {
+      const report = res.data || {};
+      ElNotification({
+        title: "宸℃鎶ュ憡宸茬敓鎴�",
+        message: `姝e父 ${report.pointNormal || 0} 涓偣浣嶏紝寮傚父 ${report.pointAbnormal || 0} 涓偣浣峘,
+        type: report.pointAbnormal > 0 ? "warning" : "success",
+      });
+      loadTask();
+      loadReport();
+    });
+  }).catch(() => {});
+};
+const finishTask = (row) => {
+  ElMessageBox.confirm("纭瀹屾垚璇ュ贰妫�浠诲姟骞剁敓鎴愬贰妫�鎶ュ憡锛�", "鎻愮ず", { type: "info" }).then(() => {
+    finishInspectionTask(row.id).then(() => {
+      proxy.$modal.msgSuccess("宸℃鎶ュ憡宸茬敓鎴�");
+      loadTask();
+      loadReport();
+    });
+  }).catch(() => {});
+};
+const removeTask = (row) => {
+  ElMessageBox.confirm(`纭畾鍒犻櫎浠诲姟銆�${row.taskCode}銆嶅悧锛焋, "鍒犻櫎鎻愮ず", { type: "warning" }).then(() => {
+    delInspectionTask([row.id]).then(() => {
+      proxy.$modal.msgSuccess("鍒犻櫎鎴愬姛");
+      loadTask();
+    });
+  }).catch(() => {});
+};
+
+// ==================== 宸℃鏄庣粏 ====================
+const recordDialog = ref(false);
+const recordList = ref([]);
+const currentTask = ref({});
+const openRecordDialog = (row) => {
+  currentTask.value = { ...row };
+  listInspectionRecord(row.id).then((res) => {
+    recordList.value = res.data || [];
+    recordDialog.value = true;
+  });
+};
+
+// ==================== 宸℃鎶ュ憡 ====================
+const reportQuery = reactive({ reportTitle: "" });
+const reportList = ref([]);
+const reportLoading = ref(false);
+const reportDialog = ref(false);
+const currentReport = ref({});
+const reportDetails = ref([]);
+
+const loadReport = () => {
+  reportLoading.value = true;
+  listInspectionReport({ ...reportQuery, current: 1, size: 500 })
+    .then((res) => {
+      reportList.value = res.data?.records || [];
+    })
+    .finally(() => {
+      reportLoading.value = false;
+    });
+};
+const viewReport = (row) => {
+  getInspectionReport(row.id).then((res) => {
+    currentReport.value = res.data || {};
+    try {
+      reportDetails.value = JSON.parse(currentReport.value.reportContent || "[]");
+    } catch (e) {
+      reportDetails.value = [];
+    }
+    reportDialog.value = true;
+  });
+};
+const removeReport = (row) => {
+  ElMessageBox.confirm(`纭畾鍒犻櫎鎶ュ憡銆�${row.reportTitle}銆嶅悧锛焋, "鍒犻櫎鎻愮ず", { type: "warning" }).then(() => {
+    delInspectionReport([row.id]).then(() => {
+      proxy.$modal.msgSuccess("鍒犻櫎鎴愬姛");
+      loadReport();
+    });
+  }).catch(() => {});
+};
+
+const handleTabChange = (name) => {
+  if (name === "route") loadRoute();
+  if (name === "task") loadTask();
+  if (name === "report") loadReport();
+  if (name === "point") loadPoint();
+};
 
 onMounted(() => {
-  load();
-  // 鏈夋墽琛屼腑浠诲姟鏃跺畾鏃跺埛鏂帮紝瑙傚療鑷姩鍥炰紶
-  timer = window.setInterval(() => {
-    if (tasks.value.some(t => t.taskStatus === "running")) load();
-  }, 30000);
+  loadRoute();
+  loadTask();
+  loadReport();
+  loadPoint();
+  loadAllPoint();
+  loadRouteOptions();
 });
-onBeforeUnmount(() => { if (timer) clearInterval(timer); });
 </script>
 
 <style scoped lang="scss">
-$line: #e3e8ed;
-$paper: #f4f6f8;
-$text: #1b2733;
-$muted: #5c6b7a;
-$brand: #2c51d9;
-$alert: #e0a02e;
-$signal: #2fbfa0;
-
 .inspection-page {
-  background: $paper;
-  min-height: calc(100vh - 84px);
-}
-
-/* 椤靛ご */
-.page-head {
-  display: flex;
-  align-items: center;
-  justify-content: space-between;
-  gap: 20px;
-  padding: 20px 22px;
-  background: linear-gradient(150deg, #14191f 0%, #1e252c 100%);
-  border-radius: 6px;
-  margin-bottom: 16px;
-
-  h2 {
-    margin: 0 0 6px;
-    font-size: 20px;
-    font-weight: 700;
-    color: #fff;
-    letter-spacing: 0.03em;
+  .ml10 {
+    margin-left: 10px;
   }
-
-  p {
-    margin: 0;
+  .sub-text {
+    color: #909399;
+    font-size: 12px;
+  }
+  .tip-text {
+    color: #909399;
     font-size: 13px;
-    color: rgba(234, 240, 245, 0.66);
   }
-
-  :deep(.el-button--primary) {
-    background: #fff;
-    border-color: #fff;
-    color: #14191f;
-    font-weight: 600;
-
-    &:hover {
-      background: #e9eef5;
-      border-color: #e9eef5;
-      color: #14191f;
+  .point-order-editor {
+    margin-top: 8px;
+    .order-item {
+      display: flex;
+      align-items: center;
+      gap: 10px;
+      padding: 4px 8px;
+      border: 1px solid #ebeef5;
+      border-radius: 4px;
+      margin-bottom: 6px;
+      background: #fafafa;
+      .seq {
+        width: 22px;
+        height: 22px;
+        line-height: 22px;
+        text-align: center;
+        border-radius: 50%;
+        background: #409eff;
+        color: #fff;
+        font-size: 12px;
+        flex: 0 0 auto;
+      }
+      .name {
+        flex: 1;
+        color: #303133;
+        font-size: 13px;
+      }
+      .ops {
+        flex: 0 0 auto;
+      }
     }
   }
-}
-
-/* 姒傝 */
-.stat-row {
-  display: grid;
-  grid-template-columns: repeat(4, minmax(0, 1fr));
-  gap: 14px;
-  margin-bottom: 16px;
-}
-
-.stat {
-  position: relative;
-  background: #fff;
-  border: 1px solid $line;
-  border-radius: 6px;
-  padding: 14px 18px 12px;
-
-  &::before {
-    content: "";
-    position: absolute;
-    left: 0;
-    top: 0;
-    bottom: 0;
-    width: 3px;
-    background: #c7d0da;
+  .record-summary {
+    margin-bottom: 12px;
+    color: #606266;
   }
-
-  &.tone-brand::before { background: $brand; }
-  &.tone-warn::before { background: $alert; }
-  &.tone-signal::before { background: $signal; }
-}
-
-.stat-top {
-  display: flex;
-  align-items: center;
-  justify-content: space-between;
-}
-
-.stat-label {
-  font-size: 12.5px;
-  color: $muted;
-}
-
-.stat-icon {
-  font-size: 16px;
-  color: #b4bfca;
-}
-
-.stat-value {
-  margin-top: 8px;
-  font-family: "MyCustomFont", "Helvetica Neue", Arial, sans-serif;
-  font-size: 26px;
-  font-weight: 700;
-  color: $text;
-  line-height: 1;
-
-  i {
-    font-style: normal;
-    font-size: 12px;
-    color: #98a4b0;
-    margin-left: 4px;
-    font-family: "Microsoft YaHei", Arial, sans-serif;
-    font-weight: 400;
+  .report-head {
+    margin-bottom: 14px;
+    h3 {
+      margin: 0 0 8px;
+    }
+    .report-meta {
+      display: flex;
+      flex-wrap: wrap;
+      gap: 18px;
+      color: #606266;
+      font-size: 13px;
+      margin-bottom: 10px;
+    }
   }
-}
-
-/* 鏌ヨ */
-.filter-card {
-  display: flex;
-  align-items: center;
-  flex-wrap: wrap;
-  gap: 10px;
-  padding: 14px 18px;
-  background: #fff;
-  border: 1px solid $line;
-  border-radius: 6px;
-  margin-bottom: 16px;
-}
-
-/* 琛ㄦ牸 */
-.table-card {
-  background: #fff;
-  border: 1px solid $line;
-  border-radius: 6px;
-  padding: 14px 16px;
-}
-
-.route-text {
-  color: $muted;
-  font-size: 12.5px;
-}
-
-.pager {
-  justify-content: flex-end;
-  margin-top: 14px;
-}
-
-.table-empty {
-  padding: 26px 0;
-  color: #a7b2bd;
-  font-size: 13px;
-}
-
-/* 琛ㄥ崟 */
-.route-templates {
-  display: flex;
-  align-items: center;
-  gap: 6px;
-  margin-top: 8px;
-  font-size: 12px;
-  color: #98a4b0;
-}
-
-/* 鎶ュ憡 */
-.report-content {
-  margin: 18px 0 0;
-  padding: 18px;
-  line-height: 1.9;
-  background: #f5f7fa;
-  border: 1px solid #e8edf2;
-  border-radius: 6px;
-  font-size: 13px;
-  color: $text;
-  white-space: pre-wrap;
-  font-family: "Microsoft YaHei", Arial, sans-serif;
-}
-
-@media (max-width: 900px) {
-  .stat-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
-  .page-head { flex-direction: column; align-items: flex-start; }
-  .filter-card { flex-wrap: wrap; }
+  .text-success {
+    color: #67c23a;
+  }
+  .text-warning {
+    color: #e6a23c;
+  }
 }
 </style>

--
Gitblit v1.9.3