刘洋 il y a 8 mois
Parent
commit
c39928f917
1 fichiers modifiés avec 71 ajouts et 43 suppressions
  1. 71 43
      src/render/views/RecognizeCheck/index.vue

+ 71 - 43
src/render/views/RecognizeCheck/index.vue

@@ -39,48 +39,53 @@
           {{ getConditionProgress(index) }}
         </template>
         <template v-if="column.dataIndex === 'operation'">
-          <a-button
-            v-if="checkActionValid(index, 'arbitrate')"
-            type="link"
-            :diabled="checkDangerActionRunning(index)"
-            @click="onArbitrate(index)"
-            >仲裁</a-button
-          >
-          <a-button
-            v-if="checkActionValid(index, 'edit')"
-            type="link"
-            :diabled="checkDangerActionRunning(index)"
-            @click="onEdit(index)"
-            >修改</a-button
-          >
-          <a-button
-            v-if="checkActionValid(index, 'reset')"
-            type="link"
-            :diabled="checkDangerActionRunning(index)"
-            @click="onReset(index)"
-            >重置</a-button
-          >
-          <a-button
-            v-if="checkActionValid(index, 'recheck')"
-            type="link"
-            :diabled="checkDangerActionRunning(index)"
-            @click="onRecheck(index)"
-            >复查</a-button
-          >
-          <a-button
-            v-if="checkActionValid(index, 'buildTask')"
-            type="link"
-            :diabled="checkDangerActionRunning(index)"
-            @click="onBuildTask(index)"
-            >生成任务</a-button
-          >
-          <a-button
-            v-if="checkActionValid(index, 'delete')"
-            type="link"
-            :diabled="checkDangerActionRunning(index)"
-            @click="onDelete(index)"
-            >删除</a-button
-          >
+          <span v-if="record.building">生成任务中...</span>
+          <span v-else-if="record.reseting">重置中...</span>
+          <span v-else-if="record.deleting">删除中...</span>
+          <template v-else>
+            <a-button
+              v-if="checkActionValid(index, 'arbitrate')"
+              type="link"
+              :diabled="checkDangerActionRunning(index)"
+              @click="onArbitrate(index)"
+              >仲裁</a-button
+            >
+            <a-button
+              v-if="checkActionValid(index, 'edit')"
+              type="link"
+              :diabled="checkDangerActionRunning(index)"
+              @click="onEdit(index)"
+              >修改</a-button
+            >
+            <a-button
+              v-if="checkActionValid(index, 'reset')"
+              type="link"
+              :diabled="checkDangerActionRunning(index)"
+              @click="onReset(index)"
+              >重置</a-button
+            >
+            <a-button
+              v-if="checkActionValid(index, 'recheck')"
+              type="link"
+              :diabled="checkDangerActionRunning(index)"
+              @click="onRecheck(index)"
+              >复查</a-button
+            >
+            <a-button
+              v-if="checkActionValid(index, 'buildTask')"
+              type="link"
+              :diabled="checkDangerActionRunning(index)"
+              @click="onBuildTask(index)"
+              >生成任务</a-button
+            >
+            <a-button
+              v-if="checkActionValid(index, 'delete')"
+              type="link"
+              :diabled="checkDangerActionRunning(index)"
+              @click="onDelete(index)"
+              >删除</a-button
+            >
+          </template>
         </template>
       </template>
     </a-table>
@@ -97,7 +102,7 @@
 </template>
 
 <script setup lang="ts">
-import { ref, reactive, onMounted } from "vue";
+import { ref, reactive, onMounted, watch, onBeforeUnmount } from "vue";
 import { useRoute, useRouter } from "vue-router";
 import { PlusCircleOutlined } from "@ant-design/icons-vue";
 import { message } from "ant-design-vue";
@@ -121,6 +126,7 @@ import { showConfirm } from "@/utils/uiUtils";
 import { useUserStore } from "@/store";
 
 import ModifyRecognizeCheckTask from "./ModifyRecognizeCheckTask.vue";
+import { useIntervalFn } from "@vueuse/core";
 
 defineOptions({
   name: "RecognizeCheck",
@@ -206,6 +212,10 @@ const curRow = ref<RecognizeCheckListItem | null>(null);
 const { dataList, pagination, loading, getList, toPage, deletePageLastItem } =
   useTable<RecognizeCheckListItem>(recognizeCheckListPage, searchModel, false);
 
+const { pause, isActive, resume } = useIntervalFn(getList, 30 * 1000, {
+  immediate: false,
+});
+
 type ActionType =
   | "arbitrate"
   | "edit"
@@ -338,4 +348,22 @@ onMounted(async () => {
   await getConditionList();
   await toPage(1);
 });
+
+watch(
+  dataList,
+  () => {
+    pause();
+    if (
+      dataList.value.find((item) => {
+        return item.building || item.deleting || item.reseting;
+      })
+    ) {
+      resume();
+    }
+  },
+  { deep: true, immediate: true }
+);
+onBeforeUnmount(() => {
+  pause();
+});
 </script>