Commit 60482086 authored by 耿迪迪's avatar 耿迪迪

统计分析导出

parent 1763b236
......@@ -62,6 +62,13 @@ public class TPurchaseController extends BaseController
return getDataTable(list);
}
@GetMapping("/purchaseList")
public TableDataInfo purchaseList(TPurchase tPurchase){
startPage();
List<TPurchase> list = tPurchaseService.selectTPurchaseList(tPurchase);
return getDataTable(list);
}
/**
* 设置查询权限
* @param purchaseList 采购列表
......
package com.zehong.system.domain;
import com.zehong.common.annotation.Excel;
import java.math.BigDecimal;
public class TBorrowingStatistics {
@Excel(name = "部门")
private String borrowingDeptName;
@Excel(name = "使用人")
private String userName;
@Excel(name = "条数")
private int countNum;
@Excel(name = "借支总额",isStatistics = true)
private BigDecimal totalFigures;
private Long borrowingDeptId;
......
......@@ -122,6 +122,12 @@ public class TPurchase extends BaseEntity
private String handledByUserName;
private Date applyBeginTime;
private Date applyEndTime;
private String sortType;
public void setPurchaseId(Long purchaseId)
{
this.purchaseId = purchaseId;
......@@ -298,6 +304,30 @@ public class TPurchase extends BaseEntity
this.handledByUserName = handledByUserName;
}
public Date getApplyBeginTime() {
return applyBeginTime;
}
public void setApplyBeginTime(Date applyBeginTime) {
this.applyBeginTime = applyBeginTime;
}
public Date getApplyEndTime() {
return applyEndTime;
}
public void setApplyEndTime(Date applyEndTime) {
this.applyEndTime = applyEndTime;
}
public String getSortType() {
return sortType;
}
public void setSortType(String sortType) {
this.sortType = sortType;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
......
package com.zehong.system.domain;
import com.zehong.common.annotation.Excel;
import java.math.BigDecimal;
public class TPurchaseStatistics {
@Excel(name = "部门")
private String purchaseDeptName;
@Excel(name = "经办人")
private String handledByUserName;
@Excel(name = "使用人")
private String userName;
@Excel(name = "条数")
private int countNum;
@Excel(name = "报销总额",isStatistics = true)
private BigDecimal totalPurchase;
private Long purchaseDeptId;
......
package com.zehong.system.domain;
import com.zehong.common.annotation.Excel;
import java.math.BigDecimal;
public class TradeExpensesStatistics {
@Excel(name = "部门")
private String tradeDeptName;
@Excel(name = "经办人")
private String tradeTransactorName;
@Excel(name = "条数")
private int countNum;
@Excel(name = "交易支出总额",isStatistics = true)
private BigDecimal totalDealPrice;
private Long tradeDeptId;
private Long tradeTransactor;
public String sortType;
public String getTradeDeptName() {
return tradeDeptName;
}
......@@ -63,4 +71,12 @@ public class TradeExpensesStatistics {
public void setTradeTransactor(Long tradeTransactor) {
this.tradeTransactor = tradeTransactor;
}
public String getSortType() {
return sortType;
}
public void setSortType(String sortType) {
this.sortType = sortType;
}
}
package com.zehong.system.domain;
import com.zehong.common.annotation.Excel;
import java.math.BigDecimal;
public class TradeIncomeStatistics {
@Excel(name = "部门")
private String applyDeptName;
@Excel(name = "经办人")
private String applyName;
@Excel(name = "条数")
private int countNum;
@Excel(name = "交易收入总额",isStatistics = true)
private BigDecimal totalDealPrice;
private Long applyDeptId;
......
package com.zehong.system.domain.vo;
import com.zehong.common.annotation.Excel;
import java.math.BigDecimal;
public class DeptTBorrowingStatisticsVo {
@Excel(name = "部门")
private String borrowingDeptName;
@Excel(name = "条数")
private int countNum;
@Excel(name = "借支总额",isStatistics = true)
private BigDecimal totalFigures;
public String getBorrowingDeptName() {
return borrowingDeptName;
}
public void setBorrowingDeptName(String borrowingDeptName) {
this.borrowingDeptName = borrowingDeptName;
}
public int getCountNum() {
return countNum;
}
public void setCountNum(int countNum) {
this.countNum = countNum;
}
public BigDecimal getTotalFigures() {
return totalFigures;
}
public void setTotalFigures(BigDecimal totalFigures) {
this.totalFigures = totalFigures;
}
}
package com.zehong.system.domain.vo;
import com.zehong.common.annotation.Excel;
import java.math.BigDecimal;
public class DeptTPurchaseStatisticsVo {
@Excel(name = "部门")
private String purchaseDeptName;
@Excel(name = "条数")
private int countNum;
@Excel(name = "报销总额",isStatistics = true)
private BigDecimal totalPurchase;
public String getPurchaseDeptName() {
return purchaseDeptName;
}
public void setPurchaseDeptName(String purchaseDeptName) {
this.purchaseDeptName = purchaseDeptName;
}
public int getCountNum() {
return countNum;
}
public void setCountNum(int countNum) {
this.countNum = countNum;
}
public BigDecimal getTotalPurchase() {
return totalPurchase;
}
public void setTotalPurchase(BigDecimal totalPurchase) {
this.totalPurchase = totalPurchase;
}
}
package com.zehong.system.domain.vo;
import com.zehong.common.annotation.Excel;
import java.math.BigDecimal;
public class DeptTradeExpensesStatisticsVo {
@Excel(name = "部门")
private String tradeDeptName;
@Excel(name = "条数")
private int countNum;
@Excel(name = "交易支出总额",isStatistics = true)
private BigDecimal totalDealPrice;
public String getTradeDeptName() {
return tradeDeptName;
}
public void setTradeDeptName(String tradeDeptName) {
this.tradeDeptName = tradeDeptName;
}
public int getCountNum() {
return countNum;
}
public void setCountNum(int countNum) {
this.countNum = countNum;
}
public BigDecimal getTotalDealPrice() {
return totalDealPrice;
}
public void setTotalDealPrice(BigDecimal totalDealPrice) {
this.totalDealPrice = totalDealPrice;
}
}
package com.zehong.system.domain.vo;
import com.zehong.common.annotation.Excel;
import java.math.BigDecimal;
public class DeptTradeIncomeStatisticsVo {
@Excel(name = "部门")
private String applyDeptName;
@Excel(name = "条数")
private int countNum;
@Excel(name = "交易收入总额",isStatistics = true)
private BigDecimal totalDealPrice;
public String getApplyDeptName() {
return applyDeptName;
}
public void setApplyDeptName(String applyDeptName) {
this.applyDeptName = applyDeptName;
}
public int getCountNum() {
return countNum;
}
public void setCountNum(int countNum) {
this.countNum = countNum;
}
public BigDecimal getTotalDealPrice() {
return totalDealPrice;
}
public void setTotalDealPrice(BigDecimal totalDealPrice) {
this.totalDealPrice = totalDealPrice;
}
}
package com.zehong.system.domain.vo;
import com.zehong.common.annotation.Excel;
import java.math.BigDecimal;
public class HandleTPurchaseStatisticsVo {
@Excel(name = "部门")
private String purchaseDeptName;
@Excel(name = "经办人")
private String handledByUserName;
@Excel(name = "条数")
private int countNum;
@Excel(name = "报销总额",isStatistics = true)
private BigDecimal totalPurchase;
public String getPurchaseDeptName() {
return purchaseDeptName;
}
public void setPurchaseDeptName(String purchaseDeptName) {
this.purchaseDeptName = purchaseDeptName;
}
public String getHandledByUserName() {
return handledByUserName;
}
public void setHandledByUserName(String handledByUserName) {
this.handledByUserName = handledByUserName;
}
public int getCountNum() {
return countNum;
}
public void setCountNum(int countNum) {
this.countNum = countNum;
}
public BigDecimal getTotalPurchase() {
return totalPurchase;
}
public void setTotalPurchase(BigDecimal totalPurchase) {
this.totalPurchase = totalPurchase;
}
}
package com.zehong.system.domain.vo;
import com.zehong.common.annotation.Excel;
import java.math.BigDecimal;
public class PurchaseStatisticsDetailExportVo {
@Excel(name = "部门")
private String purchaseDeptName;
@Excel(name = "经办人")
private String handledByUserName;
@Excel(name = "使用人")
private String userName;
@Excel(name = "名称")
private String purchaseName;
@Excel(name = "用途")
private String applicationDescription;
@Excel(name = "报销总额")
private BigDecimal total;
@Excel(name = "申请时间")
private String createTime;
@Excel(name = "状态", dictType = "purchaseStatus")
private String purchaseStatus;
@Excel(name = "审批人")
private String approvedUserName;
public String getPurchaseDeptName() {
return purchaseDeptName;
}
public void setPurchaseDeptName(String purchaseDeptName) {
this.purchaseDeptName = purchaseDeptName;
}
public String getHandledByUserName() {
return handledByUserName;
}
public void setHandledByUserName(String handledByUserName) {
this.handledByUserName = handledByUserName;
}
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
public String getPurchaseName() {
return purchaseName;
}
public void setPurchaseName(String purchaseName) {
this.purchaseName = purchaseName;
}
public String getApplicationDescription() {
return applicationDescription;
}
public void setApplicationDescription(String applicationDescription) {
this.applicationDescription = applicationDescription;
}
public BigDecimal getTotal() {
return total;
}
public void setTotal(BigDecimal total) {
this.total = total;
}
public String getCreateTime() {
return createTime;
}
public void setCreateTime(String createTime) {
this.createTime = createTime;
}
public String getPurchaseStatus() {
return purchaseStatus;
}
public void setPurchaseStatus(String purchaseStatus) {
this.purchaseStatus = purchaseStatus;
}
public String getApprovedUserName() {
return approvedUserName;
}
public void setApprovedUserName(String approvedUserName) {
this.approvedUserName = approvedUserName;
}
}
package com.zehong.system.domain.vo;
import com.zehong.common.annotation.Excel;
import java.math.BigDecimal;
import java.util.Date;
public class TBorrowingStatisticsDetailExportVo {
@Excel(name = "部门")
private String deptName;
@Excel(name = "使用人")
private String userIdName;
@Excel(name = "费用名称")
private String feeName;
@Excel(name = "借支金额")
private BigDecimal totalFigures;
@Excel(name = "申请时间")
private String registrationDateStr;
private Date registrationDate;
@Excel(name = "状态")
private String approvalStatusType;
private Integer approvalStatus;
@Excel(name = "审批人")
private String approvedUserIdName;
public String getDeptName() {
return deptName;
}
public void setDeptName(String deptName) {
this.deptName = deptName;
}
public String getUserIdName() {
return userIdName;
}
public void setUserIdName(String userIdName) {
this.userIdName = userIdName;
}
public String getFeeName() {
return feeName;
}
public void setFeeName(String feeName) {
this.feeName = feeName;
}
public BigDecimal getTotalFigures() {
return totalFigures;
}
public void setTotalFigures(BigDecimal totalFigures) {
this.totalFigures = totalFigures;
}
public Date getRegistrationDate() {
return registrationDate;
}
public void setRegistrationDate(Date registrationDate) {
this.registrationDate = registrationDate;
}
public Integer getApprovalStatus() {
return approvalStatus;
}
public void setApprovalStatus(Integer approvalStatus) {
this.approvalStatus = approvalStatus;
}
public String getApprovedUserIdName() {
return approvedUserIdName;
}
public void setApprovedUserIdName(String approvedUserIdName) {
this.approvedUserIdName = approvedUserIdName;
}
public String getApprovalStatusType() {
return approvalStatusType;
}
public void setApprovalStatusType(String approvalStatusType) {
this.approvalStatusType = approvalStatusType;
}
public String getRegistrationDateStr() {
return registrationDateStr;
}
public void setRegistrationDateStr(String registrationDateStr) {
this.registrationDateStr = registrationDateStr;
}
}
package com.zehong.system.domain.vo;
import com.zehong.common.annotation.Excel;
import java.math.BigDecimal;
public class TradeExpensesStatisticsDetailExportVo {
@Excel(name = "部门")
private String tradeDeptName;
@Excel(name = "经办人")
private String tradeTransactorName;
@Excel(name = "买方部门")
private String applyDeptName;
@Excel(name = "交易项目")
private String relationTransactionProjectName;
@Excel(name = "交易细项名称")
private String transactionDetailName;
@Excel(name = "申请时间")
private String createTime;
@Excel(name = "项目状态",dictType = "t_transaction_project_status")
private String tradeStatus;
@Excel(name = "交易成交价")
private BigDecimal dealPrice;
public String getTradeDeptName() {
return tradeDeptName;
}
public void setTradeDeptName(String tradeDeptName) {
this.tradeDeptName = tradeDeptName;
}
public String getTradeTransactorName() {
return tradeTransactorName;
}
public void setTradeTransactorName(String tradeTransactorName) {
this.tradeTransactorName = tradeTransactorName;
}
public String getApplyDeptName() {
return applyDeptName;
}
public void setApplyDeptName(String applyDeptName) {
this.applyDeptName = applyDeptName;
}
public String getRelationTransactionProjectName() {
return relationTransactionProjectName;
}
public void setRelationTransactionProjectName(String relationTransactionProjectName) {
this.relationTransactionProjectName = relationTransactionProjectName;
}
public String getTransactionDetailName() {
return transactionDetailName;
}
public void setTransactionDetailName(String transactionDetailName) {
this.transactionDetailName = transactionDetailName;
}
public String getCreateTime() {
return createTime;
}
public void setCreateTime(String createTime) {
this.createTime = createTime;
}
public String getTradeStatus() {
return tradeStatus;
}
public void setTradeStatus(String tradeStatus) {
this.tradeStatus = tradeStatus;
}
public BigDecimal getDealPrice() {
return dealPrice;
}
public void setDealPrice(BigDecimal dealPrice) {
this.dealPrice = dealPrice;
}
}
package com.zehong.system.domain.vo;
import com.zehong.common.annotation.Excel;
import java.math.BigDecimal;
public class TradeIncomeStatisticsDetailExportVo {
@Excel(name = "部门")
private String applyDeptName;
@Excel(name = "经办人")
private String applyName;
@Excel(name = "买方部门")
private String tradeDeptName;
@Excel(name = "交易项目")
private String relationTransactionProjectName;
@Excel(name = "交易细项名称")
private String transactionDetailName;
@Excel(name = "申请时间")
private String createTime;
@Excel(name = "项目状态",dictType = "t_transaction_project_status")
private String tradeStatus;
@Excel(name = "交易成交价")
private BigDecimal dealPrice;
public String getApplyDeptName() {
return applyDeptName;
}
public void setApplyDeptName(String applyDeptName) {
this.applyDeptName = applyDeptName;
}
public String getApplyName() {
return applyName;
}
public void setApplyName(String applyName) {
this.applyName = applyName;
}
public String getTradeDeptName() {
return tradeDeptName;
}
public void setTradeDeptName(String tradeDeptName) {
this.tradeDeptName = tradeDeptName;
}
public String getRelationTransactionProjectName() {
return relationTransactionProjectName;
}
public void setRelationTransactionProjectName(String relationTransactionProjectName) {
this.relationTransactionProjectName = relationTransactionProjectName;
}
public String getTransactionDetailName() {
return transactionDetailName;
}
public void setTransactionDetailName(String transactionDetailName) {
this.transactionDetailName = transactionDetailName;
}
public String getCreateTime() {
return createTime;
}
public void setCreateTime(String createTime) {
this.createTime = createTime;
}
public String getTradeStatus() {
return tradeStatus;
}
public void setTradeStatus(String tradeStatus) {
this.tradeStatus = tradeStatus;
}
public BigDecimal getDealPrice() {
return dealPrice;
}
public void setDealPrice(BigDecimal dealPrice) {
this.dealPrice = dealPrice;
}
}
......@@ -57,7 +57,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
LEFT JOIN sys_user us ON us.user_id = project.apply_id
LEFT JOIN t_transaction_project trProject ON trProject.transaction_project_id = project.relation_transaction_project_id
<where>
<if test="applyName != null">and us.user_name like concat('%', #{applyName}, '%')</if>
<if test="applyName != null">and us.nick_name like concat('%', #{applyName}, '%')</if>
<if test="createBeginTime != null and createEndTime != null">and project.create_time between #{createBeginTime} and #{createEndTime}</if>
<if test="applyDeptId != null">and project.apply_dept_id = #{applyDeptId}</if>
<if test="tradeDeptId != null">and project.trade_dept_id = #{tradeDeptId}</if>
......@@ -89,7 +89,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
LEFT JOIN sys_user us ON us.user_id = project.trade_transactor
LEFT JOIN t_transaction_project trProject ON trProject.transaction_project_id = project.relation_transaction_project_id
<where>
<if test="applyName != null">and us.user_name like concat('%', #{applyName}, '%')</if>
<if test="applyName != null">and us.nick_name like concat('%', #{applyName}, '%')</if>
<if test="createBeginTime != null and createEndTime != null">and project.create_time between #{createBeginTime} and #{createEndTime}</if>
<if test="applyDeptId != null">and project.apply_dept_id = #{applyDeptId}</if>
<if test="tradeDeptId != null">and project.trade_dept_id = #{tradeDeptId}</if>
......@@ -138,8 +138,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="purchaseStatistics" parameterType="com.zehong.system.domain.TPurchase" resultMap="TPurchaseStatisticsMap">
SELECT
dept.dept_name AS purchase_dept_name,
us.nick_name AS handled_by_user_name,
uh.nick_name AS user_name,
uh.nick_name AS handled_by_user_name,
us.nick_name AS user_name,
count(1) AS count_num,
ROUND(IFNULL(sum(pur.total),0),2) AS total_purchase,
pur.purchase_dept_id,
......@@ -150,7 +150,25 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
LEFT JOIN sys_dept dept ON dept.dept_id = pur.purchase_dept_id
LEFT JOIN sys_user us ON us.user_id = pur.user_id
LEFT JOIN sys_user uh ON uh.user_id = pur.handled_by_user_id
GROUP BY pur.purchase_dept_id,pur.user_id,pur.handled_by_user_id
<where>
<if test="purchaseDeptId != null">and pur.purchase_dept_id = #{purchaseDeptId}</if>
<if test="purchaseType != null">and pur.purchase_type = #{purchaseType}</if>
<if test="handledByUserName != null"> and uh.nick_name like concat('%', #{handledByUserName}, '%') </if>
<if test="userName != null"> and us.nick_name like concat('%', #{userName}, '%') </if>
<if test="purchaseName != null">and pur.purchase_name like concat('%', #{purchaseName}, '%')</if>
<if test="applicationDescription != null">and pur.application_description like concat('%', #{applicationDescription}, '%')</if>
<if test="applyBeginTime != null and applyEndTime != null">and pur.create_time between #{applyBeginTime} and #{applyEndTime}</if>
<if test="purchaseStatus != null"> and pur.purchase_status = #{purchaseStatus}</if>
</where>
<if test="sortType != null and sortType == 0">
GROUP BY pur.purchase_dept_id
</if>
<if test="sortType != null and sortType == 1">
GROUP BY pur.purchase_dept_id,pur.handled_by_user_id
</if>
<if test="sortType == null or sortType == 2">
GROUP BY pur.purchase_dept_id,pur.user_id,pur.handled_by_user_id
</if>
</select>
</mapper>
\ No newline at end of file
......@@ -9,6 +9,14 @@ export function listPurchase(query) {
})
}
export function purchaseList(query) {
return request({
url: '/system/purchase/purchaseList',
method: 'get',
params: query
})
}
// 查询外部采购(报销)申请详细
export function getPurchase(purchaseId) {
return request({
......
......@@ -35,3 +35,66 @@ export function purchaseStatistics(query) {
params: query
})
}
//交易项目收入导出
export function tradeIncomeStatisticsExport(query) {
return request({
url: '/statistics/tradeIncomeStatisticsExport',
method: 'get',
params: query
})
}
//交易项目支出导出
export function tradeExpensesStatisticsExport(query) {
return request({
url: '/statistics/tradeExpensesStatisticsExport',
method: 'get',
params: query
})
}
//交易项目详情导出
export function tradeStatisticsDetailExport(query) {
return request({
url: '/statistics/tradeStatisticsDetailExport',
method: 'get',
params: query
})
}
//借支导出
export function borrowingStatisticsExport(query) {
return request({
url: '/statistics/borrowingStatisticsExport',
method: 'get',
params: query
})
}
//借支详情
export function borrowingStatisticsDetailExport(query) {
return request({
url: '/statistics/borrowingStatisticsDetailExport',
method: 'get',
params: query
})
}
//报销统计导出
export function purchaseStatisticsExport(query) {
return request({
url: '/statistics/purchaseStatisticsExport',
method: 'get',
params: query
})
}
//报销详情导出
export function purchaseStatisticsDetailExport(query) {
return request({
url: '/statistics/purchaseStatisticsDetailExport',
method: 'get',
params: query
})
}
......@@ -83,6 +83,17 @@
>
</el-form-item>
</el-form>
<el-button
type="warning"
plain
icon="el-icon-download"
size="mini"
style="margin-bottom: 10px"
@click="handleExport">
导出
</el-button>
<TableList ref="tableList" :param="queryParams"/>
</div>
</template>
......@@ -100,6 +111,7 @@
},
created(){
this.getTreeselect();
this.getCurrentMonthTime();
},
data(){
return{
......@@ -146,6 +158,18 @@
sortChange(){
this.handleQuery();
},
handleExport(){
this.$refs.tableList.borrowingExport();
},
getCurrentMonthTime(){
let now = new Date(); // 获取当前日期时间
let firstDate = new Date(now.getFullYear(), now.getMonth(), 1);
let lastDate = new Date(now.getFullYear(), now.getMonth() + 1, 0, 23, 59, 59);
let firstDateStr = firstDate.toLocaleDateString().replace(/\//g, "-") + " " + firstDate.toTimeString().substr(0, 8);
let lastDateStr = lastDate.toLocaleDateString().replace(/\//g, "-") + " " + lastDate.toTimeString().substr(0, 8);
this.registrationDate = [firstDateStr,lastDateStr];
this.timeChange(this.registrationDate);
}
}
}
</script>
......
<template>
<div class="tableInfo">
<el-table v-loading="loading" :data="borrowingList">
<el-table v-loading="loading" :data="borrowingList" show-summary :summary-method="getSummaries">
<el-table-column label="部门" align="center" prop="borrowingDeptName" />
<el-table-column label="使用人" align="center" prop="userName" v-if="param.sortType != '0'"/>
<el-table-column label="条数" align="center" prop="countNum" >
......@@ -19,6 +19,16 @@
:close-on-click-modal="false"
destroy-on-close
>
<el-button
type="warning"
plain
icon="el-icon-download"
size="mini"
style="margin-bottom: 10px"
@click="handleDetailExport">
导出明细
</el-button>
<el-table v-loading="loading" :data="borrowingDetail">
<el-table-column label="部门" align="center" prop="deptName" :show-overflow-tooltip="true" width="120px"/>
<el-table-column label="使用人" align="center" prop="userIdName"/>
......@@ -54,7 +64,7 @@
</template>
<script>
import { borrowingStatistics } from "@/api/transaction/statistics.js";
import { borrowingStatistics, borrowingStatisticsExport, borrowingStatisticsDetailExport } from "@/api/transaction/statistics.js";
import { borrowingList } from "@/api/system/for";
export default {
name: "table-list",
......@@ -109,7 +119,56 @@
this.borrowingDetail = res.rows;
}
})
},
borrowingExport(){
this.$confirm('是否确认导出借支统计?', "警告", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(() => {
return borrowingStatisticsExport(this.param);
}).then(response => {
this.download(response.msg);
}).catch(() => {});
},
handleDetailExport(){
this.$confirm('是否确认导出借支明细?', "警告", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(() => {
let detailParam = { ...this.detailParam}
detailParam.pageNum = 1;
detailParam.pageSize = 1000;
return borrowingStatisticsDetailExport(detailParam);
}).then(response => {
this.download(response.msg);
}).catch(() => {});
},
getSummaries(param){
const { columns, data } = param;
const sums = [];
columns.forEach((column, index) => {
if (index === 0) {
sums[index] = "合计";
return;
}
const values = data.map((item) => Number(item[column.property]));
if (
column.property === "totalFigures"
) {
sums[index] = values.reduce((prev, curr) => {
const value = Number(curr);
if (!isNaN(value)) {
return prev + curr;
} else {
return prev;
}
}, 0);
sums[index];
}
});
return sums;
}
}
}
......
......@@ -54,6 +54,17 @@
>
</el-form-item>
</el-form>
<el-button
type="warning"
plain
icon="el-icon-download"
size="mini"
style="margin-bottom: 10px"
@click="handleExport">
导出
</el-button>
<TableList ref="tableList" :param="queryParams"/>
</div>
</template>
......@@ -66,6 +77,7 @@
TableList,
},
created(){
this.getCurrentMonthTime();
},
data(){
return{
......@@ -103,6 +115,18 @@
this.queryParams.registrationBeginDate = value[0];
this.queryParams.registrationEndDate = value[1];
}
},
handleExport(){
this.$refs.tableList.borrowingExport();
},
getCurrentMonthTime(){
let now = new Date(); // 获取当前日期时间
let firstDate = new Date(now.getFullYear(), now.getMonth(), 1);
let lastDate = new Date(now.getFullYear(), now.getMonth() + 1, 0, 23, 59, 59);
let firstDateStr = firstDate.toLocaleDateString().replace(/\//g, "-") + " " + firstDate.toTimeString().substr(0, 8);
let lastDateStr = lastDate.toLocaleDateString().replace(/\//g, "-") + " " + lastDate.toTimeString().substr(0, 8);
this.registrationDate = [firstDateStr,lastDateStr];
this.timeChange(this.registrationDate);
}
}
}
......
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" :inline="true">
<el-form-item label="指定分类" prop="sortType">
<el-select v-model="queryParams.sortType" placeholder="请选择分类类型" clearable @change="sortChange">
<el-option label="按部门分类" value="0"/>
<el-option label="按经办人分类" value="1"/>
<el-option label="按使用人分类" value="2"/>
</el-select>
</el-form-item>
<el-form-item label="部门" prop="purchaseDeptId">
<div style="width: 160px">
<treeselect
v-model="queryParams.purchaseDeptId"
:options="deptOptions"
:show-count="true"
placeholder="请选择卖方部门"
/>
</div>
</el-form-item>
<el-form-item label="经办人" prop="handledByUserName">
<el-input
v-model="queryParams.handledByUserName"
placeholder="请输入费用名称"
clearable
size="small"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="使用人" prop="userName">
<el-input
v-model="queryParams.userName"
placeholder="请输入使用人"
clearable
size="small"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="物品名称" prop="purchaseName" v-if="tab == '0'">
<el-input
v-model="queryParams.purchaseName"
placeholder="请输入物品名称"
clearable
size="small"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="费用名称" prop="purchaseName" v-if="'1' == tab">
<el-input
v-model="queryParams.purchaseName"
placeholder="请输入费用名称"
clearable
size="small"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="用途" prop="applicationDescription">
<el-input
v-model="queryParams.applicationDescription"
placeholder="请输入费用名称"
clearable
size="small"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="申请时间">
<el-date-picker
v-model="applyTime"
size="small"
type="datetimerange"
value-format="yyyy-MM-dd HH:mm:ss"
range-separator="至"
start-placeholder="开始日期"
end-placeholder="结束日期"
@change="timeChange"
style="width: 340px"
>
</el-date-picker>
</el-form-item>
<el-form-item label="状态" prop="purchaseStatus">
<el-select v-model="queryParams.purchaseStatus" placeholder="请选择采购状态" clearable size="small">
<el-option
v-for="item in purchaseStatusList"
:key="item.dictValue"
:label="item.dictLabel"
:value="item.dictValue"
/>
</el-select>
</el-form-item>
<el-form-item>
<el-button
type="primary"
icon="el-icon-search"
size="mini"
@click="handleQuery"
>搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery"
>重置</el-button>
</el-form-item>
</el-form>
<el-button
type="warning"
plain
icon="el-icon-download"
size="mini"
style="margin-bottom: 10px"
@click="handleExport">
导出
</el-button>
<el-card class="box-card">
<div class="outer-div">
<header class="header">
<ul class="tab-tilte">
<li :class="{ active: tab == 0 }" @click="changeTab(0)">
物品采购
</li>
<li :class="{ active: tab == 1 }" @click="changeTab(1)">
服务费用
</li>
</ul>
</header>
<div class="tab-content">
<div v-if="tab == 0" :key="tab">
<TableList ref="tableList" :param="this.queryParams"/>
</div>
<div v-if="tab == 1" :key="tab">
<TableList ref="tableList" :param="this.queryParams"/>
</div>
</div>
</div>
</el-card>
</div>
</template>
<script>
import TableList from "../components/TableList";
import { treeselect } from "@/api/system/dept";
import Treeselect from "@riophae/vue-treeselect";
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
export default {
name: "purchase-calculate-index",
components:{
TableList,
Treeselect
},
data(){
return{
queryParams:{
purchaseDeptId: null,
purchaseType: '0',
handledByUserName: null,
userName: null,
purchaseName: null,
applicationDescription: null,
purchaseStatus: null,
applyBeginTime: null,
applyEndTime: null,
sortType: '0'
},
purchaseStatusList: [],
applyTime: [],
tab: 0,
deptOptions: []
}
},
created(){
this.getPurchaseStatusList();
this.getTreeselect();
this.getCurrentMonthTime();
},
methods:{
/** 搜索按钮操作 */
handleQuery() {
this.$refs.tableList.getPurchaseList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.queryParams.applyBeginTime = null;
this.queryParams.applyEndTime = null;
this.applyTime = [];
//this.queryParams.purchaseType = '0';
this.handleQuery();
},
getPurchaseStatusList(){
this.getDicts("purchaseStatus").then((response) => {
this.purchaseStatusList = response.data;
});
},
//时间切换
timeChange(value) {
if (value) {
this.queryParams.applyBeginTime = value[0];
this.queryParams.applyEndTime = value[1];
}
},
changeTab(tabNum){
this.tab = tabNum;
if("0" == tabNum){
this.queryParams.purchaseType = "0";
}else{
this.queryParams.purchaseType = "1";
}
},
sortChange(){
this.handleQuery();
},
getTreeselect() {
treeselect().then((response) => {
this.deptOptions = response.data;
});
},
//导出
handleExport(){
this.$refs.tableList.purchaseExport();
},
getCurrentMonthTime(){
let now = new Date(); // 获取当前日期时间
let firstDate = new Date(now.getFullYear(), now.getMonth(), 1);
let lastDate = new Date(now.getFullYear(), now.getMonth() + 1, 0, 23, 59, 59);
let firstDateStr = firstDate.toLocaleDateString().replace(/\//g, "-") + " " + firstDate.toTimeString().substr(0, 8);
let lastDateStr = lastDate.toLocaleDateString().replace(/\//g, "-") + " " + lastDate.toTimeString().substr(0, 8);
this.applyTime = [firstDateStr,lastDateStr];
this.timeChange(this.applyTime);
}
}
}
</script>
<style scoped lang="scss">
.outer-div {
//padding: 24px;
margin: 0 auto;
}
.header {
height: 47px;
width: 100%;
//border-bottom: 1px solid #ebebeb;
//margin-bottom: 24px;
}
ul li {
margin: 0;
padding: 0;
list-style: none;
}
.tab-tilte {
font-family: PingFangSC-Semibold;
letter-spacing: 0;
width: 90%;
padding-left: 0;
}
.tab-tilte li {
float: left;
font-size: 16px;
color: #999999;
// line-height: 53px;
text-align: center;
margin-right: 30px;
cursor: pointer;
}
/* 点击对应的标题添加对应的背景颜色 */
.tab-tilte .active {
color: #3385ff;
// border-bottom: 2px solid #3385ff;
}
.tab-content{
height: 450px;
overflow-y: auto;
&::-webkit-scrollbar {
/* 设置滚动条宽度 */
width: 4px;
/* 设置滚动条背景色 */
//background: black;
}
//滚动条轨道
&::-webkit-scrollbar-track {
background-color:transparent;
-webkit-border-radius: 2em;
-moz-border-radius: 2em;
border-radius:2em;
}
//滚动条滑块
&::-webkit-scrollbar-thumb {
background-color: rgb(147,147,153,0.5);
-webkit-border-radius: 2em;
-moz-border-radius: 2em;
border-radius:2em;
}
}
</style>
<template>
<div class="tableInfo">
<el-table v-loading="loading" :data="purchaseList" show-summary :summary-method="getSummaries">
<el-table-column label="部门" align="center" prop="purchaseDeptName" />
<el-table-column label="经办人" align="center" prop="handledByUserName" v-if="'1' == param.sortType || '2' == param.sortType || !param.sortType"/>
<el-table-column label="使用人" align="center" prop="userName" v-if="'2' == param.sortType || !param.sortType"/>
<el-table-column label="条数" align="center" prop="countNum" >
<template slot-scope="scope">
<span class="detail" @click="detail(scope.row)">{{scope.row.countNum}}</span>
</template>
</el-table-column>
<el-table-column label="借支总额" align="center" prop="totalPurchase" />
</el-table>
<el-dialog
title="明细信息"
:visible.sync="open"
width="900px"
append-to-body
:close-on-click-modal="false"
destroy-on-close
>
<el-button
type="warning"
plain
icon="el-icon-download"
size="mini"
style="margin-bottom: 10px"
@click="handleDetailExport">
导出明细
</el-button>
<el-table v-loading="loading" :data="purchaseDetail">
<el-table-column label="部门" align="center" prop="purchaseDeptName" :show-overflow-tooltip="true" width="120px"/>
<el-table-column label="经办人" align="center" prop="handledByUserName" :show-overflow-tooltip="true"/>
<el-table-column label="使用人" align="center" prop="userName" :show-overflow-tooltip="true"/>
<el-table-column label="物品名称" align="center" prop="purchaseName" :show-overflow-tooltip="true" v-if="'0' == param.purchaseType"/>
<el-table-column label="费用名称" align="center" prop="purchaseName" :show-overflow-tooltip="true" v-if="'1' == param.purchaseType"/>
<el-table-column label="用途" align="center" prop="applicationDescription" :show-overflow-tooltip="true"/>
<el-table-column label="报销金额" align="center" prop="total" :show-overflow-tooltip="true"/>
<el-table-column label="申请时间" align="center" prop="createTime" :show-overflow-tooltip="true"/>
<el-table-column label="状态" align="center" prop="purchaseStatus" :formatter="getPurchaseStatus" :show-overflow-tooltip="true"/>
<el-table-column label="审批人" align="center" prop="approvedUserName">
<template slot-scope="scope">
<span v-if="scope.row.approvedUserName == null">-</span>
<span v-else>{{scope.row.approvedUserName}}</span>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total > 0"
:total="total"
:page.sync="detailParam.pageNum"
:limit.sync="detailParam.pageSize"
@pagination="getPurchaseList"
/>
</el-dialog>
</div>
</template>
<script>
import { purchaseStatistics, purchaseStatisticsExport, purchaseStatisticsDetailExport } from "@/api/transaction/statistics.js";
import { purchaseList } from "@/api/transaction/purchase";
export default {
name: "table-list",
props:{
param:{
type: Object
}
},
data(){
return{
purchaseList: [],
loading: false,
detailParam:{
pageNum: 1,
pageSize: 10,
},
open: false,
total: 0,
purchaseDetail: []
}
},
created(){
this.getPurchaseList();
},
methods:{
getPurchaseList(){
this.loading = true;
purchaseStatistics(this.param).then(res =>{
if(res.code == 200){
this.loading = false;
this.purchaseList = res.data;
}
})
},
detail(row){
this.detailParam = { ...this.param };
this.detailParam.purchaseDeptId = row.purchaseDeptId;
if(this.param.sortType != '0'){
this.detailParam.handledByUserId = row.handledByUserId;
this.detailParam.userId = row.userId;
}
this.detailParam.pageNum = 1;
this.detailParam.pageSize = 10;
this.open = true;
this.detailPurchaseList();
},
detailPurchaseList(){
this.loading = true;
purchaseList(this.detailParam).then(res =>{
if(res.code == 200){
this.loading = false;
this.total = res.total;
this.purchaseDetail = res.rows;
}
})
},
//获取交易状态
getPurchaseStatus(row) {
return this.selectDictLabel(
this.$parent.$parent.purchaseStatusList,
row.purchaseStatus
);
},
purchaseExport(){
this.$confirm('是否确认导出报销统计?', "警告", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(() => {
return purchaseStatisticsExport(this.param);
}).then(response => {
this.download(response.msg);
}).catch(() => {});
},
handleDetailExport(){
this.$confirm('是否确认导出报销明细?', "警告", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(() => {
let detailParam = { ...this.detailParam}
detailParam.pageNum = 1;
detailParam.pageSize = 1000;
return purchaseStatisticsDetailExport(detailParam);
}).then(response => {
this.download(response.msg);
}).catch(() => {});
},
getSummaries(param){
const { columns, data } = param;
const sums = [];
columns.forEach((column, index) => {
if (index === 0) {
sums[index] = "合计";
return;
}
const values = data.map((item) => Number(item[column.property]));
if (
column.property === "totalPurchase"
) {
sums[index] = values.reduce((prev, curr) => {
const value = Number(curr);
if (!isNaN(value)) {
return prev + curr;
} else {
return prev;
}
}, 0);
sums[index];
}
});
return sums;
}
}
}
</script>
<style scoped lang="scss">
.tableInfo{
height: 450px;
overflow-y: auto;
&::-webkit-scrollbar {
/* 设置滚动条宽度 */
width: 4px;
/* 设置滚动条背景色 */
//background: black;
}
//滚动条轨道
&::-webkit-scrollbar-track {
background-color:transparent;
-webkit-border-radius: 2em;
-moz-border-radius: 2em;
border-radius:2em;
}
//滚动条滑块
&::-webkit-scrollbar-thumb {
background-color: rgb(147,147,153,0.5);
-webkit-border-radius: 2em;
-moz-border-radius: 2em;
border-radius:2em;
}
}
.detail{
text-decoration: underline;
color: blue;
cursor:pointer;
}
</style>
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" :inline="true">
<el-form-item label="经办人" prop="handledByUserName">
<el-input
v-model="queryParams.handledByUserName"
placeholder="请输入费用名称"
clearable
size="small"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="使用人" prop="userName">
<el-input
v-model="queryParams.userName"
placeholder="请输入使用人"
clearable
size="small"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="物品名称" prop="purchaseName" v-if="tab == '0'">
<el-input
v-model="queryParams.purchaseName"
placeholder="请输入物品名称"
clearable
size="small"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="费用名称" prop="purchaseName" v-if="'1' == tab">
<el-input
v-model="queryParams.purchaseName"
placeholder="请输入费用名称"
clearable
size="small"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="用途" prop="applicationDescription">
<el-input
v-model="queryParams.applicationDescription"
placeholder="请输入费用名称"
clearable
size="small"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="申请时间">
<el-date-picker
v-model="applyTime"
size="small"
type="datetimerange"
value-format="yyyy-MM-dd HH:mm:ss"
range-separator="至"
start-placeholder="开始日期"
end-placeholder="结束日期"
@change="timeChange"
style="width: 340px"
>
</el-date-picker>
</el-form-item>
<el-form-item label="状态" prop="purchaseStatus">
<el-select v-model="queryParams.purchaseStatus" placeholder="请选择采购状态" clearable size="small">
<el-option
v-for="item in purchaseStatusList"
:key="item.dictValue"
:label="item.dictLabel"
:value="item.dictValue"
/>
</el-select>
</el-form-item>
<el-form-item>
<el-button
type="primary"
icon="el-icon-search"
size="mini"
@click="handleQuery"
>搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery"
>重置</el-button>
</el-form-item>
</el-form>
<el-button
type="warning"
plain
icon="el-icon-download"
size="mini"
style="margin-bottom: 10px"
@click="handleExport">
导出
</el-button>
<el-card class="box-card">
<div class="outer-div">
<header class="header">
<ul class="tab-tilte">
<li :class="{ active: tab == 0 }" @click="changeTab(0)">
物品采购
</li>
<li :class="{ active: tab == 1 }" @click="changeTab(1)">
服务费用
</li>
</ul>
</header>
<div class="tab-content">
<div v-if="tab == 0" :key="tab">
<TableList ref="tableList" :param="this.queryParams"/>
</div>
<div v-if="tab == 1" :key="tab">
<TableList ref="tableList" :param="this.queryParams"/>
</div>
</div>
</div>
</el-card>
</div>
</template>
<script>
import TableList from "./components/TableList";
export default {
name: "purchase-index",
components:{
TableList
},
data(){
return{
queryParams:{
purchaseDeptId: this.$store.state.user.deptId,
purchaseType: '0',
handledByUserName: null,
userName: null,
purchaseName: null,
applicationDescription: null,
purchaseStatus: null,
applyBeginTime: null,
applyEndTime: null
},
purchaseStatusList: [],
applyTime: [],
tab: 0
}
},
created(){
this.getPurchaseStatusList();
this.getCurrentMonthTime();
},
methods:{
/** 搜索按钮操作 */
handleQuery() {
this.$refs.tableList.getPurchaseList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.queryParams.applyBeginTime = null;
this.queryParams.applyEndTime = null;
this.applyTime = [];
//this.queryParams.purchaseType = '0';
this.handleQuery();
},
getPurchaseStatusList(){
this.getDicts("purchaseStatus").then((response) => {
this.purchaseStatusList = response.data;
});
},
//时间切换
timeChange(value) {
if (value) {
this.queryParams.applyBeginTime = value[0];
this.queryParams.applyEndTime = value[1];
}
},
changeTab(tabNum){
this.tab = tabNum;
if("0" == tabNum){
this.queryParams.purchaseType = "0";
}else{
this.queryParams.purchaseType = "1";
}
},
//导出
handleExport(){
this.$refs.tableList.purchaseExport();
},
getCurrentMonthTime(){
let now = new Date(); // 获取当前日期时间
let firstDate = new Date(now.getFullYear(), now.getMonth(), 1);
let lastDate = new Date(now.getFullYear(), now.getMonth() + 1, 0, 23, 59, 59);
let firstDateStr = firstDate.toLocaleDateString().replace(/\//g, "-") + " " + firstDate.toTimeString().substr(0, 8);
let lastDateStr = lastDate.toLocaleDateString().replace(/\//g, "-") + " " + lastDate.toTimeString().substr(0, 8);
this.applyTime = [firstDateStr,lastDateStr];
this.timeChange(this.applyTime);
}
}
}
</script>
<style scoped lang="scss">
.outer-div {
//padding: 24px;
margin: 0 auto;
}
.header {
height: 47px;
width: 100%;
//border-bottom: 1px solid #ebebeb;
//margin-bottom: 24px;
}
ul li {
margin: 0;
padding: 0;
list-style: none;
}
.tab-tilte {
font-family: PingFangSC-Semibold;
letter-spacing: 0;
width: 90%;
padding-left: 0;
}
.tab-tilte li {
float: left;
font-size: 16px;
color: #999999;
// line-height: 53px;
text-align: center;
margin-right: 30px;
cursor: pointer;
}
/* 点击对应的标题添加对应的背景颜色 */
.tab-tilte .active {
color: #3385ff;
// border-bottom: 2px solid #3385ff;
}
.tab-content{
height: 450px;
overflow-y: auto;
&::-webkit-scrollbar {
/* 设置滚动条宽度 */
width: 4px;
/* 设置滚动条背景色 */
//background: black;
}
//滚动条轨道
&::-webkit-scrollbar-track {
background-color:transparent;
-webkit-border-radius: 2em;
-moz-border-radius: 2em;
border-radius:2em;
}
//滚动条滑块
&::-webkit-scrollbar-thumb {
background-color: rgb(147,147,153,0.5);
-webkit-border-radius: 2em;
-moz-border-radius: 2em;
border-radius:2em;
}
}
</style>
......@@ -101,6 +101,17 @@
</el-form-item>
</el-form>
<el-button
type="warning"
plain
icon="el-icon-download"
size="mini"
style="margin-bottom: 10px"
@click="handleExport">
导出
</el-button>
<el-card class="box-card">
<div class="outer-div">
<header class="header">
......@@ -168,6 +179,7 @@
this.getDicts("t_transaction_project_status").then((response) => {
this.transactionProjectStatus = response.data;
});
this.getCurrentMonthTime();
},
methods:{
changeTab(tabNum){
......@@ -207,6 +219,24 @@
this.queryParams.createBeginTime = value[0];
this.queryParams.createEndTime = value[1];
}
},
//导出
handleExport(){
if('0' == this.tab){
this.$refs.income.incomeExport();
}
if('1' == this.tab){
this.$refs.expenses.expensesExport();
}
},
getCurrentMonthTime(){
let now = new Date(); // 获取当前日期时间
let firstDate = new Date(now.getFullYear(), now.getMonth(), 1);
let lastDate = new Date(now.getFullYear(), now.getMonth() + 1, 0, 23, 59, 59);
let firstDateStr = firstDate.toLocaleDateString().replace(/\//g, "-") + " " + firstDate.toTimeString().substr(0, 8);
let lastDateStr = lastDate.toLocaleDateString().replace(/\//g, "-") + " " + lastDate.toTimeString().substr(0, 8);
this.applyTime = [firstDateStr,lastDateStr];
this.timeChange(this.applyTime);
}
}
}
......
<template>
<div class="expenses">
<el-table v-loading="loading" :data="projectList">
<el-table v-loading="loading" :data="projectList" show-summary :summary-method="getSummaries">
<el-table-column label="部门" align="center" prop="tradeDeptName" />
<el-table-column label="经办人" align="center" prop="tradeTransactorName" v-if="param.sortType != '0'"/>
<el-table-column label="条数" align="center" prop="countNum">
......@@ -19,6 +19,15 @@
:close-on-click-modal="false"
destroy-on-close
>
<el-button
type="warning"
plain
icon="el-icon-download"
size="mini"
style="margin-bottom: 10px"
@click="handleDetailExport">
导出明细
</el-button>
<el-table v-loading="loading" :data="projectDetail">
<el-table-column label="部门" align="center" prop="tradeDeptName" :show-overflow-tooltip="true" width="120px"/>
......@@ -47,7 +56,7 @@
</template>
<script>
import { tradeExpensesStatistics } from "@/api/transaction/statistics.js";
import { tradeExpensesStatistics, tradeExpensesStatisticsExport, tradeStatisticsDetailExport } from "@/api/transaction/statistics.js";
import { listProject } from "@/api/transaction/tradeProject.js";
export default {
name: "expenses-table-list",
......@@ -110,6 +119,56 @@
row.tradeStatus
);
},
expensesExport(){
this.$confirm('是否确认导出交易项目支出统计?', "警告", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(() => {
return tradeExpensesStatisticsExport(this.param);
}).then(response => {
this.download(response.msg);
}).catch(() => {});
},
handleDetailExport(){
this.$confirm('是否确认导出交易项目支出明细?', "警告", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(() => {
let detailParam = { ...this.detailParam}
detailParam.pageNum = 1;
detailParam.pageSize = 1000;
return tradeStatisticsDetailExport(detailParam);
}).then(response => {
this.download(response.msg);
}).catch(() => {});
},
getSummaries(param){
const { columns, data } = param;
const sums = [];
columns.forEach((column, index) => {
if (index === 0) {
sums[index] = "合计";
return;
}
const values = data.map((item) => Number(item[column.property]));
if (
column.property === "totalDealPrice"
) {
sums[index] = values.reduce((prev, curr) => {
const value = Number(curr);
if (!isNaN(value)) {
return prev + curr;
} else {
return prev;
}
}, 0);
sums[index];
}
});
return sums;
}
}
}
</script>
......
<template>
<div>
<el-table v-loading="loading" :data="projectList">
<el-table v-loading="loading" :data="projectList" show-summary :summary-method="getSummaries">
<el-table-column label="部门" align="center" prop="applyDeptName" />
<el-table-column label="经办人" align="center" prop="applyName" v-if="param.sortType != '0'"/>
<el-table-column label="条数" align="center" prop="countNum">
......@@ -19,6 +19,15 @@
:close-on-click-modal="false"
destroy-on-close
>
<el-button
type="warning"
plain
icon="el-icon-download"
size="mini"
style="margin-bottom: 10px"
@click="handleDetailExport">
导出明细
</el-button>
<el-table v-loading="loading" :data="projectDetail">
<el-table-column label="部门" align="center" prop="applyDeptName" :show-overflow-tooltip="true" width="120px"/>
......@@ -48,7 +57,7 @@
</template>
<script>
import { tradeIncomeStatistics } from "@/api/transaction/statistics.js";
import { tradeIncomeStatistics, tradeIncomeStatisticsExport, tradeStatisticsDetailExport } from "@/api/transaction/statistics.js";
import { listProject } from "@/api/transaction/tradeProject.js";
export default {
name: "income-table-list",
......@@ -111,6 +120,56 @@
row.tradeStatus
);
},
incomeExport(){
this.$confirm('是否确认导出交易项目收入统计?', "警告", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(() => {
return tradeIncomeStatisticsExport(this.param);
}).then(response => {
this.download(response.msg);
}).catch(() => {});
},
handleDetailExport(){
this.$confirm('是否确认导出交易项目收入明细?', "警告", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(() => {
let detailParam = { ...this.detailParam}
detailParam.pageNum = 1;
detailParam.pageSize = 1000;
return tradeStatisticsDetailExport(detailParam);
}).then(response => {
this.download(response.msg);
}).catch(() => {});
},
getSummaries(param){
const { columns, data } = param;
const sums = [];
columns.forEach((column, index) => {
if (index === 0) {
sums[index] = "合计";
return;
}
const values = data.map((item) => Number(item[column.property]));
if (
column.property === "totalDealPrice"
) {
sums[index] = values.reduce((prev, curr) => {
const value = Number(curr);
if (!isNaN(value)) {
return prev + curr;
} else {
return prev;
}
}, 0);
sums[index];
}
});
return sums;
}
}
}
</script>
......
......@@ -92,6 +92,17 @@
</el-form-item>
</el-form>
<el-button
type="warning"
plain
icon="el-icon-download"
size="mini"
style="margin-bottom: 10px"
@click="handleExport">
导出
</el-button>
<el-card class="box-card">
<div class="outer-div">
<header class="header">
......@@ -158,6 +169,7 @@
this.getDicts("t_transaction_project_status").then((response) => {
this.transactionProjectStatus = response.data;
});
this.getCurrentMonthTime();
},
methods:{
changeTab(tabNum){
......@@ -201,6 +213,24 @@
this.queryParams.createBeginTime = value[0];
this.queryParams.createEndTime = value[1];
}
},
//导出
handleExport(){
if('0' == this.tab){
this.$refs.income.incomeExport();
}
if('1' == this.tab){
this.$refs.expenses.expensesExport();
}
},
getCurrentMonthTime(){
let now = new Date(); // 获取当前日期时间
let firstDate = new Date(now.getFullYear(), now.getMonth(), 1);
let lastDate = new Date(now.getFullYear(), now.getMonth() + 1, 0, 23, 59, 59);
let firstDateStr = firstDate.toLocaleDateString().replace(/\//g, "-") + " " + firstDate.toTimeString().substr(0, 8);
let lastDateStr = lastDate.toLocaleDateString().replace(/\//g, "-") + " " + lastDate.toTimeString().substr(0, 8);
this.applyTime = [firstDateStr,lastDateStr];
this.timeChange(this.applyTime);
}
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment