From cc1920f14f67a62734be737e8a3c735b5dcd5ac1 Mon Sep 17 00:00:00 2001 From: lancer <1905818361@qq.com> Date: Tue, 11 Jan 2022 19:04:20 +0800 Subject: [PATCH] init --- src/views/building/index.vue | 7 +- src/views/houseData/analyse.vue | 169 +++++++++++++++++++++++++------- 2 files changed, 135 insertions(+), 41 deletions(-) diff --git a/src/views/building/index.vue b/src/views/building/index.vue index 52f6459..4846632 100644 --- a/src/views/building/index.vue +++ b/src/views/building/index.vue @@ -276,7 +276,7 @@ - + @@ -308,14 +308,15 @@ - + - + diff --git a/src/views/houseData/analyse.vue b/src/views/houseData/analyse.vue index 456cc2e..fe68945 100644 --- a/src/views/houseData/analyse.vue +++ b/src/views/houseData/analyse.vue @@ -180,6 +180,13 @@ cursor: pointer; " > +
+ 不变 +
-
+
{{ item.name }}
{ - console.log(res); + // console.log(res); + // 数据处理 + this.orgArr = res.data; + this.dealData(); }); }, + // 数据处理 + dealData() { + let arr = []; + if (this.tabFlag == 1) { + // 达标 + // res.data.upToStandardList + let num = Math.max.apply( + Math, + this.orgArr.upToStandardList.map(function (o) { + return o.upToStandard; + }) + ); + // console.log(num, "最大值"); + this.orgArr.upToStandardList.map((item) => { + let obj = {}; + obj.zxl = item.upToStandard; + obj.name = item.name; + obj.zxl1 = Math.floor((item.upToStandard / num) * 100); + arr.push(obj); + }); + } else { + // res.data.didNotMakeItList + let num = Math.max.apply( + Math, + this.orgArr.didNotMakeItList.map(function (o) { + return o.didNotMakeIt; + }) + ); + // console.log(num, "最大值"); + this.orgArr.didNotMakeItList.map((item) => { + let obj = {}; + obj.zxl = item.didNotMakeIt; + obj.name = item.name; + obj.zxl1 = Math.floor((item.didNotMakeIt / num) * 100); + arr.push(obj); + }); + } + this.objList = arr; + }, //第二个饼状图 targetAnalysisCompared() { let obj = { - month: this.time, + month: this.time + "-01", agentId: this.selValue == 0 ? this.choicValue : null, orgCode: this.selValue == 1 ? this.choicValue : null, houseId: this.selValue == 2 ? this.choicValue : null, - operationType: localStorage.getItem("orgType")/1+1, + operationType: localStorage.getItem("orgType") / 1 + 1, houseTypes: "0,1", operationStaffId: this.operationStaffId, }; this.$api.api.targetAnalysisCompared(obj).then((res) => { let arr = [ { - value: res.data.upToStandard, - name: "达标", + value: res.data.rise, + name: "上升", }, { - value: res.data.didNotMakeIt, - name: "未达标", + value: res.data.decline, + name: "下降", + }, + { + value: res.data.constant, + name: "不变", }, ]; // console.log(res); @@ -503,23 +538,81 @@ export default { // 第二个柱状图 operationalGoalsCompared() { let obj = { - month: this.time, + month: this.time + "-01", agentId: this.selValue == 0 ? this.choicValue : null, orgCode: this.selValue == 1 ? this.choicValue : null, houseId: this.selValue == 2 ? this.choicValue : null, - operationType: localStorage.getItem("orgType")/1+1, + operationType: localStorage.getItem("orgType") / 1 + 1, houseTypes: "0,1", operationStaffId: this.operationStaffId, }; this.$api.api.operationalGoalsCompared(obj).then((res) => { - console.log(res); + // console.log(res); + this.orgData = res.data; + this.dealData2(); }); }, + // 数据处理 + dealData2() { + let arr = []; + if (this.tabFlag2 == 0) { + // 达标 + // res.data.upToStandardList + let num = Math.max.apply( + Math, + this.orgData.riseList.map(function (o) { + return o.rise; + }) + ); + // console.log(num, "最大值"); + this.orgData.riseList.map((item) => { + let obj = {}; + obj.zxl = item.rise; + obj.name = item.name; + obj.zxl1 = Math.floor((item.rise / num) * 100); + arr.push(obj); + }); + } else if (this.tabFlag2 == 1) { + // res.data.didNotMakeItList + let num = Math.max.apply( + Math, + this.orgData.constantList.map(function (o) { + return o.constant; + }) + ); + // console.log(num, "最大值"); + this.orgData.constantList.map((item) => { + let obj = {}; + obj.zxl = item.constant; + obj.name = item.name; + obj.zxl1 = Math.floor((item.constant / num) * 100); + arr.push(obj); + }); + } else { + let num = Math.max.apply( + Math, + this.orgData.declineList.map(function (o) { + return o.decline; + }) + ); + // console.log(num, "最大值"); + this.orgData.declineList.map((item) => { + let obj = {}; + obj.zxl = item.decline; + obj.name = item.name; + obj.zxl1 = Math.floor((item.decline / num) * 100); + arr.push(obj); + }); + } + this.objList1 = arr; + }, tabClick2(idx) { this.tabFlag2 = idx; + this.dealData2(); }, tabClick1(idx) { this.tabFlag = idx; + this.dealData(); }, reset() { this.receiveForm = {