From f2bef1061f5dc9815f1b02bd23737b6bc915b6cb Mon Sep 17 00:00:00 2001
From: 张含笑 <zhx18749296735@163.com>
Date: Sat, 02 Aug 2025 14:04:30 +0800
Subject: [PATCH] feat:工单类型不能修改  关联算法可变更

---
 src/views/tickets/ticket.vue |   64 +++++++++++++++++++-------------
 1 files changed, 38 insertions(+), 26 deletions(-)

diff --git a/src/views/tickets/ticket.vue b/src/views/tickets/ticket.vue
index 3f62c26..e7a5439 100644
--- a/src/views/tickets/ticket.vue
+++ b/src/views/tickets/ticket.vue
@@ -422,7 +422,7 @@
             <template #default="{ row }">
               <!-- 添加必填星号的标签 -->
               <span
-                v-if="currentDetail.status === 0 && row.label1 === '工单名称'"
+                v-if="currentDetail.status === 0 &&(row.label1 === '关联算法' ||  row.label1 === '工单名称')"
                 class="required-label"
               >
                 <span class="required-star">*</span>{{ row.label1 }}
@@ -445,16 +445,37 @@
                   class="required-input"
                 />
               </template>
+               <template
+                v-else-if="
+                  currentDetail.status === 0 &&
+                  row.label1 === '关联算法' &&
+                  hasProcessingBtnPermission()
+                "
+              >
+                <el-select
+                  v-model="currentDetail.aiType"
+                  placeholder="请选择关联算法"
+                  class="required-input"
+                >
+                  <el-option
+                    v-for="item in algorithms"
+                    :key="item.value"
+                    :label="item.label"
+                    :value="item.value"
+                  />
+                </el-select>
+              </template>
               <template v-else>{{ row.value1 }}</template>
             </template>
           </el-table-column>
           <el-table-column prop="label2" label="基本信息" width="150">
             <template #default="{ row }">
               <!-- 添加必填星号的标签 -->
+           
               <span
                 v-if="
                   currentDetail.status === 0 &&
-                  (row.label2 === '工单类型' || row.label2 === '工单内容')
+                   row.label2 === '工单内容'
                 "
                 class="required-label"
               >
@@ -466,28 +487,10 @@
           <el-table-column>
             <template #default="{ row }">
               <!-- 修改工单类型和工单内容的显示 -->
+             
+             
               <template
                 v-if="
-                  currentDetail.status === 0 &&
-                  row.label2 === '工单类型' &&
-                  hasProcessingBtnPermission()
-                "
-              >
-                <el-select
-                  v-model="currentDetail.type"
-                  placeholder="请选择工单类型"
-                  class="required-input"
-                >
-                  <el-option
-                    v-for="item in types"
-                    :key="item.value"
-                    :label="item.label"
-                    :value="item.value"
-                  />
-                </el-select>
-              </template>
-              <template
-                v-else-if="
                   currentDetail.status === 0 &&
                   row.label2 === '工单内容' &&
                   hasProcessingBtnPermission()
@@ -1262,7 +1265,14 @@
         { label: '任务发起人', value: this.currentDetail.creator },
         { label: '当前状态', value: this.mapStatus(this.currentDetail.status) },
         { label: '事件地址', value: this.currentDetail.address || this.currentDetail.latAndLon }, // 包含经纬度信息
-        { label: '关联算法', value: this.currentDetail.aiType },
+        { label: '关联算法',
+        //  value: this.currentDetail.aiType 
+         value:
+            this.algorithms.find(t => t.value === this.currentDetail.aiType)?.label ||
+            this.currentDetail.aiType ||
+            '/',
+
+        },
         { label: '发起单位', value: this.currentDetail.department },
         { label: '发起任务时间', value: this.currentDetail.startTime },
         { label: '工单内容', value: this.currentDetail.content },
@@ -1509,8 +1519,8 @@
         columnType.dicData = this.types;
         this.allAlgorithms  = info
 
-        // console.log('工单类型',this.types);
-        // console.log('关联算法',this.allAlgorithms );
+        console.log('工单类型',this.types);
+        console.log('关联算法',this.allAlgorithms );
         // 确保算法数据的映射一致
         // this.algorithms =
         //   ai_type?.map(item => ({
@@ -1550,6 +1560,7 @@
         this.$message.info('该工单类型暂无关联算法');
         return;
       }
+// console.log('matchedCategory',matchedCategory);
 
       this.algorithms = matchedCategory.algorithms.map(algo => ({
         label: algo.dict_value, 
@@ -2039,6 +2050,7 @@
 
       console.log('this.currentDetail', this.currentDetail);
       this.detailVisible = true;
+      this.handleTypeChange(this.currentDetail.type)
       this.$nextTick(() => {
         if (this.$refs.MapContainer && this.$refs.MapContainer.initAddEntity) {
           this.$refs.MapContainer.initAddEntity('point', this.currentDetail.location);
@@ -2344,7 +2356,7 @@
     },
     hasProcessingBtnPermission() {
       // undefined 或 false 都返回 false,只有 true 返回 true
-      // console.log('权限检查:', this.permission)
+      //  console.log('权限检查:', this.permission.tickets_processing_btn)
       return this.permission && this.permission.tickets_processing_btn === true;
     },
     hasProcessedAndOverBtnPermission() {

--
Gitblit v1.9.3