dong преди 2 месеца
родител
ревизия
d86a3e6dc7

+ 4 - 4
src/views/dashboard/Analysis.vue

@@ -170,7 +170,7 @@ export default {
       // 运维统计前端绘制
       operaContent: [
         { type: 'repair', title: '设备当前运行数', completed: 'machineCompleted', completedTitle: 'machineCompleted', incomplete: 'machineIncomplete', 
-          incompleteTitle: 'machineIncomplete', legend: 'hdd', class: 'spotcheck', to: '/ehm/status' },
+          incompleteTitle: 'machineIncomplete', legend: 'hdd', class: 'spotcheck', to: '/ehm/runsearch' },
         // { type: 'repair', title: '未处理报警', completed: 'alarmCompleted', completedTitle: 'alarmCompleted', incomplete: 'alarmIncomplete', 
         //   incompleteTitle: 'alarmIncomplete', legend: 'a-icon-warning warning', to: '/alarmManage/handleAlarm' },
         { type: 'repair', title: '待维修任务', completed: 'repairCompleted', completedTitle: 'repairCompleted', incomplete: 'repairIncomplete', 
@@ -178,7 +178,7 @@ export default {
         { type: 'repair', title: '待保养任务', completed: 'upkeepCompleted', completedTitle: 'upkeepCompleted', incomplete: 'upkeepIncomplete', 
           incompleteTitle: 'upkeepIncomplete', legend: 'book', class: 'upkeep', to: '/cmms/upkeep/upkeep' },
         { type: 'repair', title: '待巡检任务', completed: 'inspectCompleted', completedTitle: 'inspectCompleted', incomplete: 'inspectIncomplete', 
-          incompleteTitle: 'inspectIncomplete', legend: 'interaction', class: 'inspect', to: '/cmms/inspect' },
+          incompleteTitle: 'inspectIncomplete', legend: 'interaction', class: 'inspect', to: '/cmms/inspectorder' },
       ],
       // 运维统计后端数据
       operaStatistics: {
@@ -260,10 +260,10 @@ export default {
     },
     // 处理/查看
     chakan(){
-      this.$router.push({path: '/msgcharge'})
+      this.$router.push({path: '/messageAlarm'})
     },
     chakan2(){
-      this.$router.push({path: '/msgnotice'})
+      this.$router.push({path: '/messageNotification'})
     },
     // 正式需要删除
     getTest() {

+ 14 - 11
src/views/module_tpm/equipmentRunStatis/history.vue

@@ -10,14 +10,14 @@
           </a-col>
           <a-col :xl="6" :lg="11" :md="12" :sm="24">
             <a-form-item label="查询日期">
-              <a-range-picker date-format="YYYY-MM-DD" v-model="queryParams.date" @change="handleQuery" />
+              <a-date-picker v-model="queryParams.date" placeholder="选择日期" style="width:100%;" @change="handleSearch" />
             </a-form-item>
           </a-col>
-          <a-col :xl="6" :lg="7" :md="8" :sm="24">
+          <!-- <a-col :xl="6" :lg="7" :md="8" :sm="24">
             <a-form-item label="参数类型">
               <j-dict-select-tag v-model="queryParams.tagtype"  placeholder="请输入优先级" dictCode="tpm_tag_type"/>
             </a-form-item>
-          </a-col>
+          </a-col> -->
           <a-col :xl="6" :lg="7" :md="8" :sm="24">
             <span style="float: left; overflow: hidden" class="table-page-search-submitButtons">
               <a-button type="primary" @click="handleQuery" icon="search">查询</a-button>
@@ -80,13 +80,11 @@ export default {
       tpmequiponoffsectionList: [],
       // 查询参数
       queryParams: {
-        date: [],
-        day_begin: '',
-        day_end: '',
+        date: '',
         pageNum: 1,
         pageSize: 1000,
         equipmentid: '1780110297413861377',
-        tagtype: null,
+        // tagtype: null,
       },
       dataSource: [],
       url: {
@@ -176,10 +174,7 @@ export default {
   mounted() {
     this.$nextTick(() => {
       var now = this.dateformat(new Date()).substring(0, 10)
-      this.queryParams.date.push(now)
-      this.queryParams.date.push(now)
-      this.queryParams.day_begin = now
-      this.queryParams.day_end = now
+      this.queryParams.date = now
       // this.handleQuery()
       this.getTest()
     })
@@ -219,6 +214,14 @@ export default {
     },
     handleQuery() {
       var _this = this
+      if (!this.queryParams.equipmentid) {
+        this.$message.error('请选择设备!')
+        return
+      }
+      if (!this.queryParams.date) {
+        this.$message.error('请选择查询日期!')
+        return
+      }
       _this.loading = true
       getAction(this.url.list, _this.queryParams).then((response) => {
         _this.tpmequiponoffsectionList = response.result

+ 2 - 2
src/views/module_tpm/equipmentRunStatis/index.vue

@@ -1,10 +1,10 @@
 <template>
   <a-card :bordered="false" style="padding: 0px 10px 0px 10px;">
     <a-tabs v-model="curtab" @tab-click="tabClick">
-      <a-tab-pane tab="实时数据" key="realtime">
+      <a-tab-pane tab="折线展示" key="realtime">
         <realtime v-if="curtab === 'realtime'"></realtime>
       </a-tab-pane>
-      <a-tab-pane tab="历史数据" key="history">
+      <a-tab-pane tab="表格展示" key="history">
         <history v-if="curtab === 'history'"></history>
       </a-tab-pane>
     </a-tabs>

+ 373 - 367
src/views/module_tpm/equipmentRunStatis/realtime.vue

@@ -8,9 +8,9 @@
               <j-search-select-tag v-model="queryParams.equipmentid" dict="tpm_equipment,equipmentname,id"  style="width: 100%"/>
             </a-form-item>
           </a-col>
-          <a-col :xl="4" :lg="7" :md="8" :sm="24">
-            <a-form-item label="参数类型">
-              <j-dict-select-tag v-model="queryParams.tagtype"  placeholder="请输入优先级" dictCode="tpm_tag_type"/>
+          <a-col :xl="6" :lg="11" :md="12" :sm="24">
+            <a-form-item label="查询日期">
+              <a-date-picker v-model="queryParams.date" placeholder="选择日期" style="width:100%;" @change="handleSearch" />
             </a-form-item>
           </a-col>
           <a-col :xl="6" :lg="7" :md="8" :sm="24">
@@ -23,44 +23,6 @@
     </div>    
     <div class="trend-charts" ref="trendCharts" :style="{ height: echartsHeight + 'px', }"></div>
 
-    <!-- table区域-begin -->
-    <div>
-      <a-table
-        ref="table"
-        size="middle"
-        :scroll="{ x: true }"
-        style="padding-top:10px;"
-        bordered
-        rowKey="id"
-        :columns="columns2"
-        :dataSource="dataSource"
-        :pagination="ipagination"
-        :rowSelection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }"
-        class="j-table-force-nowrap"
-        @change="handleTableChange"
-      >
-        <template slot="htmlSlot" slot-scope="text">
-          <div v-html="text"></div>
-        </template>
-        <template slot="imgSlot" slot-scope="text, record">
-          <span v-if="!text" style="font-size: 12px; font-style: italic">无图片</span>
-          <img
-            v-else
-            :src="getImgView(text)"
-            :preview="record.equipmentid"
-            height="25px"
-            alt=""
-            style="max-width: 80px; font-size: 12px; font-style: italic"
-          />
-        </template>
-        <template slot="fileSlot" slot-scope="text">
-          <span v-if="!text" style="font-size: 12px; font-style: italic">无文件</span>
-          <a-button v-else :ghost="true" type="primary" icon="download" size="small" @click="downloadFile(text)">
-            下载
-          </a-button>
-        </template>
-      </a-table>
-    </div>
   </div>
 </template>
 
@@ -88,83 +50,320 @@ export default {
       echartsHeight: window.innerHeight - 450,
       // 查询参数
       queryParams: {
-        pageNum: 1,
-        pageSize: 10,
         equipmentid: '1780110297413861377',
-        day: null,
-        tagtype: "5",
+        date: '',
       },
       url: {
         list: '/equipmentStatistics/equipmentStatistics/listday',
-        listinfo: '/equipmentStatistics/equipmentStatistics/listdayinfo',
       },
       // 时间
       timeList: [],
       // 表头
       columns: [],
-      columns1: [
-        {
-          title: '序号',
-          dataIndex: '',
-          key: 'rowIndex',
-          width: 60,
-          align: 'center',
-          customRender: function (t, r, index) {
-            return parseInt(index) + 1;
-          },
+      equipmentparams: [{"tagname": "电流", "symbol": "CURR"},{"tagname": "电压", "symbol": "VOLT"}],
+      mongodbdata: [
+        {
+          "logtime": "2024-02-05 07:02:00",
+          "CURR": 0.3,
+          "VOLT": 230
         },
         {
-          title: '点位名称',
-          align: 'center',
-          dataIndex: 'tagname',
+          "logtime": "2024-02-05 07:03:00",
+          "CURR": 0.3,
+          "VOLT": 380
         },
         {
-          title: '时间',
-          align: 'center',
-          dataIndex: 'logtime',
+          "logtime": "2024-02-05 07:04:00",
+          "CURR": 0.3,
+          "VOLT": 340
         },
         {
-          title: '值',
-          align: 'center',
-          dataIndex: 'tagvalue',
+          "logtime": "2024-02-05 07:05:00",
+          "CURR": 0.3,
+          "VOLT": 340
         },
-      ],
-      columns2: [
-        {
-          title: '序号',
-          dataIndex: '',
-          key: 'rowIndex',
-          width: 60,
-          align: 'center',
-          customRender: function (t, r, index) {
-            return parseInt(index) + 1;
-          },
+        {
+          "logtime": "2024-02-05 07:06:00",
+          "CURR": 0.2,
+          "VOLT": 380
+        },
+        {
+          "logtime": "2024-02-05 07:07:00",
+          "CURR": 0.2,
+          "VOLT": 400
+        },
+        {
+          "logtime": "2024-02-05 07:08:00",
+          "CURR": 0.2,
+          "VOLT": 390
+        },
+        {
+          "logtime": "2024-02-05 07:09:00",
+          "CURR": 0.2,
+          "VOLT": 430
+        },
+        {
+          "logtime": "2024-02-05 07:10:00",
+          "CURR": 0.2,
+          "VOLT": 480
+        },
+        {
+          "logtime": "2024-02-05 07:11:00",
+          "CURR": 0.3,
+          "VOLT": 360
+        },
+        {
+          "logtime": "2024-02-05 07:12:00",
+          "CURR": 0.3,
+          "VOLT": 340
+        },
+        {
+          "logtime": "2024-02-05 07:13:00",
+          "CURR": 0.2,
+          "VOLT": 390
+        },
+        {
+          "logtime": "2024-02-05 07:14:00",
+          "CURR": 0.3,
+          "VOLT": 360
+        },
+        {
+          "logtime": "2024-02-05 07:15:00",
+          "CURR": 0.2,
+          "VOLT": 340
+        },
+        {
+          "logtime": "2024-02-05 07:16:00",
+          "CURR": 0.2,
+          "VOLT": 370
+        },
+        {
+          "logtime": "2024-02-05 07:17:00",
+          "CURR": 0.3,
+          "VOLT": 390
+        },
+        {
+          "logtime": "2024-02-05 07:18:00",
+          "CURR": 0.3,
+          "VOLT": 340
+        },
+        {
+          "logtime": "2024-02-05 07:19:00",
+          "CURR": 0.2,
+          "VOLT": 330
+        },
+        {
+          "logtime": "2024-02-05 07:20:00",
+          "CURR": 0.3,
+          "VOLT": 320
+        },
+        {
+          "logtime": "2024-02-05 07:21:00",
+          "CURR": 0.4,
+          "VOLT": 310
+        },
+        {
+          "logtime": "2024-02-05 07:22:00",
+          "CURR": 0.2,
+          "VOLT": 351
+        },
+        {
+          "logtime": "2024-02-05 07:23:00",
+          "CURR": 0.4,
+          "VOLT": 350
+        },
+        {
+          "logtime": "2024-02-05 07:24:00",
+          "CURR": 0.4,
+          "VOLT": 330
+        },
+        {
+          "logtime": "2024-02-05 07:25:00",
+          "CURR": 0.2,
+          "VOLT": 280
+        },
+        {
+          "logtime": "2024-02-05 07:26:00",
+          "CURR": 0.4,
+          "VOLT": 290
+        },
+        {
+          "logtime": "2024-02-05 07:27:00",
+          "CURR": 0.4,
+          "VOLT": 290
+        },
+        {
+          "logtime": "2024-02-05 07:28:00",
+          "CURR": 0.4,
+          "VOLT": 290
+        },
+        {
+          "logtime": "2024-02-05 07:29:00",
+          "CURR": 0.5,
+          "VOLT": 280
+        },
+        {
+          "logtime": "2024-02-05 07:30:00",
+          "CURR": 0.4,
+          "VOLT": 270
+        },
+        {
+          "logtime": "2024-02-05 07:31:00",
+          "CURR": 0.2,
+          "VOLT": 270
+        },
+        {
+          "logtime": "2024-02-05 07:32:00",
+          "CURR": 0.4,
+          "VOLT": 270
+        },
+        {
+          "logtime": "2024-02-05 07:33:00",
+          "CURR": 0.4,
+          "VOLT": 280
+        },
+        {
+          "logtime": "2024-02-05 07:34:00",
+          "CURR": 0.3,
+          "VOLT": 310
+        },
+        {
+          "logtime": "2024-02-05 07:35:00",
+          "CURR": 0.2,
+          "VOLT": 280
+        },
+        {
+          "logtime": "2024-02-05 07:36:00",
+          "CURR": 0.3,
+          "VOLT": 250
+        },
+        {
+          "logtime": "2024-02-05 07:37:00",
+          "CURR": 0.2,
+          "VOLT": 265
+        },
+        {
+          "logtime": "2024-02-05 07:38:00",
+          "CURR": 0.3,
+          "VOLT": 270
+        },
+        {
+          "logtime": "2024-02-05 07:39:00",
+          "CURR": 0.2,
+          "VOLT": 280
+        },
+        {
+          "logtime": "2024-02-05 07:40:00",
+          "CURR": 0.4,
+          "VOLT": 280
+        },
+        {
+          "logtime": "2024-02-05 07:41:00",
+          "CURR": 0.3,
+          "VOLT": 300
+        },
+        {
+          "logtime": "2024-02-05 07:42:00",
+          "CURR": 0.4,
+          "VOLT": 300
+        },
+        {
+          "logtime": "2024-02-05 07:43:00",
+          "CURR": 0.3,
+          "VOLT": 290
         },
         {
-          title: '点位名称',
-          align: 'center',
-          // dataIndex: 'tagname',
-          dataIndex: 'MeterCode',
+          "logtime": "2024-02-05 07:44:00",
+          "CURR": 0.3,
+          "VOLT": 290
         },
         {
-          title: '时间',
-          align: 'center',
-          // dataIndex: 'logtime',
-          dataIndex: 'Time',
+          "logtime": "2024-02-05 07:45:00",
+          "CURR": 0.4,
+          "VOLT": 300
         },
         {
-          title: '值',
-          align: 'center',
-          // dataIndex: 'tagvalue2',
-          dataIndex: 'Power',
+          "logtime": "2024-02-05 07:46:00",
+          "CURR": 0.5,
+          "VOLT": 300
         },
+        {
+          "logtime": "2024-02-05 07:47:00",
+          "CURR": 0.4,
+          "VOLT": 320
+        },
+        {
+          "logtime": "2024-02-05 07:48:00",
+          "CURR": 0.3,
+          "VOLT": 340
+        },
+        {
+          "logtime": "2024-02-05 07:49:00",
+          "CURR": 0.4,
+          "VOLT": 340
+        },
+        {
+          "logtime": "2024-02-05 07:50:00",
+          "CURR": 0.4,
+          "VOLT": 360
+        },
+        {
+          "logtime": "2024-02-05 07:51:00",
+          "CURR": 0.4,
+          "VOLT": 380
+        },
+        {
+          "logtime": "2024-02-05 07:52:00",
+          "CURR": 0.4,
+          "VOLT": 400
+        },
+        {
+          "logtime": "2024-02-05 07:53:00",
+          "CURR": 0.4,
+          "VOLT": 430
+        },
+        {
+          "logtime": "2024-02-05 07:54:00",
+          "CURR": 0.3,
+          "VOLT": 430
+        },
+        {
+          "logtime": "2024-02-05 07:55:00",
+          "CURR": 0.4,
+          "VOLT": 380
+        },
+        {
+          "logtime": "2024-02-05 07:56:00",
+          "CURR": 0.4,
+          "VOLT": 350
+        },
+        {
+          "logtime": "2024-02-05 07:57:00",
+          "CURR": 0.5,
+          "VOLT": 340
+        },
+        {
+          "logtime": "2024-02-05 07:58:00",
+          "CURR": 0.5,
+          "VOLT": 360
+        },
+        {
+          "logtime": "2024-02-05 07:59:00",
+          "CURR": 0.5,
+          "VOLT": 340
+        },
+        {
+          "logtime": "2024-02-05 08:00:00",
+          "CURR": 0.5,
+          "VOLT": 340
+        }
       ],
     }
   },
   created() {},
   mounted() {
     var now = this.dateformat(new Date()).substring(0, 10)
-    this.queryParams.day = now
+    this.queryParams.date = now
     this.$nextTick(() => {
     })
   },
@@ -186,323 +385,130 @@ export default {
     },
     /** 查询设备运行状态时间段列表 */
     loadData(arg) {
+      var _this = this
+      setTimeout(function() {
+        _this.getList();
+      }, 1000);
+    },
+    getList(){
       var _this = this;
       if (!this.url.list) {
         this.$message.error('请设置url.list属性!')
         return
       }
       if (!this.queryParams.equipmentid) {
+        this.$message.error('请选择设备!')
         return
       }
-      //加载数据 若传入参数1则加载第一页的内容
-      if (arg === 1) {
-        this.ipagination.current = 1
-      }
-      var params = this.getQueryParams() //查询条件
-      params.equipmentid = !this.queryParams.equipmentid ? '' : this.queryParams.equipmentid
-      params.day = !this.queryParams.day ? '' : this.queryParams.day
-      params.tagtype = !this.queryParams.tagtype ? '' : this.queryParams.tagtype
-      // this.loading = true
-
-      // 电量用另外一个列定义
-      if (params.tagtype == "7") {
-        this.columns = this.columns2;
-      }
-      else {
-        this.columns = this.columns1;
+      if (!this.queryParams.date) {
+        this.$message.error('请选择查询日期!')
+        return
       }
-
       // 获取图表信息
-      // getAction(_this.url.listinfo, params).then((res) => {
+      // getAction(_this.url.list, _this.queryParams).then((res) => {
       //   if (res.success) {
       //     _this.dataInfo = res.result.records || res.result;
-      //     _this.getList(params);
       //     _this.initEcharts();
       //   } else {
       //     this.$message.warning(res.message)
       //   }
       // });
-      setTimeout(() => {
-        this.getTest()
-      }, 2000)
-      // this.loading = false
-    },
-    
-    // 获取表格信息
-    getList(params) {
-      getAction(this.url.list, params).then((res) => {
-        if (res.success) {
-          //update-begin---author:zhangyafei    Date:20201118  for:适配不分页的数据列表------------
-          this.dataSource = res.result.records || res.result
-          if (res.result.total) {
-            this.ipagination.total = res.result.total
-          } else {
-            this.ipagination.total = 0
-          }
-          //update-end---author:zhangyafei    Date:20201118  for:适配不分页的数据列表------------
-        } else {
-          this.$message.warning(res.message)
-        }
-      })
+      this.getTest();
     },
-    // 后端好了需要删掉    
+    // 后端好了需要删掉
     getTest() {
-      var _this = this;
-      var rowid=0;
-      _this.times = [],
-      _this.gd02us = [],
-      _this.gd03us = [],
-      _this.gd05us = [],
-      _this.gd06us = [],
-      pvdata.mdcurveanalysisdata.forEach((item) => {
-        item.data.forEach((i) => {
-          i.id = rowid;
-          _this.dataSource.push(i)
-          rowid++;
-
-          if (item.meterName === 'GD02') {
-            _this.times.push(i.Time.substring(11, 16));
-            _this.gd02us.push(i.Ua.toFixed(1));
-          }
-          else if (item.meterName === 'GD03') {
-            _this.gd03us.push(i.Ua.toFixed(1));
-          }
-          else if (item.meterName === 'GD05') {
-            _this.gd05us.push(i.Ua.toFixed(1));
-          }
-          else if (item.meterName === 'GD06') {
-            _this.gd06us.push(i.Ua.toFixed(1));
-          }
-        })
-      })
-      _this.initEcharts()
+      var _this = this
+      _this.gd02us = []
+      _this.times = []
+      this.initEcharts()
     },
-    // 后端好了需要删掉
     initEcharts() {
       var _this = this
-      var chartDom = _this.$refs.trendCharts
-      _this.myChart && _this.myChart.dispose();
+      var chartDom = this.$refs.trendCharts
       _this.myChart = echarts.init(chartDom)
+      _this.echartsHeight = 4 * 300;
 
-      var option = {
-        animationDuration: 3000, // 动态,刷新时长,3秒
-        tooltip: {
-          trigger: 'axis',
-          position: function (pt) {
-            return [pt[0], '20%']
+      // 获取time
+      _this.mongodbdata.forEach((i) => {
+        _this.times.push(i.logtime.substring(11, 16))
+      });      
+
+      var leftValue = '5%';
+      // Grid配置
+      var grid = [];
+      // xAxis配置
+      var xAxis = [];
+      // yAxis配置
+      var yAxis = [];
+      // series配置
+      var series1 = [];
+      var paramscount = 0;
+      var paramslength = _this.equipmentparams.length;
+      _this.equipmentparams.forEach((item) => {
+        grid.push({left: leftValue, top: (0.05 + (paramscount) / paramslength) * 100 + "%", bottom: (1.05 - (paramscount + 1) / paramslength) * 100 + "%"});
+
+        xAxis.push({
+          type: 'category',
+          gridIndex: paramscount,
+          boundaryGap: false,
+          name: item.symbol,
+          data: _this.times,
+        });
+
+        yAxis.push({ type: 'value', gridIndex: paramscount });
+
+        // 获取数据
+        var realtimedata = [];
+        _this.mongodbdata.forEach((i) => {
+          realtimedata.push(i[item.symbol])
+        });
+        series1.push({
+          name: item.symbol,
+          type: 'line',
+          symbol: 'none',
+          sampling: 'lttb',
+          xAxisIndex: paramscount,
+          yAxisIndex: paramscount,
+          itemStyle: {
+            color: '#91CC75',
           },
-        },
+          data: realtimedata
+        });
+
+        paramscount++;
+      })
+      console.log("grid", grid)
+      console.log("xAxis", xAxis)
+      console.log("yAxis", yAxis)
+      console.log("series1", series1)
+      var option = {
         title: {
           left: 'left',
-          text: '参数历史数据',
+          text: '设备运行数据趋势预测',
         },
         legend: {
-          data: ['GD02 U', 'GD03 U', 'GD05 U', 'GD06 U'],
+          data: ['实际值'],
         },
-        xAxis: {
-          type: 'category',
-          boundaryGap: false,
-          data: _this.times,
-        },
-        yAxis: {
-          type: 'value',
-          boundaryGap: [0, '100%'],
-        },
-        dataZoom: [
-          {
-            type: 'inside',
-            start: 0,
-            end: 100,
-            xAxisIndex: 0,
-          },
-          {
-            start: 0,
-            end: 10,
-          },
-          {
-            show: true,
-            yAxisIndex: 0,
-            filterMode: 'empty',
-            width: 30,
-            height: '80%',
-            right: '7%',
-          },
-        ],
-        series: [
-          {
-            name: 'GD02 U',
-            type: 'line',
-            symbol: 'none',
-            sampling: 'lttb',
-            itemStyle: {
-              color: '#91CC75',
-            },
-            markPoint: {
-              data: [
-                { type: 'max', name: 'Max' },
-                { type: 'min', name: 'Min' },
-              ],
-            },
-            data: _this.gd02us,
-          },
-          {
-            name: 'GD03 U',
-            type: 'line',
-            symbol: 'none',
-            sampling: 'lttb',
-            itemStyle: {
-              color: '#EE6666',
-            },
-            markPoint: {
-              data: [
-                { type: 'max', name: 'Max' },
-                { type: 'min', name: 'Min' },
-              ],
-            },
-            data: _this.gd03us,
-          },
-          {
-            name: 'GD05 U',
-            type: 'line',
-            symbol: 'none',
-            sampling: 'lttb',
-            itemStyle: {
-              color: '#FAAD14',
-            },
-            markPoint: {
-              data: [
-                { type: 'max', name: 'Max' },
-                { type: 'min', name: 'Min' },
-              ],
-            },
-            data: _this.gd05us,
-          },
-          {
-            name: 'GD06 U',
-            type: 'line',
-            symbol: 'none',
-            sampling: 'lttb',
-            itemStyle: {
-              color: '#5470C6',
-            },
-            markPoint: {
-              data: [
-                { type: 'max', name: 'Max' },
-                { type: 'min', name: 'Min' },
-              ],
-            },
-            data: _this.gd06us,
-          },
-        ],
-      }
-
+        grid: grid,
+        xAxis: xAxis,
+        yAxis: yAxis,
+        series: series1
+      };
+      
       option && _this.myChart.setOption(option)
+      setTimeout(() => {
+        _this.myChart.resize()
+      }, 1000)
 
       window.addEventListener('resize', function () {
         _this.myChart.resize()
       })
     },
     /** 搜索按钮操作 */
-    handleSearch(param) {
-      this.getTest()
-      // this.getDemandanalysis()
+    handleSearch(arg) {
+      this.loadData(arg)
     },
   },
-    // initEcharts() {
-    //   var _this = this
-    //   var chartDom = _this.$refs.trendCharts;
-    //   _this.myChart && _this.myChart.dispose();
-    //   _this.myChart = echarts.init(chartDom)
-
-    //   var legends = [];
-    //   var seriess = [];
-    //   _this.times = [];
-    //   var rec = 0;
-    //   _this.dataInfo.tag.forEach(item => {
-    //     legends.push(item.tagname);
-    //     var realdatas = [];
-    //     _this.dataInfo.list[rec].forEach(realdata => {
-    //       // 电量获取值的方法不一样
-    //       if (_this.queryParams.tagtype == "7") {
-    //         realdatas.push(realdata.tagvalue2);
-    //       }
-    //       else {
-    //         realdatas.push(realdata.tagvalue);
-    //       }
-    //     });
-    //     seriess.push({
-    //       name: item.tagname,
-    //       type: 'line',
-    //       symbol: 'none',
-    //       sampling: 'lttb',
-    //       markPoint: {
-    //         data: [
-    //           { type: 'max', name: 'Max' },
-    //           { type: 'min', name: 'Min' },
-    //         ],
-    //       },
-    //       data: realdatas,
-    //     });
-    //     console.log(rec, seriess);
-    //     rec++;
-    //   });
-
-    //   _this.dataInfo.list[0].forEach(item => {
-    //     _this.times.push(item.logtime);
-    //   });
-
-    //   var option = {
-    //     tooltip: {
-    //       trigger: 'axis',
-    //       position: function (pt) {
-    //         return [pt[0], '20%']
-    //       },
-    //     },
-    //     title: {
-    //       left: 'left',
-    //       text: '实时数据',
-    //     },
-    //     legend: {
-    //       data: legends,
-    //     },
-    //     xAxis: {
-    //       type: 'category',
-    //       boundaryGap: false,
-    //       data: _this.times,
-    //     },
-    //     yAxis: {
-    //       type: 'value',
-    //       boundaryGap: [0, '100%'],
-    //     },
-    //     dataZoom: [
-    //       {
-    //         type: 'inside',
-    //         start: 0,
-    //         end: 100,
-    //         xAxisIndex: 0,
-    //       },
-    //       {
-    //         start: 0,
-    //         end: 10,
-    //       },
-    //       {
-    //         show: true,
-    //         yAxisIndex: 0,
-    //         filterMode: "empty",
-    //         width: 30,
-    //         height: "80%",
-    //         right: "7%",
-    //       },
-    //     ],
-    //     series: seriess,
-    //   }
-
-    //   option && _this.myChart.setOption(option)
-
-    //   window.addEventListener('resize', function () {
-    //     _this.myChart.resize()
-    //   })
-    // },
 }
 </script>
 

+ 46 - 30
src/views/module_tpm/healthDashboard/index.vue

@@ -24,17 +24,17 @@
       <a-col :span="5" style="padding-left: 10px; padding-right: 18px">
         <a-card :body-style="{ padding: '10px 8px 8px', height: '910px' }" :bordered="false">
           <span class="leftHeader common-title"></span>
-          <span class="head-title">重点关注设备</span>
+          <span class="head-title">今日重点关注设备</span>
           <a-row>
             <a-col>
               <div class="head-info">
-                <span>电动单梁桥式起重机(63011909034)设备检测异常,需要维修人员核实。</span>
+                <span v-html="equipmentInfo"></span>
               </div>
             </a-col>
           </a-row>
           <a-divider style="margin: 8px 0" />
-          <span class="leftHeader common-title"></span>
-          <span class="head-title">重点关注产线</span>
+          <!-- <span class="leftHeader common-title"></span>
+          <span class="head-title">今日重点关注产线</span>
           <a-row>
             <a-col>
               <div class="head-info">
@@ -42,13 +42,13 @@
               </div>
             </a-col>
           </a-row>
-          <a-divider style="margin: 8px 0" />
+          <a-divider style="margin: 8px 0" /> -->
           <span class="leftHeader common-title"></span>
-          <span class="head-title">日运维提醒</span>
+          <span class="head-title">日运维提醒</span>
           <a-row>
             <a-col>
               <div class="head-info">
-                <span>储气罐(55091203000005)阀门异常,需要更换。</span>
+                <span v-html="devopsInfo"></span>
               </div>
             </a-col>
           </a-row>
@@ -196,11 +196,15 @@ export default {
         listAlarmdata: '/tpmMessageAlarm/tpmMessageAlarm/list',
         dashboard: '/healthStatistics/healthStatistics/dashboard',
       },
+      myChart1: null,
+      myChart2: null,
+      myChart3: null,
+      equipmentInfo: "",
+      devopsInfo: "",
     }
   },
   created() {
-    this.getAlarmList();
-    this.getInfo();
+    this.refreshData();
   },
   mounted() {
     this.$nextTick(() => {
@@ -241,13 +245,19 @@ export default {
       this.daySectionList = [];
       this.days = [];
     },
+    refreshData() {
+      this.getAlarmList();
+      this.getInfo();
+      // 定时刷新 2分钟
+      setTimeout(() => {
+        this.refreshData()
+      }, 120000)
+    },
     getInfo() {
       var _this = this
       this.initParams();
 
       getAction(this.url.dashboard, null).then((response) => {
-        console.log("response", response.result)
-
         // 日期
         _this.days = response.result.days;
 
@@ -289,6 +299,9 @@ export default {
           _this.yearSectionList.unhealth.push(item.unhealthduration)
           _this.yearSectionList.offline.push(item.offlineduration)
         });
+
+        _this.equipmentInfo = response.result.equipmentInfo;
+        _this.devopsInfo = response.result.devopsInfo;
         
         this.initEcharts();
         this.initEfficEcharts();
@@ -310,8 +323,10 @@ export default {
     // 设备健康统计
     initEcharts() {
       var _this = this
-      var chartDom = this.$refs.elecCharts
-      var myChart = echarts.init(chartDom)
+      if (_this.myChart1 == null) {
+        var chartDom = _this.$refs.elecCharts
+        _this.myChart1 = echarts.init(chartDom)
+      }
 
       var option = {
         legend: {
@@ -406,20 +421,21 @@ export default {
         ],
       }
 
-      option && myChart.setOption(option)
+      option && _this.myChart1.setOption(option)
 
       window.addEventListener('resize', function () {
-        myChart.resize()
+        _this.myChart1.resize()
       })
     },
     // 设备健康统计
     initEfficEcharts() {
       var _this = this
-      var chartDom = this.$refs.efficCharts
-      var myChart = echarts.init(chartDom)
-      var option
+      if (_this.myChart2 == null) {
+        var chartDom = _this.$refs.efficCharts
+        _this.myChart2 = echarts.init(chartDom)
+      }
 
-      option = {
+      var option = {
         color: ['#27b150', '#f9ba27', '#ff4949', '#cdcdcd'],
         legend: {
           selectedMode: true,
@@ -470,20 +486,20 @@ export default {
         ],
       }
 
-      option && myChart.setOption(option)
+      option && _this.myChart2.setOption(option)
 
       window.addEventListener('resize', function () {
-        myChart.resize()
+        _this.myChart2.resize()
       })
     },
     // 设备健康分布
     initStatusEcharts() {
       var _this = this
-      var chartDom = this.$refs.statusCharts
-      var myChart = echarts.init(chartDom)
-      var option
-
-      option = {
+      if (_this.myChart3 == null) {
+        var chartDom = _this.$refs.statusCharts
+        _this.myChart3 = echarts.init(chartDom)
+      }
+      var option = {
         title: {
           text: '设备健康分布(今日)'
         },
@@ -494,7 +510,7 @@ export default {
               { text: '健康', max: 100 },
               { text: '亚健康', max: 30 },
               { text: '高危', max: 30 },
-              { text: '离线', max: 50 }
+              { text: '离线', max: 100 }
             ],
             radius: 120,
             startAngle: 90,
@@ -546,10 +562,10 @@ export default {
         ],
       }
 
-      option && myChart.setOption(option)
+      option && _this.myChart3.setOption(option)
 
       window.addEventListener('resize', function () {
-        myChart.resize()
+        _this.myChart3.resize()
       })
     },
   },
@@ -589,7 +605,7 @@ export default {
     width: 100%;
     font-size: 16px;
     font-weight: 400;
-    height: 250px;
+    height: 370px;
     // border: 1px solid #148cb1;
   }
   .leftHeader {