Преглед изворни кода

Merge branch 'system-integration' of http://39.106.8.246:3003/web/ibms into system-integration

zhulizhen1111 пре 4 година
родитељ
комит
b9ca2fba12

+ 6 - 6
config/prod.env.js

@@ -1,14 +1,14 @@
 'use strict'
 module.exports = {
   NODE_ENV: '"production"',
-  // BASE_URL: '"http://172.16.44.215"', //测试iframe地址
-  // SSO_SERVER: '"http://172.16.44.235:8081"', //测试环境
+  BASE_URL: '"http://172.16.44.215"', //测试iframe地址
+  SSO_SERVER: '"http://172.16.44.235:8081"', //测试环境
   // BASE_URL: '"http://192.168.20.236"', //(新)测试iframe地址
   // SSO_SERVER: '"http://192.168.20.236:8086"', //(新)测试环境
-  // MQTT_SERVICE: '"ws://172.16.42.210:61614/stomp/"' //MQ测试环境地址
-  BASE_URL: '"http://mbi.sagacloud.cn"', //线上iframe地址
-  SSO_SERVER: '"http://sso.sagacloud.cn"',  //正式环境
-   MQTT_SERVICE: '"ws://adm.sagacloud.cn/stomp/"' //MQ正式环境地址
+  MQTT_SERVICE: '"ws://172.16.42.210:61614/stomp/"' //MQ测试环境地址
+  // BASE_URL: '"http://mbi.sagacloud.cn"', //线上iframe地址
+  // SSO_SERVER: '"http://sso.sagacloud.cn"',  //正式环境
+  //  MQTT_SERVICE: '"ws://adm.sagacloud.cn/stomp/"' //MQ正式环境地址
   // BASE_URL: '"http://182.92.126.202"', //线上iframe地址(龙湖)
   // SSO_SERVER: '"http://182.92.126.202:8889"',  //正式环境(龙湖)
   // MQTT_SERVICE: '"ws://182.92.126.202:61614/stomp/"' //MQ正式环境地址(龙湖)

+ 1 - 0
package.json

@@ -57,6 +57,7 @@
     "html-webpack-plugin": "^2.30.1",
     "less": "^3.9.0",
     "less-loader": "^4.1.0",
+    "moment": "^2.29.0",
     "node-notifier": "^5.1.2",
     "node-sass": "^4.11.0",
     "node-ssh": "^6.0.0",

Разлика између датотеке није приказан због своје велике величине
+ 338 - 175
src/api/scan/request.js


+ 134 - 0
src/components/point/report/curve.vue

@@ -0,0 +1,134 @@
+<template>
+  <el-dialog
+    :visible.sync="dialogVisible"
+    title="曲线"
+    class="curve"
+    @close="value = 0"
+  >
+    <el-select v-model="value" @change="handleTime">
+      <el-option
+        v-for="(item,index) in options"
+        :key="index"
+        :label="item"
+        :value="index">
+      </el-option>
+    </el-select>
+    <!-- 图表 -->
+    <div class="chart-area" ref="chart"></div>
+  </el-dialog>
+</template>
+
+<script>
+import echarts from 'echarts'
+import moment from 'moment'
+import {originalHistory} from '@/api/scan/request'
+
+export default {
+  name: "curve",
+  data() {
+    return {
+      lineChart: null,//折线表
+      chartData: [],//数据表
+      dialogVisible: false,
+      options: ['当日', '最近七天'],
+      value: 0,
+      row: {}
+    }
+  },
+  methods: {
+    handleTime() {
+      this.open(this.row, this.value)
+    },
+    /**
+     *@param row   当前行
+     *@param val  当前日期
+     */
+    open(row, val) {
+      this.row = row
+      let toDay = moment().format('YYYY-MM-DD 00:00:00'),
+        toCurrentDay = moment().format('YYYY-MM-DD HH:mm:ss'),
+        history7 = moment().subtract('days', 6).format('YYYY-MM-DD HH:mm:ss'),
+        Filters = '';
+      if (val == 1) {
+        Filters = `Time > '${history7}' and Time < '${toCurrentDay}'`
+      } else {
+        Filters = `Time > '${toDay}' and Time < '${toCurrentDay}'`
+      }
+      let param = {
+        PointId: row.Id,
+        ...row,
+        Filters,
+      }
+      originalHistory(param, res => {
+        let arr = res.Content ? res.Content : []
+        this.chartData = []
+        arr.forEach(i => this.chartData.push([moment(i.Time).format('YYYY-MM-DD'), i.Data]))
+      })
+      console.log(this.chartData)
+      this.timeoutSetVal()
+      this.dialogVisible = true
+    },
+    timeoutSetVal() {
+      setTimeout(() => {
+        if (this.$refs.chart) {
+          this.lineChart = echarts.init(this.$refs.chart);
+          let dateList = this.chartData.map(item => item[0]),
+            valueList = this.chartData.map(item => item[1]),
+            lineChartOption = {
+              visualMap: [
+                {
+                  show: false,
+                  type: 'continuous',
+                  seriesIndex: 1,
+                  dimension: 0,
+                  min: 0,
+                  max: dateList.length
+                }],
+              tooltip: {
+                trigger: 'axis'
+              },
+              xAxis: [{}, {
+                data: dateList,
+                gridIndex: 1
+              }],
+              yAxis: [{}, {
+                splitLine: {show: false},
+                gridIndex: 1
+              }],
+              grid: [{
+                bottom: '13%'
+              }, {
+                top: '45%'
+              }],
+              series: [
+                {
+                  type: 'line',
+                  showSymbol: false,
+                  data: valueList,
+                  xAxisIndex: 1,
+                  yAxisIndex: 1
+                }]
+            }
+          this.lineChart.setOption(lineChartOption);
+        } else {
+          this.timeoutSetVal()
+        }
+      }, 500)
+    },
+  },
+  mounted() {
+    let _this = this
+    window.onresize = () => {
+      _this.lineChart.resize()
+    }
+  },
+}
+</script>
+
+<style scoped lang="less">
+.curve {
+  .chart-area {
+    height: 450px;
+  }
+}
+</style>

+ 0 - 2
src/components/point/report/integrateStatistics.vue

@@ -32,7 +32,6 @@
             <el-popover
               placement="right"
               width="300"
-              trigger="click"
               @hide="removeTestValue"
             >
               <div>测试报文</div>
@@ -126,7 +125,6 @@
   export default {
     data() {
       return {
-
         test: '',
         testLog: '',
         pointList: [],//点位数量集合

+ 101 - 18
src/components/point/report/tabControlTest.vue

@@ -1,6 +1,6 @@
 <template>
   <div id="controlTest">
-    <div class="query-area" style="padding:10px;">
+    <div class="query-area" style="padding:10px;" v-if="isShowSelect">
       <el-select v-model="originName" placeholder="请选择数据源" clearable @change="changeHandleSelect">
         <el-option
           v-for="(item,index) in selectAggregate.originList"
@@ -17,6 +17,15 @@
           :value="index">
         </el-option>
       </el-select>
+      <el-input
+        placeholder="输入整合ID或点位描述"
+        style="width: 220px"
+        v-model.trim="describe"
+        clearable
+        @change="handleDescribe"
+      >
+        <i slot="prefix" class="el-input__icon el-icon-search"></i>
+      </el-input>
       <span style="float: right">
     <el-popover
       placement="bottom"
@@ -30,10 +39,13 @@
     <el-button type="primary" size="mini" @click="implement">确定</el-button>
   </div>
   <el-button slot="reference">执行</el-button>
-</el-popover>
+    </el-popover>
         <i class="el-icon-download" style="cursor: pointer" @click="downloads" title="下载"/>
       </span>
     </div>
+    <div v-else class="query-area">
+      <el-button style="margin: 10px" @click="back">返回</el-button>
+    </div>
     <!-- 数据表格 -->
     <div class="table-area">
       <el-table
@@ -44,7 +56,7 @@
         :header-cell-style="headerStyle"
         @selection-change="handleSelectionChange"
       >
-        <el-table-column type="selection"/>
+        <el-table-column type="selection" v-if="isShowSelect"/>
         <el-table-column label="序号" type="index" align='center' width="55">
           <template slot-scope="scope">
             {{ scope.$index + (currentPage - 1) * pageSize + 1 }}
@@ -54,7 +66,13 @@
         <el-table-column prop='ReadWrite' label='读写' show-overflow-tooltip align='center'/>
         <el-table-column prop='Meterfunc' label='整合ID' show-overflow-tooltip align='center'/>
         <el-table-column prop='Description' label='点位描述' show-overflow-tooltip align='center'/>
-        <el-table-column prop='Status' label='状态' show-overflow-tooltip align='center'/>
+        <el-table-column prop='Status' label='状态' show-overflow-tooltip align='center'>
+          <template slot-scope="scope">
+            <span v-if="scope.row.Status== 0">进行中</span>
+            <span v-if="scope.row.Status== 1">成功</span>
+            <span v-if="scope.row.Status== 2">失败</span>
+          </template>
+        </el-table-column>
         <el-table-column prop='Data' label='反馈值' show-overflow-tooltip align='center'/>
       </el-table>
       <!-- 分页 -->
@@ -65,18 +83,21 @@
         style="float:right;margin-top:10px;padding:2px 5px;">
       </el-pagination>
     </div>
-
   </div>
 </template>
 
 <script>
 import {pointTest, settingValue} from '@/api/scan/request'
+import axios from "axios";
+import {mapGetters} from 'vuex'
 
 export default {
   name: "tabControlTest",
   props: ['selectAggregate'],
   data() {
     return {
+      isShowSelect: true,
+      describe: '',
       pageSizes: [10, 20, 50, 100],
       pageSize: 50,
       currentPage: 1,
@@ -99,18 +120,41 @@ export default {
   created() {
     this.getSettingValue()
   },
+  computed: {
+    ...mapGetters('layout', ['projectId'])
+  },
   methods: {
+    //返回
+    back() {
+      this.isShowSelect = true
+      this.getSettingValue()
+    },
+    //搜索
+    handleDescribe() {
+      if (this.describe) {
+        let Filters = `Description='${this.describe}' or Meterfunc='${this.describe}';`
+        this.getSettingValue(Filters)
+      } else {
+        this.getSettingValue()
+      }
+
+    },
     //执行
     implement() {
-      let list = this.multipleSelection.map(i => ({Data:this.instructions,...i}))
       this.visible = false
-      this.getPointTest(list)
+      if (this.multipleSelection) {
+        let list = this.multipleSelection
+        list.forEach(i => i.Data = this.instructions)
+        this.getPointTest(list)
+      } else {
+        return false
+      }
+      this.instructions = ''
     },
     //当前设定值
-    getSettingValue() {
+    getSettingValue(val) {
       let _this = this
       _this.loading = true;
-
       let param = {
         PageNumber: this.currentPage,
         PageSize: this.pageSize
@@ -121,6 +165,9 @@ export default {
       if (_this.statusName) {
         Filters += `ReadWrite='${_this.statusName}';`
       }
+      if (val) {
+        Filters += val
+      }
       let index = Filters.lastIndexOf(';')
       Filters = Filters.substring(0, index)
       param.Filters = Filters !== '' ? Filters : undefined
@@ -133,12 +180,22 @@ export default {
 
     //点位测试
     getPointTest(list) {
-      pointTest(list, res => {
-        this.tableDate = res.Content
-
-      })
+      // pointTest(list, res => {
+      //   this.tableDate = res.Content
+      //
+      // })
+      pointTest(list).then(res => {
+        if (res.data.Result === "failure") {
+          this.$message.error('执行失败')
+          this.getSettingValue()
+        } else {
+          this.isShowSelect = false
+          this.tableDate = res.data.Content
+        }
+      });
     },
     changeHandleSelect() {
+      this.currentPage = 1
       this.getSettingValue()
     },
 
@@ -158,11 +215,37 @@ export default {
     },
     //点击下载
     downloads() {
-      let a = document.createElement('a')
-      a.href = '/pointconfig/datasource/pointset-present-download'
-      a.download = '控制测试'
-      a.click()
-      document.body.removeChild(a)
+      let param = {
+        method: 'post',
+        url: `/pointconfig/datasource/pointset-present-download`,
+        responseType: 'blob',
+        headers: {
+          ProjectId: this.projectId
+        },
+        data: {},
+      }
+
+      axios(param).then(function (res) {
+        var blob = new Blob([res.data], {
+          type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8'
+        });
+        var fileName = res.headers['content-disposition'];
+        if (fileName)
+          fileName = fileName.substring(fileName.indexOf('=') + 1);
+        if ('download' in document.createElement('a')) { // 非IE下载
+          const elink = document.createElement('a')
+          elink.download = fileName
+          elink.style.display = 'none'
+          elink.href = URL.createObjectURL(blob)
+          document.body.appendChild(elink)
+          elink.click()
+          URL.revokeObjectURL(elink.href) // 释放URL 对象
+          document.body.removeChild(elink)
+        } else { // IE10+下载
+          navigator.msSaveBlob(blob, fileName)
+        }
+      }).catch(function (err) {
+      })
     },
   }
 }

+ 52 - 64
src/components/point/report/tabFunDetail.vue

@@ -30,9 +30,8 @@
       <el-button @click="handleControl">控制测试</el-button>
         <i class="el-icon-refresh" style="cursor: pointer;padding: 0 15px" title="刷新" @click="getOverViewList"/>
         <i class="el-icon-download" style="cursor: pointer" @click="downloads" title="下载"/>
-<!--        <a class="el-icon-download" style="cursor: pointer"   href="/pointconfig/datasource/pointdetail-download"-->
-<!--           download="检测详情"title="下载"/>-->
-
+        <!--        <a class="el-icon-download" style="cursor: pointer"   href="/pointconfig/datasource/pointdetail-download"-->
+        <!--           download="检测详情"title="下载"/>-->
       </span>
     </div>
     <!-- 数据表格 -->
@@ -71,58 +70,40 @@
 
       </el-table>
       <!-- 分页 -->
-      <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="currentPage"
-                     :page-sizes="pageSizes"
-                     :page-size="pageSize" layout="total, sizes, prev, pager, next, jumper" :total="total"
-                     style="float:right;margin-top:10px;padding:2px 5px;">
+      <el-pagination
+        @size-change="handleSizeChange"
+        @current-change="handleCurrentChange"
+        :current-page="currentPage"
+        :page-sizes="pageSizes"
+        :page-size="pageSize"
+        layout="total, sizes, prev, pager, next, jumper"
+        :total="total"
+        style="float:right;margin-top:10px;padding:2px 5px;">
       </el-pagination>
     </div>
-    <!-- 对话框和抽屉统一放在drawers中 -->
-    <!-- 对话框 -->
-    <el-dialog :title="'< ' + drawers[0].objId + ' > 的历史数据'" :visible.sync="drawers[0].drawer">
-      <historyChart :tabFunNum='drawers[0].objId'></historyChart>
-    </el-dialog>
-    <!-- 抽屉 -->
-    <el-drawer :title="'< ' + drawers[1].objId + ' > 的子系统点位'" :visible.sync="drawers[1].drawer"
-               :direction="drawers[1].direction" size="35%">
-      <dataSource :tabFunNum='drawers[1].objId'></dataSource>
-    </el-drawer>
-    <el-drawer :title="'< ' + drawers[2].objId + ' > 的对象实例'" :visible.sync="drawers[2].drawer"
-               :direction="drawers[2].direction" size="35%">
-      <objectInstance :tabFunNum='drawers[2].objId' :reValue='drawers[2].value'></objectInstance>
-    </el-drawer>
-    <el-dialog title="新增表号功能号" :visible.sync="drawers[3].drawer">
-      <addTabFunNum @closeDrawer="closeDrawer()" @reloadData="reloadData()"></addTabFunNum>
-    </el-dialog>
+    <curve ref="curve"/>
   </div>
 </template>
 
 <script>
-import {testDetail} from '@/api/scan/request'
-import historyChart from './historyChart'
-import dataSource from './dataSource'
-import objectInstance from './objectInstance'
-import addTabFunNum from './addTabFunNum'
+import {testDetail, originalHistory} from '@/api/scan/request'
 import lStorage from '@/utils/localStorage'
 import {mapGetters} from "vuex";
+import curve from './curve'
+import axios from "axios";
+import moment from 'moment'
 
 export default {
   /** 运行状态 */
   // 0:正常 1:异常 2:停用 3:间接
-
   /** 启动状态 */
   // 0:未启动 1:已启动
-
   /** 状态 */
   // 0:延迟<30min 1:延迟>30min 2:无数据
-
   /** method */
   // 0:订阅 1:推送 2:查询 3:其他
-  //   @ApiModelProperty(value = "获取方式")
-
   /** read-write */
   // 0:读 1:写 2:读写
-  //   @ApiModelProperty(value = "读写模式"
   data() {
     return {
       //表格头样式
@@ -160,14 +141,15 @@ export default {
         {value: '1', label: '订阅'},
         {value: '2', label: '查询'},
         {value: '3', label: '其他'}
-      ]
+      ],
+      seven: ''
     }
   },
   props: ['selectAggregate'],
   methods: {
     //查看曲线
     handleDrawer(row, index) {
-
+      this.$refs.curve.open(row, 0)
     },
     //控制测试
     handleControl() {
@@ -177,27 +159,38 @@ export default {
     },
     //点击下载
     downloads() {
-      let a = document.createElement('a')
-      a.href = '/pointconfig/datasource/pointdetail-download'
-      a.download = '检测详情.xls'
-      a.click()
-      document.body.removeChild(a)
+      let param = {
+        method: 'post',
+        url: `/pointconfig/datasource/pointdetail-download`,
+        responseType: 'blob',
+        headers: {
+          ProjectId: this.projectId
+        },
+        data: {},
+      }
+
+      axios(param).then(function (res) {
+        var blob = new Blob([res.data], {
+          type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8'
+        });
+        var fileName = res.headers['content-disposition'];
+        if (fileName)
+          fileName = fileName.substring(fileName.indexOf('=') + 1);
+        if ('download' in document.createElement('a')) { // 非IE下载
+          const elink = document.createElement('a')
+          elink.download = fileName
+          elink.style.display = 'none'
+          elink.href = URL.createObjectURL(blob)
+          document.body.appendChild(elink)
+          elink.click()
+          URL.revokeObjectURL(elink.href) // 释放URL 对象
+          document.body.removeChild(elink)
+        } else { // IE10+下载
+          navigator.msSaveBlob(blob, fileName)
+        }
+      }).catch(function (err) {
+      })
     },
-    //抽屉处理
-    // handleDrawer(row, index) {
-    //   if (index == 2 || index == 1) {
-    //     //实例数量大于0才能打开
-    //     if ((row.RelatedInstance > 0 && index == 2) || (row.RelatedPoint > 0 && index == 1)) {
-    //       this.drawers[index].value = row.Data ? row.Data.Data : '';
-    //       this.drawers[index].objId = row.MeterFunc;
-    //       this.drawers[index].drawer = true;
-    //     }
-    //   } else {
-    //     if (index != 3)
-    //       this.drawers[index].objId = row.MeterFunc;
-    //     this.drawers[index].drawer = true;
-    //   }
-    // },
     handleClickRow(row, column, event) {//点击表格行
       lStorage.set('screen_data', {
         path: this.$route.path,
@@ -205,8 +198,8 @@ export default {
       })
     },
     //筛选
-
     changeHandleSelect() {
+      this.currentPage = 1
       this.getOverViewList()
     },
     //获取统计数据
@@ -295,12 +288,7 @@ export default {
     //     (this.currentPage * this.pageSize < this.allTableData.length) ? this.currentPage * this.pageSize : this.allTableData.length);
     // }
   },
-  components: {
-    historyChart,
-    dataSource,
-    objectInstance,
-    addTabFunNum
-  }
+  components: {curve}
 }
 </script>