浏览代码

feat: add verification computed and action handlers to S8TaskDetailPage

YY968XX 2 月之前
父节点
当前提交
08c05be6a3
共有 1 个文件被更改,包括 33 次插入0 次删除
  1. 33 0
      Web/src/views/aidop/s8/exceptions/S8TaskDetailPage.vue

+ 33 - 0
Web/src/views/aidop/s8/exceptions/S8TaskDetailPage.vue

@@ -34,6 +34,16 @@ const canTransfer = computed(() => !['', 'CLOSED'].includes(currentStatus.value)
 const canUpgrade = computed(() => !hasActiveFlow.value && ['ASSIGNED', 'IN_PROGRESS'].includes(currentStatus.value));
 const canReject = computed(() => ['NEW', 'ASSIGNED', 'IN_PROGRESS'].includes(currentStatus.value));
 const canClose = computed(() => !hasActiveFlow.value && currentStatus.value === 'RESOLVED');
+const currentUserId = computed(() => Number(detail.value?.assigneeId ?? 0));
+const canSubmitVerification = computed(
+	() => currentStatus.value === 'IN_PROGRESS' && !!detail.value?.assigneeId
+);
+const canApproveVerification = computed(
+	() => currentStatus.value === 'PENDING_VERIFICATION' && !!detail.value?.verifierId
+);
+const canRejectVerification = computed(
+	() => currentStatus.value === 'PENDING_VERIFICATION' && !!detail.value?.verifierId
+);
 
 function goBack() {
 	router.push('/aidop/s8/exceptions');
@@ -80,6 +90,9 @@ function actionTitle() {
 			reject: '驳回',
 			close: '提交关闭申请',
 			comment: '补充说明',
+			submitVerification: '提交复检',
+			approveVerification: '检验通过',
+			rejectVerification: '检验退回',
 		}[dialogMode.value] ?? '动作'
 	);
 }
@@ -116,6 +129,26 @@ async function submitAction() {
 			await s8ExceptionApi.reject(id, { remark: actionForm.remark || undefined });
 		} else if (dialogMode.value === 'close') {
 			await s8ExceptionApi.close(id, { remark: actionForm.remark || undefined });
+		} else if (dialogMode.value === 'submitVerification') {
+			if (!actionForm.assigneeId) { ElMessage.warning('请选择检验人'); return; }
+			await s8ExceptionApi.submitVerification(
+				id,
+				{ verifierId: actionForm.assigneeId, remark: actionForm.remark || undefined },
+				currentUserId.value
+			);
+		} else if (dialogMode.value === 'approveVerification') {
+			await s8ExceptionApi.approveVerification(
+				id,
+				{ remark: actionForm.remark || undefined },
+				currentUserId.value
+			);
+		} else if (dialogMode.value === 'rejectVerification') {
+			if (!actionForm.remark) { ElMessage.warning('检验退回必须填写退回原因'); return; }
+			await s8ExceptionApi.rejectVerification(
+				id,
+				{ remark: actionForm.remark },
+				currentUserId.value
+			);
 		} else if (dialogMode.value === 'comment') {
 			await s8ExceptionApi.comment(id, { remark: actionForm.remark || undefined });
 		}