diff --git a/src/views/business/erp/cost/firm-reports-list.vue b/src/views/business/erp/cost/firm-reports-list.vue index 449d3cf..63eb62d 100644 --- a/src/views/business/erp/cost/firm-reports-list.vue +++ b/src/views/business/erp/cost/firm-reports-list.vue @@ -57,12 +57,12 @@
- + @@ -166,6 +180,13 @@ const exportLoading = ref(false); const tableData = ref([]); const loading = ref(false); +// 分页配置 +const pagination = reactive({ + pageNum: 1, + pageSize: 10, + total: 0 +}); + // 查询表单 const queryForm = reactive({ year: new Date().getFullYear(), @@ -183,9 +204,18 @@ const quarterOptions = ref([ { value: 4, label: '第四季度' } ]); -// 是否是CEO角色 +// 是否是 CEO 角色 const isCeo = ref(false); +// 获取当前季度 +function getCurrentQuarter() { + const month = new Date().getMonth() + 1; + if (month <= 3) return 1; + if (month <= 6) return 2; + if (month <= 9) return 3; + return 4; +} + // 初始化年度选项 function initYearOptions() { const currentYear = new Date().getFullYear(); @@ -203,12 +233,20 @@ async function handleQuery() { const params = { year: queryForm.year, quarter: queryForm.quarter, - firmId: queryForm.firmId || props.params?.firmId + firmId: queryForm.firmId || props.params?.firmId, + pageNum: pagination.pageNum, + pageSize: pagination.pageSize }; - + const response = await serviceApplicationsApi.statisticsDepartment(params); - tableData.value = response.data || []; - + if (response.data) { + tableData.value = response.data.list || []; + pagination.total = response.data.total || 0; + } else { + tableData.value = []; + pagination.total = 0; + } + } catch (error) { message.error('查询失败'); console.error('查询失败:', error); @@ -217,10 +255,26 @@ async function handleQuery() { } } +// 分页变化事件 +function handlePageChange(page, pageSize) { + pagination.pageNum = page; + pagination.pageSize = pageSize; + handleQuery(); +} + +// 每页条数变化事件 +function handlePageSizeChange(current, size) { + pagination.pageNum = 1; + pagination.pageSize = size; + handleQuery(); +} + // 重置查询条件 function handleReset() { queryForm.quarter = null; queryForm.firmId = null; + pagination.pageNum = 1; + pagination.pageSize = 10; // 重置后自动查询 handleQuery(); } @@ -274,19 +328,25 @@ async function fetchStatisticsData() { const params = { year: props.params.year, quarter: props.params.quarter, - firmId: props.params.firmId + firmId: props.params.firmId, + pageNum: pagination.pageNum, + pageSize: pagination.pageSize }; - + // 调用API获取统计数据 const response = await serviceApplicationsApi.statisticsDepartment(params); - tableData.value = response.data || []; + if (response.data) { + tableData.value = response.data.list || []; + pagination.total = response.data.total || 0; + } else { + tableData.value = []; + pagination.total = 0; + } console.log('API返回的数据:', tableData.value); - // 检查是否有律师数据 - tableData.value.forEach((item, index) => { - }); } catch (error) { message.error('获取统计数据失败'); tableData.value = []; + pagination.total = 0; } finally { loading.value = false; } @@ -302,10 +362,11 @@ async function handleExport() { exportLoading.value = true; try { console.log('开始导出律所统计详情...'); + // 使用 queryForm 作为导出参数,避免 props.params 为 null 时报错 const exportParams = { - quarter: props.params.quarter, - year: props.params.year, - firmId: props.params.firmId + quarter: queryForm.quarter, + year: queryForm.year, + firmId: queryForm.firmId // 去除分页参数,导出所有数据 }; @@ -518,4 +579,12 @@ onMounted(() => { font-weight: 600; border-bottom: 1px solid #ddd; } + +/* 分页容器样式 */ +.pagination-container { + padding: 16px; + text-align: right; + background: #fff; + border-top: 1px solid #ddd; +} \ No newline at end of file diff --git a/src/views/business/erp/service/law-firm-service-report-statistics.vue b/src/views/business/erp/service/law-firm-service-report-statistics.vue index e1f5aa7..00a982e 100644 --- a/src/views/business/erp/service/law-firm-service-report-statistics.vue +++ b/src/views/business/erp/service/law-firm-service-report-statistics.vue @@ -170,7 +170,7 @@ const queryFormState = { firmId: undefined, year: new Date().getFullYear(), - quarter: Math.ceil((new Date().getMonth() + 1) / 3), + quarter: null, pageNum: 1, pageSize: 10 }; @@ -262,6 +262,7 @@ function onSearch() { pagination.current = 1; + queryForm.pageNum = 1; queryData(); } diff --git a/src/views/business/erp/service/law-firm-statistics.vue b/src/views/business/erp/service/law-firm-statistics.vue index a7c5216..6d680fe 100644 --- a/src/views/business/erp/service/law-firm-statistics.vue +++ b/src/views/business/erp/service/law-firm-statistics.vue @@ -32,7 +32,7 @@ /> - + 查询 @@ -178,6 +178,12 @@ function initYearOptions() { yearOptions.value = years; } +// 点击查询 +function onSearch() { + pagination.value.current = 1; + handleQuery(); +} + // 查询数据 async function handleQuery() { try { diff --git a/src/views/business/erp/service/lawyer-service-report-statistics.vue b/src/views/business/erp/service/lawyer-service-report-statistics.vue index a87fb12..8670c32 100644 --- a/src/views/business/erp/service/lawyer-service-report-statistics.vue +++ b/src/views/business/erp/service/lawyer-service-report-statistics.vue @@ -135,9 +135,10 @@ { label: '第四季度', value: 4 } ]); - const queryFormState = { + const queryFormState = { + firmId: undefined, year: new Date().getFullYear(), - quarter: Math.ceil((new Date().getMonth() + 1) / 3), + quarter: null, pageNum: 1, pageSize: 10 }; @@ -341,11 +342,8 @@ // ---------------------------- 生命周期 ---------------------------- onMounted(() => { - console.log('律师报表页面 onMounted 被调用'); initYearOptions(); - console.log('准备调用 queryData'); queryData(); - console.log('onMounted 完成'); }); diff --git a/src/views/business/erp/service/lawyer-statistics-detail.vue b/src/views/business/erp/service/lawyer-statistics-detail.vue index bef3ceb..b9af89e 100644 --- a/src/views/business/erp/service/lawyer-statistics-detail.vue +++ b/src/views/business/erp/service/lawyer-statistics-detail.vue @@ -127,6 +127,15 @@ const quarterOptions = ref([ { value: 4, label: '第四季度' } ]); +// 获取当前季度 +function getCurrentQuarter() { + const month = new Date().getMonth() + 1; + if (month <= 3) return 1; + if (month <= 6) return 2; + if (month <= 9) return 3; + return 4; +} + // 初始化年度选项 function initYearOptions() { const currentYear = new Date().getFullYear();