添加报表模块
parent
2332440e81
commit
121b97b5ce
@ -0,0 +1,58 @@
|
||||
import request from '@/plugin/axios'
|
||||
|
||||
// 申请单报表
|
||||
export function applyReportApi(query) {
|
||||
return request({
|
||||
url: 'bs/expense-apply/getreport',
|
||||
method: 'get',
|
||||
params: query,
|
||||
})
|
||||
}
|
||||
// 申请单报表
|
||||
export function claimReportApi(query) {
|
||||
return request({
|
||||
url: 'bs/expense-claim/getreport',
|
||||
method: 'get',
|
||||
params: query,
|
||||
})
|
||||
}
|
||||
|
||||
// 报表
|
||||
export function gatherMsgApi(query) {
|
||||
return request({
|
||||
url: 'bs/statement/gathering ',
|
||||
method: 'get',
|
||||
})
|
||||
}
|
||||
|
||||
// 申请单报表
|
||||
export function paymentMsgApi(query) {
|
||||
return request({
|
||||
url: 'bs/statement/payment',
|
||||
method: 'get',
|
||||
})
|
||||
}
|
||||
|
||||
// 付款饼图
|
||||
export function paymentPieApi(query) {
|
||||
return request({
|
||||
url: '/bs/statement/paymentPie',
|
||||
method: 'get',
|
||||
})
|
||||
}
|
||||
// 收款饼图
|
||||
export function gatheringPieApi(query) {
|
||||
return request({
|
||||
url: '/bs/statement/gatheringPie',
|
||||
method: 'get',
|
||||
})
|
||||
}
|
||||
|
||||
// 供应商柱状图
|
||||
export function paymentColumnarApi(query) {
|
||||
return request({
|
||||
url: '/bs/statement/paymentColumnar',
|
||||
method: 'get',
|
||||
})
|
||||
}
|
||||
|
@ -0,0 +1,14 @@
|
||||
import layoutHome from '../../layout/index.vue'
|
||||
|
||||
const meta = { requiresAuth: true }
|
||||
|
||||
export default {
|
||||
path: '/reportForms',
|
||||
name: 'reportForms',
|
||||
meta,
|
||||
redirect: { name: 'reportForms' },
|
||||
component: layoutHome,
|
||||
children: (pre => [
|
||||
{ path: '/myReportForms', name: `${pre}myReportForms`, component: () => import('@/views/reportForms/myReportForms'), meta: { cache: true, title: '我的报表' } },
|
||||
])('reportForms-')
|
||||
}
|
@ -0,0 +1,126 @@
|
||||
<template>
|
||||
<div :class="className" :style="{ height: height, width: width }" />
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import * as echarts from "echarts";
|
||||
require("echarts/theme/macarons"); // echarts theme
|
||||
// import resize from '../mixins/resize'
|
||||
|
||||
export default {
|
||||
// mixins: [resize],
|
||||
props: {
|
||||
className: {
|
||||
type: String,
|
||||
default: "chart",
|
||||
},
|
||||
width: {
|
||||
type: String,
|
||||
default: "100%",
|
||||
},
|
||||
height: {
|
||||
type: String,
|
||||
default: "350px",
|
||||
},
|
||||
autoResize: {
|
||||
type: Boolean,
|
||||
default: true,
|
||||
},
|
||||
chartData: {
|
||||
type: Object,
|
||||
required: true,
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
chart: null,
|
||||
};
|
||||
},
|
||||
watch: {
|
||||
chartData: {
|
||||
deep: true,
|
||||
handler(val) {
|
||||
this.setOptions(val);
|
||||
},
|
||||
},
|
||||
},
|
||||
mounted() {
|
||||
this.$nextTick(() => {
|
||||
this.initChart();
|
||||
});
|
||||
},
|
||||
beforeDestroy() {
|
||||
if (!this.chart) {
|
||||
return;
|
||||
}
|
||||
this.chart.dispose();
|
||||
this.chart = null;
|
||||
},
|
||||
methods: {
|
||||
initChart() {
|
||||
this.chart = echarts.init(this.$el, "macarons");
|
||||
this.setOptions(this.chartData);
|
||||
},
|
||||
setOptions({ amountDataList } = {}) {
|
||||
let newAmountDataList = amountDataList || [];
|
||||
let xArr = [];
|
||||
newAmountDataList.forEach((element) => {
|
||||
xArr.push(element.date);
|
||||
});
|
||||
let yArr = [];
|
||||
newAmountDataList.forEach((element) => {
|
||||
yArr.push(element.num);
|
||||
});
|
||||
this.chart.setOption({
|
||||
tooltip: {
|
||||
trigger: "axis",
|
||||
axisPointer: {
|
||||
type: "shadow",
|
||||
},
|
||||
},
|
||||
grid: {
|
||||
left: "3%",
|
||||
right: "4%",
|
||||
bottom: "3%",
|
||||
containLabel: true,
|
||||
},
|
||||
xAxis: [
|
||||
{
|
||||
type: "category",
|
||||
data: xArr,
|
||||
axisTick: {
|
||||
alignWithLabel: true,
|
||||
},
|
||||
axisLine: {
|
||||
//这是x轴文字颜色
|
||||
lineStyle: {
|
||||
color: "#333",
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
yAxis: [
|
||||
{
|
||||
type: "value",
|
||||
axisLine: {
|
||||
//这是y轴文字颜色
|
||||
lineStyle: {
|
||||
color: "#333",
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
series: [
|
||||
{
|
||||
color: "#4E98FF",
|
||||
name: "CNY",
|
||||
type: "bar",
|
||||
barWidth: "30%",
|
||||
data: yArr,
|
||||
},
|
||||
],
|
||||
});
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
@ -0,0 +1,273 @@
|
||||
<template>
|
||||
<div class="common-list-contain">
|
||||
<div class="common-form">
|
||||
<van-form
|
||||
ref="queryParams"
|
||||
:show-error-message="false"
|
||||
validate-trigger=""
|
||||
:submit-on-enter="false"
|
||||
label-width="8rem"
|
||||
>
|
||||
<div class="section"><span class="line"> </span> 查询条件</div>
|
||||
<div class="trips-box">
|
||||
<div class="item-box">
|
||||
<RePick
|
||||
v-model="bblx"
|
||||
titleKey="label"
|
||||
idKey="value"
|
||||
label="报表类型"
|
||||
:list="option1"
|
||||
isRequrie
|
||||
isCell
|
||||
clearable
|
||||
/>
|
||||
<RePick
|
||||
v-model="ssdlx"
|
||||
titleKey="label"
|
||||
idKey="value"
|
||||
label="申请单类型"
|
||||
:list="option2"
|
||||
isRequrie
|
||||
isCell
|
||||
clearable
|
||||
/>
|
||||
<van-field
|
||||
:value="queryParams.createTime"
|
||||
label="日期"
|
||||
placeholder="请选择"
|
||||
@click="handleDateShow"
|
||||
:right-icon="queryParams.createTime ? '' : 'arrow'"
|
||||
input-align="right"
|
||||
autosize
|
||||
rows="1"
|
||||
type="textarea"
|
||||
>
|
||||
<template v-if="queryParams.createTime" #button>
|
||||
<van-icon
|
||||
name="clear"
|
||||
color="#C8C9CC"
|
||||
size="16"
|
||||
@click.stop="handleClear"
|
||||
/>
|
||||
</template>
|
||||
</van-field>
|
||||
<div style="display: flex; justify-content: center">
|
||||
<van-button
|
||||
style="margin-right: 30px"
|
||||
@click="handleConfirm"
|
||||
type="primary"
|
||||
size="normal"
|
||||
>搜索</van-button
|
||||
>
|
||||
<van-button @click="handleDateReset">重置</van-button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</van-form>
|
||||
</div>
|
||||
|
||||
<!-- 费用统计 -->
|
||||
<van-cell-group style="margin-top: 20px">
|
||||
<van-cell title="费用统计" />
|
||||
<div class="account-box">
|
||||
<div class="item-box" v-for="(item, index) in accountList" :key="index">
|
||||
<div class="box-tt">
|
||||
<div>
|
||||
<span>{{ item.tt }}</span>
|
||||
</div>
|
||||
<div>
|
||||
CNY <span class="fw600">{{ item.m }}</span>
|
||||
</div>
|
||||
<div>
|
||||
单据 <span class="fw600">{{ item.num }}</span> 笔
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</van-cell-group>
|
||||
|
||||
<van-cell-group style="margin-top: 20px">
|
||||
<van-cell title="金额按月统计" />
|
||||
<LineChart :chartData="chartData" />
|
||||
</van-cell-group>
|
||||
|
||||
<van-cell-group style="margin-top: 20px">
|
||||
<van-cell title="按费用类型统计" />
|
||||
<RoundChart :chartData="chartData" />
|
||||
</van-cell-group>
|
||||
|
||||
<!--行程时间范围选择 -->
|
||||
<van-calendar
|
||||
ref="vanCalendar"
|
||||
allow-same-day
|
||||
:maxDate="maxDate"
|
||||
v-model="dateShow"
|
||||
:min-date="minDate"
|
||||
:default-date="defaultDate"
|
||||
type="range"
|
||||
color="#0088FE"
|
||||
@confirm="handleDateSelect"
|
||||
/>
|
||||
|
||||
<div class="common-bottom-btns" style="bottom: 6rem">
|
||||
<div class="common-bottom-btn" @click="handleBack">
|
||||
<img src="@/assets/images/icons/home.png" alt="" />
|
||||
<span>返回首页</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import dayjs from "dayjs";
|
||||
import { applyReportApi, claimReportApi } from "@/api/bs/chart";
|
||||
export default {
|
||||
components: {
|
||||
RePick: () => import("@/components/ReComponents/RePick"),
|
||||
RoundChart: () => import("./components/RoundChart"),
|
||||
LineChart: () => import("./components/LineChart"),
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
// 报表类型
|
||||
option1: [
|
||||
{
|
||||
value: "SQ",
|
||||
label: "申请单",
|
||||
},
|
||||
{
|
||||
value: "BX",
|
||||
label: "费用单",
|
||||
},
|
||||
],
|
||||
// 申请单类型
|
||||
option2: [
|
||||
{
|
||||
value: "RC",
|
||||
label: "日常",
|
||||
},
|
||||
{
|
||||
value: "CL",
|
||||
label: "差旅",
|
||||
},
|
||||
],
|
||||
// 查询参数
|
||||
bblx: "SQ",
|
||||
ssdlx: "RC",
|
||||
queryParams: {
|
||||
billType: "RCSQ",
|
||||
createTime: "",
|
||||
startDate: null,
|
||||
endDate: null,
|
||||
},
|
||||
minDate: new Date("2000/01/01"),
|
||||
maxDate: new Date("2030/01/01"),
|
||||
defaultDate: new Date(),
|
||||
dateShow: false,
|
||||
// 费用统计
|
||||
accountList: [
|
||||
{
|
||||
m: 747.8,
|
||||
num: 2,
|
||||
tt: "合计",
|
||||
},
|
||||
{
|
||||
tt: "流程中",
|
||||
m: 747.8,
|
||||
num: 2,
|
||||
},
|
||||
],
|
||||
chartData: {},
|
||||
};
|
||||
},
|
||||
watch: {
|
||||
ssdlx: {
|
||||
handler(val) {
|
||||
this.queryParams.billType = val + this.bblx;
|
||||
},
|
||||
immediate: true,
|
||||
},
|
||||
bblx: {
|
||||
handler(val) {
|
||||
this.queryParams.billType = this.ssdlx + val;
|
||||
},
|
||||
immediate: true,
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
// 转换日期
|
||||
handleDateShow(obj) {
|
||||
const { startTime, endTime } = obj;
|
||||
this.$nextTick(() => {
|
||||
this.$refs.vanCalendar && this.$refs.vanCalendar.reset();
|
||||
this.dateShow = true;
|
||||
if (startTime && endTime) {
|
||||
this.defaultDate = [
|
||||
dayjs(startTime).toDate(),
|
||||
dayjs(endTime).toDate(),
|
||||
];
|
||||
}
|
||||
});
|
||||
},
|
||||
// 清除搜索日期
|
||||
handleClear() {
|
||||
this.queryParams.startDate = "";
|
||||
this.queryParams.endDate = "";
|
||||
},
|
||||
// 选择日期
|
||||
handleDateSelect(list) {
|
||||
this.queryParams.startDate = dayjs(list[0]).format("YY/MM/DD");
|
||||
this.queryParams.endDate = dayjs(list[1]).format("YY/MM/DD");
|
||||
this.queryParams.createTime = `${dayjs(list[0]).format(
|
||||
"YY/MM/DD"
|
||||
)}~${dayjs(list[1]).format("YY/MM/DD")}`;
|
||||
this.dateShow = false;
|
||||
},
|
||||
// 搜索
|
||||
handleConfirm() {
|
||||
let api = this.bblx == "SQ" ? applyReportApi : claimReportApi;
|
||||
const { billType, startDate, endDate } = this.queryParams;
|
||||
api({
|
||||
billType,
|
||||
startDate: startDate || null,
|
||||
endDate: endDate || null,
|
||||
}).then((res) => {
|
||||
this.chartData = res.data || {};
|
||||
this.accountList[0].m = this.chartData.totalAmount;
|
||||
this.accountList[0].num = this.chartData.totalCount;
|
||||
this.accountList[1].m = this.chartData.processAmount;
|
||||
this.accountList[1].num = this.chartData.processCount;
|
||||
});
|
||||
},
|
||||
// 重置搜索
|
||||
handleDateReset() {
|
||||
this.queryParams = {
|
||||
billType: "RCSQ",
|
||||
createTime: "",
|
||||
startDate: null,
|
||||
endDate: null,
|
||||
};
|
||||
this.handleConfirm();
|
||||
},
|
||||
handleBack() {
|
||||
history.back();
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
@import "~@/assets/style/common/form.scss";
|
||||
/* .account-box {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
} */
|
||||
.box-tt {
|
||||
padding: 10px 30px;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
.fw600 {
|
||||
font-weight: 600;
|
||||
}
|
||||
}
|
||||
</style>
|
Loading…
Reference in New Issue