Просмотр исходного кода

🎨 优化提交审核按钮提示

快乐的梦鱼 1 месяц назад
Родитель
Сommit
5c165eb898

+ 1 - 0
src/api/collect/AssessmentContent.ts

@@ -442,6 +442,7 @@ export class SelfAssessmentDetail extends DataModel<SelfAssessmentDetail> {
   deductContent = '' as string|null;
   deductPoints = 0 as number;
   points = 0 as number;
+  progress = 0 as number;
   self = null as number|null;
   sign = '' as string|null;
   ichUnit = null as number|null;

+ 17 - 5
src/pages/collect/assessment/evaluation-form.vue

@@ -54,7 +54,7 @@
             </FlexCol>
             <Divider />
             <Button type="primary" block :loading="submitLoading" @click="saveForm">保存评估表</Button>
-            <Button type="primary" block :loading="submitLoading" @click="submitForm">提交审核</Button>
+            <Button v-if="currentForm?.progress === 0" type="primary" block :loading="submitLoading" @click="submitForm">提交审核</Button>
             <Button :loading="submitLoading" @click="downloadForm">下载评估表PDF</Button>
           </FlexCol>
         </template>
@@ -70,7 +70,7 @@ import { useSimpleDataLoader } from '@/components/composeabe/loader/SimpleDataLo
 import { useAuthStore } from '@/store/auth';
 import { useLoadQuerys } from '@/components/composeabe/LoadQuerys';
 import { assertNotNull, formatError, waitTimeOut } from '@imengyu/imengyu-utils';
-import { toast, alert } from '@/components/dialog/CommonRoot';
+import { toast, alert, confirm } from '@/components/dialog/CommonRoot';
 import AssessmentContentApi, {
   SelfAssessmentDetail,
   CheckItemInfo,
@@ -183,12 +183,19 @@ async function saveForm() {
     toast('请填写完整信息');
     return;
   }
-
+  if ((detail?.progress ?? 0) > 0) {
+    const confirmed = await confirm({
+      title: '提示',
+      content: '您之前已提交审核,修改将导致审核撤回并需要重新审核,是否继续修改?',
+    });
+    if (!confirmed)
+      return;
+  }
   submitLoading.value = true;
   currentForm.value!.checkItems = currentFormCheckItems.value;
   try {
     assertNotNull(detail, 'currentForm is null');
-    await AssessmentContentApi.saveSelfAssessment(detail as SelfAssessmentDetail);
+    await AssessmentContentApi.saveSelfAssessment(detail as SelfAssessmentDetail, 0);
     toast('保存评估表成功');
 
     await waitTimeOut(1000);
@@ -210,7 +217,12 @@ async function submitForm() {
     toast('请填写完整信息');
     return;
   }
-
+  const confirmed = await confirm({
+    title: '提示',
+    content: '您确认要提交审核吗?请确认各项信息填写无误。',
+  });
+  if (!confirmed)
+    return;
   submitLoading.value = true;
   currentForm.value!.checkItems = currentFormCheckItems.value;
   try {