Przeglądaj źródła

📦 自查表审核回退

快乐的梦鱼 1 miesiąc temu
rodzic
commit
89a9cdf3c2

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

@@ -551,6 +551,10 @@ export interface IchCheckReviewPayload {
   provincePoints?: number;
   /** 0=草稿,1=已自评,2=项目保护单位审核完成,3=县(区)文旅部门审核完成,4=设区市文旅部门/省非遗中心审核完成,5=省文化和旅游厅审核完成 */
   progress: number;
+  /** 退回状态: 0=无,1=自评阶段退回,2=项目保护单位退回,3=县(区)文旅部门退回,4=设区市文旅部门/省非遗中心退回,5=省文化和旅游厅退回 */
+  rejectType?: number;
+  /** 退回原因 */
+  rejectReason?: string;
 }
 
 /** 证明材料修改与新增请求体(POST /ich/check/saveAnnex) */
@@ -780,6 +784,8 @@ export class AssessmentContentApi extends AppServerRequestModule<DataModel> {
       province: payload.province,
       province_points: payload.provincePoints,
       progress: payload.progress,
+      reject_type: payload.rejectType,
+      reject_reason: payload.rejectReason,
     }, '自查评估表审核');
   }
 

+ 1 - 1
src/pages/collect/assessment/components/EvaluationFormBlock.vue

@@ -78,7 +78,7 @@
           <a-empty v-if="!getAnnexFileList(item.id).length" description="暂无佐证资料" />
           <ul v-else class="annex-list pl-5 mt-2">
             <li v-for="file in getAnnexFileList(item.id)" :key="file.uid">
-              <a :href="file.url" target="_blank" rel="noopener noreferrer">({{ (file.response as any).desc ?? '暂无说明' }}){{ file.name }}</a>
+              <a :href="file.url" target="_blank" rel="noopener noreferrer">{{ file.name }}</a>
             </li>
           </ul>
         </template>

+ 88 - 9
src/pages/collect/assessment/evaluation-form-review.vue

@@ -60,14 +60,24 @@
                   <a-input :value="progressSubmitLabel" readonly />
                 </a-form-item>
                 <a-form-item>
-                  <a-button
-                    type="primary"
-                    :loading="submitLoading"
-                    :disabled="!canSubmitReview"
-                    @click="submitReview"
-                  >
-                    提交审核
-                  </a-button>
+                  <a-space>
+                    <a-button
+                      type="primary"
+                      :loading="submitLoading"
+                      :disabled="!canSubmitReview"
+                      @click="submitReview"
+                    >
+                      提交审核
+                    </a-button>
+                    <a-button
+                      danger
+                      :loading="rejectLoading"
+                      :disabled="!canSubmitReview"
+                      @click="submitReject"
+                    >
+                      回退
+                    </a-button>
+                  </a-space>
                 </a-form-item>
               </a-form>
             </a-card>
@@ -81,7 +91,7 @@
 <script setup lang="ts">
 import { computed, h, onMounted, ref, watch } from 'vue';
 import { useRoute, useRouter } from 'vue-router';
-import { message, Modal } from 'ant-design-vue';
+import { Input, message, Modal } from 'ant-design-vue';
 import { RequestApiError } from '@imengyu/imengyu-utils';
 import { ArrowLeftOutlined } from '@ant-design/icons-vue';
 import AssessmentContentApi, {
@@ -120,6 +130,7 @@ const currentFormCheckItems = ref([] as SelfAssessmentCheckItemAnswer[]);
 const checkItemList = ref([] as CheckItemInfo[]);
 
 const submitLoading = ref(false);
+const rejectLoading = ref(false);
 const reviewOpinion = ref<number | null>(null);
 const reviewPoints = ref<number | null>(null);
 
@@ -261,6 +272,74 @@ onMounted(() => {
   loader.load();
 });
 
+/** 回退后 progress:退回至上一环节 */
+const rejectTargetProgress = computed(() => Math.max(1, reviewProgress.value - 1));
+
+function promptRejectReason() {
+  const draft = ref('');
+  return new Promise<string | null>((resolve) => {
+    Modal.confirm({
+      title: '回退自查评估表',
+      okText: '确认回退',
+      cancelText: '取消',
+      okType: 'danger',
+      width: 800,
+      content: () => h(Input.TextArea, {
+        value: draft.value,
+        rows: 4,
+        maxlength: 500,
+        showCount: true,
+        placeholder: '请输入回退原因(必填)',
+        'onUpdate:value': (v: string) => {
+          draft.value = v ?? '';
+        },
+      }),
+      onOk: () => {
+        const reason = draft.value.trim();
+        if (!reason) {
+          message.warning('请输入回退原因');
+          return Promise.reject();
+        }
+        resolve(reason);
+      },
+      onCancel: () => {
+        resolve(null);
+      },
+    });
+  });
+}
+
+async function submitReject() {
+  const f = currentForm.value;
+  if (!f?.id) {
+    message.warning('缺少自查表 ID');
+    return;
+  }
+  if (!canSubmitReview.value) {
+    message.warning('当前账号用户组无权回退');
+    return;
+  }
+  const rejectReason = await promptRejectReason();
+  if (rejectReason === null)
+    return;
+  const t = reviewProgress.value;
+  try {
+    rejectLoading.value = true;
+    await AssessmentContentApi.reviewSelfAssessment({
+      id: f.id,
+      progress: rejectTargetProgress.value,
+      rejectType: t,
+      rejectReason,
+    });
+    message.success('已回退');
+    router.back();
+  } catch (e) {
+    Modal.error({ title: '回退失败', content: formatErr(e) });
+  } finally {
+    rejectLoading.value = false;
+  }
+}
+
 async function submitReview() {
   const f = currentForm.value;
   if (!f?.id) {