cfofpp 5 months ago
parent
commit
2cf66963d2
1 changed files with 48 additions and 13 deletions
  1. 48 13
      src/views/home/components/TargetSituation/index.vue

+ 48 - 13
src/views/home/components/TargetSituation/index.vue

@@ -5,13 +5,13 @@
       <div>
       <div>
         <el-select
         <el-select
           size="mini"
           size="mini"
-          style="width: 70px; margin-right: 10px"
+          style="width: 100px; margin-right: 10px"
           v-model="queryParams.type"
           v-model="queryParams.type"
           @change="dateTypeChange"
           @change="dateTypeChange"
           placeholder="请选择时间纬度"
           placeholder="请选择时间纬度"
         >
         >
-          <el-option label="年" value="reportYear"></el-option>
-          <el-option label="月" value="reportDate"></el-option>
+          <el-option label="展示" value="reportYear"></el-option>
+          <el-option label="展示" value="reportDate"></el-option>
         </el-select>
         </el-select>
 
 
         <el-date-picker
         <el-date-picker
@@ -28,7 +28,7 @@
         </el-date-picker>
         </el-date-picker>
         <el-select
         <el-select
           size="mini"
           size="mini"
-          style="width: 100px; margin-left: 10px"
+          style="width: 120px; margin-left: 10px"
           v-model="zdlx"
           v-model="zdlx"
           @change="dateLxChange"
           @change="dateLxChange"
           placeholder="请选择"
           placeholder="请选择"
@@ -40,6 +40,21 @@
             :value="ite.key"
             :value="ite.key"
           ></el-option>
           ></el-option>
         </el-select>
         </el-select>
+        <el-select
+          v-if="queryParams.type == 'reportDate'"
+          size="mini"
+          style="width: 120px; margin-left: 10px"
+          v-model="currentCompany"
+          @change="dateCpChange"
+          placeholder="请选择"
+        >
+          <el-option
+            v-for="(ite, i) in cpList"
+            :key="i"
+            :label="ite"
+            :value="ite"
+          ></el-option>
+        </el-select>
       </div>
       </div>
     </div>
     </div>
     <div
     <div
@@ -107,12 +122,22 @@ export default {
           value2: { 0: "errorStopTimeMonth", 1: "errorStopMonth" },
           value2: { 0: "errorStopTimeMonth", 1: "errorStopMonth" },
         },
         },
       ],
       ],
+      currentCompany: "",
+      cpList: [],
     };
     };
   },
   },
   mounted() {
   mounted() {
     this.getList();
     this.getList();
   },
   },
   methods: {
   methods: {
+    dateCpChange(e) {
+      this.currentCompany = e;
+      if (this.queryParams.type == "reportYear") {
+        this.initEcharts();
+      } else {
+        this.initEcharts2();
+      }
+    },
     dateTypeChange(e) {
     dateTypeChange(e) {
       this.queryParams.type = e;
       this.queryParams.type = e;
       this.dataList = [];
       this.dataList = [];
@@ -133,10 +158,15 @@ export default {
         this.dataList = response.rows.filter(
         this.dataList = response.rows.filter(
           (ite) => ite.companyName != "总计"
           (ite) => ite.companyName != "总计"
         );
         );
+        this.cpList = this.dataList.map((ite) => ite.companyName);
+        this.currentCompany = this.cpList ? this.cpList[0] : "";
         this.loading = false;
         this.loading = false;
         if (this.queryParams.type == "reportYear") {
         if (this.queryParams.type == "reportYear") {
           this.initEcharts();
           this.initEcharts();
         } else {
         } else {
+          this.currentCompany = this.dataList
+            ? this.dataList[0].companyName
+            : "";
           this.initEcharts2();
           this.initEcharts2();
         }
         }
       });
       });
@@ -178,6 +208,7 @@ export default {
           color: "#fff",
           color: "#fff",
         },
         },
         legend: {
         legend: {
+          top: "10",
           textStyle: {
           textStyle: {
             color: "#fff",
             color: "#fff",
           },
           },
@@ -186,7 +217,7 @@ export default {
           left: "2%", //图表距离容器左侧多少距离
           left: "2%", //图表距离容器左侧多少距离
           right: "2%", //图表距离容器右侧侧多少距离
           right: "2%", //图表距离容器右侧侧多少距离
           bottom: "5%", //图表距离容器上面多少距离
           bottom: "5%", //图表距离容器上面多少距离
-          top: "8%", //图表距离容器下面多少距离
+          top: "10%", //图表距离容器下面多少距离
           containLabel: true,
           containLabel: true,
         },
         },
         xAxis: {
         xAxis: {
@@ -218,10 +249,14 @@ export default {
       });
       });
     },
     },
     initEcharts2() {
     initEcharts2() {
+      let data = [];
       let legend = [];
       let legend = [];
       let series = [];
       let series = [];
+      data = this.dataList.filter(
+        (ite) => ite.companyName == this.currentCompany
+      );
       const zdlx = this.yearTypeList.find((ite) => ite.key == this.zdlx).value2;
       const zdlx = this.yearTypeList.find((ite) => ite.key == this.zdlx).value2;
-      this.dataList.forEach((e, i) => {
+      data.forEach((e, i) => {
         legend.push(e.companyName);
         legend.push(e.companyName);
         series.push(
         series.push(
           {
           {
@@ -270,14 +305,14 @@ export default {
               const value = item.value; // 数据值
               const value = item.value; // 数据值
               const marker = item.marker; // 标志图形
               const marker = item.marker; // 标志图形
               result += `${marker}${seriesName}: ${value}<br/>`;
               result += `${marker}${seriesName}: ${value}<br/>`;
-              if (i % 2 == 0) {
-                const zxl = Number(params[1].value) / Number(params[0].value);
-                result += `${params[0].marker}执行率: ${
-                  zxl.toFixed(2) * 100
-                }%<br/>`;
-              }
-            });
+              // if (i % 2 == 0) {
 
 
+              // }
+            });
+            const zxl = Number(params[1].value) / Number(params[0].value);
+            result += `${params[0].marker}执行率: ${
+              zxl.toFixed(2) * 100
+            }%<br/>`;
             return result;
             return result;
           },
           },
           // width: 320, // 设置tooltip宽度
           // width: 320, // 设置tooltip宽度