Forráskód Böngészése

完善下载功能

shaun-sheep 4 éve
szülő
commit
a500ded7f3

A különbségek nem kerülnek megjelenítésre, a fájl túl nagy
+ 338 - 175
src/api/scan/request.js


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

@@ -0,0 +1,180 @@
+<template>
+  <el-dialog
+    :visible.sync="dialogVisible"
+    title="曲线"
+    class="curve"
+  >
+    <!-- 图表 -->
+    <div class="chart-area" ref="chart"></div>
+  </el-dialog>
+</template>
+
+<script>
+import echarts from 'echarts'
+
+export default {
+  name: "curve",
+  data() {
+    return {
+      lineChart: null,//折线表
+      chartData: ['2020-01-01', '2020-01-02', '2020-01-03', '2020-01-04', '2020-01-05'],//数据表
+      dialogVisible: false
+    }
+  },
+  methods: {
+    open() {
+      this.timeoutSetVal()
+      this.dialogVisible = true
+    },
+    timeoutSetVal() {
+      setTimeout(() => {
+        if (this.$refs.chart) {
+          //折线图参数
+          // let lineChartOption = {
+          //   tooltip: {
+          //     trigger: 'axis',
+          //     position: function (pt) {
+          //       return [pt[0], '10%'];
+          //     }
+          //   },
+          //   xAxis: {
+          //     type: 'category',
+          //     boundaryGap: false,
+          //     data: this.chartData.map(item => item)
+          //   },
+          //   yAxis: {
+          //     type: 'value',
+          //     boundaryGap: [0, '100%']
+          //   },
+          //   dataZoom: [{
+          //     type: 'inside',
+          //     start: 80,
+          //     end: 100
+          //   }, {
+          //     start: 0,
+          //     end: 10,
+          //     handleIcon: 'M10.7,11.9v-1.3H9.3v1.3c-4.9,0.3-8.8,4.4-8.8,9.4c0,5,3.9,9.1,8.8,9.4v1.3h1.3v-1.3c4.9-0.3,8.8-4.4,8.8-9.4C19.5,16.3,15.6,12.2,10.7,11.9z M13.3,24.4H6.7V23h6.6V24.4z M13.3,19.6H6.7v-1.4h6.6V19.6z',
+          //     handleSize: '80%',
+          //     handleStyle: {
+          //       color: '#fff',
+          //       shadowBlur: 3,
+          //       shadowColor: 'rgb(144, 147, 153)',
+          //       shadowOffsetX: 2,
+          //       shadowOffsetY: 2
+          //     }
+          //   }],
+          //   series: [
+          //     {
+          //       name: '数值',
+          //       type: 'line',
+          //       smooth: true,
+          //       symbol: 'none',
+          //       sampling: 'average',
+          //       itemStyle: {
+          //         color: 'rgb(103, 194, 58)'
+          //       },
+          //       areaStyle: {
+          //         color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
+          //           offset: 0,
+          //           color: 'rgb(225, 243, 216)'
+          //         }, {
+          //           offset: 1,
+          //           color: 'rgb(225, 243, 216)'
+          //         }])
+          //       },
+          //       data: this.chartData.map(item => item)
+          //     }
+          //   ]
+          // };
+          this.lineChart = echarts.init(this.$refs.chart);
+          var data = [
+            ["2000-06-05", 116],
+            ["2000-06-05", 73],
+            ["2000-06-10", 85],
+            ["2000-06-11", 73],
+            ["2000-06-12", 68],
+            ["2000-06-13", 92],
+            ["2000-06-14", 130],
+            ["2000-06-15", 245],
+            ["2000-06-16", 139],
+            ["2000-06-17", 115],
+            ["2000-06-18", 111],
+
+          ]
+          var dateList = data.map(function (item) {
+            return item[0];
+          });
+          var valueList = data.map(function (item) {
+            return item[1];
+          });
+          let lineChartOption = {
+            visualMap: [{
+              show: false,
+              type: 'continuous',
+              seriesIndex: 0,
+              min: 0,
+              max: 400
+            }, {
+              show: false,
+              type: 'continuous',
+              seriesIndex: 1,
+              dimension: 0,
+              min: 0,
+              max: dateList.length - 1
+            }],
+            tooltip: {
+              trigger: 'axis'
+            },
+            xAxis: [{
+              // data: dateList
+              data: ['2000-07-17', '2000-07-18', '2000-07-19', '2000-07-20']
+            }, {
+              data: dateList,
+              gridIndex: 1
+            }],
+            yAxis: [{
+              splitLine: {show: false}
+            }, {
+              splitLine: {show: false},
+              gridIndex: 1
+            }],
+            grid: [{
+              bottom: '60%'
+            }, {
+              top: '60%'
+            }],
+            series: [{
+              type: 'line',
+              showSymbol: false,
+              data: valueList
+            }, {
+              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: [],//点位数量集合

+ 82 - 15
src/components/point/report/tabControlTest.vue

@@ -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,7 +39,7 @@
     <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>
@@ -65,18 +74,20 @@
         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 {
+      describe: '',
       pageSizes: [10, 20, 50, 100],
       pageSize: 50,
       currentPage: 1,
@@ -99,18 +110,36 @@ export default {
   created() {
     this.getSettingValue()
   },
+  computed: {
+    ...mapGetters('layout', ['projectId'])
+  },
   methods: {
+
+    //搜索
+    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
+      }
     },
     //当前设定值
-    getSettingValue() {
+    getSettingValue(val) {
       let _this = this
       _this.loading = true;
-
       let param = {
         PageNumber: this.currentPage,
         PageSize: this.pageSize
@@ -121,6 +150,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 +165,21 @@ export default {
 
     //点位测试
     getPointTest(list) {
-      pointTest(list, res => {
-        this.tableDate = res.Content
-
-      })
+      // pointTest(list, res => {
+      //   this.tableDate = res.Content
+      //
+      // })
+      pointTest(list).then(res => {
+        if (res.message === "failure") {
+          this.$message.error('执行失败')
+          this.getSettingValue()
+        } else {
+          this.tableDate = res.Content
+        }
+      });
     },
     changeHandleSelect() {
+      this.currentPage = 1
       this.getSettingValue()
     },
 
@@ -158,11 +199,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 - 62
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,39 @@
 
       </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";
 
 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 {
       //表格头样式
@@ -167,7 +147,10 @@ export default {
   methods: {
     //查看曲线
     handleDrawer(row, index) {
-
+      originalHistory(row, res => {
+        console.log(res)
+      })
+      this.$refs.curve.open()
     },
     //控制测试
     handleControl() {
@@ -177,27 +160,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,
@@ -207,6 +201,7 @@ export default {
     //筛选
 
     changeHandleSelect() {
+      this.currentPage = 1
       this.getOverViewList()
     },
     //获取统计数据
@@ -295,12 +290,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>
 

A különbségek nem kerülnek megjelenítésre, a fájl túl nagy
+ 590 - 580
src/views/point/config_point/steps/step1.vue