加入报表功能

This commit is contained in:
Your Name 2023-09-09 16:03:12 +08:00
parent ebb791c4f8
commit 95e1662701
10 changed files with 548 additions and 34 deletions

View File

@ -62,38 +62,7 @@ export function loadCategoryMenus(_that, _data) {
reslove(_data);
return;
}
reslove(_data[0].childs);
// let _menus = _data[0].childs;
// _menus = _menus.sort(function(a, b) {
// return a.seq - b.seq;
// });
// let _tempMenuData = {};
// let _menuPage = [];
// let _curMenu = {};
// for (let _menuIndex = 0; _menuIndex < _menus.length; _menuIndex++) {
// _curMenu = _menus[_menuIndex];
// if (_curMenu.isShow != 'Y') {
// continue;
// }
// _menuPage.push({
// name: _curMenu.name,
// src: _curMenu.description,
// href: _curMenu.href
// });
// if ((_menuIndex + 1) % 8 == 0 && _menuIndex != 0) {
// _tempMenuData[_menuIndex] = _menuPage;
// _menuPage = [];
// }
// }
// if (_menuPage.length > 0) {
// _tempMenuData[_menus.length] = _menuPage;
// }
// console.log('_tempMenuData', _tempMenuData)
// reslove(_tempMenuData);
reslove(_data);
},
fail: function(e) {
wx.showToast({

91
api/report/feeReport.js Normal file
View File

@ -0,0 +1,91 @@
/**
* 查询首页 目录
*/
/**
* 查询数据统计
* @param {Object} _that
* @param {Object} _data
*/
export function queryFeeDataReport(_that, _data) {
return new Promise(function(reslove, reject) {
_that.context.get({
url: _that.url.queryFeeDataReport,
data: _data, //动态数据
success: function(res) {
let _data = res.data;
reslove(_data);
},
fail: function(e) {
wx.showToast({
title: "服务器异常了",
icon: 'none',
duration: 2000
})
}
});
})
}
export function queryOrderDataReport(_that, _data) {
return new Promise(function(reslove, reject) {
_that.context.get({
url: _that.url.queryOrderDataReport,
data: _data, //动态数据
success: function(res) {
let _data = res.data;
reslove(_data);
},
fail: function(e) {
wx.showToast({
title: "服务器异常了",
icon: 'none',
duration: 2000
})
}
});
})
}
export function queryInoutDataReport(_that, _data) {
return new Promise(function(reslove, reject) {
_that.context.get({
url: _that.url.queryInoutDataReport,
data: _data, //动态数据
success: function(res) {
let _data = res.data;
reslove(_data);
},
fail: function(e) {
wx.showToast({
title: "服务器异常了",
icon: 'none',
duration: 2000
})
}
});
})
}
export function queryOthersDataReport(_that, _data) {
return new Promise(function(reslove, reject) {
_that.context.get({
url: _that.url.queryOthersDataReport,
data: _data, //动态数据
success: function(res) {
let _data = res.data;
reslove(_data);
},
fail: function(e) {
wx.showToast({
title: "服务器异常了",
icon: 'none',
duration: 2000
})
}
});
})
}

View File

@ -0,0 +1,80 @@
<template>
<view>
<view class="index-undo">
<view class="undo-title">
<text class="text-bold">费用类</text>
</view>
<view class="undo-menu flex justify-start flex-wrap">
<view class="menu-item" v-for="(item,index) in fees" :key="index" @click="_toPage(item)">
<view style="position: relative;">
<view class="item-value"><text>{{item.value}}</text></view>
<view class="item-name"><text>{{item.name}}</text></view>
</view>
</view>
</view>
</view>
</view>
</template>
<script>
import {queryFeeDataReport} from '@/api/report/feeReport.js'
export default {
name:"feeDataReport",
data() {
return {
fees:[]
};
},
methods:{
_loadFeeData:function(startDate,endDate){
let _that = this;
queryFeeDataReport(this,{
communityId:this.getCommunityId(),
startDate:startDate,
endDate:endDate
}).then(_data=>{
_that.fees = _data.data;
})
}
}
}
</script>
<style lang="scss">
.index-undo {
background-color: #ffffff;
.undo-title {
padding: 20upx;
border-bottom: 1upx solid #F1F1F1;
}
.undo-menu{
padding:20upx;
.menu-item{
width: 33.33%;
padding: 30upx;
text-align: center;
.item-name{
color:#777 ;
margin-top: 10upx;
}
.item-value{
color: #F28A4A;
font-size: 32upx;
}
border-bottom: 1upx solid #F1F1F1;
border-right: 1upx solid #F1F1F1;
}
.menu-item:nth-child(3n+3) {
border-right: none;
}
.menu-item:nth-child(n+4) {
border-bottom: none;
}
}
}
</style>

View File

@ -0,0 +1,80 @@
<template>
<view>
<view class="index-undo">
<view class="undo-title">
<text class="text-bold">出入类</text>
</view>
<view class="undo-menu flex justify-start flex-wrap">
<view class="menu-item" v-for="(item,index) in inouts" :key="index" @click="_toPage(item)">
<view style="position: relative;">
<view class="item-value"><text>{{item.value}}</text></view>
<view class="item-name"><text>{{item.name}}</text></view>
</view>
</view>
</view>
</view>
</view>
</template>
<script>
import {queryInoutDataReport} from '@/api/report/feeReport.js'
export default {
name:"inoutDataReport",
data() {
return {
inouts:[]
};
},
methods:{
_loadInoutData:function(startDate,endDate){
let _that = this;
queryInoutDataReport(this,{
communityId:this.getCommunityId(),
startDate:startDate,
endDate:endDate
}).then(_data=>{
_that.inouts = _data.data;
})
}
}
}
</script>
<style lang="scss">
.index-undo {
background-color: #ffffff;
.undo-title {
padding: 20upx;
border-bottom: 1upx solid #F1F1F1;
}
.undo-menu{
padding:20upx;
.menu-item{
width: 33.33%;
padding: 30upx;
text-align: center;
.item-name{
color:#777 ;
margin-top: 10upx;
}
.item-value{
color: #F28A4A;
font-size: 32upx;
}
border-bottom: 1upx solid #F1F1F1;
border-right: 1upx solid #F1F1F1;
}
.menu-item:nth-child(3n+3) {
border-right: none;
}
.menu-item:nth-child(n+4) {
border-bottom: none;
}
}
}
</style>

View File

@ -0,0 +1,80 @@
<template>
<view>
<view class="index-undo">
<view class="undo-title">
<text class="text-bold">工单类</text>
</view>
<view class="undo-menu flex justify-start flex-wrap">
<view class="menu-item" v-for="(item,index) in orders" :key="index" @click="_toPage(item)">
<view style="position: relative;">
<view class="item-value"><text>{{item.value}}</text></view>
<view class="item-name"><text>{{item.name}}</text></view>
</view>
</view>
</view>
</view>
</view>
</template>
<script>
import {queryOrderDataReport} from '@/api/report/feeReport.js'
export default {
name:"orderDataReport",
data() {
return {
orders:[]
};
},
methods:{
_loadOrderData:function(startDate,endDate){
let _that = this;
queryOrderDataReport(this,{
communityId:this.getCommunityId(),
startDate:startDate,
endDate:endDate
}).then(_data=>{
_that.orders = _data.data;
})
}
}
}
</script>
<style lang="scss">
.index-undo {
background-color: #ffffff;
.undo-title {
padding: 20upx;
border-bottom: 1upx solid #F1F1F1;
}
.undo-menu{
padding:20upx;
.menu-item{
width: 33.33%;
padding: 30upx;
text-align: center;
.item-name{
color:#777 ;
margin-top: 10upx;
}
.item-value{
color: #F28A4A;
font-size: 32upx;
}
border-bottom: 1upx solid #F1F1F1;
border-right: 1upx solid #F1F1F1;
}
.menu-item:nth-child(3n+3) {
border-right: none;
}
.menu-item:nth-child(n+4) {
border-bottom: none;
}
}
}
</style>

View File

@ -0,0 +1,80 @@
<template>
<view>
<view class="index-undo">
<view class="undo-title">
<text class="text-bold">其他类</text>
</view>
<view class="undo-menu flex justify-start flex-wrap">
<view class="menu-item" v-for="(item,index) in others" :key="index" @click="_toPage(item)">
<view style="position: relative;">
<view class="item-value"><text>{{item.value}}</text></view>
<view class="item-name"><text>{{item.name}}</text></view>
</view>
</view>
</view>
</view>
</view>
</template>
<script>
import {queryOthersDataReport} from '@/api/report/feeReport.js'
export default {
name:"otherDataReport",
data() {
return {
others:[]
};
},
methods:{
_loadOtherData:function(startDate,endDate){
let _that = this;
queryOthersDataReport(this,{
communityId:this.getCommunityId(),
startDate:startDate,
endDate:endDate
}).then(_data=>{
_that.others = _data.data;
})
}
}
}
</script>
<style lang="scss">
.index-undo {
background-color: #ffffff;
.undo-title {
padding: 20upx;
border-bottom: 1upx solid #F1F1F1;
}
.undo-menu{
padding:20upx;
.menu-item{
width: 33.33%;
padding: 30upx;
text-align: center;
.item-name{
color:#777 ;
margin-top: 10upx;
}
.item-value{
color: #F28A4A;
font-size: 32upx;
}
border-bottom: 1upx solid #F1F1F1;
border-right: 1upx solid #F1F1F1;
}
.menu-item:nth-child(3n+3) {
border-right: none;
}
.menu-item:nth-child(n+4) {
border-bottom: none;
}
}
}
</style>

View File

@ -1,6 +1,6 @@
<template>
<view>
<view class="real_list">
<view class="real_list" v-if="real_list && real_list.length>0">
<view class="title">常用功能</view>
<view class="list">
<view class="item" v-for="(item,index) in real_list" :key="index" @tap="to(item)">
@ -9,6 +9,15 @@
</view>
</view>
</view>
<view class="real_list" v-if="reportMenus && reportMenus.length>0">
<view class="title">报表</view>
<view class="list">
<view class="item" v-for="(item,index) in reportMenus" :key="index" @tap="to(item)">
<image :src="item.description"></image>
<view class="text">{{item.name}}</view>
</view>
</view>
</view>
</view>
</template>
@ -24,6 +33,7 @@
data() {
return {
real_list: [],
reportMenus:[]
};
},
created() {
@ -37,12 +47,20 @@
});
},
_loadMenu: function() {
let _that =this;
loadCategoryMenus(this, {
userId: getUserInfo().userId,
groupType: 'P_APP'
}).then(_data=>{
console.log(_data);
this.real_list = _data;
_data.forEach(_menu=>{
if(_menu.name == "物业手机版"){
_that.real_list = _menu.childs;
}
if(_menu.name == "手机报表"){
_that.reportMenus = _menu.childs;
}
})
})
}
}

View File

@ -204,4 +204,11 @@ export default {
queryUndoCount: baseUrl+"callComponent/undo/list",
allocationStoreEnter: baseUrl+"app/resourceStore.allocationStoreEnter",
//todo 报表相关接口
queryFeeDataReport:baseUrl+"app/dataReport.queryFeeDataReport",
queryOrderDataReport:baseUrl+"app/dataReport.queryOrderDataReport",
queryInoutDataReport:baseUrl+"app/dataReport.queryInoutDataReport",
queryOthersDataReport:baseUrl+"app/dataReport.queryOthersDataReport",
}

View File

@ -658,6 +658,15 @@
}
}
,{
"path" : "pages/report/dataReport",
"style" :
{
"navigationBarTitleText": "数据统计",
"enablePullDownRefresh": false
}
}
],
"globalStyle": {
"navigationBarTextStyle": "white",

100
pages/report/dataReport.vue Normal file
View File

@ -0,0 +1,100 @@
<template>
<view>
<view class="cu-bar bg-white solid-bottom" style="justify-content: space-around;">
<view class="action" @click="changeListType(0)">
<text class="text-blue"
:class="{'cuIcon-roundcheckfill' : currentPage == 0, 'cuIcon-roundcheck' : currentPage != 0}"></text>今日
</view>
<view class="action" @click="changeListType(1)">
<text class="text-blue"
:class="{'cuIcon-roundcheckfill' : currentPage == 1, 'cuIcon-roundcheck' : currentPage != 1}"></text>昨日
</view>
<view class="action" @click="changeListType(2)">
<text class="text-blue"
:class="{'cuIcon-roundcheckfill' : currentPage == 2, 'cuIcon-roundcheck' : currentPage != 2}"></text>近30日
</view>
</view>
<view class="padding-sm">
<fee-data-report ref="feeDataReportRef"></fee-data-report>
</view>
<view class="padding-sm">
<order-data-report ref="orderDataReportRef"></order-data-report>
</view>
<view class="padding-sm">
<inout-data-report ref="inoutDataReportRef"></inout-data-report>
</view>
<view class="padding-sm">
<others-data-report ref="otherDataReportRef"></others-data-report>
</view>
</view>
</template>
<script>
import feeDataReport from '@/components/report/fee-data-report.vue';
import orderDataReport from '../../components/report/order-data-report.vue';
import inoutDataReport from '../../components/report/inout-data-report.vue';
import othersDataReport from '../../components/report/others-data-report.vue';
export default {
data() {
return {
currentPage: 0,
}
},
components: {
feeDataReport,
orderDataReport,
inoutDataReport,
othersDataReport
},
onLoad() {
let _that =this;
// #ifdef H5
setTimeout(function(){
_that.changeListType(0);
},1000)
// #endif
// #ifndef H5
this.changeListType(0);
// #endif
},
methods: {
changeListType: function(e) {
this.currentPage = e;
let _tmpStartDate = '';
let _tmpEndDate = '';
let _endDate = new Date();
if (e == 1) {
_endDate.setDate(_endDate.getDate() - 1);
_tmpEndDate = _endDate.getFullYear() + "-" + (_endDate.getMonth() +
1) + "-" + _endDate.getDate();
_tmpStartDate = _endDate.getFullYear() + "-" + (_endDate.getMonth() +
1) + "-" + _endDate.getDate();
} else if (e == 2) {
_tmpEndDate = _endDate.getFullYear() + "-" + (_endDate.getMonth() +
1) + "-" + _endDate.getDate();
_endDate.setDate(_endDate.getDate() - 30);
_tmpStartDate = _endDate.getFullYear() + "-" + (_endDate.getMonth() +
1) + "-" + _endDate.getDate();
}else{
_tmpEndDate = _endDate.getFullYear() + "-" + (_endDate.getMonth() +
1) + "-" + _endDate.getDate();
_tmpStartDate = _endDate.getFullYear() + "-" + (_endDate.getMonth() +
1) + "-" + _endDate.getDate();
}
this.$refs.feeDataReportRef._loadFeeData(_tmpStartDate,_tmpEndDate);
this.$refs.orderDataReportRef._loadOrderData(_tmpStartDate,_tmpEndDate);
this.$refs.inoutDataReportRef._loadInoutData(_tmpStartDate,_tmpEndDate);
this.$refs.otherDataReportRef._loadOtherData(_tmpStartDate,_tmpEndDate);
},
}
}
</script>
<style>
</style>