|
@@ -101,24 +101,27 @@
|
|
|
computed: {
|
|
|
...mapState(['loginUser']),
|
|
|
},
|
|
|
- onLoad(state){
|
|
|
+ onLoad(option){
|
|
|
this.init();
|
|
|
},
|
|
|
mounted() {
|
|
|
+ this.init();
|
|
|
},
|
|
|
methods: {
|
|
|
...mapActions('chart', ['getStatistics','getMainStatistics']),
|
|
|
- init(){
|
|
|
+ async init(){
|
|
|
+ console.log("adminId:" + this.adminId)
|
|
|
+ console.log("equipmentId:" + this.equipmentId)
|
|
|
_self = this;
|
|
|
this.cWidth = uni.upx2px(750);
|
|
|
this.cHeight = uni.upx2px(500);
|
|
|
|
|
|
- this.getMainStatisticsData();
|
|
|
+ await this.getMainStatisticsData();
|
|
|
|
|
|
- this.initDateRang(new Date(),'day');
|
|
|
- this.initDateRang(new Date(),'week');
|
|
|
- this.initDateRang(new Date(),'month');
|
|
|
- this.initDateRang(new Date(),'year');
|
|
|
+ await this.initDateRang(new Date(),'day');
|
|
|
+ await this.initDateRang(new Date(),'week');
|
|
|
+ await this.initDateRang(new Date(),'month');
|
|
|
+ await this.initDateRang(new Date(),'year');
|
|
|
},
|
|
|
initDateRang(day,chartType) {
|
|
|
const daystr = dateUtils.formateDate(day, 'yyyy/MM/dd');
|
|
@@ -138,7 +141,7 @@
|
|
|
this.endDate4 = dateUtils.formateDate(dateUtils.getCurrentYearLastDate(day), 'yyyy/MM/dd');
|
|
|
}
|
|
|
|
|
|
- this.getStatisticsData(chartType);
|
|
|
+ return this.getStatisticsData(chartType);
|
|
|
},
|
|
|
/**上一个 */
|
|
|
pre(chartType) {
|
|
@@ -211,8 +214,8 @@
|
|
|
if (this.equipmentId) {
|
|
|
param['equipmentId'] = this.equipmentId;
|
|
|
}
|
|
|
- setTimeout(() => {
|
|
|
- this.getStatistics(param)
|
|
|
+ // setTimeout(() => {
|
|
|
+ return this.getStatistics(param)
|
|
|
.then(data => {
|
|
|
uni.stopPullDownRefresh();
|
|
|
if(param['chartType']=='day'){
|
|
@@ -244,7 +247,7 @@
|
|
|
}
|
|
|
}
|
|
|
);
|
|
|
- }, 0);
|
|
|
+ // }, 0);
|
|
|
},
|
|
|
initChart(canvasId, chartData){
|
|
|
return new uCharts({
|
|
@@ -284,7 +287,7 @@
|
|
|
});
|
|
|
},
|
|
|
getMainStatisticsData(){
|
|
|
- setTimeout(() => {
|
|
|
+ // setTimeout(() => {
|
|
|
const param = {};
|
|
|
if(this.adminId){ // 子组件,则拿传过来的参
|
|
|
param['adminId'] = this.adminId;
|
|
@@ -295,7 +298,7 @@
|
|
|
param['equipmentId'] = this.equipmentId;
|
|
|
}
|
|
|
console.log('getMainStatisticsData:{}',param)
|
|
|
- this.getMainStatistics(param)
|
|
|
+ return this.getMainStatistics(param)
|
|
|
.then(data => {
|
|
|
for (let bean of data) {
|
|
|
if(bean['categorie']==='day'){
|
|
@@ -314,7 +317,7 @@
|
|
|
uni.stopPullDownRefresh();
|
|
|
}
|
|
|
, _ => void uni.stopPullDownRefresh());
|
|
|
- }, 0);
|
|
|
+ // }, 0);
|
|
|
},
|
|
|
touchLine1(e) {
|
|
|
if(canvaColumn1){
|