From 484b1f3e41a561e438ce4cdbec0e09958c932767 Mon Sep 17 00:00:00 2001
From: yxh <172933527@qq.com>
Date: 星期三, 28 十月 2026 17:02:59 +0800
Subject: [PATCH] 统计分析
---
src/views/project/statistics/applyStatistics/index.vue | 336 ++++++++++++++++++++++++++++++++++++--------------------
1 files changed, 216 insertions(+), 120 deletions(-)
diff --git a/src/views/project/statistics/applyStatistics/index.vue b/src/views/project/statistics/applyStatistics/index.vue
index 0be6121..a534727 100644
--- a/src/views/project/statistics/applyStatistics/index.vue
+++ b/src/views/project/statistics/applyStatistics/index.vue
@@ -6,54 +6,12 @@
:model="queryParams"
ref="queryForm"
:inline="true"
+ v-show="showSearch"
label-width="70px"
>
<el-row :gutter="8">
- <el-col :span="6">
- <el-form-item label="涓氬姟浜哄憳" prop="name">
- <el-input
- v-model="queryParams.pausername"
- placeholder="璇疯緭鍏ュ鍚�"
- clearable
- size="small"
- @keyup.enter.native="handleQuery"
- />
- </el-form-item>
- </el-col>
- <el-col :span="6">
- <el-form-item align="left" label="涓氬姟缁�" prop="treatmenthospitalno">
- <el-select
- v-model="queryParams.padeptno"
- placeholder="璇烽�夋嫨妗堜緥鐘舵��"
- >
- <el-option
- v-for="item in deptList"
- :label="item.deptName"
- :value="item.deptId"
- >
- </el-option>
- </el-select>
- </el-form-item>
- </el-col>
- <el-col :span="6">
- <el-form-item label="璐圭敤绫诲瀷">
- <el-select
- v-model="queryParams.paexpensetype"
- placeholder="璇烽�夋嫨妗堜緥鐘舵��"
- >
- <el-option
- v-for="item in reportlist"
- :label="item.label"
- :value="item.value"
- >
- </el-option>
- </el-select>
- </el-form-item>
- </el-col>
- </el-row>
- <el-row :gutter="8">
- <el-col :span="12">
- <el-form-item label="缁熻鏃ユ湡">
+ <el-col :span="8">
+ <el-form-item label="鏈堜唤鑼冨洿">
<el-date-picker
style="width: 100%"
v-model="selecttime"
@@ -66,8 +24,43 @@
>
</el-date-picker>
</el-form-item>
+ </el-col>
+ <el-col :span="6">
+ <el-form-item align="left" label="鎶ラ攢閮ㄩ棬" prop="padeptno">
+ <el-select
+ v-model="queryParams.padeptno"
+ placeholder="璇烽�夋嫨鎶ラ攢閮ㄩ棬"
+ >
+ <el-option
+ v-for="item in deptList"
+ :label="item.deptName"
+ :value="item.deptId"
+ >
+ </el-option>
+ </el-select>
+ </el-form-item>
+ </el-col>
+ </el-row>
+ <el-row :gutter="8">
+ <el-col :span="6">
+ <el-form-item label="鎶ラ攢浜哄憳" prop="pauserno">
+ <el-select
+ v-model="queryParams.pauserno"
+ placeholder="璇烽�夋嫨鎶ラ攢浜哄憳"
+ clearable
+ filterable
+ style="width: 100%"
+ >
+ <el-option
+ v-for="item in userList"
+ :key="item.username"
+ :label="item.nickname"
+ :value="item.username"
+ >
+ </el-option>
+ </el-select>
+ </el-form-item>
</el-col>
-
<el-col :span="6">
<el-form-item>
<el-button
@@ -85,38 +78,66 @@
</el-row>
</el-form>
- <!--<el-table v-loading="loading" border :data="donatebaseinfoList"> -->
- <el-table
- :data="jxidata"
- ref="table"
- border
- max-height="700"
- highlight-current-row
- :summary-method="getSummaries"
- show-summary
- >
- <el-table-column label="搴忓彿" align="center" prop="id" width="100">
- </el-table-column>
+ <el-row :gutter="10" class="mb8">
+ <el-col :span="1.5">
+ <el-button
+ type="warning"
+ plain
+ icon="el-icon-download"
+ size="mini"
+ :loading="exportLoading"
+ @click="handleExport"
+ >瀵煎嚭</el-button
+ >
+ </el-col>
+ <right-toolbar
+ :showSearch.sync="showSearch"
+ @queryTable="getList"
+ ></right-toolbar>
+ </el-row>
- <el-table-column label="缁熻鏈堜唤" align="center" prop="applymonth" />
- <el-table-column label="涓氬姟缁�" align="center" prop="deptmentName">
- </el-table-column>
- <el-table-column label="涓撹亴浜哄憳" align="center" prop="username" />
+ <el-tabs v-model="activeTab">
+ <el-tab-pane label="鎸変笟鍔$粍" name="dept">
+ <el-table :data="deptData" ref="deptTable" border max-height="700" highlight-current-row
+ :summary-method="getDeptSummaries" show-summary>
+ <el-table-column label="搴忓彿" align="center" prop="id" width="50" />
+ <el-table-column label="涓氬姟缁�" align="center" prop="deptname" />
+ <el-table-column label="鎶ラ攢鎬婚噾棰�" align="center" prop="amount" width="180" :formatter="amountFormatter" />
+ <el-table-column label="涓撳璐�" align="center" prop="expertfee" width="160" :formatter="amountFormatter" />
+ <el-table-column label="浼︾悊涓撳璐�" align="center" prop="ethicalistfee" width="160" :formatter="amountFormatter" />
+ <el-table-column label="鍖诲鎴愭湰" align="center" prop="medicalcost" width="160" :formatter="amountFormatter" />
+ <el-table-column label="鍔炲叕璐�" align="center" prop="officecost" width="160" :formatter="amountFormatter" />
+ <el-table-column label="宸梾璐�" align="center" prop="reimcost" width="160" :formatter="amountFormatter" />
+ </el-table>
+ </el-tab-pane>
- <el-table-column label="閲戦" align="center" prop="amount" />
+ <el-tab-pane label="鎸変汉鍛�" name="person">
+ <el-table :data="jxidata" ref="personTable" border max-height="700" highlight-current-row
+ :summary-method="getSummaries" show-summary>
+ <el-table-column label="搴忓彿" align="center" prop="id" width="50" />
+ <el-table-column label="涓氬姟缁�" align="center" prop="deptmentName" />
+ <el-table-column label="涓撹亴浜哄憳" align="center" prop="username" />
+ <el-table-column label="鎶ラ攢鎬婚噾棰�" align="center" prop="amount" width="180" :formatter="amountFormatter" />
+ <el-table-column label="涓撳璐�" align="center" prop="expertfee" width="160" :formatter="amountFormatter" />
+ <el-table-column label="浼︾悊涓撳璐�" align="center" prop="ethicalistfee" width="160" :formatter="amountFormatter" />
+ <el-table-column label="鍖诲鎴愭湰" align="center" prop="medicalcost" width="160" :formatter="amountFormatter" />
+ <el-table-column label="鍔炲叕璐�" align="center" prop="officecost" width="160" :formatter="amountFormatter" />
+ <el-table-column label="宸梾璐�" align="center" prop="reimcost" width="160" :formatter="amountFormatter" />
- <el-table-column label="鎿嶄綔" align="center">
- <template slot-scope="scope">
- <el-button size="mini" type="text" icon="el-icon-edit"
- >鏄庣粏</el-button
- >
- </template>
- </el-table-column>
- </el-table>
+ <!-- <el-table-column label="鎿嶄綔" align="center">
+ <template slot-scope="scope">
+ <el-button size="mini" type="text" icon="el-icon-edit"
+ >鏄庣粏</el-button
+ >
+ </template>
+ </el-table-column> -->
+ </el-table>
+ </el-tab-pane>
+ </el-tabs>
<div style="margin: 10px;text-align: right;">
<div>
- 鍏� <span style="color:#1890FF ;">{{ total }}</span> 鏉℃暟鎹�
+ 鍏� <span style="color:#1890FF ;">{{ tableTotal }}</span> 鏉℃暟鎹�
</div>
</div>
@@ -132,7 +153,9 @@
listsfeistatistics,
listbxiaostatistics,
listjixstatistics,
- listanlstatistics
+ listanlstatistics,
+ exportExpenseStatistics,
+ exportExpenseDeptStatistics
} from "@/api/project/statistics";
import { listUser } from "@/api/project/organization";
@@ -161,7 +184,7 @@
selecttime: "",
reportervalue: "",
reportlist: [
- { label: "宸梾璐�", value: "0" },
+ { label: "宸梾璐�", value: "5" },
{ label: "涓撳璐�", value: "1" },
{ label: "浼︾悊涓撳璐�", value: "2" },
{ label: "鍖诲鎴愭湰", value: "3" },
@@ -205,6 +228,7 @@
qu: ""
},
deptList: [],
+ userList: [],
// 閬僵灞�
loading: false,
// 瀵煎嚭閬僵灞�
@@ -223,6 +247,10 @@
donatebaseinfoList: [],
// 鎹愮尞鍩虹琛ㄦ牸鏁版嵁
jxidata: [],
+ // 褰撳墠椤电锛歞ept=鎸変笟鍔$粍锛宲erson=鎸変汉鍛�
+ activeTab: "dept",
+ // 鎸変笟鍔$粍鑱氬悎鏁版嵁
+ deptData: [],
// 寮瑰嚭灞傛爣棰�
title: "",
// 鏄惁鏄剧ず寮瑰嚭灞�
@@ -253,7 +281,11 @@
};
},
//鐩戝惉灞炴�� 绫讳技浜巇ata姒傚康
- computed: {},
+ computed: {
+ tableTotal() {
+ return this.activeTab === "dept" ? this.deptData.length : this.jxidata.length;
+ }
+ },
activated() {},
mounted() {},
@@ -266,48 +298,14 @@
this.queryParams.pabegtime = this.selecttime[0];
this.queryParams.paendtime = this.selecttime[1];
// if (this.queryParams.paendtime == this.queryParams.pabegtime) {
- let num = Number(this.queryParams.paendtime.slice(5, 7));
- if (num < 9) {
- let mon = Number(this.queryParams.paendtime.slice(6, 7));
- this.queryParams.paendtime =
- this.queryParams.paendtime.slice(0, 5) +
- "0" +
- (mon + 1) +
- "-" +
- "01" +
- " " +
- "00" +
- ":" +
- "00" +
- ":" +
- "00";
- }
- // this.queryParams.paendtime=this.queryParams.paendtime.slice(0,5)骞�
- else if (num >= 10) {
- this.queryParams.paendtime =
- this.queryParams.paendtime.slice(0, 5) +
- (num + 1) +
- "-" +
- "01" +
- " " +
- "00" +
- ":" +
- "00" +
- ":" +
- "00";
- } else {
- this.queryParams.paendtime =
- this.queryParams.paendtime.slice(0, 5) +
- "10" +
- "-" +
- "01" +
- " " +
- "00" +
- ":" +
- "00" +
- ":" +
- "00";
- }
+ // 缁撴潫鏃堕棿鍙�"鎵�閫夌粨鏉熸湀鐨勬鏈� 1 鍙�"锛屼互鍖呭惈鏁翠釜缁撴潫鏈堛��
+ // 鍘熷疄鐜版妸鏈堜唤 +1 鍚庣洿鎺ユ嫾瀛楃涓诧紝12 鏈堜細寰楀埌 13 鏈堬紙2026-13-01锛夛紝
+ // MySQL 鎶� Incorrect datetime value锛屽瓨鍌ㄨ繃绋嬬洿鎺� 500銆�
+ this.queryParams.paendtime = this.$moment(this.queryParams.paendtime)
+ .startOf("month")
+ .add(1, "month")
+ .format("YYYY-MM")
+ .concat("-01 00:00:00");
this.queryParams.pabegtime =
this.queryParams.pabegtime + " " + "00" + ":" + "00" + ":" + "00";
// }
@@ -320,6 +318,11 @@
listDept({}).then(response => {
this.deptList = response.data;
this.loading = false;
+ });
+ },
+ getUserList() {
+ listUser().then(res => {
+ this.userList = res.data;
});
},
resetArr(Arr) {
@@ -341,7 +344,64 @@
this.jxidata.forEach(($obj, $index) => {
$obj.id = $index + 1;
});
+ this.buildDeptData();
});
+ },
+ /** 鎸変笟鍔$粍鑱氬悎锛�6 涓噾棰濆垎鍒眰鍜� */
+ buildDeptData() {
+ const map = new Map();
+ this.jxidata.forEach(row => {
+ const key = row.deptmentno || row.deptmentName || "鏈垎缁�";
+ if (!map.has(key)) {
+ map.set(key, {
+ deptname: row.deptmentName || "鏈垎缁�",
+ amount: 0,
+ expertfee: 0,
+ ethicalistfee: 0,
+ medicalcost: 0,
+ officecost: 0,
+ reimcost: 0
+ });
+ }
+ const item = map.get(key);
+ item.amount += Number(row.amount) || 0;
+ item.expertfee += Number(row.expertfee) || 0;
+ item.ethicalistfee += Number(row.ethicalistfee) || 0;
+ item.medicalcost += Number(row.medicalcost) || 0;
+ item.officecost += Number(row.officecost) || 0;
+ item.reimcost += Number(row.reimcost) || 0;
+ });
+ this.deptData = Array.from(map.values()).map((item, index) => {
+ item.id = index + 1;
+ return item;
+ });
+ },
+ /** 瀵煎嚭鎸夐挳鎿嶄綔 */
+ handleExport() {
+ const queryParams = {
+ pabegtime: this.queryParams.pabegtime,
+ paendtime: this.queryParams.paendtime,
+ padeptno: this.queryParams.padeptno,
+ pauserno: this.queryParams.pauserno,
+ paexpensetype: this.queryParams.paexpensetype
+ };
+ const exportApi =
+ this.activeTab === "dept"
+ ? exportExpenseDeptStatistics
+ : exportExpenseStatistics;
+ this.$modal
+ .confirm("鏄惁纭瀵煎嚭褰撳墠鍒楄〃鐨勮垂鐢ㄧ粺璁℃暟鎹紵")
+ .then(() => {
+ this.exportLoading = true;
+ return exportApi(queryParams);
+ })
+ .then(response => {
+ this.$download.name(response.msg);
+ this.exportLoading = false;
+ })
+ .catch(() => {
+ this.exportLoading = false;
+ });
},
// 琛ㄥ崟閲嶇疆
@@ -372,10 +432,24 @@
this.resetForm("queryForm");
this.handleQuery();
},
+ /** 閲戦鏄剧ず锛氫繚鐣欎袱浣嶅皬鏁帮紝0.00 涓嶆樉绀� */
+ formatAmount(value) {
+ if (value === null || value === undefined || value === "") {
+ return "";
+ }
+ const num = Number(value);
+ if (!Number.isFinite(num) || num === 0) {
+ return "";
+ }
+ return num.toFixed(2);
+ },
+ amountFormatter(row, column, cellValue) {
+ return this.formatAmount(cellValue);
+ },
getSummaries(param) {
const { columns, data } = param;
const sums = [];
- var columnnames = ["applymonth", "deptmentName", "username"];
+ var columnnames = ["deptmentName", "username"];
columns.forEach((column, index) => {
if (index === 0) {
sums[index] = "鍚堣";
@@ -388,7 +462,7 @@
const values = data.map(item => Number(item[column.property]));
if (!values.every(value => isNaN(value))) {
- sums[index] = values.reduce((prev, curr) => {
+ const total = values.reduce((prev, curr) => {
const value = Number(curr);
if (!isNaN(value)) {
return prev + curr;
@@ -396,10 +470,31 @@
return prev;
}
}, 0);
- sums[index] = sums[index].toFixed(2); // 淇濈暀2浣嶅皬鏁帮紝瑙e喅灏忔暟鍚堣鍒�;
+ // 鍚堣淇濈暀 2 浣嶅皬鏁帮紱0.00 涓嶆樉绀�
+ sums[index] = total === 0 ? "" : Number(total).toFixed(2);
} else {
sums[index] = "";
}
+ });
+ return sums;
+ },
+ /** 鎸変笟鍔$粍琛ㄦ牸鍚堣 */
+ getDeptSummaries(param) {
+ const { columns, data } = param;
+ const sums = [];
+ columns.forEach((column, index) => {
+ if (index === 0) {
+ sums[index] = "鍚堣";
+ return;
+ }
+ if (column.property === "deptname") {
+ return;
+ }
+ const total = data.reduce(
+ (prev, item) => prev + (Number(item[column.property]) || 0),
+ 0
+ );
+ sums[index] = total === 0 ? "" : Number(total).toFixed(2);
});
return sums;
}
@@ -410,6 +505,7 @@
//鑾峰彇鍒楄〃
this.getList();
this.listDept();
+ this.getUserList();
}
// //鐢熷懡鍛ㄦ湡 - 鎸傝浇瀹屾垚锛堝彲浠ヨ闂瓺OM鍏冪礌锛�
--
Gitblit v1.9.3