index.vue
4.39 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
<template>
<page-view has-bread>
<basic-card :project="project as any" :loading="loading" />
<a-card :bordered="false" style="margin-top: 16px">
<a-tabs v-model:active-key="tabKey" type="rounded" :animation="true" size="small" :justify="true">
<a-tab-pane key="activity" :title="`歌曲列表(${activityCount})`">
<activity-card
style="padding: 0"
:has-bread="false"
:hide-tool="true"
:init-filter="{ status: '', project_id: projectKey }"
:hide-search-item="['projectName']"
:export-name="project.name"
:query-hook="() => syncActivityCount()"
/>
</a-tab-pane>
<a-tab-pane key="demo" :title="`Demo列表(${demoCount})`">
<demo-card
:hide-tool="true"
:init-filter="{ project_id: projectKey }"
style="padding: 0"
:has-bread="false"
:hide-create="true"
:hide-search-item="['projectName']"
:query-hook="() => syncDemoCount()"
/>
</a-tab-pane>
<a-tab-pane key="member" :title="`厂牌成员(${memberCount})`">
<member-table :project-key="projectKey" :query-hook="() => syncMemberCount()" />
</a-tab-pane>
<a-tab-pane key="manage" :title="`厂牌管理(${manageCount})`">
<manage-table :project-key="projectKey" :query-hook="() => syncManageCount()" />
</a-tab-pane>
<a-tab-pane key="out-manage" :title="`外部管理(${outManageCount})`">
<out-manage-table
:project-key="projectKey"
:has-permission="project.is_can_manage as boolean"
:query-hook="() => syncOutManageCount()"
/>
</a-tab-pane>
</a-tabs>
</a-card>
</page-view>
</template>
<script lang="ts" setup>
import { useRoute } from 'vue-router';
import { useRouteQuery } from '@vueuse/router';
import { onMounted, ref } from 'vue';
import useLoading from '@/hooks/loading';
import useProjectApi from '@/api/project';
import useActivityApi from '@/api/activity';
import { useSelectionStore } from '@/store';
import BasicCard from '@/views/project-show/components/basic-card.vue';
import ManageTable from '@/views/project-show/components/manage-table.vue';
import OutManageTable from '@/views/project-show/components/out-manage-table.vue';
import ActivityCard from '@/views/audition/activity/index.vue';
import DemoCard from '@/views/audition/demo/index.vue';
import MemberTable from '@/views/project-show/components/member-table.vue';
const tabKey = useRouteQuery('tabKey', 'activity');
const projectKey = Number(useRoute().params?.id);
const project = ref({ name: '', is_can_manage: 0 });
const { loading, setLoading } = useLoading(true);
const manageCount = ref(0);
const outManageCount = ref(0);
const memberCount = ref(0);
const demoCount = ref(0);
const activityCount = ref(0);
const syncParams = { pageSize: 1, limit: 1 };
const syncManageCount = () =>
// eslint-disable-next-line no-return-assign
useProjectApi.manageUsers(projectKey, syncParams).then(({ meta }) => (manageCount.value = meta.total));
const syncMemberCount = () =>
// eslint-disable-next-line no-return-assign
useProjectApi.memberUsers(projectKey, { pageSize: 1, limit: 1 }).then(({ meta }) => (memberCount.value = meta.total));
const syncOutManageCount = () =>
// eslint-disable-next-line no-return-assign
useProjectApi.outManageUsers(projectKey, syncParams).then(({ meta }) => (outManageCount.value = meta.total));
const syncActivityCount = () =>
// eslint-disable-next-line import/no-named-as-default-member,no-return-assign
useActivityApi
.get({ status: '', song_type: 1, audit_status: 1, project_id: projectKey, ...syncParams })
// eslint-disable-next-line no-return-assign
.then(({ meta }) => (activityCount.value = meta.total));
const syncDemoCount = () => {
// eslint-disable-next-line import/no-named-as-default-member,no-return-assign
useActivityApi
.get({ status: '', song_type: 2, audit_status: 1, project_id: projectKey, ...syncParams })
// eslint-disable-next-line no-return-assign
.then(({ meta }) => (demoCount.value = meta.total));
};
const { queryAll } = useSelectionStore();
onMounted(() => {
useProjectApi
.show(projectKey)
// eslint-disable-next-line no-return-assign
.then((data) => (project.value = data as any))
.finally(() => setLoading(false));
queryAll();
});
</script>