From e147bba689a107d8c7b32a41e6508865428827eb Mon Sep 17 00:00:00 2001
From: rain <1679827795@qq.com>
Date: Wed, 23 Apr 2025 19:44:25 +0800
Subject: [PATCH] Merge branch 'master' into test

---
 src/views/tickets/ticket.vue |  109 ++++++++++++++++++++++++++++++++++++++++--------------
 1 files changed, 80 insertions(+), 29 deletions(-)

diff --git a/src/views/tickets/ticket.vue b/src/views/tickets/ticket.vue
index 023b750..3c8d35e 100644
--- a/src/views/tickets/ticket.vue
+++ b/src/views/tickets/ticket.vue
@@ -146,7 +146,7 @@
                     <i class="el-icon-plus">+</i>
                   </template>
                 </el-upload>
-                <div class="upload-tip">支持jpg/png格式图片,单张不超过5MB</div>
+                <div class="upload-tip">需上传含有地址信息的照片(jpg、jpeg、png),且不超过5M</div>
               </el-form-item>
             </el-col>
           </el-row>
@@ -222,41 +222,42 @@
 
         <!-- 基本信息表格 -->
         <el-table :show-header="false" :data="formattedDetailFields" border style="width: 100%; margin-bottom: 20px;">
-          <el-table-column prop="label1" label="基本信息" width="150" />
+          <el-table-column prop="label1" label="基本信息" width="150">
+            <template #default="{ row }">
+              <!-- 添加必填星号的标签 -->
+              <span v-if="currentDetail.status === 0 && row.label1 === '工单名称'" class="required-label">
+                <span class="required-star">*</span>{{ row.label1 }}
+              </span>
+              <span v-else>{{ row.label1 }}</span>
+            </template>
+          </el-table-column>
           <el-table-column>
             <template #default="{ row }">
-              <!-- 修复工单名称可编辑 -->
               <template v-if="currentDetail.status === 0 && row.label1 === '工单名称' && hasProcessingBtnPermission()">
-                <el-input v-model="currentDetail.orderName" placeholder="请输入工单名称" />
-              </template>
-              <!-- 修复任务接收单位为下拉框 -->
-              <template v-else-if="currentDetail.status === 0 && row.label1 === '发起单位'">
-                <el-select v-model="currentDetail.department" placeholder="请选择任务接收单位" @change="handleDepartmentChange">
-                  <el-option v-for="item in departments" :key="item.value" :label="item.label" :value="item.value" />
-                </el-select>
+                <el-input v-model="currentDetail.orderName" placeholder="请输入工单名称" class="required-input" />
               </template>
               <template v-else>{{ row.value1 }}</template>
             </template>
           </el-table-column>
-          <el-table-column prop="label2" label="基本信息" width="150" />
+          <el-table-column prop="label2" label="基本信息" width="150">
+            <template #default="{ row }">
+              <!-- 添加必填星号的标签 -->
+              <span v-if="currentDetail.status === 0 && (row.label2 === '工单类型' || row.label2 === '工单内容')" class="required-label">
+                <span class="required-star">*</span>{{ row.label2 }}
+              </span>
+              <span v-else>{{ row.label2 }}</span>
+            </template>
+          </el-table-column>
           <el-table-column>
             <template #default="{ row }">
-              <!-- 修复工单内容可编辑 -->
-              <template v-if="currentDetail.status === 0 && row.label2 === '工单内容' && hasProcessingBtnPermission()">
-                <el-input type="textarea" v-model="currentDetail.content" placeholder="请输入工单内容" />
-              </template>
-              <!-- 修复工单类型为下拉框 -->
-              <template v-else-if="currentDetail.status === 0 && row.label2 === '工单类型' && hasProcessingBtnPermission()">
-                <el-select v-model="currentDetail.type" placeholder="请选择工单类型">
+              <!-- 修改工单类型和工单内容的显示 -->
+              <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 === '任务处理人'">
-                <el-select v-model="currentDetail.handler" placeholder="请选择任务处理人" @change="handleHandlerChange">
-                  <el-option v-for="user in departmentUsers[currentDetail.department] || []" :key="user.id"
-                    :label="user.name" :value="user.id" />
-                </el-select>
+              <template v-else-if="currentDetail.status === 0 && row.label2 === '工单内容' && hasProcessingBtnPermission()">
+                <el-input type="textarea" v-model="currentDetail.content" placeholder="请输入工单内容" class="required-input" />
               </template>
               <template v-else>{{ row.value2 }}</template>
             </template>
@@ -310,7 +311,7 @@
                 <div class="media-title">事件图片</div>
                 <div class="media-content">
                   <el-image v-if="currentDetail.mediaUrl" :src="getThumbUrl(currentDetail.mediaUrl)"
-                    :preview-src-list="[currentDetail.mediaUrl]" fit="contain"
+                    :preview-src-list="[getPreviewUrl(currentDetail.mediaUrl)]" fit="contain"
                     style="width: 700px; height: 520px; cursor: pointer;">
                     <template #placeholder>
                       <div class="image-placeholder">
@@ -336,7 +337,7 @@
                   <div class="media-title">工单处理图片</div>
                   <div class="media-content">
                     <el-image v-if="currentDetail.updatePhotoUrl" :src="getThumbUrl(currentDetail.updatePhotoUrl)"
-                      :preview-src-list="[currentDetail.updatePhotoUrl]" fit="fill"
+                      :preview-src-list="[getPreviewUrl(currentDetail.updatePhotoUrl)]" fit="fill"
                       style="width: 700px; height: 520px; cursor: pointer;">
                       <template #placeholder>
                         <div class="image-placeholder">
@@ -1663,8 +1664,23 @@
     },
     async approveAndDispatch() {
       if (this.dispatchLoading) return;
-      // this.dispatchLoading = true;
-      this.dispatchDialogVisible = true; // 打开派发对话框
+      
+      // 添加必填项检查
+      if (!this.currentDetail.orderName || !this.currentDetail.orderName.trim()) {
+        this.$message.warning('请填写工单名称');
+        return;
+      }
+      if (!this.currentDetail.type) {
+        this.$message.warning('请选择工单类型');
+        return;
+      }
+      if (!this.currentDetail.content || !this.currentDetail.content.trim()) {
+        this.$message.warning('请填写工单内容');
+        return;
+      }
+      
+      // 通过验证后,打开派发对话框
+      this.dispatchDialogVisible = true;
     },
     hasProcessingBtnPermission() {
       // undefined 或 false 都返回 false,只有 true 返回 true
@@ -2086,7 +2102,7 @@
     // 获取所有图片列表用于预览
     getImageList() {
       return this.selections
-        .map(item => item.photo_url)
+        .map(item => this.getPreviewUrl(item.photo_url))
         .filter(url => url); // 过滤掉空值
     },
 
@@ -2121,6 +2137,14 @@
       const lastDot = url.lastIndexOf('.');
       if (lastDot === -1) return url;
       return url.slice(0, lastDot) + '_small' + url.slice(lastDot);
+    },
+
+    // 添加新方法:获取预览图地址
+    getPreviewUrl(url) {
+      if (!url) return '';
+      const lastDot = url.lastIndexOf('.');
+      if (lastDot === -1) return url;
+      return url.slice(0, lastDot) + '_show' + url.slice(lastDot);
     },
   },
 };
@@ -2502,6 +2526,10 @@
   margin-bottom: 8px;
 }
 
+.no-media {
+  border: 1px dashed #d9d9d9;
+}
+
 .info-table {
   margin-bottom: 20px;
 }
@@ -2791,4 +2819,27 @@
     object-fit: contain;
   }
 }
+
+/* 必填项样式 */
+.required-label {
+  position: relative;
+  display: inline-block;
+  
+  .required-star {
+    color: #F56C6C;
+    margin-right: 4px;
+  }
+}
+
+/* 必填输入框样式 */
+.required-input {
+  width: 100%;
+  
+  :deep(.el-input__inner),
+  :deep(.el-textarea__inner) {
+    &:focus {
+      border-color: #409EFF;
+    }
+  }
+}
 </style>
\ No newline at end of file

--
Gitblit v1.9.3