Explorar el Código

修改逻辑代码/对接历史趋势折线图数据202107161835

fanghuisheng hace 4 años
padre
commit
963a94374e

+ 10 - 10
src/api/content/CircuitEdit.js

@@ -1,12 +1,12 @@
-import request from '@/utils/request'
+// import request from '@/utils/request'
 
 
-export default {
-    // 获取单位信息列表
-    queryGroupTree() {
-        return request({
-            url: `/organizationMenager/queryGroupTree`,
-            method: 'post',
-        })
-    },
-}
+// export default {
+//     // 获取单位信息列表
+//     queryGroupTree() {
+//         return request({
+//             // url: `/organizationMenager/queryGroupTree`,
+//             // method: 'post',
+//         })
+//     },
+// }

+ 8 - 0
src/api/site/Device_motore.js

@@ -43,4 +43,12 @@ export default {
             params: params
         })
     },
+    // 获取历史趋势折线图数据
+    HistoricalCurve(params) {
+        return request({
+            url: `rtAnalogData/HistoricalCurve`,
+            method: 'GET',
+            params: params
+        })
+    },
 }

+ 42 - 17
src/store/index.js

@@ -56,7 +56,7 @@ export default createStore({
                     { name: "外接温度2", value: "T2" },
                     { name: "外接温度3", value: "T3" },
                     { name: "外接温度4", value: "T4" },
-                    { name: "环境温度", value: "Ic" },
+                    { name: "环境温度", value: "DeviceTemp" },
                 ],
             },
             {
@@ -93,30 +93,33 @@ export default createStore({
                 ],
             },
         ],//数据报表->默认tabs数据
+        se_tabs: [
+            { label: '电流', name: "I" },
+            { label: '功率', name: "P" },
+            { label: '电度', name: "KWh" },
+            { label: '电压', name: "V" },
+            { label: '温度', name: "C" },
+            { label: '频率', name: "HZ" },
+            { label: '功率因数', name: "PS" },
+            { label: '谐波电流有效值', name: "RMS" },
+            { label: '通讯参数', name: "DDB" },
+            { label: '电压突变', name: "VT" },
+        ],
 
         run_off_Status: null,//运行状态统计->echarts->OFF次数分布和运行状态曲线图表 api信息存储
 
         timearr: [],//公共处理开始时间和结束时间中的时间段天数 值存储
+
+        HistoricalCurve:null,//历史趋势->echarts->曲线图表 api信息存储
     },
     mutations: {
-        increment(state, val) {
-            state.siteId = val
-        },
         /**
-         * @公共处理时区方法
+         * @公共api请求参数siteId
+         * @param {*}} state 
+         * @param {*} val 
          */
-        TimeAll_function(state, time) {
-            state.Time_Data = []
-            for (let i in time) {
-                var Y = time[i].getFullYear() < 10 ? '0' + time[i].getFullYear() : time[i].getFullYear()
-                var M = (time[i].getMonth() + 1) < 10 ? '0' + (time[i].getMonth() + 1) : (time[i].getMonth() + 1)
-                var D = time[i].getDate() < 10 ? '0' + time[i].getDate() : time[i].getDate()
-                var HH = time[i].getHours() < 10 ? '0' + time[i].getHours() : time[i].getHours()
-                var MM = time[i].getMinutes() < 10 ? '0' + time[i].getMinutes() : time[i].getMinutes()
-                var SS = time[i].getSeconds() < 10 ? '0' + time[i].getSeconds() : time[i].getSeconds()
-                // console.log(Y + '-' + M + '-' + D + ' ' + HH + ':' + MM + ':' + SS)
-                state.Time_Data.push(Y + '-' + M + '-' + D + ' ' + HH + ':' + MM + ':' + SS)
-            }
+        increment(state, val) {
+            state.siteId = val
         },
         /**
          * @数据报表 —> 多选按钮数据处理
@@ -152,12 +155,34 @@ export default createStore({
             }
             state.queryType = checked_list.length > 1 ? state.queryType.slice(0, state.queryType.length - 1) : state.queryType
         },
+        /**
+         * @历史趋势 -> echarts ->曲线图表 api信息存储
+         */
+        HistoricalCurve(state,data){
+            state.HistoricalCurve = data
+        },
         /**
          * @运行状态统计 -> echarts -> OFF次数分布和运行状态曲线图表 api信息存储
          */
         run_off_Status(state, data) {
             state.run_off_Status = data
         },
+        /**
+         * @公共处理时区方法
+         */
+        TimeAll_function(state, time) {
+            state.Time_Data = []
+            for (let i in time) {
+                var Y = time[i].getFullYear() < 10 ? '0' + time[i].getFullYear() : time[i].getFullYear()
+                var M = (time[i].getMonth() + 1) < 10 ? '0' + (time[i].getMonth() + 1) : (time[i].getMonth() + 1)
+                var D = time[i].getDate() < 10 ? '0' + time[i].getDate() : time[i].getDate()
+                var HH = time[i].getHours() < 10 ? '0' + time[i].getHours() : time[i].getHours()
+                var MM = time[i].getMinutes() < 10 ? '0' + time[i].getMinutes() : time[i].getMinutes()
+                var SS = time[i].getSeconds() < 10 ? '0' + time[i].getSeconds() : time[i].getSeconds()
+                // console.log(Y + '-' + M + '-' + D + ' ' + HH + ':' + MM + ':' + SS)
+                state.Time_Data.push(Y + '-' + M + '-' + D + ' ' + HH + ':' + MM + ':' + SS)
+            }
+        },
         /**
          * @公共处理开始时间和结束时间中的时间段天数
          * @param {*} state 

+ 52 - 35
src/views/CircuitEdit.vue

@@ -83,7 +83,9 @@
                     ',' +
                     item.svgPositionY +
                     ')' +
-                    'rotate(' +item.angle+')'
+                    'rotate(' +
+                    item.angle +
+                    ')'
                   "
                 >
                   <SvgComponents
@@ -117,9 +119,8 @@ import RightToolBar from "@/components/RightToolBar.vue";
 import global from "@/global/global.js"; //全局变量
 // import admin from '@/global/1.json';//全局变量
 import SvgComponents from "@/components/SvgComponents.vue";
-import api from "../api/content/CircuitEdit";
 export default {
-  components: { LeftToolBar, RightToolBar, SvgComponents},
+  components: { LeftToolBar, RightToolBar, SvgComponents },
   data() {
     return {
       svgInfoData: [], //接口获取到的组件数据
@@ -152,7 +153,7 @@ export default {
       tableRowCount: 2, //表格默认行数
       tableColCount: 2, //表格默认列数
       tableDefaultData: [],
-      AnalogData: []
+      AnalogData: [],
     };
   },
   methods: {
@@ -224,8 +225,10 @@ export default {
       //console.log('点击了画布');
     },
     MousedownSvg(id, index, pointX, pointY, e) {
-      this.CurrentlySelectedToolBar.Type = global.CurrentlySelectedToolBarType = "";
-      this.CurrentlySelectedToolBar.Title = global.CurrentlySelectedToolBarTitle = "";
+      this.CurrentlySelectedToolBar.Type = global.CurrentlySelectedToolBarType =
+        "";
+      this.CurrentlySelectedToolBar.Title =
+        global.CurrentlySelectedToolBarTitle = "";
       //从数组里面根据index找到当前元素
       this.selectSvg.ID = id;
       this.selectSvg.Index = index;
@@ -267,10 +270,10 @@ export default {
       }
       e.preventDefault();
       //判断滚轮方向 -100是往上滑 100是下滑
-      let svgZoom = e.deltaY <0 ? 0.1 : -0.1;
+      let svgZoom = e.deltaY < 0 ? 0.1 : -0.1;
       console.log(e.deltaY);
       selectSvgInfo.size += svgZoom;
-      selectSvgInfo.size =parseFloat(selectSvgInfo.size.toFixed(1));
+      selectSvgInfo.size = parseFloat(selectSvgInfo.size.toFixed(1));
       if (selectSvgInfo.size < 1) {
         selectSvgInfo.size = 1;
       }
@@ -377,12 +380,12 @@ export default {
               </div>
             </td>
           </tr>
-        </table>`
-      gAnyList[0].innerHTML = html
-      
+        </table>`;
+      gAnyList[0].innerHTML = html;
     },
   },
   mounted() {
+    let _this = this;
     //请求接口获取组件
     this.$axios
       .get("/1.json")
@@ -393,25 +396,35 @@ export default {
       .catch(function (error) {
         console.log(error);
       });
-    let _this = this;
-    api.queryGroupTree().then((requset)=>{
-      console.log(requset)
-    })
+
     let canvasdiv = document.querySelector("#canvas");
     _this.guideX = document.querySelector("#guide-x"); //辅助线x轴
     _this.guideY = document.querySelector("#guide-y"); //辅助线y轴
-    canvasdiv.addEventListener("dragover",function (e) {
-      e.preventDefault();
-      _this.CurrentlySelectedToolBar.Type = global.CurrentlySelectedToolBarType;
-      _this.CurrentlySelectedToolBar.Title = global.CurrentlySelectedToolBarTitle;
-      _this.CurrentlySelectedToolBar.TypeName = global.CurrentlySelectedToolBarTypeName;
-      _this.CurrentlySelectedToolBar.Color = global.CurrentlySelectedToolBarColor;
-      _this.CurrentlySelectedToolBar.Height = global.CurrentlySelectedToolBarHeight;
-      _this.CurrentlySelectedToolBar.Width = global.CurrentlySelectedToolBarWidth;
-      _this.CurrentlySelectedToolBar.SvgText = global.CurrentlySelectedToolBarSvgText;
-      _this.CurrentlySelectedToolBar.FontSize = global.CurrentlySelectedToolBarFontSize;
-      _this.CurrentlySelectedToolBar.TableData = global.CurrentlySelectedToolBarTableData;
-    },false);
+    canvasdiv.addEventListener(
+      "dragover",
+      function (e) {
+        e.preventDefault();
+        _this.CurrentlySelectedToolBar.Type =
+          global.CurrentlySelectedToolBarType;
+        _this.CurrentlySelectedToolBar.Title =
+          global.CurrentlySelectedToolBarTitle;
+        _this.CurrentlySelectedToolBar.TypeName =
+          global.CurrentlySelectedToolBarTypeName;
+        _this.CurrentlySelectedToolBar.Color =
+          global.CurrentlySelectedToolBarColor;
+        _this.CurrentlySelectedToolBar.Height =
+          global.CurrentlySelectedToolBarHeight;
+        _this.CurrentlySelectedToolBar.Width =
+          global.CurrentlySelectedToolBarWidth;
+        _this.CurrentlySelectedToolBar.SvgText =
+          global.CurrentlySelectedToolBarSvgText;
+        _this.CurrentlySelectedToolBar.FontSize =
+          global.CurrentlySelectedToolBarFontSize;
+        _this.CurrentlySelectedToolBar.TableData =
+          global.CurrentlySelectedToolBarTableData;
+      },
+      false
+    );
     canvasdiv.addEventListener(
       "drop",
       function (e) {
@@ -435,9 +448,9 @@ export default {
           width: _this.CurrentlySelectedToolBar.Width,
           svgText: _this.CurrentlySelectedToolBar.SvgText,
           fontSize: _this.CurrentlySelectedToolBar.FontSize,
-          tableRowCount:_this.tableRowCount,
+          tableRowCount: _this.tableRowCount,
           tableColCount: _this.tableColCount,
-          tableData:_this.CurrentlySelectedToolBar.TableData,
+          tableData: _this.CurrentlySelectedToolBar.TableData,
           angle: 0,
           //translate:`translate(${this.mousePosition.positionX},${this.mousePosition.positionY})`
         };
@@ -464,7 +477,11 @@ export default {
     document.onkeydown = function (e) {
       //获取当前选中组件
       let selectSvgInfo = _this.selectSvgInfo;
-      if (selectSvgInfo == undefined || selectSvgInfo == null || selectSvgInfo == "" ) {
+      if (
+        selectSvgInfo == undefined ||
+        selectSvgInfo == null ||
+        selectSvgInfo == ""
+      ) {
         return;
       }
       //事件对象兼容
@@ -555,7 +572,7 @@ export default {
   z-index: 2;
   box-shadow: 1px 1px 5px #ddd;
 }
-.tdsvg[data-v-025fdfb6]{
+.tdsvg[data-v-025fdfb6] {
   border: 1px solid #ff0;
   white-space: nowrap;
   background: #fff;
@@ -564,13 +581,13 @@ export default {
   font-size: 16px;
   background-color: #7cfc00;
 }
-foreignObject{
+foreignObject {
   width: 0;
   height: 0;
   overflow: visible;
   cursor: pointer;
 }
-foreignObject #divtable{
+foreignObject #divtable {
   position: absolute;
   left: 0;
   top: 0;
@@ -581,7 +598,7 @@ foreignObject #divtable{
   cursor: pointer;
   font-size: 20px;
 }
-.add-tag .ainput{
+.add-tag .ainput {
   display: inline-block;
   height: 100%;
   padding: 0 32px;
@@ -594,7 +611,7 @@ foreignObject #divtable{
   color: #ff0;
   background-color: #000;
 }
-.add-tag{
+.add-tag {
   color: #333;
   padding: 0;
   position: relative;

+ 2 - 2
src/views/index.vue

@@ -94,7 +94,7 @@ export default {
   methods: {
     el_select(val) {
       // console.log(val);
-      for (let i = 0; i < this.options.length; i++) {
+      for (let i in this.options) {
         if (this.options[i].value == val) {
           this.name = this.options[i].label;
         }
@@ -123,7 +123,7 @@ export default {
       this.title = title;
       this.name = name;
       if (type === "index" || name.indexOf("站点") == 2) {
-        for (let i = 0; i < this.options.length; i++) {
+        for (let i in this.options) {
           if (this.options[i].label == name) {
             this.value = this.options[i].value;
           }

+ 46 - 38
src/views/site/Device_motore.vue

@@ -99,36 +99,7 @@
             @tab-click="handleClick2"
             class="se-content"
           >
-            <el-tab-pane label="电流" name="flow" class="flow"> </el-tab-pane>
-            <el-tab-pane label="功率" name="power" class="power"> </el-tab-pane>
-            <el-tab-pane label="电度" name="degree" class="degree">
-            </el-tab-pane>
-            <el-tab-pane label="电压" name="voltage" class="voltage">
-            </el-tab-pane>
-            <el-tab-pane label="温度" name="temperature" class="temperature">
-            </el-tab-pane>
-            <el-tab-pane label="频率" name="frequency" class="frequency">
-            </el-tab-pane>
-            <el-tab-pane
-              label="功率因数"
-              name="power_factor"
-              class="power_factor"
-            >
-            </el-tab-pane>
-            <el-tab-pane
-              label="谐波电流有效值"
-              name="hc_valid_value"
-              class="hc_valid_value"
-            >
-            </el-tab-pane>
-            <el-tab-pane
-              label="通讯参数"
-              name="c_parameters"
-              class="c_parameters"
-            >
-            </el-tab-pane>
-            <el-tab-pane label="电压突变" name="v_mutation" class="v_mutation">
-            </el-tab-pane>
+            <el-tab-pane v-for="tabs in $store.state.se_tabs" :key="tabs" :label="tabs.label" :name="tabs.name" :class="tabs.name"></el-tab-pane>
             <el-button type="primary" class="preservation" @click="preservation"
               >保存为图片</el-button
             >
@@ -136,12 +107,13 @@
           <div class="block">
             <span>选择时间范围 :</span>
             <el-date-picker
+              @change="HistoricalCurve_api($store.state.siteId)"
               v-model="se_defaultTime"
               type="datetimerange"
               start-placeholder="开始日期"
               end-placeholder="结束日期"
               range-separator="~"
-              :disabledDate="se_disabledDate"
+              :disabledDate="disabledDate"
             >
             </el-date-picker>
           </div>
@@ -196,6 +168,9 @@
           </div>
           <div class="table">
             <el-table
+              v-loading="table_loading"
+              empty-text=" "
+              element-loading-text="拼命加载中"
               class="elTable"
               :data="th_tableData"
               style="width: 100%"
@@ -227,7 +202,7 @@
                 </el-table-column>
               </template>
 
-              <template #empty>
+              <template #empty v-if="table_loading == false">
                 <div class="zwsj">
                   <img src="./../../assets/images/No_data.png" alt="" />
                   <p>暂无数据</p>
@@ -338,7 +313,7 @@ export default {
     return {
       activeName: "first", //最外层tabs切换name
       ac_content: "model", //实时数据tabs切换name
-      se_content: "flow", //历史趋势tabs切换name
+      se_content: "I", //历史趋势tabs切换name
       se_label: "电流", //历史趋势label/name信息存储 tabs切换时调用接口进行判断的值
 
       model_array: [], //实时数据->模拟量接口返回信息存储
@@ -362,6 +337,7 @@ export default {
       checkedCities: [], //数据报表->多选按钮信息存储
       cities: cityOptions, //数据报表->多选按钮信息存储
       isIndeterminate: false, //数据报表->全选按钮是否选中
+      table_loading: false, //数据报表->Loading 加载
 
       columnHeaders: [
         { index: 0, title: "电流", isShow: false },
@@ -381,10 +357,8 @@ export default {
   methods: {
     //最外层tabs切换事件触发
     handleClick(tab, event) {
-      //   console.log(tab, event);
-      //   console.log(tab.props.name)
-      this.ac_content = "model";
-      this.se_content = "flow";
+      this.ac_content = "model";//将实时数据->恢复默认内部tabs选中
+      this.se_content = "I";//将历史趋势->恢复默认内部tabs选中
       for (let i in event.path) {
         if (event.path[i].className === "el-tabs__nav is-top") {
           var childNodes = event.path[i].childNodes;
@@ -408,6 +382,7 @@ export default {
       tab || event;
       // console.log(tab, event);
       this.se_label = tab.props.label;
+      this.If_tabs_api(this.$store.state.siteId);
     },
     //数据报表全选按钮事件
     handleCheckAllChange(val) {
@@ -428,6 +403,7 @@ export default {
      */
     Data_report_api(siteid) {
       var _this = this;
+      _this.table_loading = true;
       _this.$store.commit("TimeAll_function", _this.th_defaultTime);
       var time = _this.$store.state.Time_Data;
       _this.$store.commit("checkedCities_all", _this.checkedCities);
@@ -443,6 +419,7 @@ export default {
         .then((requset) => {
           if (requset.status === "SUCCESS") {
             _this.th_tableData = requset.data;
+            _this.table_loading = false;
           } else {
             ElMessage.success({
               message: requset.msg,
@@ -534,12 +511,33 @@ export default {
       LoopStatus();
       runStatus();
     },
+    /**
+     * @历史趋势api请求
+     */
+    HistoricalCurve_api(siteid) {
+      var _this = this
+      _this.$store.commit("TimeAll_function", _this.se_defaultTime);
+      var time = _this.$store.state.Time_Data;
+
+      api.HistoricalCurve({ siteId: siteid ,startTime:time[0],endTime:time[1],queryType:_this.se_content}).then((requset) => {
+        if (requset.status === "SUCCESS") {
+          _this.$store.commit("HistoricalCurve", requset.data);
+        } else {
+          ElMessage.success({
+            message: requset.msg,
+            type: "success",
+          });
+        }
+      });
+    },
     /**
      * @判断最外层tabs切换时请求api
      */
     If_tabs_api(siteid) {
       this.activeName === "first"
         ? this.Real_time_api(siteid) //调用实时数据api请求
+        : this.activeName === "second"
+        ? this.HistoricalCurve_api(siteid) //调用历史趋势api请求
         : this.activeName === "fourth"
         ? this.Operation_status_api(siteid) //调用运行状态统计api请求
         : "";
@@ -832,6 +830,16 @@ export default {
   white-space: nowrap;
   display:inline;
 } */
+
+#pane-third .el-loading-mask {
+  background-color: rgb(0, 244, 253, 0.05);
+}
+#pane-third .el-loading-spinner .path {
+  stroke: rgb(86, 158, 160, 1);
+}
+#pane-third .el-loading-spinner .el-loading-text {
+  color: rgb(86, 158, 160, 1);
+}
 </style>
 
 <style>
@@ -874,7 +882,7 @@ export default {
   height: 35px;
   margin: 2px 0.4rem 5px 0px;
 }
-.se-content #tab-flow {
+.se-content #tab-I {
   border-left: 1px rgba(0, 244, 253, 0.1) solid;
 }
 

+ 3 - 5
src/views/site_ehcarts/Device_StateCurve.vue

@@ -108,14 +108,12 @@ export default {
       for (let i in run_off_Status) {
         if (run_off_Status[i].name === "runStates") {
           if (run_off_Status[i].list.length <= 0) {
-            _this.data_time = time;
             _this.data = [1, 1].map((val, ind) => {
-              return [_this.data_time[ind], val];
+              return [time[ind], val];
             });
           } else {
-            _this.data_time = run_off_Status[i].listDate;
             _this.data = run_off_Status[i].list.map((val, ind) => {
-              return [_this.data_time[ind], val];
+              return [run_off_Status[i].listDate[ind], val];
             });
           }
         }
@@ -241,7 +239,7 @@ export default {
           {
             name: "回路带电/停电",
             type: "line",
-            smooth: true,
+            // smooth: true,
             data: this.data,
           },
         ],

+ 18 - 15
src/views/site_ehcarts/Device_distion.vue

@@ -44,6 +44,8 @@ export default {
       msgFormSon: null,
       data_time: [],
       data: [],
+      dataall: [],
+      data_cont: 0,
     };
   },
   mounted() {
@@ -68,32 +70,33 @@ export default {
       var chart = echarts.init(this.$refs.distion);
       var option;
 
-      var time = _this.$store.state.Time_Data;
+      var time = _this.$store.state.Time_Data; //将存储在store中的开始时间和结束时间存入变量time
 
       this.$store.commit("getAll", [
         time[0].split(" ")[0],
         time[1].split(" ")[0],
-      ]);
+      ]); //将time变量中的开始时间和结束时间传给getAll方法
 
-      var timeall = this.$store.state.timearr;
-      var dataall = [];
-      for (let i in timeall) {
-        i;
-        dataall.push(0);
-      }
+      var timeall = this.$store.state.timearr; //将getAll已便利好的时间区间数组存入变量timeall
+      timeall.map(() => {
+        _this.dataall.push(0);
+      });
 
       var run_off_Status = _this.$store.state.run_off_Status;
       for (let i in run_off_Status) {
         if (run_off_Status[i].name === "offCount") {
+          //判断后台返回的数据下标是否为0
           if (run_off_Status[i].list.length <= 0) {
-            _this.data_time = timeall;
-            _this.data = dataall.map((val, ind) => {
-              return [_this.data_time[ind], val];
+            _this.dataall.map((val, ind) => {
+              _this.data.push([timeall[ind], val]);
+              _this.data_cont = _this.data_cont + val;
+              return;
             });
           } else {
-            _this.data_time = run_off_Status[i].listDate;
-            _this.data = run_off_Status[i].list.map((val, ind) => {
-              return [_this.data_time[ind], val];
+            run_off_Status[i].list.map((val, ind) => {
+              _this.data_cont = _this.data_cont + val;
+              _this.data.push([run_off_Status[i].listDate[ind], val]);
+              return;
             });
           }
         }
@@ -110,7 +113,7 @@ export default {
             },
           },
           {
-            text: `OFF次数:${0}`,
+            text: `OFF次数:${_this.data_cont}`,
             left: "right",
             padding: [0, "7", 0, 0],
             textStyle: {

+ 63 - 109
src/views/site_ehcarts/Device_second.vue

@@ -77,76 +77,69 @@ export default {
         },
       ],
       msgFormSon: null,
+      data: [],
+      Data_Name: [],
+      series_all: [],
     };
   },
-  mounted() {
-    this.$nextTick(() => {
-      this.initChart();
-      // console.log(this.defaul_tTime);
-    });
-  },
+  mounted() {},
   beforeUnmount() {
     window.removeEventListener("resize", this.chart);
   },
+  watch: {
+    "$store.state.HistoricalCurve"() {
+      // this.chart.resize();
+      this.initChart();
+    },
+  },
   methods: {
     //历史趋势折线图
     initChart() {
       var chart = echarts.init(this.$refs.main);
       var option;
-      let data = [
-        "2020-01-01 14:00:00",
-        "2020-01-01 15:00:00",
-        "2020-01-01 16:00:00",
-        "2020-01-01 17:00:00",
-        "2020-01-01 18:00:00",
-        "2020-01-01 19:00:00",
-        "2020-01-01 20:00:00",
-        "2020-01-01 21:00:00",
-        "2020-01-01 22:00:00",
-        "2020-01-01 23:00:00",
-        "2020-01-02 01:05:00",
-        "2020-01-02 01:10:00",
-        "2020-01-02 01:15:00",
-        "2020-01-02 01:20:00",
-        "2020-01-02 01:25:00",
-        "2020-01-02 01:30:00",
-        "2020-01-02 01:35:00",
-        "2020-01-02 01:40:00",
-        "2020-01-02 01:45:00",
-        "2020-01-02 01:50:00",
-        "2020-01-02 01:55:00",
-        "2020-01-02 02:00:00",
-      ];
-      let arr = [
-        0, 0, 0, 0.03, 0, 0, 0, 0, 0, 0, 0, 0.005, 0, 0, 0, 0.03, 0, 0, 0, 0, 0,
-        0, 0, 0.005, 0, 0, 0, 0.03, 0, 0, 0, 0, 0, 0, 0, 0.005,
-      ].map((val, ind) => {
-        return [data[ind], val];
-      });
-      // console.log(arr);
-      option = {
-        // title: {
-        //   // text: "折线图堆叠",
-        //   textStyle: {
-        //     color: "red",
-        //     fontSize: "12",
-        //     fontFamily: "fangsong",
-        //     fontWeight: "400",
-        //     fontStyle: "normal",
-        //   },
+      var time;
+      this.series_all = [];
+      this.data = [];
+      this.Data_Name = [];
 
-        //   // subtext: "副标题",
-        //   subtextStyle: {
-        //     color: "red",
-        //   },
+      var HistoricalCurve = this.$store.state.HistoricalCurve;
+      if (HistoricalCurve.length <= 0) {
+        time = this.$store.state.Time_Data; //将存储在store中的开始时间和结束时间存入变量time
+        time.map((val, ind) => {
+          this.data.push([val, 0]);
+          this.Data_Name = ["暂无数据"];
+          this.series_all = [
+            {
+              // smooth: true,  //设置折线为圆滑曲线,false则有转折点
+              name: "暂无数据",
+              type: "line",
+              data: this.data,
+              itemStyle: this.itemStyle[ind],
+              symbolSize: 5,
+              symbol: "circle",
+            },
+          ];
+          return;
+        });
+      } else {
+        HistoricalCurve.map((val, ind) => {
+          this.Data_Name.push(val.name);
+          this.series_all.push({
+            // smooth: true,  //设置折线为圆滑曲线,false则有转折点
+            name: val.name,
+            type: "line",
+            data: val.arr,
+            itemStyle: this.itemStyle[ind],
+            symbolSize: 5,
+            symbol: "circle",
+          });
+          return;
+        });
+      }
+
+      // console.log(this.series_all);
 
-        //   align: "center",
-        //   x: "right",
-        //   y: "top",
-        //   textAlign: "center",
-        //   padding: [5, 10, 5, 10],
-        //   itemGap: "4",
-        // },
+      option = {
         tooltip: {
           backgroundColor: "rgba(0, 244, 253, 0.1)",
           borderColor: "rgba(0, 244, 253, 0.3)",
@@ -157,18 +150,19 @@ export default {
           // item  主要在散点图,饼图等无类目轴的图表中使用。 // axis  坐标轴触发,主要在柱状图,折线图等会使用类目轴的图表中使用 //none   什么都不触发
           axisPointer: {
             // 坐标轴指示器配置项。
-            type: "cross",
+            // type: "cross",
             // line   直线指示器 / 'shadow' 阴影指示器 /'none' 无指示器 /'cross' 十字准星指示器。其实是种简写,表示启用两个正交的轴的 axisPointer。
           },
           formatter: function (params) {
             // console.log(params);
-            var res = params[0].name;
+            var res = params[0].axisValueLabel;
+
             for (let i in params) {
               res += `
               <div style="display:flex">
                   <div style="width:10px;height:10px;background:${params[i].borderColor};border-radius: 10px;margin:10px 0;"></div>
-                  <div style="padding:4px 0px 0px 10px;">${params[i].seriesName}</div>
-                  <div style="padding:4px 0px 0px 40px;">${params[i].data}</div>
+                  <div style="padding:4px 0px 0px 10px;">${params[i].seriesName} :</div>
+                  <div style="padding:4px 0px 0px 10px;">${params[i].data[1]}</div>
               </div>`; //可以在这个方法中做改变
             }
 
@@ -181,7 +175,7 @@ export default {
           right: "auto",
           left: "center",
           padding: [5, 10, 18, 10],
-          data: ["A相电流", "B相电流", "C相电流"],
+          data: this.Data_Name,
           itemGap: 70, // 图例间隔
           itemWidth: 40, // 图例宽度
           itemHeight: 15, //高度
@@ -192,7 +186,6 @@ export default {
               "font-family: Microsoft YaHei Regular, Microsoft YaHei Regular-Regular;",
             padding: [5, 10, 18, 10],
           },
-
           formatter: function (name) {
             return name;
           },
@@ -208,7 +201,7 @@ export default {
         },
         xAxis: {
           type: "time",
-          // boundaryGap: false,
+          boundaryGap: false,
           nameTextStyle: {
             // 名称样式
             fontSize: 12,
@@ -217,20 +210,20 @@ export default {
           },
           axisLine: {
             lineStyle: {
-              color: this.color_XY,
+              color: "rgba(0, 244, 253, 0.1)",
             },
             // symbol: ["none", "arrow"], //轴线两边的箭头
             symbolSize: [8, 12],
           },
-          interval: 2,
           axisLabel: {
+            showMaxLabel: true,
             textStyle: {
               color: "#fff", //坐标值得具体的颜色
             },
             // formatter: '{yyyy}-{MM}-{dd}'
             formatter: {
               year: "{yyyy}",
-              month: "{MMM}",
+              month: "{yyyy} {MM}-{dd}",
               day: "{MM}-{dd} {hh}:{mm}",
               hour: "{MM}-{dd} {HH}:{mm}",
               minute: "{HH}:{mm}",
@@ -242,7 +235,6 @@ export default {
         },
         yAxis: {
           type: "value",
-          max: 0.15,
           splitLine: {
             lineStyle: {
               // 使用深浅的间隔色
@@ -255,48 +247,10 @@ export default {
             },
           },
         },
-        series: [
-          {
-            // smooth: true,  //设置折线为圆滑曲线,false则有转折点
-            name: "A相电流",
-            type: "line",
-            data: arr,
-            itemStyle: this.itemStyle[0],
-            symbolSize: 10,
-            symbol: "circle",
-          },
-          {
-            name: "B相电流",
-            type: "line",
-            data: [
-              0.015, 0.01, 0.015, 0.012, 0.01, 0.012, 0.01, 0.01, 0.06, 0.04,
-              0.007, 0, 0.015, 0.01, 0.015, 0.012, 0.01, 0.012, 0.01, 0.01,
-              0.06, 0.04, 0.007, 0,
-            ].map((val, ind) => {
-              return [data[ind], val];
-            }), //0.01,
-            itemStyle: this.itemStyle[1],
-            symbolSize: 10,
-            symbol: "circle",
-          },
-          {
-            name: "C相电流",
-            type: "line",
-            data: [
-              0.02, 0, 0.03, 0.04, 0.03, 0.04, 0.02, 0.03, 0.009, 0.03, 0.006,
-              0.008, 0.02, 0, 0.03, 0.04, 0.03, 0.04, 0.02, 0.03, 0.009, 0.03,
-              0.006, 0.008,
-            ].map((val, ind) => {
-              return [data[ind], val];
-            }), //0.005,
-            itemStyle: this.itemStyle[2],
-            symbolSize: 10,
-            symbol: "circle",
-          },
-        ],
+        series: this.series_all,
       };
 
-      chart.setOption(option);
+      chart.setOption(option,true);
       window.addEventListener("resize", () => {
         chart.resize();
       });