|
@@ -1,18 +1,22 @@
|
|
|
<template>
|
|
|
<BodyPanlHeader>
|
|
|
- <div>
|
|
|
+ <div class="project-detail-body">
|
|
|
<a-radio-group v-model:value="type">
|
|
|
- <a-radio-button value="all">所有</a-radio-button>
|
|
|
- <a-radio-button v-for="option in types" :key="option" :value="option">
|
|
|
- {{ TaggingStatusDesc[option] }}
|
|
|
- </a-radio-button>
|
|
|
+ <a-badge :count="Object.values(totals).reduce((t,c) => t + c,0)">
|
|
|
+ <a-radio-button value="all">所有</a-radio-button>
|
|
|
+ </a-badge>
|
|
|
+ <a-badge v-for="option in types" :count="totals[option]">
|
|
|
+ <a-radio-button :key="option" :value="option as any">
|
|
|
+ {{ TaggingStatusDesc[option] }}
|
|
|
+ </a-radio-button>
|
|
|
+ </a-badge>
|
|
|
</a-radio-group>
|
|
|
</div>
|
|
|
<div>
|
|
|
<a-input-search
|
|
|
v-model:value="filterName"
|
|
|
- style="width: 280px"
|
|
|
placeholder="请输入标注关键字"
|
|
|
+ style="width: 280px"
|
|
|
@search="updateMaterials"
|
|
|
/>
|
|
|
</div>
|
|
@@ -20,15 +24,14 @@
|
|
|
|
|
|
<BodyPanlBody>
|
|
|
<a-table
|
|
|
- :data-source="materials"
|
|
|
:columns="materialColumns"
|
|
|
+ :data-source="materials"
|
|
|
:pagination="pagination"
|
|
|
>
|
|
|
- <template #bodyCell="{ column }">
|
|
|
+ <template #bodyCell="{ column, record }">
|
|
|
<template v-if="column.key === 'action'">
|
|
|
<div class="table-actions">
|
|
|
- <a>查看</a>
|
|
|
- <a>前往</a>
|
|
|
+ <a target="_blank" :href="`smart-viewer.html?projectId=${record.projectId}&m=${record.num}`">查看</a>
|
|
|
</div>
|
|
|
</template>
|
|
|
</template>
|
|
@@ -37,41 +40,66 @@
|
|
|
</template>
|
|
|
|
|
|
<script lang="ts" setup>
|
|
|
-import { ref, reactive, computed, watch } from 'vue'
|
|
|
-import { BodyPanlHeader, BodyPanlBody } from '@/layout/panl'
|
|
|
-import { useRealtime } from '@/hook'
|
|
|
-import { router } from '@/router'
|
|
|
-import { taggingColumns as baseColumns } from './columns'
|
|
|
-import { fetchTaggings, TaggingStatus, TaggingStatusDesc } from '@/api'
|
|
|
-import type { FetchTaggingsProps } from '@/api'
|
|
|
+import { computed, reactive, ref, watch } from "vue";
|
|
|
+import { BodyPanlBody, BodyPanlHeader } from "@/layout/panl";
|
|
|
+import { useRealtime } from "@/hook";
|
|
|
+import { router } from "@/router";
|
|
|
+import { taggingColumns as baseColumns } from "./columns";
|
|
|
+import type { FetchTaggingsProps } from "@/api";
|
|
|
+import { fetchTaggings, TaggingStatus, TaggingStatusDesc } from "@/api";
|
|
|
|
|
|
const materialColumns = [
|
|
|
...baseColumns,
|
|
|
{
|
|
|
- title: '操作',
|
|
|
- dataIndex: 'action',
|
|
|
- key: 'action'
|
|
|
+ title: "操作",
|
|
|
+ dataIndex: "action",
|
|
|
+ key: "action"
|
|
|
}
|
|
|
-]
|
|
|
+];
|
|
|
|
|
|
const types = [
|
|
|
TaggingStatus.pending,
|
|
|
TaggingStatus.progress,
|
|
|
TaggingStatus.unsolved,
|
|
|
TaggingStatus.solved
|
|
|
-]
|
|
|
-const type = ref<TaggingStatus | 'all'>('all')
|
|
|
-const filterName = ref('')
|
|
|
-const projectId = computed(() => Number(router.currentRoute.value.params.id))
|
|
|
+];
|
|
|
+const type = ref<TaggingStatus | "all">("all");
|
|
|
+const filterName = ref("");
|
|
|
+const projectId = computed(() => Number(router.currentRoute.value.params.id));
|
|
|
const pagination = reactive({
|
|
|
current: 1,
|
|
|
total: 0,
|
|
|
pageSize: 12,
|
|
|
onChange: (current: number) => {
|
|
|
- pagination.current = current
|
|
|
- updateMaterials()
|
|
|
+ pagination.current = current;
|
|
|
+ updateMaterials();
|
|
|
}
|
|
|
-})
|
|
|
+});
|
|
|
+
|
|
|
+const totals = ref({
|
|
|
+ [TaggingStatus.pending]: 0,
|
|
|
+ [TaggingStatus.progress]: 0,
|
|
|
+ [TaggingStatus.unsolved]: 0,
|
|
|
+ [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 });
|
|
|
|
|
|
const [materials, updateMaterials] = useRealtime(async () => {
|
|
|
const params: FetchTaggingsProps = {
|
|
@@ -79,15 +107,30 @@ const [materials, updateMaterials] = useRealtime(async () => {
|
|
|
projectId: projectId.value,
|
|
|
pageNum: pagination.current,
|
|
|
pageSize: pagination.pageSize
|
|
|
+ };
|
|
|
+ if (type.value !== "all") {
|
|
|
+ params.markingStatus = type.value;
|
|
|
}
|
|
|
- if (type.value !== 'all') {
|
|
|
- params.markingStatus = type.value
|
|
|
+ const result = await fetchTaggings(params);
|
|
|
+ pagination.total = result.total;
|
|
|
+ if (type.value !== "all") {
|
|
|
+ totals.value[type.value] = result.total;
|
|
|
}
|
|
|
- const result = await fetchTaggings(params)
|
|
|
- pagination.total = result.total
|
|
|
-
|
|
|
- return result.list
|
|
|
-}, [])
|
|
|
+ return result.list;
|
|
|
+}, []);
|
|
|
|
|
|
-watch(() => type.value + filterName.value, updateMaterials)
|
|
|
+watch(() => type.value + filterName.value, updateMaterials);
|
|
|
</script>
|
|
|
+
|
|
|
+<style lang="scss">
|
|
|
+.project-detail-body .ant-badge:first-child .ant-radio-button-wrapper {
|
|
|
+ margin-left: -1px;
|
|
|
+}
|
|
|
+
|
|
|
+.project-detail-body
|
|
|
+.ant-radio-button-wrapper-checked:not(.ant-radio-button-wrapper-disabled) {
|
|
|
+ z-index: auto;
|
|
|
+ border-left: 1px solid #2997ff !important;
|
|
|
+ margin-left: -1px;
|
|
|
+}
|
|
|
+</style>
|