소스 검색

0527bug修复

zhbyyy 2 년 전
부모
커밋
f32da3262e
1개의 변경된 파일50개의 추가작업 그리고 16개의 파일을 삭제
  1. 50 16
      investmentPort/js/investHomeGroup.js

+ 50 - 16
investmentPort/js/investHomeGroup.js

@@ -126,6 +126,24 @@ let app = new Vue({
       }
       return Number(num1.toString().replace(".", "")) * Number(num2.toString().replace(".", "")) / Math.pow(10, baseNum);
     },
+    // 解决减法失去精度
+    numSub(num1, num2) {
+      var baseNum, baseNum1, baseNum2;
+      var precision;// 精度
+      try {
+        baseNum1 = num1.toString().split(".")[1].length;
+      } catch (e) {
+        baseNum1 = 0;
+      }
+      try {
+        baseNum2 = num2.toString().split(".")[1].length;
+      } catch (e) {
+        baseNum2 = 0;
+      }
+      baseNum = Math.pow(10, Math.max(baseNum1, baseNum2));
+      precision = (baseNum1 >= baseNum2) ? baseNum1 : baseNum2;
+      return ((num1 * baseNum - num2 * baseNum) / baseNum).toFixed(precision);
+    },
     // 获取地址栏参数
     getUrlParams (id) {
       let url = window.location.href
@@ -767,6 +785,7 @@ let app = new Vue({
             right7[index][4] = item.mdnb_jindu
             right7[index][5] = item.mdnb_securty
           })
+          console.log(right7, '看看风险')
           this.getDate11()
           resolve(1);
         })
@@ -1251,7 +1270,7 @@ let app = new Vue({
             common5 = []
             if (type == 'distribution') {
               that.changeLine = false
-              that.lineCommonCompany = res.data.topData.map(item => item.type)
+              that.lineCommonCompany = res.data.topData
               common4 = res.data.topData.map(item => that.yuanChange(item.amount))
               common5 = res.data.bottomData.map(item => that.yuanChange(item.amount))
             } else {
@@ -1292,6 +1311,7 @@ let app = new Vue({
     },
     // 中间穿透二级
     centerPenetrateTwo (type, param, orgNum, portType, proName) {
+      console.log(param, '????????')
       this.boardType = 'center'
       let that = this
       return new Promise((resolve, err) => {
@@ -1697,7 +1717,7 @@ let app = new Vue({
             if (this.titleName == '项目数量' || this.titleName == '项目总数') {
               return `${data[0].name}</br>${data[0].seriesName}:${that.numFormat(data[0].value)}个`
             } else {
-              return `${data[0].name}</br>${data[0].seriesName}:${that.numFormat(data[0].value - 1)}亿`
+              return `${data[0].name}</br>${data[0].seriesName}:${that.numFormat(that.numSub(data[0].value,1))}亿`
             }
           },
           textStyle: {
@@ -1867,7 +1887,7 @@ let app = new Vue({
           },
         },
         xAxis: {
-          data: this.changeLine ? commonCompany : this.lineCommonCompany,
+          data: this.changeLine ? commonCompany : this.lineCommonCompany.map(item => item.type),
           axisTick: {
             show: false,
           },
@@ -1985,7 +2005,12 @@ let app = new Vue({
           } else if (location == 'left') {
             that.leftPenetrateTwo(mdnb_textfield11, mdnb_textfield13, mdnb_textfield16, mdnb_textfield23, param.name, that.projectNum)
           } else if (location == 'center') {
-            that.centerPenetrateTwo(typeCTwo, paramCTwo, that.findCode(param.name), portType, param2)
+            if (this.changeLine) {
+              that.centerPenetrateTwo(typeCTwo, paramCTwo, that.findCode(param.name), portType, param2)
+            } else {
+              let a = that.lineCommonCompany.find(item => item.type == param.name)
+              that.centerPenetrateTwo(typeCTwo, a.typeno, '', portType, param2)
+            }
           }
         } else {
           that.projectListTipShow = true
@@ -2012,7 +2037,7 @@ let app = new Vue({
             type: "shadow", // 默认为直线,可选为:'line' | 'shadow'
           },
           formatter: data => {
-            return `${data[0].name}</br>${data[0].seriesName}:${that.numFormat(data[0].value - 1)}亿`
+            return `${data[0].name}</br>${data[0].seriesName}:${that.numFormat(that.numSub(data[0].value,1))}亿`
           },
           textStyle: {
             color: '#FFF',     // 文字的颜色
@@ -5151,7 +5176,7 @@ let app = new Vue({
           // 补0
           return intPartFormat + '.' + floatPart + '0'
         } else {
-          floatPart = floatPart.slice(0, 2) 
+          floatPart = floatPart.slice(0, 2)
           return intPartFormat + '.' + floatPart
         }
       } else {
@@ -5989,7 +6014,7 @@ let app = new Vue({
       })
       let option = {
         tooltip: {
-          formatter: (data,ticket, callback) => {
+          formatter: (data, ticket, callback) => {
             return `${data[0].name}<br /><span style="display:inline-block;border-radius:50%; width:7px;height:7px;background-color:${data[0].color.colorStops[0].color}"></span> ${data[0].seriesName}:${that.numFormat(data[0].value)}亿<br/><span style="display:inline-block;border-radius:50%; width:7px;height:7px;background-color:${data[1].color.colorStops[0].color}"></span> ${data[1].seriesName}:${that.numFormat(data[1].value)}亿<br/><span style="display:inline-block;border-radius:50%; width:7px;height:7px;background-color:${data[2].color.colorStops[0].color}"></span> ${data[2].seriesName}:${that.numFormat(data[2].value)}亿<br/><span style="display:inline-block;border-radius:50%; width:7px;height:7px;background-color:${data[3].color.colorStops[0].color}"></span> ${data[3].seriesName}:${that.numFormat(data[3].value)}亿<br/><span style="display:inline-block;border-radius:50%; width:7px;height:7px;background-color:${data[4].color.colorStops[0].color}"></span> ${data[4].seriesName}:${that.numFormat(data[4].value)}亿`
           },
           textStyle: {
@@ -6040,7 +6065,7 @@ let app = new Vue({
           bottom: '5%',
         },
         legend: {
-          selectedMode:false,
+          selectedMode: false,
           data: ["预算额", "已签合同额", '产值认定额', '结算额', '付款额'],
           x: 'center',
           y: '0px',
@@ -6298,7 +6323,7 @@ let app = new Vue({
           }
         ],
         legend: {
-          selectedMode:false,
+          selectedMode: false,
           top: 10,
           data: ['正偏差', '容差', '负偏差'],
           textStyle: {
@@ -6626,7 +6651,7 @@ let app = new Vue({
           bottom: '20%',
         },
         legend: {
-          selectedMode:false,
+          selectedMode: false,
           data: ["低风险", "中风险", '高风险'],
           x: 'center',
           y: '15px',
@@ -6780,6 +6805,15 @@ let app = new Vue({
     },
     initChartR4 (indexValue) {
       this.echartR4Chart = echarts.init(this.$refs['echartR4'])
+      let a = []
+      right7.forEach(item => {
+        item.forEach(item2 => {
+          a.push(item2)
+        })
+      })
+      let b = a.reduce((x, y) => {
+        return x > y ? x : y;
+      });
       option = {
         title: {
           text: ''
@@ -6788,12 +6822,12 @@ let app = new Vue({
           center: ['50%', '50%'],
           radius: 135,
           indicator: [
-            { name: '安全风险', max: 100000 },
-            { name: '付款风险', max: 100000 },
-            { name: '合同风险', max: 100000 },
-            { name: '结算风险', max: 100000 },
-            { name: '进度风险', max: 100000 },
-            { name: '质量风险', max: 100000 },
+            { name: '安全风险', max: b },
+            { name: '付款风险', max: b },
+            { name: '合同风险', max: b },
+            { name: '结算风险', max: b },
+            { name: '进度风险', max: b },
+            { name: '质量风险', max: b },
           ],
           axisLine: {  // 设置雷达图中间射线的颜色
             lineStyle: {