|
@@ -40,7 +40,7 @@
|
|
|
</template>
|
|
|
|
|
|
<script lang="ts" setup>
|
|
|
-import { computed, reactive, ref, watch } from "vue";
|
|
|
+import { computed, onActivated, onDeactivated, reactive, ref, watch } from "vue";
|
|
|
import { BodyPanlBody, BodyPanlHeader } from "@/layout/panl";
|
|
|
import { useRealtime } from "@/hook";
|
|
|
import { router } from "@/router";
|
|
@@ -83,23 +83,26 @@ const totals = ref({
|
|
|
[TaggingStatus.solved]: 0
|
|
|
});
|
|
|
|
|
|
-watch(() => projectId.value, () => {
|
|
|
- if (!projectId.value) {
|
|
|
- return;
|
|
|
- }
|
|
|
- types.forEach(async type => {
|
|
|
- const params = {
|
|
|
- pageNum: 1,
|
|
|
- pageSize: 1,
|
|
|
- markingStatus: type,
|
|
|
- markingTitle: "",
|
|
|
- projectId: projectId.value
|
|
|
- };
|
|
|
- const result = await fetchTaggings(params);
|
|
|
- totals.value[type] = result.total;
|
|
|
- console.log(totals);
|
|
|
- });
|
|
|
-}, { immediate: true });
|
|
|
+let interval: number
|
|
|
+onActivated(() => {
|
|
|
+ interval = setInterval(() => {
|
|
|
+ types.forEach(async type => {
|
|
|
+ const params = {
|
|
|
+ pageNum: 1,
|
|
|
+ pageSize: 1,
|
|
|
+ markingStatus: type,
|
|
|
+ markingTitle: "",
|
|
|
+ projectId: projectId.value
|
|
|
+ };
|
|
|
+ const result = await fetchTaggings(params);
|
|
|
+ totals.value[type] = result.total;
|
|
|
+ console.log(totals);
|
|
|
+ });
|
|
|
+ }, 1000)
|
|
|
+})
|
|
|
+onDeactivated(() => {
|
|
|
+ clearInterval(interval)
|
|
|
+})
|
|
|
|
|
|
const [materials, updateMaterials] = useRealtime(async () => {
|
|
|
const params: FetchTaggingsProps = {
|