Selaa lähdekoodia

复启权限、待办列表修改

HD_wangm 3 kuukautta sitten
vanhempi
commit
ac78272867

+ 1 - 1
ygtx-gxt/src/main/java/com/ygtx/gxt/controller/GxtRepairOrderController.java

@@ -259,7 +259,7 @@ public class GxtRepairOrderController extends BaseController
     /**
      * 正式结单(完结工单)
      */
-    @PreAuthorize("@ss.hasPermi('gxt:repairOrder:finalize')")
+    @PreAuthorize("@ss.hasPermi('gxt:repairOrder:finalize') or @ss.hasPermi('gxt:repairOrder:resetStart')")
     @Log(title = "维修工单", businessType = BusinessType.UPDATE)
     @PutMapping("/finalize")
     @ApiOperation("正式结单(完结工单)")

+ 8 - 0
ygtx-ui/src/api/gxt/gxtOrder.js

@@ -259,3 +259,11 @@ export function shutdownOrder(data) {
     data: data
   })
 }
+
+// 查询首页工单统计列表
+export function getOrderList(keyword) {
+  return request({
+    url: '/mobile/order/list?keyword=' + keyword,
+    method: 'get'
+  })
+}

+ 3 - 2
ygtx-ui/src/components/gxtOrder/backfillAddEdit.vue

@@ -125,7 +125,7 @@
 <script setup>
 import {ref, reactive, nextTick, watch, getCurrentInstance, defineProps} from 'vue';
 import EquipmentSelect from '@/components/equipmentSelect/single.vue'; // 根据实际情况调整路径
-import {listGxtOrder, updateGxtOrder} from '@/api/gxt/gxtOrder';
+import {getOrderList, listGxtOrder, updateGxtOrder} from '@/api/gxt/gxtOrder';
 import {listMisInfo} from "@/api/gxt/misInfo.js";
 import MisInfoSelectSingle from "@/components/misInfoSelect/single.vue";
 
@@ -457,7 +457,8 @@ const workPermitNumProxy = computed({
 /** 设备MIS信息回调 */
 function onMisInfoSelected(row) {
   if (row) {
-    listGxtOrder({pageNum: 1, pageSize: 10, misNo: row.misNo }).then(response => {
+    // listGxtOrder({pageNum: 1, pageSize: 10, misNo: row.misNo }).then(response => {
+    getOrderList(row.misNo).then(response => {
       const  gxtOrders= response.rows
       debugger
       if (gxtOrders.length > 0) {

+ 10 - 33
ygtx-ui/src/components/gxtOrder/finalize.vue

@@ -279,7 +279,7 @@
     <template #footer>
       <div class="dialog-footer">
         <el-button @click="handleCancel">取 消</el-button>
-        <el-button type="primary" @click="handleSubmit" :loading="submitLoading">确认结单</el-button>
+        <el-button type="primary" @click="handleSubmit">确认结单</el-button>
       </div>
     </template>
 
@@ -300,7 +300,7 @@ import { ref, defineProps, defineEmits, getCurrentInstance, watch } from 'vue'
 import preview from '@/components/FileUpload/preview.vue'
 import UserSelectMulti from "@/components/userSelect/multi.vue";
 import {ElMessageBox} from "element-plus";
-import {listGxtOrder} from "@/api/gxt/gxtOrder.js";
+import {getOrderList, listGxtOrder} from "@/api/gxt/gxtOrder.js";
 import {listUser, listUserData, listUserNoPermi, listLeader} from "@/api/system/user";
 import MisInfoSelectSingle from "@/components/misInfoSelect/single.vue";
 import {listWorkPerson} from "@/api/gxt/misInfo.js";
@@ -752,38 +752,12 @@ const handleSubmit = async () => {
 
   await finishRef.value.validate(async (valid) => {
     if (valid) {
-      const { realStartTime, acceptTime } = formData.value;
-      debugger
-      // if (realStartTime && acceptTime && (new Date(realStartTime) < new Date(acceptTime))) { //开始时间早于接单时间,为补录工单
-        // formData.value.orderEntryType = '2'
-        // try {
-        //   debugger
-        //   await ElMessageBox.confirm(
-        //       '检测到开始时间早于接单时间,系统将按“补录工单”处理,准备工时为0。是否继续?',
-        //       '提示',
-        //       {
-        //         confirmButtonText: '是',
-        //         cancelButtonText: '否',
-        //         type: 'warning',
-        //         distinguishCancelAndClose: true
-        //       }
-        //   );
-        //   formData.value.orderEntryType = '2'
-        //   // 用户点击“是”,继续提交
-        // } catch (error) {
-        //   // 用户点击“否”或关闭弹窗
-        //   finalizeFormRef.value?.validateField('realStartTime');
-        //   return;
-        // }
-      // }
-
-
       try {
         if (!formData.value.realEndTime) {
           proxy.$modal.msgError("该工单未结束,无法结单!")
           return
         }
-        submitLoading.value = true
+        // submitLoading.value = true
 
         // 调用父组件传入的提交函数
         if (props.onSubmit && typeof props.onSubmit === 'function') {
@@ -794,9 +768,11 @@ const handleSubmit = async () => {
           }
           formData.value.workOrderFlowList = flowList.value
           formData.value.finalizeMethod = '2'
+          formData.value.workOrderStatus = 'completed'
+          // 防止提交时候时间格式转换错误
           formData.value.createTime = null
           formData.value.updateTime = null
-          await props.onSubmit(formData.value)
+          await props.onSubmit(formData.value.id, formData.value)
         } else {
           throw new Error("未提供提交方法")
         }
@@ -806,8 +782,8 @@ const handleSubmit = async () => {
         emit('success')
       } catch (error) {
         // proxy.$modal.msgError("操作失败: " + (error.message || "未知错误"))
-      } finally {
-        submitLoading.value = false
+      // } finally {
+      //   submitLoading.value = false
       }
     }
   })
@@ -1111,7 +1087,8 @@ const handleTeamLeaderClear = () => {
 
 const onMisInfoSelected = (row) => {
   if (row) {
-    listGxtOrder({pageNum: 1, pageSize: 10, misNo: row.misNo }).then(response => {
+    // listGxtOrder({pageNum: 1, pageSize: 10, misNo: row.misNo }).then(response => {
+    getOrderList(row.misNo ).then(response => {
       const  gxtOrders= response.rows
       debugger
       if (gxtOrders.length > 0) {

+ 6 - 2
ygtx-ui/src/components/repairOrder/finalize.vue

@@ -297,6 +297,7 @@ import {listUser, listUserData, listUserNoPermi, listLeader} from "@/api/system/
 import MisInfoSelectSingle from "@/components/misInfoSelect/single.vue";
 import {listRepairOrder} from "@/api/gxt/repairOrder.js";
 import {listWorkPerson} from "@/api/gxt/misInfo.js";
+import {getOrderList} from "@/api/gxt/gxtOrder.js";
 
 // 获取当前实例
 const { proxy } = getCurrentInstance()
@@ -978,7 +979,9 @@ const handleSubmit = async () => {
         }
         submitData.repairOrderFlowList = flowList.value
         submitData.finalizeMethod = '2'
-
+        // 防止提交时候时间格式转换错误
+        submitData.createTime = null
+        submitData.updateTime = null
         // 5. 调用父组件提交函数(传入转换后的临时数据)
         if (props.onSubmit && typeof props.onSubmit === 'function') {
           await props.onSubmit(submitData) // 提交转换后的数据
@@ -1132,7 +1135,8 @@ const handleTeamLeaderClear = () => {
 /** 设备MIS信息回调 */
 const onMisInfoSelected = (row) => {
   if (row) {
-    listRepairOrder({pageNum: 1, pageSize: 10, misOrderNo: row.misNo }).then(response => {
+    // listRepairOrder({pageNum: 1, pageSize: 10, misOrderNo: row.misNo }).then(response => {
+    getOrderList(row.misNo ).then(response => {
       const  gxtOrders= response.rows
       if (gxtOrders.length > 0) {
         proxy.$modal.msgWarning('选择工单已存在!请重新选择!')

+ 45 - 12
ygtx-ui/src/views/gxt/gxtOrder/index.vue

@@ -794,7 +794,6 @@
       :data="finishForm"
       :work-order-status-options="gxt_work_order_status"
       :info-entry-options="gxt_info_entry"
-      :list-gxt-order="listGxtOrder"
       :list-work-person="listWorkPerson"
       :list-mis-info="listMisInfo"
       :list-user-data="listUserData"
@@ -1265,7 +1264,7 @@ import {
   importGxtWorkOrderPersonFromExcel,
   // importTemplate
   invalidateGxtOrder,
-  getExportFields, shutdownOrder
+  getExportFields, shutdownOrder, getOrderList
 } from "@/api/gxt/gxtOrder"
 import {listUserData, listUserNoPermi, listLeader} from "@/api/system/user"
 import {getToken} from "@/utils/auth.js";
@@ -2246,7 +2245,8 @@ function handleFinish(row) {
         if (misInfo.length > 0 && misInfo.length == 1) {
           // 有工作票号提示
           if (misInfo[0].workPermitNum) {
-            listGxtOrder({pageNum: 1, pageSize: 10, misNo: misInfo[0].misNo }).then(response => {
+            // listGxtOrder({pageNum: 1, pageSize: 10, misNo: misInfo[0].misNo }).then(response => {
+            getOrderList(misInfo[0].misNo ).then(response => {
               const gxtOrders = response.rows
               if (gxtOrders.length == 0) {
                 finishForm.value.misNo = misInfo[0].misNo
@@ -2265,11 +2265,10 @@ function handleFinish(row) {
                       }
                     }
                     const nickNames = finishForm.value.workOrderPersonList
+                        .filter(person => person.isLeader != 1)
                         .map(person => person.nickName)
                         .join(',');
                     finishForm.value.workGroupMemberName = nickNames
-                    // finishDialogVisible.value = true
-
                     finishForm.value.workOrderPersonList.map(person => {
                       // 构造查询参数:username 和 nickName
                       const queryParams = {
@@ -2294,11 +2293,10 @@ function handleFinish(row) {
                         }
                       });
                     })
-
                   }
                 })
               } else {
-                ElMessageBox.confirm('未找到匹配的MIS工单,请确认风机停复机时间是否已录入工效通系统或请进入工作票录入方式。', '提示', {
+                ElMessageBox.confirm('该MIS工单已被其他工单关联,请检查是否重复操作。', '提示', {
                   confirmButtonText: '确定',
                   showCancelButton: false,
                   type: 'warning'
@@ -2381,12 +2379,45 @@ function handleBackfillingFinish(row) {
       listWorkPerson({misNo: row.misNo}).then(response => {
         finishForm.value.workOrderPersonList = response.rows;
         if (finishForm.value.workOrderPersonList) {
+          // 查询负责人信息并回填
+          for (const person of finishForm.value.workOrderPersonList) {
+            // 严格判断isLeader为1(兼容数字/字符串类型)
+            if (person.isLeader === 1 || person.isLeader === '1') {
+              finishForm.value.teamLeaderName = person.nickName;
+              break; // 找到后立即停止循环
+            }
+          }
           const nickNames = finishForm.value.workOrderPersonList
+              .filter(person => person.isLeader != 1)
               .map(person => person.nickName)
               .join(',');
           finishForm.value.workGroupMemberName = nickNames
-          backfillFinishDialogVisible.value = true
+          finishForm.value.workOrderPersonList.map(person => {
+            // 构造查询参数:username 和 nickName
+            const queryParams = {
+              userName: person.userName, // 假设person对象有username字段
+              nickName: person.nickName  // 假设person对象有nickName字段
+            };
+            listUserData(queryParams).then(response => {
+              if (!response.total) {
+                let msg = "已匹配到MIS工单,但工作班成员'" + person.nickName + "'在系统中不存在,系统无法自动结单,请检查"
+                if (person.isLeader == 1) {
+                  msg = "已匹配到MIS工单,但工作负责人'" + person.nickName + "'在系统中不存在,系统无法自动结单,请检查"
+                }
+                ElMessageBox.confirm(msg, '提示', {
+                  confirmButtonText: '确定',
+                  showCancelButton: false,
+                  type: 'warning'
+                }).then(function() {
+                  // finishForm.value.infoEntry = '2'
+                  infoEntryDisabled.value = true
+                }).then(() => {
+                }).catch(() => {})
+              }
+            });
+          })
         }
+        backfillFinishDialogVisible.value = true
       })
     } else {
       finishForm.value.realStartTime = null
@@ -2428,9 +2459,10 @@ function saveFinishWorkOrder() {
 }
 
 // 用于传递给结单组件的提交方法
-async function submitFinishFromParent(data) {
-  finishForm.value = data
-  await saveFinishWorkOrder()
+async function submitFinishFromParent(id, data) {
+  // finishForm.value = data
+  // await saveFinishWorkOrder()
+  await completeWorkOrder(id, data)
 }
 
 // 在提交结单成功后的回调函数
@@ -3018,7 +3050,8 @@ function handleSelectMisInfo2() {
 /** 设备MIS信息回调 */
 function onMisInfoSelected(row) {
   if (row) {
-    listGxtOrder({pageNum: 1, pageSize: 10, misNo: row.misNo }).then(response => {
+    // listGxtOrder({pageNum: 1, pageSize: 10, misNo: row.misNo }).then(response => {
+    getOrderList(row.misNo ).then(response => {
       const  gxtOrders= response.rows
       debugger
       if (gxtOrders.length > 0) {

+ 211 - 52
ygtx-ui/src/views/gxt/orderMyTodo/index.vue

@@ -200,7 +200,7 @@
                 type="primary"
                 link
                 @click="handleReset(scope.row)"
-                v-hasPermi="['gxt:repairOrder:finalize']"
+                v-hasPermi="['gxt:repairOrder:resetStart']"
             ><i class="fa fa-refresh"></i>复启</el-button>
             <el-button
                 v-if="scope.row.workOrderStatus === 'to_approve'"
@@ -1370,7 +1370,7 @@ import {
   completeWorkOrder,
   getGxtOrder,
   suspendWorkOrder,
-  approveWorkOrder, shutdownOrder
+  approveWorkOrder, shutdownOrder, getOrderList
 } from "@/api/gxt/gxtOrder"
 import EquipmentSelectSingle from "@/components/equipmentSelect/single.vue"
 import FinalizeDialog from "@/components/repairOrder/finalize.vue";
@@ -2756,14 +2756,143 @@ const finalizeFormData = ref({})
 
 /** 结单操作 */
 function handleRepairOrderFinalize(row) {
-  getRepairOrder(row.id).then(response => {
-    finalizeFormData.value = { ...response.data, selectedMembers: [] }
-    debugger
-    finalizeFormData.value.repairMethod = '1';
-    finalizeFormData.value.infoEntry = '1'
-    finalizeDialogVisible.value = true
-    commonKey++
-  })
+  // getRepairOrder(row.id).then(response => {
+  //   finalizeFormData.value = { ...response.data, selectedMembers: [] }
+  //   debugger
+  //   finalizeFormData.value.repairMethod = '1';
+  //   finalizeFormData.value.infoEntry = '1'
+  //   finalizeDialogVisible.value = true
+  //   commonKey++
+  // })
+  finalizeFormData.value = row
+  finalizeFormData.value.orderId = row.id
+  finalizeFormData.value.infoEntry = '1'
+  debugger
+  if (row.occurTime && row.restartTime) {
+    listAutoMisInfo({
+      pauseTime: row.occurTime,
+      restartTime: row.restartTime,
+      pcsDeviceName: row.pcsDeviceName,
+      pcsStationName: row.pcsStationName,
+      workOrderStatus: '结束'
+    }).then(response => {
+      const misInfo = response.rows
+      if (misInfo.length > 0 && misInfo.length == 1) {
+        // 有工作票号提示
+        if (misInfo[0].workPermitNum) {
+          // 查询MIS工单是否已存在
+          getOrderList(misInfo[0].misNo ).then(response => {
+            const gxtOrders = response.rows
+            if (gxtOrders.length == 0) {
+              finalizeFormData.value.misOrderNo = misInfo[0].misNo
+              finalizeFormData.value.realStartTime = misInfo[0].realStartTime
+              finalizeFormData.value.realEndTime = misInfo[0].realEndTime
+              finalizeFormData.value.workPermitNum = misInfo[0].workPermitNum
+              listWorkPerson({misNo: misInfo[0].misNo}).then(response => {
+                finalizeFormData.value.repairOrderPersonList = response.rows;
+                if (finalizeFormData.value.repairOrderPersonList) {
+                  // 查询负责人信息并回填
+                  for (const person of finalizeFormData.value.repairOrderPersonList) {
+                    // 严格判断isLeader为1(兼容数字/字符串类型)
+                    if (person.isLeader === 1 || person.isLeader === '1') {
+                      finalizeFormData.value.teamLeaderName = person.nickName;
+                      break; // 找到后立即停止循环
+                    }
+                  }
+                  const nickNames = finalizeFormData.value.repairOrderPersonList
+                      .filter(person => person.isLeader != 1)
+                      .map(person => person.nickName)
+                      .join(',');
+                  finalizeFormData.value.workGroupMemberName = nickNames
+                  finalizeFormData.value.repairOrderPersonList.map(person => {
+                    // 构造查询参数:username 和 nickName
+                    const queryParams = {
+                      userName: person.userName, // 假设person对象有username字段
+                      nickName: person.nickName  // 假设person对象有nickName字段
+                    };
+                    listUserData(queryParams).then(response => {
+                      debugger
+                      if (!response.total) {
+                        let msg = "已匹配到MIS工单,但工作班成员'" + person.nickName + "'在系统中不存在,系统无法自动结单,请检查"
+                        if (person.isLeader == 1) {
+                          msg = "已匹配到MIS工单,但工作负责人'" + person.nickName + "'在系统中不存在,系统无法自动结单,请检查"
+                        }
+                        ElMessageBox.confirm(msg, '提示', {
+                          confirmButtonText: '确定',
+                          showCancelButton: false,
+                          type: 'warning'
+                        }).then(function() {
+                          infoEntryDisabled.value = true
+                        }).then(() => {
+                        }).catch(() => {})
+                      }
+                    });
+                  })
+                }
+              })
+            } else {
+              ElMessageBox.confirm('该MIS工单已被其他工单关联,请检查是否重复操作。', '提示', {
+                confirmButtonText: '确定',
+                showCancelButton: false,
+                type: 'warning'
+              }).then(function() {
+                // finalizeFormData.value.infoEntry = '2'
+                infoEntryDisabled.value = true
+              }).then(() => {
+              }).catch(() => {})
+            }
+          })
+        } else {  // 无工作票号提示
+          ElMessageBox.confirm('已匹配到MIS工单,但未关联工作票号,系统无法自动结单,请进入工作票录入方式。', '提示', {
+            confirmButtonText: '确定',
+            showCancelButton: false,
+            type: 'warning'
+          }).then(function() {
+            // finalizeFormData.value.infoEntry = '2'
+            infoEntryDisabled.value = true
+          }).then(() => {
+          }).catch(() => {})
+        }
+
+      } else if (misInfo.length == 0) {
+        ElMessageBox.confirm('未找到匹配的MIS工单,请确认风机停复机时间是否已录入工效通系统或请进入工作票录入方式。', '提示', {
+          confirmButtonText: '确定',
+          showCancelButton: false,
+          type: 'warning'
+        }).then(function() {
+          // finalizeFormData.value.infoEntry = '2'
+          infoEntryDisabled.value = true
+        }).then(() => {
+        }).catch(() => {})
+      } else if (misInfo.length > 1) {
+        ElMessageBox.confirm('已匹配到多个MIS工单,请手动结单,信息录入选择关联MIS。', '提示', {
+          confirmButtonText: '确定',
+          showCancelButton: false,
+          type: 'warning'
+        }).then(function() {
+          // finalizeFormData.value.infoEntry = '2'
+          infoEntryDisabled.value = false
+        }).then(() => {
+        }).catch(() => {})
+      }
+    })
+  } else {
+    // finishDialogVisible.value = true
+    ElMessageBox.confirm('未找到匹配的MIS工单,请确认风机停复机时间是否已录入工效通系统或请进入工作票录入方式。', '提示', {
+      confirmButtonText: '确定',
+      showCancelButton: false,
+      type: 'warning'
+    }).then(function() {
+      debugger
+      // finalizeFormData.value.infoEntry = '2'
+      infoEntryDisabled.value = true
+    }).then(() => {
+    }).catch(() => {})
+    finalizeFormData.value.workPermitNum = null
+    finalizeFormData.value.misNo = null
+  }
+  finalizeDialogVisible.value = true
+  commonKey++
 }
 
 // 在提交结单成功后的回调函数
@@ -2805,40 +2934,6 @@ function handleReturnSuccess() {
 
 /** 待结单状态:结单按钮 */
 function handleFinish(row) {
-  // getGxtOrder(row.id).then(response => {
-  //   finishForm.value = response.data
-  //   finishForm.value.orderId = row.id
-  //   if (finishForm.value.infoEntry != null && finishForm.value.infoEntry == '1') {
-  //     if (row.misNo != null) {
-  //       listMisInfo({misNo: row.misNo}).then(response => {
-  //         const misInfo = response.rows
-  //         debugger
-  //         if (misInfo.length > 0) {
-  //           finishForm.value.realStartTime = misInfo[0].realStartTime
-  //           finishForm.value.realEndTime = misInfo[0].realEndTime
-  //         }
-  //       })
-  //     }
-  //     listWorkPerson({misNo: row.misNo}).then(response => {
-  //       finishForm.value.workOrderPersonList = response.rows;
-  //       if (finishForm.value.workOrderPersonList) {
-  //         const nickNames = finishForm.value.workOrderPersonList
-  //             .map(person => person.nickName)
-  //             .join(',');
-  //         finishForm.value.workGroupMemberName = nickNames
-  //         finishDialogVisible.value = true
-  //       }
-  //     })
-  //   } else {
-  //     finishForm.value.realStartTime = null
-  //     finishForm.value.realEndTime = null
-  //     finishDialogVisible.value = true
-  //   }
-  //   // 打开对话框后重置表单验证错误
-  //   proxy.$nextTick(() => {
-  //     proxy.$refs["finishRef"]?.clearValidate()
-  //   })
-  // })
   finishForm.value = row
   finishForm.value.orderId = row.id
   finishForm.value.infoEntry = '1'
@@ -2852,7 +2947,6 @@ function handleFinish(row) {
     }).then(response => {
       const misInfo = response.rows
       debugger
-      // finishDialogVisible.value = true
       if (misInfo.length > 0 && misInfo.length == 1) {
         // 有工作票号提示
         if (misInfo[0].workPermitNum) {
@@ -2875,14 +2969,38 @@ function handleFinish(row) {
                     }
                   }
                   const nickNames = finishForm.value.workOrderPersonList
+                      .filter(person => person.isLeader != 1)
                       .map(person => person.nickName)
                       .join(',');
                   finishForm.value.workGroupMemberName = nickNames
-                  // finishDialogVisible.value = true
+                  finishForm.value.workOrderPersonList.map(person => {
+                    // 构造查询参数:username 和 nickName
+                    const queryParams = {
+                      userName: person.userName, // 假设person对象有username字段
+                      nickName: person.nickName  // 假设person对象有nickName字段
+                    };
+                    listUserData(queryParams).then(response => {
+                      if (!response.total) {
+                        let msg = "已匹配到MIS工单,但工作班成员'" + person.nickName + "'在系统中不存在,系统无法自动结单,请检查"
+                        if (person.isLeader == 1) {
+                          msg = "已匹配到MIS工单,但工作负责人'" + person.nickName + "'在系统中不存在,系统无法自动结单,请检查"
+                        }
+                        ElMessageBox.confirm(msg, '提示', {
+                          confirmButtonText: '确定',
+                          showCancelButton: false,
+                          type: 'warning'
+                        }).then(function() {
+                          // finishForm.value.infoEntry = '2'
+                          infoEntryDisabled.value = true
+                        }).then(() => {
+                        }).catch(() => {})
+                      }
+                    });
+                  })
                 }
               })
             } else {
-              ElMessageBox.confirm('未找到匹配的MIS工单,请确认风机停复机时间是否已录入工效通系统或请进入工作票录入方式。', '提示', {
+              ElMessageBox.confirm('该MIS工单已被其他工单关联,请检查是否重复操作。', '提示', {
                 confirmButtonText: '确定',
                 showCancelButton: false,
                 type: 'warning'
@@ -2916,7 +3034,14 @@ function handleFinish(row) {
         }).then(() => {
         }).catch(() => {})
       } else if (misInfo.length > 1) {
-        infoEntryDisabled.value = false
+        ElMessageBox.confirm('已匹配到多个MIS工单,请手动结单,信息录入选择关联MIS。', '提示', {
+          confirmButtonText: '确定',
+          showCancelButton: false,
+          type: 'warning'
+        }).then(function() {
+          infoEntryDisabled.value = false
+        }).then(() => {
+        }).catch(() => {})
       }
     })
   } else {
@@ -2958,12 +3083,45 @@ function handleBackfillingFinish(row) {
       listWorkPerson({misNo: row.misNo}).then(response => {
         finishForm.value.workOrderPersonList = response.rows;
         if (finishForm.value.workOrderPersonList) {
+          // 查询负责人信息并回填
+          for (const person of finishForm.value.workOrderPersonList) {
+            // 严格判断isLeader为1(兼容数字/字符串类型)
+            if (person.isLeader === 1 || person.isLeader === '1') {
+              finishForm.value.teamLeaderName = person.nickName;
+              break; // 找到后立即停止循环
+            }
+          }
           const nickNames = finishForm.value.workOrderPersonList
+              .filter(person => person.isLeader != 1)
               .map(person => person.nickName)
               .join(',');
           finishForm.value.workGroupMemberName = nickNames
-          backfillFinishDialogVisible.value = true
+          finishForm.value.workOrderPersonList.map(person => {
+            // 构造查询参数:username 和 nickName
+            const queryParams = {
+              userName: person.userName, // 假设person对象有username字段
+              nickName: person.nickName  // 假设person对象有nickName字段
+            };
+            listUserData(queryParams).then(response => {
+              if (!response.total) {
+                let msg = "已匹配到MIS工单,但工作班成员'" + person.nickName + "'在系统中不存在,系统无法自动结单,请检查"
+                if (person.isLeader == 1) {
+                  msg = "已匹配到MIS工单,但工作负责人'" + person.nickName + "'在系统中不存在,系统无法自动结单,请检查"
+                }
+                ElMessageBox.confirm(msg, '提示', {
+                  confirmButtonText: '确定',
+                  showCancelButton: false,
+                  type: 'warning'
+                }).then(function() {
+                  // finishForm.value.infoEntry = '2'
+                  infoEntryDisabled.value = true
+                }).then(() => {
+                }).catch(() => {})
+              }
+            });
+          })
         }
+        backfillFinishDialogVisible.value = true
       })
     } else {
       finishForm.value.realStartTime = null
@@ -2996,9 +3154,10 @@ function saveFinishWorkOrder() {
 }
 
 // 用于传递给结单组件的提交方法
-async function submitFinishFromParent(data) {
-  finishForm.value = data
-  await saveFinishWorkOrder()
+async function submitFinishFromParent(id, data) {
+  // finishForm.value = data
+  // await saveFinishWorkOrder()
+  await completeWorkOrder(id, data)
 }
 
 // 在提交结单成功后的回调函数

+ 5 - 3
ygtx-ui/src/views/gxt/repairOrder/index.vue

@@ -341,7 +341,7 @@
               type="primary"
               link
               @click="handleReset(scope.row)"
-              v-hasPermi="['gxt:repairOrder:finalize']"
+              v-hasPermi="['gxt:repairOrder:resetStart']"
           ><i class="fa fa-refresh"></i>复启</el-button>
           <el-button
               v-if="scope.row.workOrderStatus === 'to_finish'&& (scope.row.teamLeaderId == userStore.id || userStore.roles.includes('admin'))"
@@ -1321,7 +1321,7 @@ import { getConfigKey } from "@/api/system/config"
 import {genPostCode} from "@/api/system/autocode/rule.js";
 import MisInfoSelectSingle from "@/components/misInfoSelect/single.vue";
 import {listAutoMisInfo, listMisInfo, listWorkPerson} from "@/api/gxt/misInfo.js";
-import {listGxtOrder} from "@/api/gxt/gxtOrder.js";
+import {getOrderList, listGxtOrder} from "@/api/gxt/gxtOrder.js";
 import useUserStore from '@/store/modules/user'
 import { useRoute } from 'vue-router'
 import {ref, watch} from 'vue'
@@ -3458,7 +3458,8 @@ function handleFinalize(row, method) {
         // 有工作票号提示
         if (misInfo[0].workPermitNum) {
           // 查询MIS工单是否已存在
-          listRepairOrder({pageNum: 1, pageSize: 10, misOrderNo: misInfo[0].misNo }).then(response => {
+          // listRepairOrder({pageNum: 1, pageSize: 10, misOrderNo: misInfo[0].misNo }).then(response => {
+          getOrderList(misInfo[0].misNo ).then(response => {
             const gxtOrders = response.rows
             if (gxtOrders.length == 0) {
               finalizeFormData.value.misOrderNo = misInfo[0].misNo
@@ -3477,6 +3478,7 @@ function handleFinalize(row, method) {
                     }
                   }
                   const nickNames = finalizeFormData.value.repairOrderPersonList
+                      .filter(person => person.isLeader != 1)
                       .map(person => person.nickName)
                       .join(',');
                   finalizeFormData.value.workGroupMemberName = nickNames