Files
zkxw/web-admin/src/views/project-management/statistics/index.vue
T
zlwu b510d18439 fix(project): add list row numbers and align search actions
Keep project management lists and related detail, preview and audit dialogs consistent with existing table and filter styles. Number paginated rows continuously and align statistics and assignment searches to the right.
2026-11-02 16:31:02 +08:00

127 lines
4.5 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<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
>
<el-alert
title="按业务主单计数,各业务量不代表独立客户人数;预签约单独统计。点击数量查看对应明细。"
type="info"
:closable="false"
/>
<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 formalTypes"
: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
><p class="form-tip">预签约:{{ data.presignTotal }} 单(单独计数)</p></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,
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 formalTypes: BizType[] = [
'cell_storage',
'research_donation',
'pilot_service',
'basic_experiment'
]
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>