Files
zkxw/web-admin/src/views/project-management/statistics/index.vue
T
cykjandCursor c22a0d1eb0 feat(market): 完善临床科研与委托加工上线能力
补齐项目组负责人审批、费用信息、合作客户、生产出库菜单、申请单号 LCKY 前缀及配套 SQL 迁移,并同步相关前后端与单测。

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-11-30 18:51:37 +08:00

127 lines
4.3 KiB
Vue

<template>
<div class="page-container"
><section class="panel">
<div class="filter-block"
><el-form class="filter-form" label-position="top"
><div class="filter-grid">
<el-form-item label="汇总维度"
><el-select v-model="query.groupBy"
><el-option value="team" label="项目组" /><el-option
value="project"
label="项目" /></el-select
></el-form-item>
<el-form-item label="项目组"
><ProjectSelect filter v-model="query.teamId" team /></el-form-item
><el-form-item label="项目"
><ProjectSelect filter v-model="query.projectId"
/></el-form-item>
<el-form-item label="创建日期"
><el-date-picker
v-model="dateRange"
type="daterange"
value-format="YYYY-MM-DD"
start-placeholder="开始日期"
end-placeholder="结束日期"
/></el-form-item> </div
><div class="filter-actions-row"
><div class="filter-actions-end"
><el-button type="primary" @click="load"
><el-icon><Search /></el-icon>查询</el-button
></div
></div
></el-form
></div
>
<div class="list-body list-wrap"
><el-table :data="displayRows" v-loading="loading" class="list-table" stripe>
<el-table-column
type="index"
label="序号"
min-width="68"
align="center"
header-align="center"
/>
<el-table-column prop="name" label="项目组 / 项目" min-width="200" /><el-table-column
prop="teamName"
label="所属项目组"
min-width="150"
/>
<el-table-column
v-for="key in statisticsTypes"
:key="key"
:label="bizLabels[key]"
min-width="130"
><template #default="{ row }"
><el-button link type="primary" @click="drill(row, key)"
><el-icon><View /></el-icon>{{ row[key] || 0 }}</el-button
></template
></el-table-column
>
</el-table></div
>
<el-dialog
v-model="detailsVisible"
title="业务明细"
width="90%"
append-to-body
class="dialog-form-layout"
><RecordList v-if="detailsVisible" :filters="detailFilters"
/></el-dialog> </section
></div>
</template>
<script setup lang="ts">
import { Search, View } from '@element-plus/icons-vue'
import ProjectSelect from '@/components/business/ProjectSelect.vue'
import RecordList from '../RecordList.vue'
import { buildDrillFilters } from '@/utils/project-management'
import {
fetchProjectStatistics,
bizLabels,
isProjectBizTypeVisible,
type BizType,
type ProjectRecord
} from '@/api/project-management'
const query = reactive({ groupBy: 'team', projectId: '', teamId: '' }),
dateRange = ref<string[]>([]),
loading = ref(false),
detailsVisible = ref(false),
detailFilters = ref<ProjectRecord>({})
const data = ref<{
items: ProjectRecord[]
totals: ProjectRecord
unassignedTotals: ProjectRecord
presignTotal: number
}>({ items: [], totals: {}, unassignedTotals: {}, presignTotal: 0 })
const statisticsTypes: BizType[] = (
[
'presign',
'cell_storage',
'research_donation',
'pilot_service',
'basic_experiment',
'contract_processing'
] as BizType[]
).filter((key) => isProjectBizTypeVisible(key))
const applied = ref<ProjectRecord>({ groupBy: 'team' })
const displayRows = computed(() => [
...data.value.items,
{ ...data.value.totals, id: 'total', name: '业务总量' },
{ ...data.value.unassignedTotals, id: 'unassigned', name: '未归属' }
])
async function load() {
loading.value = true
try {
const params = { ...query, startDate: dateRange.value?.[0], endDate: dateRange.value?.[1] }
data.value = await fetchProjectStatistics(params)
applied.value = params
} finally {
loading.value = false
}
}
function drill(row: ProjectRecord, bizType: BizType) {
detailFilters.value = buildDrillFilters(applied.value, row, bizType)
detailsVisible.value = true
}
onMounted(load)
</script>