Browse Source

pms 保养工单 退回到提交人修改

zhangcl 8 hours ago
parent
commit
ef055697b6
1 changed files with 32 additions and 2 deletions
  1. 32 2
      src/views/pms/iotmainworkorder/index.vue

+ 32 - 2
src/views/pms/iotmainworkorder/index.vue

@@ -165,9 +165,9 @@
               <el-button
                 link
                 type="danger"
-                @click="detail(scope.row.id)"
+                @click="handleBack(scope.row.id)"
                 v-hasPermi="['pms:iot-main-work-order:back']"
-                v-if="scope.row.result === 2"
+                v-if="scope.row.result === 2 && scope.row.status === 0"
               >
                 {{ t('workOrderMaterial.back')  }}
               </el-button>
@@ -504,6 +504,36 @@ const resetQuery = () => {
   handleQuery()
 }
 
+/** 处理退回操作 */
+const handleBack = async (id: number) => {
+  try {
+    // 弹出确认提示框
+    await message.confirm('退回到提交人修改?', t('common.confirmTitle') || '确认', {
+      confirmButtonText: t('common.ok') || '确定',
+      cancelButtonText: t('common.cancel') || '取消',
+      type: 'warning'
+    })
+
+    // 调用接口提交退回请求
+    await IotMainWorkOrderApi.updateIotMainWorkOrder({
+      id: id,
+      backFlag: '1'  // 退回标识参数
+    })
+
+    message.success(t('common.success') || '退回成功')
+    // 刷新列表数据
+    await getList()
+  } catch (error) {
+    // 如果是用户取消操作,不显示任何提示信息
+    if (error?.toString().includes('cancel') || error?.toString().includes('取消')) {
+      return // 静默返回,不显示任何提示
+    }
+
+    console.error('退回操作失败:', error)
+    message.error(t('sys.api.operationFailed') || '退回失败')
+  }
+}
+
 // 保养状态 下拉列表 添加数据字典外的选项
 const resultOptions = computed(() => [
   {