zhaomiao 3 лет назад
Родитель
Сommit
291dfcdf36
8 измененных файлов с 1409 добавлено и 81 удалено
  1. 98 81
      package-lock.json
  2. 1 0
      package.json
  3. 4 0
      src/main.js
  4. 8 0
      src/router/zm.js
  5. 177 0
      src/tools/excel/Blob.js
  6. 179 0
      src/tools/excel/Export2Excel.js
  7. 514 0
      src/views/lineChart/index.vue
  8. 428 0
      src/views/search/index.vue

+ 98 - 81
package-lock.json

@@ -1710,16 +1710,6 @@
           "integrity": "sha1-/q7SVZc9LndVW4PbwIhRpsY1IPo=",
           "dev": true
         },
-        "ansi-styles": {
-          "version": "4.3.0",
-          "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz",
-          "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==",
-          "dev": true,
-          "optional": true,
-          "requires": {
-            "color-convert": "^2.0.1"
-          }
-        },
         "cacache": {
           "version": "13.0.1",
           "resolved": "https://registry.npm.taobao.org/cacache/download/cacache-13.0.1.tgz?cache=0&sync_timestamp=1616431251047&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fcacache%2Fdownload%2Fcacache-13.0.1.tgz",
@@ -1746,53 +1736,6 @@
             "unique-filename": "^1.1.1"
           }
         },
-        "chalk": {
-          "version": "4.1.1",
-          "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.1.tgz",
-          "integrity": "sha512-diHzdDKxcU+bAsUboHLPEDQiw0qEe0qd7SYUn3HgcFlWgbDcfLGswOHYeGrHKzG9z6UYf01d9VFMfZxPM1xZSg==",
-          "dev": true,
-          "optional": true,
-          "requires": {
-            "ansi-styles": "^4.1.0",
-            "supports-color": "^7.1.0"
-          }
-        },
-        "color-convert": {
-          "version": "2.0.1",
-          "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
-          "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==",
-          "dev": true,
-          "optional": true,
-          "requires": {
-            "color-name": "~1.1.4"
-          }
-        },
-        "color-name": {
-          "version": "1.1.4",
-          "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
-          "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==",
-          "dev": true,
-          "optional": true
-        },
-        "has-flag": {
-          "version": "4.0.0",
-          "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz",
-          "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==",
-          "dev": true,
-          "optional": true
-        },
-        "loader-utils": {
-          "version": "2.0.0",
-          "resolved": "https://registry.npmjs.org/loader-utils/-/loader-utils-2.0.0.tgz",
-          "integrity": "sha512-rP4F0h2RaWSvPEkD7BLDFQnvSf+nK+wr3ESUjNTyAGobqrijmW92zc+SO6d4p4B1wh7+B/Jg1mkQe5NYUEHtHQ==",
-          "dev": true,
-          "optional": true,
-          "requires": {
-            "big.js": "^5.2.2",
-            "emojis-list": "^3.0.0",
-            "json5": "^2.1.2"
-          }
-        },
         "source-map": {
           "version": "0.6.1",
           "resolved": "https://registry.npm.taobao.org/source-map/download/source-map-0.6.1.tgz",
@@ -1809,16 +1752,6 @@
             "minipass": "^3.1.1"
           }
         },
-        "supports-color": {
-          "version": "7.2.0",
-          "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz",
-          "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==",
-          "dev": true,
-          "optional": true,
-          "requires": {
-            "has-flag": "^4.0.0"
-          }
-        },
         "terser-webpack-plugin": {
           "version": "2.3.8",
           "resolved": "https://registry.npm.taobao.org/terser-webpack-plugin/download/terser-webpack-plugin-2.3.8.tgz",
@@ -1835,18 +1768,6 @@
             "terser": "^4.6.12",
             "webpack-sources": "^1.4.3"
           }
-        },
-        "vue-loader-v16": {
-          "version": "npm:vue-loader@16.2.0",
-          "resolved": "https://registry.npmjs.org/vue-loader/-/vue-loader-16.2.0.tgz",
-          "integrity": "sha512-TitGhqSQ61RJljMmhIGvfWzJ2zk9m1Qug049Ugml6QP3t0e95o0XJjk29roNEiPKJQBEi8Ord5hFuSuELzSp8Q==",
-          "dev": true,
-          "optional": true,
-          "requires": {
-            "chalk": "^4.1.0",
-            "hash-sum": "^2.0.0",
-            "loader-utils": "^2.0.0"
-          }
         }
       }
     },
@@ -2146,7 +2067,7 @@
     },
     "adler-32": {
       "version": "1.2.0",
-      "resolved": "https://registry.npmjs.org/adler-32/-/adler-32-1.2.0.tgz",
+      "resolved": "https://registry.nlark.com/adler-32/download/adler-32-1.2.0.tgz",
       "integrity": "sha1-aj5r8KY5ALoVZSgIyxXGgT0aXyU=",
       "requires": {
         "exit-on-epipe": "~1.0.1",
@@ -3985,7 +3906,7 @@
     },
     "codepage": {
       "version": "1.14.0",
-      "resolved": "https://registry.npmjs.org/codepage/-/codepage-1.14.0.tgz",
+      "resolved": "https://registry.npm.taobao.org/codepage/download/codepage-1.14.0.tgz",
       "integrity": "sha1-jL4lSBMjVZ19MHVxsP/5HnodL5k=",
       "requires": {
         "commander": "~2.14.1",
@@ -11767,6 +11688,21 @@
         "ajv-keywords": "^3.5.2"
       }
     },
+    "script-loader": {
+      "version": "0.7.2",
+      "resolved": "https://registry.npm.taobao.org/script-loader/download/script-loader-0.7.2.tgz",
+      "integrity": "sha1-IBbbb4byX1z1baOJFdgzeLsWa6c=",
+      "requires": {
+        "raw-loader": "~0.5.1"
+      },
+      "dependencies": {
+        "raw-loader": {
+          "version": "0.5.1",
+          "resolved": "https://registry.npm.taobao.org/raw-loader/download/raw-loader-0.5.1.tgz",
+          "integrity": "sha1-DD0L6u2KAclm2Xh793goElKpeao="
+        }
+      }
+    },
     "seek-bzip": {
       "version": "1.0.6",
       "resolved": "https://registry.npm.taobao.org/seek-bzip/download/seek-bzip-1.0.6.tgz",
@@ -13705,6 +13641,87 @@
         }
       }
     },
+    "vue-loader-v16": {
+      "version": "npm:vue-loader@16.2.0",
+      "resolved": "https://registry.npm.taobao.org/vue-loader/download/vue-loader-16.2.0.tgz?cache=0&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fvue-loader%2Fdownload%2Fvue-loader-16.2.0.tgz",
+      "integrity": "sha1-BGpTMI3Ufljv4g3ewe3sAnzjtG4=",
+      "dev": true,
+      "optional": true,
+      "requires": {
+        "chalk": "^4.1.0",
+        "hash-sum": "^2.0.0",
+        "loader-utils": "^2.0.0"
+      },
+      "dependencies": {
+        "ansi-styles": {
+          "version": "4.3.0",
+          "resolved": "https://registry.npm.taobao.org/ansi-styles/download/ansi-styles-4.3.0.tgz",
+          "integrity": "sha1-7dgDYornHATIWuegkG7a00tkiTc=",
+          "dev": true,
+          "optional": true,
+          "requires": {
+            "color-convert": "^2.0.1"
+          }
+        },
+        "chalk": {
+          "version": "4.1.1",
+          "resolved": "https://registry.nlark.com/chalk/download/chalk-4.1.1.tgz?cache=0&sync_timestamp=1618995384030&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fchalk%2Fdownload%2Fchalk-4.1.1.tgz",
+          "integrity": "sha1-yAs/qyi/Y3HmhjMl7uZ+YYt35q0=",
+          "dev": true,
+          "optional": true,
+          "requires": {
+            "ansi-styles": "^4.1.0",
+            "supports-color": "^7.1.0"
+          }
+        },
+        "color-convert": {
+          "version": "2.0.1",
+          "resolved": "https://registry.npm.taobao.org/color-convert/download/color-convert-2.0.1.tgz",
+          "integrity": "sha1-ctOmjVmMm9s68q0ehPIdiWq9TeM=",
+          "dev": true,
+          "optional": true,
+          "requires": {
+            "color-name": "~1.1.4"
+          }
+        },
+        "color-name": {
+          "version": "1.1.4",
+          "resolved": "https://registry.npm.taobao.org/color-name/download/color-name-1.1.4.tgz",
+          "integrity": "sha1-wqCah6y95pVD3m9j+jmVyCbFNqI=",
+          "dev": true,
+          "optional": true
+        },
+        "has-flag": {
+          "version": "4.0.0",
+          "resolved": "https://registry.npm.taobao.org/has-flag/download/has-flag-4.0.0.tgz",
+          "integrity": "sha1-lEdx/ZyByBJlxNaUGGDaBrtZR5s=",
+          "dev": true,
+          "optional": true
+        },
+        "loader-utils": {
+          "version": "2.0.0",
+          "resolved": "https://registry.npm.taobao.org/loader-utils/download/loader-utils-2.0.0.tgz",
+          "integrity": "sha1-5MrOW4FtQloWa18JfhDNErNgZLA=",
+          "dev": true,
+          "optional": true,
+          "requires": {
+            "big.js": "^5.2.2",
+            "emojis-list": "^3.0.0",
+            "json5": "^2.1.2"
+          }
+        },
+        "supports-color": {
+          "version": "7.2.0",
+          "resolved": "https://registry.npm.taobao.org/supports-color/download/supports-color-7.2.0.tgz?cache=0&sync_timestamp=1618561008172&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fsupports-color%2Fdownload%2Fsupports-color-7.2.0.tgz",
+          "integrity": "sha1-G33NyzK4E4gBs+R4umpRyqiWSNo=",
+          "dev": true,
+          "optional": true,
+          "requires": {
+            "has-flag": "^4.0.0"
+          }
+        }
+      }
+    },
     "vue-pdf": {
       "version": "4.2.0",
       "resolved": "https://registry.npm.taobao.org/vue-pdf/download/vue-pdf-4.2.0.tgz",

+ 1 - 0
package.json

@@ -22,6 +22,7 @@
     "js-cookie": "^2.2.1",
     "jsonwebtoken": "^8.5.1",
     "moment": "^2.29.1",
+    "script-loader": "^0.7.2",
     "stompjs": "^2.3.3",
     "uglifyjs-webpack-plugin": "^2.2.0",
     "vue": "^2.6.11",

+ 4 - 0
src/main.js

@@ -25,6 +25,10 @@ Vue.prototype.ET = echartsTool;
 import EClzx from "@tools/echartsToolLzx"; // echarts处理
 Vue.prototype.ECLZX = EClzx;
 
+// excel导出
+import Blob from '@tools/excel/Blob.js';
+import Export2Excel from '@tools/excel/Export2Excel.js';// excel导出
+
 // import formCheck from "@tools/formCheck"; // 表单的处理
 // Vue.prototype.FC = formCheck;
 

+ 8 - 0
src/router/zm.js

@@ -91,4 +91,12 @@ export default [
     path:'/curveDeviation',
     component: r => require.ensure([], () => r(require('@views/healthManagement/curveDeviation')), 'healthManagement')
   },
+  { // 区间曲线偏差
+    path:'/lineChart',
+    component: r => require.ensure([], () => r(require('@views/lineChart')), 'healthManagement')
+  },
+  { // 区间曲线偏差
+    path:'/search',
+    component: r => require.ensure([], () => r(require('@views/search')), 'healthManagement')
+  },
 ]

+ 177 - 0
src/tools/excel/Blob.js

@@ -0,0 +1,177 @@
+/* eslint-disable */
+/* Blob.js
+ * A Blob implementation.
+ * 2014-05-27
+ *
+ * By Eli Grey, http://eligrey.com
+ * By Devin Samarin, https://github.com/eboyjr
+ * License: X11/MIT
+ *   See LICENSE.md
+ */
+
+/*global self, unescape */
+/*jslint bitwise: true, regexp: true, confusion: true, es5: true, vars: true, white: true,
+ plusplus: true */
+
+/*! @source http://purl.eligrey.com/github/Blob.js/blob/master/Blob.js */
+
+const blob = function (view) {
+  "use strict";
+
+  view.URL = view.URL || view.webkitURL;
+
+  if (view.Blob && view.URL) {
+    try {
+      new Blob;
+      return;
+    } catch (e) {}
+  }
+
+  // Internally we use a BlobBuilder implementation to base Blob off of
+  // in order to support older browsers that only have BlobBuilder
+  var BlobBuilder = view.BlobBuilder || view.WebKitBlobBuilder || view.MozBlobBuilder || (function (view) {
+    var
+      get_class = function (object) {
+        return Object.prototype.toString.call(object).match(/^\[object\s(.*)\]$/)[1];
+      },
+      FakeBlobBuilder = function BlobBuilder() {
+        this.data = [];
+      },
+      FakeBlob = function Blob(data, type, encoding) {
+        this.data = data;
+        this.size = data.length;
+        this.type = type;
+        this.encoding = encoding;
+      },
+      FBB_proto = FakeBlobBuilder.prototype,
+      FB_proto = FakeBlob.prototype,
+      FileReaderSync = view.FileReaderSync,
+      FileException = function (type) {
+        this.code = this[this.name = type];
+      },
+      file_ex_codes = (
+        "NOT_FOUND_ERR SECURITY_ERR ABORT_ERR NOT_READABLE_ERR ENCODING_ERR " +
+        "NO_MODIFICATION_ALLOWED_ERR INVALID_STATE_ERR SYNTAX_ERR"
+      ).split(" "),
+      file_ex_code = file_ex_codes.length,
+      real_URL = view.URL || view.webkitURL || view,
+      real_create_object_URL = real_URL.createObjectURL,
+      real_revoke_object_URL = real_URL.revokeObjectURL,
+      URL = real_URL,
+      btoa = view.btoa,
+      atob = view.atob
+
+      ,
+      ArrayBuffer = view.ArrayBuffer,
+      Uint8Array = view.Uint8Array;
+    FakeBlob.fake = FB_proto.fake = true;
+    while (file_ex_code--) {
+      FileException.prototype[file_ex_codes[file_ex_code]] = file_ex_code + 1;
+    }
+    if (!real_URL.createObjectURL) {
+      URL = view.URL = {};
+    }
+    URL.createObjectURL = function (blob) {
+      var
+        type = blob.type,
+        data_URI_header;
+      if (type === null) {
+        type = "application/octet-stream";
+      }
+      if (blob instanceof FakeBlob) {
+        data_URI_header = "data:" + type;
+        if (blob.encoding === "base64") {
+          return data_URI_header + ";base64," + blob.data;
+        } else if (blob.encoding === "URI") {
+          return data_URI_header + "," + decodeURIComponent(blob.data);
+        }
+        if (btoa) {
+          return data_URI_header + ";base64," + btoa(blob.data);
+        } else {
+          return data_URI_header + "," + encodeURIComponent(blob.data);
+        }
+      } else if (real_create_object_URL) {
+        return real_create_object_URL.call(real_URL, blob);
+      }
+    };
+    URL.revokeObjectURL = function (object_URL) {
+      if (object_URL.substring(0, 5) !== "data:" && real_revoke_object_URL) {
+        real_revoke_object_URL.call(real_URL, object_URL);
+      }
+    };
+    FBB_proto.append = function (data /*, endings*/ ) {
+      var bb = this.data;
+      // decode data to a binary string
+      if (Uint8Array && (data instanceof ArrayBuffer || data instanceof Uint8Array)) {
+        var
+          str = "",
+          buf = new Uint8Array(data),
+          i = 0,
+          buf_len = buf.length;
+        for (; i < buf_len; i++) {
+          str += String.fromCharCode(buf[i]);
+        }
+        bb.push(str);
+      } else if (get_class(data) === "Blob" || get_class(data) === "File") {
+        if (FileReaderSync) {
+          var fr = new FileReaderSync;
+          bb.push(fr.readAsBinaryString(data));
+        } else {
+          // async FileReader won't work as BlobBuilder is sync
+          throw new FileException("NOT_READABLE_ERR");
+        }
+      } else if (data instanceof FakeBlob) {
+        if (data.encoding === "base64" && atob) {
+          bb.push(atob(data.data));
+        } else if (data.encoding === "URI") {
+          bb.push(decodeURIComponent(data.data));
+        } else if (data.encoding === "raw") {
+          bb.push(data.data);
+        }
+      } else {
+        if (typeof data !== "string") {
+          data += ""; // convert unsupported types to strings
+        }
+        // decode UTF-16 to binary string
+        bb.push(unescape(encodeURIComponent(data)));
+      }
+    };
+    FBB_proto.getBlob = function (type) {
+      if (!arguments.length) {
+        type = null;
+      }
+      return new FakeBlob(this.data.join(""), type, "raw");
+    };
+    FBB_proto.toString = function () {
+      return "[object BlobBuilder]";
+    };
+    FB_proto.slice = function (start, end, type) {
+      var args = arguments.length;
+      if (args < 3) {
+        type = null;
+      }
+      return new FakeBlob(
+        this.data.slice(start, args > 1 ? end : this.data.length), type, this.encoding
+      );
+    };
+    FB_proto.toString = function () {
+      return "[object Blob]";
+    };
+    FB_proto.close = function () {
+      this.size = this.data.length = 0;
+    };
+    return FakeBlobBuilder;
+  }(view));
+
+  view.Blob = function Blob(blobParts, options) {
+    var type = options ? (options.type || "") : "";
+    var builder = new BlobBuilder();
+    if (blobParts) {
+      for (var i = 0, len = blobParts.length; i < len; i++) {
+        builder.append(blobParts[i]);
+      }
+    }
+    return builder.getBlob(type);
+  };
+}
+exports.blob = blob;

+ 179 - 0
src/tools/excel/Export2Excel.js

@@ -0,0 +1,179 @@
+//Export2Excel.js
+/* eslint-disable */
+require('script-loader!file-saver');
+require('./Blob.js');//转二进制用  这边要写你的blob的实际地址
+require('script-loader!xlsx/dist/xlsx.core.min');
+
+function generateArray (table) {
+  var out = [];
+  var rows = table.querySelectorAll('tr');
+  var ranges = [];
+  for (var R = 0; R < rows.length; ++R) {
+    var outRow = [];
+    var row = rows[R];
+    var columns = row.querySelectorAll('td');
+    for (var C = 0; C < columns.length; ++C) {
+      var cell = columns[C];
+      var colspan = cell.getAttribute('colspan');
+      var rowspan = cell.getAttribute('rowspan');
+      var cellValue = cell.innerText;
+      if (cellValue !== "" && cellValue == +cellValue) cellValue = +cellValue;
+
+      //Skip ranges
+      ranges.forEach(function (range) {
+        if (R >= range.s.r && R <= range.e.r && outRow.length >= range.s.c && outRow.length <= range.e.c) {
+          for (var i = 0; i <= range.e.c - range.s.c; ++i) outRow.push(null);
+        }
+      });
+
+      //Handle Row Span
+      if (rowspan || colspan) {
+        rowspan = rowspan || 1;
+        colspan = colspan || 1;
+        ranges.push({
+          s: {
+            r: R,
+            c: outRow.length
+          },
+          e: {
+            r: R + rowspan - 1,
+            c: outRow.length + colspan - 1
+          }
+        });
+      };
+
+      //Handle Value
+      outRow.push(cellValue !== "" ? cellValue : null);
+
+      //Handle Colspan
+      if (colspan)
+        for (var k = 0; k < colspan - 1; ++k) outRow.push(null);
+    }
+    out.push(outRow);
+  }
+  return [out, ranges];
+};
+
+function datenum (v, date1904) {
+  if (date1904) v += 1462;
+  var epoch = Date.parse(v);
+  return (epoch - new Date(Date.UTC(1899, 11, 30))) / (24 * 60 * 60 * 1000);
+}
+
+function sheet_from_array_of_arrays (data, opts) {
+  var ws = {};
+  var range = {
+    s: {
+      c: 10000000,
+      r: 10000000
+    },
+    e: {
+      c: 0,
+      r: 0
+    }
+  };
+  for (var R = 0; R != data.length; ++R) {
+    for (var C = 0; C != data[R].length; ++C) {
+      if (range.s.r > R) range.s.r = R;
+      if (range.s.c > C) range.s.c = C;
+      if (range.e.r < R) range.e.r = R;
+      if (range.e.c < C) range.e.c = C;
+      var cell = {
+        v: data[R][C]
+      };
+      if (cell.v == null) continue;
+      var cell_ref = XLSX.utils.encode_cell({
+        c: C,
+        r: R
+      });
+
+      if (typeof cell.v === 'number') cell.t = 'n';
+      else if (typeof cell.v === 'boolean') cell.t = 'b';
+      else if (cell.v instanceof Date) {
+        cell.t = 'n';
+        cell.z = XLSX.SSF._table[14];
+        cell.v = datenum(cell.v);
+      } else cell.t = 's';
+
+      ws[cell_ref] = cell;
+    }
+  }
+  if (range.s.c < 10000000) ws['!ref'] = XLSX.utils.encode_range(range);
+  return ws;
+}
+
+function Workbook () {
+  if (!(this instanceof Workbook)) return new Workbook();
+  this.SheetNames = [];
+  this.Sheets = {};
+}
+
+function s2ab (s) {
+  var buf = new ArrayBuffer(s.length);
+  var view = new Uint8Array(buf);
+  for (var i = 0; i != s.length; ++i) view[i] = s.charCodeAt(i) & 0xFF;
+  return buf;
+}
+
+export function export_table_to_excel (id) {
+  var theTable = document.getElementById(id);
+  console.log('a')
+  var oo = generateArray(theTable);
+  var ranges = oo[1];
+
+  /* original data */
+  var data = oo[0];
+  var ws_name = "导出的Excel";
+  console.log(data);
+
+  var wb = new Workbook(),
+    ws = sheet_from_array_of_arrays(data);
+
+  /* add ranges to worksheet */
+  // ws['!cols'] = ['apple', 'banan'];
+  ws['!merges'] = ranges;
+
+  /* add worksheet to workbook */
+  wb.SheetNames.push(ws_name);
+  wb.Sheets[ws_name] = ws;
+
+  var wbout = XLSX.write(wb, {
+    bookType: 'xlsx',
+    bookSST: false,
+    type: 'binary'
+  });
+
+  saveAs(new Blob([s2ab(wbout)], {
+    type: "application/octet-stream"
+  }), "test.xlsx")
+}
+
+function formatJson (jsonData) {
+  console.log(jsonData)
+}
+export function export_json_to_excel (th, jsonData, defaultTitle) {
+
+  /* original data */
+
+  var data = jsonData;
+  data.unshift(th);
+  var ws_name = "导出的Excel";
+
+  var wb = new Workbook(),
+    ws = sheet_from_array_of_arrays(data);
+
+
+  /* add worksheet to workbook */
+  wb.SheetNames.push(ws_name);
+  wb.Sheets[ws_name] = ws;
+
+  var wbout = XLSX.write(wb, {
+    bookType: 'xlsx',
+    bookSST: false,
+    type: 'binary'
+  });
+  var title = defaultTitle || '列表'
+  saveAs(new Blob([s2ab(wbout)], {
+    type: "application/octet-stream"
+  }), title + ".xlsx")
+};

+ 514 - 0
src/views/lineChart/index.vue

@@ -0,0 +1,514 @@
+<template>
+  <div class="searchPage">
+    <div class="searchBox">
+      <el-form ref="form" :model="form" inline label-width="80px">
+        <el-form-item label="日期:">
+          <el-date-picker size="medium" value-format="yyyy-MM-dd HH:mm:ss" v-model="form.dateArea" type="datetimerange"
+            :picker-options="pickerOptions" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期" align="right">
+          </el-date-picker>
+        </el-form-item>
+        <el-form-item label="间隔:">
+          <el-input placeholder="请输入间隔" clearable v-model="form.interval" type="number"></el-input>
+        </el-form-item>
+        <transition name="el-zoom-in-center">
+          <el-form-item v-show="form.interval" label=" ">
+            <el-radio-group v-model="form.type" size="small">
+              <el-radio label="0" @click.native.prevent="getRadio('0')">最大</el-radio>
+              <el-radio label="1" @click.native.prevent="getRadio('1')">最小</el-radio>
+              <el-radio label="2" @click.native.prevent="getRadio('2')">平均</el-radio>
+            </el-radio-group>
+          </el-form-item>
+        </transition>
+      </el-form>
+      <div class="btnBox">
+        <el-button type="primary" size="middle" @click="renderCharts">生成曲线</el-button>
+      </div>
+    </div>
+    <div class="cardBox">
+      <el-card class="box-card">
+        <div slot="header" class="clearfix">
+          <span>类型</span>
+          <!-- <el-button style="float: right; padding: 3px 0" type="text">操作按钮</el-button> -->
+        </div>
+        <div>
+          <el-radio-group v-model="form.fjType" size="small" @change="(fjType) => { this.resetForm(); }">
+            <el-form ref="form" :model="form">
+              <el-form-item style="margin-bottom:5px;">
+                <el-radio border size="medium" label="1">单风机多参数对比</el-radio>
+              </el-form-item>
+              <el-form-item style="margin-bottom:5px;">
+                <el-radio border size="medium" label="2">多风机单参数对比</el-radio>
+              </el-form-item>
+            </el-form>
+          </el-radio-group>
+        </div>
+      </el-card>
+      <el-card class="box-card">
+        <div slot="header" class="clearfix">
+          <span>设备结构</span>
+        </div>
+        <div>
+          <div class="treeBox">
+            <el-input size="small" placeholder="输入以检索" :disabled="!treeData.length" v-model="filterText"></el-input>
+            <el-tree ref="treeRef" node-key="id" :data="treeData" :props="treeProps" :show-checkbox="true"
+              :highlight-current="true" :filter-node-method="filterNode" @check-change="getTreeChecked"></el-tree>
+          </div>
+        </div>
+      </el-card>
+      <el-card class="box-card">
+        <div slot="header" class="clearfix">
+          <span>关键参数</span>
+        </div>
+        <div class="selectBox treeBox">
+          <el-input size="small" placeholder="输入以检索" :disabled="!gjcsOptions.length" v-model="filterText1"></el-input>
+          <el-tree ref="treeRef1" node-key="code" :data="gjcsOptions" :props="{children: null, label: 'description'}"
+            :show-checkbox="true" :highlight-current="true" :filter-node-method="filterNode1" @check-change="getTreeChecked1"></el-tree>
+          <!-- <el-select style="width:100%;" v-model="form.gjcs" filterable clearable :multiple="!treeIsMultiple"
+            placeholder="输入以检索" @change="(res) => { this.$forceUpdate(); }">
+            <el-option v-for="item in gjcsOptions" :key="item.id" :label="item.description" :value="item.code">
+            </el-option>
+          </el-select> -->
+        </div>
+      </el-card>
+    </div>
+    <div class="chartsBox">
+      <div id="lineChart" style="width:100%;height:100%;"></div>
+    </div>
+  </div>
+</template>
+
+<script>
+import { Message } from 'element-ui';
+import * as echarts from "echarts";
+
+export default {
+  data () {
+    return {
+      form: {
+        pointId: "",
+        pointName: "",
+        autoReq: false,
+        dateArea: [
+          this.fmtDate(new Date(new Date().setTime(new Date().getTime() - 3600 * 1000 * 24))),
+          this.fmtDate(new Date())
+        ],
+        interval: "",
+        type: "",
+        fjType: "1",
+        gjcs: ''
+      },
+
+      treeIsMultiple: false,
+      filterText: "",
+      filterText1: "",
+
+      treeData: [],
+      gjcsOptions: [],
+
+      treeProps: {
+        children: 'children',
+        label: 'label'
+      },
+
+      pickerOptions: {
+        shortcuts: [{
+          text: '最近一天',
+          onClick (picker) {
+            const end = new Date();
+            const start = new Date();
+            start.setTime(start.getTime() - 3600 * 1000 * 24);
+            picker.$emit('pick', [start, end]);
+          }
+        }, {
+          text: '最近一周',
+          onClick (picker) {
+            const end = new Date();
+            const start = new Date();
+            start.setTime(start.getTime() - 3600 * 1000 * 24 * 7);
+            picker.$emit('pick', [start, end]);
+          }
+        }, {
+          text: '最近一个月',
+          onClick (picker) {
+            const end = new Date();
+            const start = new Date();
+            start.setTime(start.getTime() - 3600 * 1000 * 24 * 30);
+            picker.$emit('pick', [start, end]);
+          }
+        }, {
+          text: '最近三个月',
+          onClick (picker) {
+            const end = new Date();
+            const start = new Date();
+            start.setTime(start.getTime() - 3600 * 1000 * 24 * 90);
+            picker.$emit('pick', [start, end]);
+          }
+        }]
+      }
+    }
+  },
+
+  mounted () {
+    let that = this;
+    that.$nextTick(() => {
+      that.getEquipmentStructure();
+      that.getEquipmentParams();
+    });
+  },
+
+  methods: {
+    // 获取设备结构
+    getEquipmentStructure () {
+      let that = this;
+      that.API.requestData({
+        subUrl: "paramComparison/equipmentStructure",
+        success (res) {
+          // 请求成功的回调
+          let treeData = [];
+
+          res.data.forEach(ele => {
+            let findRes = treeData.find(findEle => {
+              return ele.windpowerstationid === findEle.label;
+            });
+            if (!findRes) {
+              let treeTemp = {
+                label: ele.windpowerstationid,
+                children: []
+              };
+              treeTemp.children.push({
+                label: ele.name,
+                id: ele.id
+              });
+              treeData.push(treeTemp);
+            } else {
+              findRes.children.push({
+                label: ele.name,
+                id: ele.id
+              });
+            }
+          });
+          that.treeData = treeData;
+        }
+      });
+    },
+
+    // 获取关键节点
+    getEquipmentParams () {
+      let that = this;
+      that.API.requestData({
+        subUrl: "paramComparison/equipmentParams",
+        success (res) {
+          that.gjcsOptions = res.data;
+        }
+      });
+    },
+
+    // 获取单选结果
+    getRadio (type) {
+      if (type === this.form.type && this.form.type !== '') {
+        this.form.type = '';
+      } else {
+        this.form.type = type;
+      }
+    },
+
+    // 渲染图表
+    renderCharts () {
+      let that = this;
+      that.$nextTick(() => {
+
+        let begin = that.form.dateArea.length ? that.form.dateArea[0] : '';
+        let end = that.form.dateArea.length ? that.form.dateArea[1] : '';
+        let interval = that.form.interval;
+        let type = that.form.type;
+        let paramtype = that.form.fjType;
+        let wts = [];
+        let wtsArray = that.$refs.treeRef.getCheckedNodes();
+        let params = [];
+        let paramsArray = that.$refs.treeRef1.getCheckedNodes();
+        // let params = that.form.gjcs;
+
+        wtsArray.forEach(pEle => {
+          if (pEle.id) {
+            wts.push(pEle.id);
+          } else {
+            pEle.children.forEach(cEle => {
+              wts.push(cEle.id);
+            });
+          }
+        });
+
+        paramsArray.forEach(pEle => {
+          params.push(pEle.code);
+        });
+
+        let data = {};
+        data.begin = begin;
+        data.end = end;
+        interval && (data.interval = interval);
+        type && (data.type = type);
+        data.paramtype = paramtype;
+        data.wts = wts.toString();
+        data.params = params.toString();
+
+        if (begin && end && paramtype && wts.length && params.length) {
+          that.API.requestData({
+            subUrl: "paramComparison/generatingCurve",
+            timeout: 30000,
+            data,
+            success (res) {
+              console.log('res', res);
+
+              if (res.data.length) {
+
+                let xAxisData = []; // x轴标题
+                let seriesData = []; // 折线图数据
+
+                let keyArray = [];
+
+                if (that.form.fjType === '1') {
+                  params.forEach(ele => {
+                    let findRes = that.gjcsOptions.find(findEle => {
+                      return ele === findEle.code;
+                    });
+                    keyArray.push(findRes.description);
+                  });
+                } else {
+                  wtsArray.forEach(pEle => {
+                    if (pEle.id) {
+                      keyArray.push(pEle.label);
+                    } else {
+                      pEle.children.forEach(cEle => {
+                        keyArray.push(cEle.label);
+                      });
+                    }
+                  });
+                }
+
+                keyArray.forEach(ele => {
+                  seriesData.push({
+                    data: [],
+                    type: 'line',
+                    smooth: true,
+                    name: ele
+                  });
+                });
+
+                res.data.forEach(pEle => {
+                  xAxisData.push(that.fmtDate(new Date(pEle.time)));
+                  keyArray.forEach((cEle, cIndex) => {
+                    seriesData[cIndex].data.push((pEle[cEle] || null));
+                  });
+                });
+
+                document.getElementById("lineChart").removeAttribute("_echarts_instance_");
+                let chartDom = document.getElementById('lineChart');
+                let myChart = echarts.init(chartDom);
+                let option = {
+                  xAxis: {
+                    type: 'category',
+                    data: xAxisData
+                  },
+                  yAxis: {
+                    type: 'value'
+                  },
+                  series: seriesData,
+                  tooltip: {
+                    trigger: 'axis',
+                    axisPointer: {
+                      type: 'cross',
+                      label: {
+                        backgroundColor: '#6a7985'
+                      }
+                    }
+                  }
+                };
+                option && myChart.setOption(option);
+
+              } else {
+                Message.warning("所选参数暂无数据,请切换参数后再次尝试");
+              }
+            }
+          });
+        } else {
+          Message.error("无法生成,请检查 日期、设备结构与关键参数是否已选择");
+        }
+
+      });
+    },
+
+    // 过滤树形节点
+    filterNode (value, data) {
+      if (!value) return true;
+      return data.label.indexOf(value) !== -1;
+    },
+
+    // 过滤树形节点
+    filterNode1 (value, data) {
+      if (!value) return true;
+      return data.description.indexOf(value) !== -1;
+    },
+
+    // 获取树形选中
+    getTreeChecked (data, checked, node) {
+      if (!this.treeIsMultiple) {
+        if (checked === true) {
+          this.checkedId = data.id;
+          this.$refs.treeRef.setCheckedKeys([data.id]);
+        } else {
+          if (this.checkedId == data.id) {
+            this.$refs.treeRef.setCheckedKeys([]);
+          }
+        }
+      }
+    },
+
+    // 获取树形选中
+    getTreeChecked1 (data, checked, node) {
+      if (this.treeIsMultiple) {
+        if (checked === true) {
+          this.checkedId = data.code;
+          this.$refs.treeRef1.setCheckedKeys([data.code]);
+        } else {
+          if (this.checkedId == data.code) {
+            this.$refs.treeRef1.setCheckedKeys([]);
+          }
+        }
+      }
+    },
+
+    // 重置表单
+    resetForm () {
+      this.form.fjType === '1' ? this.treeIsMultiple = false : this.treeIsMultiple = true;
+      this.$refs.treeRef.setCheckedKeys([]);
+      this.$refs.treeRef1.setCheckedKeys([]);
+      this.form.gjcs = '';
+      this.$forceUpdate();
+      document.getElementById("lineChart").removeAttribute("_echarts_instance_");
+      echarts.init(document.getElementById('lineChart'));
+    },
+
+    // 格式化日期
+    fmtDate (date) {
+      let curDate = date || new Date();
+      let year = curDate.getFullYear();
+      let mouth = curDate.getUTCMonth() + 1;
+      let day = curDate.getDate();
+      let hour = curDate.getHours();
+      let minutes = curDate.getMinutes();
+      let seconds = curDate.getSeconds();
+      return year + '-' + (mouth < 10 ? '0' + mouth : mouth) + '-' + (day < 10 ? '0' + day : day) + ' ' + (hour < 10 ? '0' + hour : hour) + ':' + (minutes < 10 ? '0' + minutes : minutes) + ':' + (seconds < 10 ? '0' + seconds : seconds);
+    }
+  },
+
+  watch: {
+    filterText (val) {
+      this.$refs.treeRef.filter(val);
+    },
+
+    filterText1 (val) {
+      this.$refs.treeRef1.filter(val);
+    }
+  },
+}
+</script>
+<style lang="scss" scoped>
+.searchBox {
+  width: 80%;
+  display: flex;
+  justify-content: start;
+  align-items: center;
+  position: relative;
+
+  .btnBox {
+    position: absolute;
+    left: calc(100% + 60px);
+    top: 0;
+    display: flex;
+    justify-content: start;
+    align-items: center;
+  }
+
+  .el-input {
+    width: 150px;
+  }
+}
+
+.cardBox {
+  width: 100%;
+  display: flex;
+  justify-content: space-between;
+  align-items: center;
+
+  .el-card {
+    width: 32%;
+    height: 255px;
+
+    .treeBox {
+      width: 100%;
+
+      .el-tree {
+        width: 100%;
+        height: 160px;
+        margin-top: 10px;
+        overflow-y: scroll;
+
+        &::-webkit-scrollbar {
+          width: 6px;
+          height: 6px;
+          background: #fff;
+        }
+
+        &::-webkit-scrollbar-track {
+          border-radius: 5px;
+          background: #fff;
+        }
+
+        &::-webkit-scrollbar-thumb {
+          border-radius: 10px;
+          background: rgba(144, 147, 153, 0.3);
+        }
+      }
+    }
+  }
+}
+
+.selectBox {
+  .el-select {
+    max-height: 150px;
+    overflow-y: scroll;
+
+    &::-webkit-scrollbar {
+      width: 6px;
+      height: 6px;
+      background: #fff;
+    }
+
+    &::-webkit-scrollbar-track {
+      border-radius: 5px;
+      background: #fff;
+    }
+
+    &::-webkit-scrollbar-thumb {
+      border-radius: 10px;
+      background: rgba(144, 147, 153, 0.3);
+    }
+  }
+}
+
+.chartsBox {
+  width: 100%;
+  height: 400px;
+}
+</style>
+<style lang="scss">
+.cardBox {
+  .el-card__header {
+    padding: 5px 20px;
+  }
+
+  .el-card__body {
+    padding: 10px 20px;
+  }
+}
+</style>

+ 428 - 0
src/views/search/index.vue

@@ -0,0 +1,428 @@
+<template>
+  <div class="searchPage">
+    <div class="searchBox">
+      <el-form ref="form" :model="form" inline label-width="80px">
+        <el-form-item label="点名:">
+          <el-input style="width: 250px;" placeholder="请输入点名" size="middle" v-model="form.pointId" clearable></el-input>
+        </el-form-item>
+        <el-form-item label="描述:">
+          <el-input placeholder="请输入描述" size="middle" v-model="form.pointName" clearable></el-input>
+        </el-form-item>
+        <el-form-item label=" ">
+          <el-checkbox v-model="form.autoReq" label="刷新" border @change="reReqAjax"></el-checkbox>
+        </el-form-item>
+      </el-form>
+      <div class="btnBox">
+        <el-button type="primary" size="middle" @click="getTableData">查询</el-button>
+        <el-button type="warning" size="middle" @click="exportExcel('tableData')" v-if="tableData.length">导出</el-button>
+      </div>
+    </div>
+    <div class="tableBox">
+      <el-table :data="tableData" align="center" header-align="center" style="width: 100%;" height="700" max-height="700"
+        :fit="true">
+        <el-table-column type="index" :index="indexMethod" label="序号" width="100"></el-table-column>
+        <el-table-column prop="pointId" label="点名" :show-overflow-tooltip="true"></el-table-column>
+        <el-table-column prop="pointName" label="描述" width="400" :show-overflow-tooltip="true"></el-table-column>
+        <el-table-column prop="value" label="值" width="300"></el-table-column>
+        <el-table-column prop="timeDate" label="时间戳" width="260"></el-table-column>
+        <el-table-column fixed="right" label="操作" width="150">
+          <template slot-scope="scope">
+            <el-button @click="goDetails(scope.row)" type="text" size="small">详情</el-button>
+          </template>
+        </el-table-column>
+      </el-table>
+    </div>
+    <div class="block" style="margin-top:5px;" align="right">
+      <el-pagination @size-change="handleSizerealChange" @current-change="getPaginationCurrent" :current-page="currentPage"
+        :page-sizes="[100, 200, 300, 400]" :page-size="pagesizereal" layout="total, sizes, prev, pager, next, jumper"
+        :total="currentPageTotal">
+      </el-pagination>
+      <!-- <el-pagination
+          background
+          layout="prev, pager, next"
+          :page-size="pagesize"
+          :current-page.sync="currentPage"
+          @current-change="getPaginationCurrent"
+          :total="currentPageTotal">
+        </el-pagination> -->
+    </div>
+    <el-dialog title="查看详情" top="50px" :visible.sync="showDialog" width="95%" @closed="(res) =>{ this.form.dateArea=[this.fmtDate(new Date(new Date().setTime(new Date().getTime() - 3600 * 1000 * 24))), this.fmtDate(new Date()) ];this.detailsTableData=[]; }">
+      <div class="searchBox">
+        <el-form ref="form" :model="form" inline label-width="80px">
+          <el-form-item label="点名:">
+            <el-input readonly style="width: 300px;" size="middle" v-model="pointId" clearable></el-input>
+          </el-form-item>
+          <el-form-item label="日期:">
+            <el-date-picker size="medium" value-format="yyyy-MM-dd HH:mm:ss" v-model="form.dateArea" type="datetimerange"
+              :picker-options="pickerOptions" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期" align="right"
+              @change="(res) => { this.getDatePickerChange(res); }">
+            </el-date-picker>
+          </el-form-item>
+          <el-form-item label="间隔:">
+            <el-input placeholder="请输入间隔" clearable v-model="form.interval" type="number"></el-input>
+          </el-form-item>
+        </el-form>
+        <div class="btnBox">
+          <el-button type="primary" size="middle" @click="getDetails">查询</el-button>
+          <el-button type="warning" size="middle" @click="exportExcel('detailsTableData')" v-if="detailsTableData.length">导出</el-button>
+          <el-button type="success" size="middle" @click="renderCharts" v-if="detailsTableData.length">查看折线图</el-button>
+        </div>
+      </div>
+      <div class="tableBox" style="margin-top:0;">
+        <el-table :data="detailsTableData.slice((currentPage-1)*pagesize,currentPage*pagesize)" align="center"
+          header-align="center" style="width: 100%" max-height="450" height="450" :fit="true">
+          <el-table-column type="index" :index="indexMethod" label="序号" width="100"></el-table-column>
+          <!-- <el-table-column prop="pointId" label="点名" :show-overflow-tooltip="true"></el-table-column>
+          <el-table-column prop="pointName" label="描述" width="400" :show-overflow-tooltip="true"></el-table-column>
+          <el-table-column prop="timeDate" label="时间戳" width="260"></el-table-column>
+          <el-table-column prop="value" label="值" width="300"></el-table-column> -->
+          <el-table-column prop="timeDate" label="时间戳"></el-table-column>
+          <el-table-column prop="value" label="值"></el-table-column>
+        </el-table>
+      </div>
+      <div class="block" style="margin-top:5px;">
+        <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="currentPage"
+          :page-sizes="[10, 20, 50, 100]" :page-size="pagesize" layout="total, sizes, prev, pager, next, jumper" :total="detailsTableData.length">
+        </el-pagination>
+      </div>
+    </el-dialog>
+    <el-dialog title="查看折线图" top="100px" :visible.sync="chartDialogShow" width="60%">
+      <div id="lineChart" style="width:100%;height:500px;"></div>
+    </el-dialog>
+  </div>
+</template>
+
+<script>
+import { Message } from 'element-ui';
+import * as echarts from "echarts";
+
+export default {
+  data () {
+    return {
+      tableid: "",
+      pointId: "",
+      form: {
+        pointId: "",
+        pointName: "",
+        autoReq: false,
+        dateArea: [
+          this.fmtDate(new Date(new Date().setTime(new Date().getTime() - 3600 * 1000 * 24))),
+          this.fmtDate(new Date())
+        ],
+        interval: ""
+      },
+      showDialog: false,
+      chartDialogShow: false,
+      tableData: [],
+      detailsTableData: [],
+      autoReqTimmer: null,
+
+      currentPage: 1,
+      pagesize: 10,
+      pagesizereal: 100,
+      currentPageTotal: 0,
+      pickerOptions: {
+        shortcuts: [{
+          text: '最近一天',
+          onClick (picker) {
+            const end = new Date();
+            const start = new Date();
+            start.setTime(start.getTime() - 3600 * 1000 * 24);
+            picker.$emit('pick', [start, end]);
+          }
+        }, {
+          text: '最近一周',
+          onClick (picker) {
+            const end = new Date();
+            const start = new Date();
+            start.setTime(start.getTime() - 3600 * 1000 * 24 * 7);
+            picker.$emit('pick', [start, end]);
+          }
+        }, {
+          text: '最近一个月',
+          onClick (picker) {
+            const end = new Date();
+            const start = new Date();
+            start.setTime(start.getTime() - 3600 * 1000 * 24 * 30);
+            picker.$emit('pick', [start, end]);
+          }
+        }, {
+          text: '最近三个月',
+          onClick (picker) {
+            const end = new Date();
+            const start = new Date();
+            start.setTime(start.getTime() - 3600 * 1000 * 24 * 90);
+            picker.$emit('pick', [start, end]);
+          }
+        }]
+      }
+    }
+  },
+
+  mounted () {
+    let that = this;
+    that.$nextTick(() => {
+      that.tableid = that.$route.query.tableid;
+      that.getTableData();
+    });
+  },
+
+  destroyed () {
+    clearInterval(this.autoReqTimmer);
+    this.autoReqTimmer = null;
+  },
+
+  created () {
+    let that = this
+    that.tableid = "JSFW";
+    that.getTableData();
+  },
+
+  methods: {
+    // 获取表格数据
+    getTableData (skipLoading) {
+      if (!skipLoading) {
+        this.$store.commit("loadingStore", true);
+      }
+      this.API.get("datacenter/realtimeData?tableid=" + this.tableid + "&pointId=" + this.form.pointId + "&pointName=" + this.form.pointName + "&pageNum=" + this.currentPage + "&pageSize=" + this.pagesizereal).then((res) => {
+        res.data.forEach(ele => {
+          ele.timeDate = this.fmtDate(new Date(ele.time));
+          if (ele.value > 0) {
+            ele.value = parseFloat(ele.value).toFixed(4);
+          }
+        });
+        this.tableData = res.data || [];
+        this.currentPageTotal = res.count || [];
+        if (!skipLoading) {
+          this.$store.commit("loadingStore", false);
+        }
+      });
+    },
+
+    // index渲染函数
+    indexMethod (index) {
+      return index + 1;
+    },
+
+    // 查看详情按钮被点击
+    goDetails (row) {
+      this.pointId = row.pointId;
+      this.showDialog = true;
+    },
+
+    // 获取详情
+    getDetails () {
+      if (!this.form.dateArea || !this.form.dateArea.length) {
+        Message.error("请先选择要查询的日期区间后再试");
+      } else {
+        this.$store.commit("loadingStore", true);
+        let begin = (this.form.dateArea.length ? this.form.dateArea[0] : '');
+        let end = (this.form.dateArea.length ? this.form.dateArea[1] : '');
+
+        this.API.get("datacenter/historyData?pointId=" + this.pointId + "&begin=" + begin + "&end=" + end + (this.form.interval ? ("&interval=" + this.form.interval) : '')).then((res) => {
+          if (res.data.length) {
+            res.data.forEach(ele => {
+              ele.timeDate = this.fmtDate(new Date(ele.time));
+              if (ele.value > 0) {
+                ele.value = parseFloat(ele.value).toFixed(4);
+              }
+            });
+            this.detailsTableData = res.data || [];
+          } else {
+            Message.warning("所选日期区间之内暂无数据,请重试");
+          }
+          this.$store.commit("loadingStore", false);
+        });
+      }
+    },
+
+    // 初始页currentPage、初始每页数据数pagesize和数据data
+    handleSizeChange: function (size) {
+      this.pagesize = size;
+    },
+    handleSizerealChange: function (size) {
+      this.currentPage = 1;
+      this.pagesizereal = size;
+      this.getTableData();
+    },
+    handleCurrentChange: function (currentPage) {
+      this.currentPage = currentPage;
+    },
+
+    // 导出excel
+    exportExcel (tableDataName) {
+      if (tableDataName === 'tableData') {
+        let tableid = this.tableid;
+        let pointId = this.form.pointId || '';
+        let pointName = this.form.pointName || '';
+        this.API.get("datacenter/realtimeExport?tableid=" + tableid + "&pointId=" + pointId + "&pointName=" + pointName).then(res => {
+          const { export_json_to_excel } = require('@tools/excel/Export2Excel.js'); // 注意这个Export2Excel路径      
+          const tHeader = ['点名', '描述']; // 上面设置Excel的表格第一行的标题       
+          const filterVal = ['id', 'name']; // 上面的index、nickName、name是tableData里对象的属性key值   
+          const list = res.data; //把要导出的数据tableData存到list 
+          const data = this.formatJson(filterVal, list);
+          export_json_to_excel(tHeader, data, '导出的Excel'); // 最后一个是表名字
+        });
+      } else {
+        const { export_json_to_excel } = require('@tools/excel/Export2Excel.js'); // 注意这个Export2Excel路径      
+        const tHeader = ['点名', '描述', '时间戳', '值']; // 上面设置Excel的表格第一行的标题       
+        const filterVal = ['pointId', 'pointName', 'timeDate', 'value']; // 上面的index、nickName、name是tableData里对象的属性key值   
+        const list = this[tableDataName]; //把要导出的数据tableData存到list 
+        const data = this.formatJson(filterVal, list);
+        export_json_to_excel(tHeader, data, '导出的Excel'); // 最后一个是表名字
+      }
+    },
+
+    formatJson (filterVal, jsonData) {
+      return jsonData.map(v => filterVal.map(j => v[j]));
+    },
+
+    // 刷新开关
+    reReqAjax () {
+      clearInterval(this.autoReqTimmer);
+      this.autoReqTimmer = null;
+      if (this.form.autoReq) {
+        Message.success("已开启自动刷新数据,每间隔 1 秒自动刷新一次数据");
+        this.autoReqTimmer = setInterval(() => {
+          this.getTableData(true);
+        }, 1000);
+      } else {
+        Message.warning("已关闭自动刷新数据");
+      }
+    },
+
+    // 分页器每页数量修改
+    getPaginationSize (value) {
+      this.currentPageSize = value;
+      this.getDetails();
+    },
+
+    // 分页器页数修改
+    getPaginationCurrent (value) {
+      this.currentPage = value;
+      this.getTableData();
+    },
+
+    // 获取选中的时间
+    getDatePickerChange (value) {
+      this.detailsTableData = [];
+    },
+
+    // 渲染折线图
+    renderCharts () {
+      this.chartDialogShow = true;
+      this.$nextTick(() => {
+
+        let xAxisData = [];
+        let seriesData = [];
+
+        this.detailsTableData.forEach(ele => {
+          xAxisData.push(ele.timeDate);
+          seriesData.push(ele.value);
+        });
+        document.getElementById("lineChart").removeAttribute("_echarts_instance_");
+        let chartDom = document.getElementById('lineChart');
+        let myChart = echarts.init(chartDom);
+
+        let option = {
+          xAxis: {
+            type: 'category',
+            data: xAxisData
+          },
+          yAxis: {
+            type: 'value'
+          },
+          series: [{
+            data: seriesData,
+            type: 'line',
+            smooth: true,
+            name: "值"
+          }],
+          tooltip: {
+            trigger: 'axis',
+            axisPointer: {
+              type: 'cross',
+              label: {
+                backgroundColor: '#6a7985'
+              }
+            }
+          }
+        };
+        option && myChart.setOption(option);
+      });
+    },
+
+    // 格式化日期
+    fmtDate (date) {
+      let curDate = date || new Date();
+      let year = curDate.getFullYear();
+      let mouth = curDate.getUTCMonth() + 1;
+      let day = curDate.getDate();
+      let hour = curDate.getHours();
+      let minutes = curDate.getMinutes();
+      let seconds = curDate.getSeconds();
+      return year + '-' + (mouth < 10 ? '0' + mouth : mouth) + '-' + (day < 10 ? '0' + day : day) + ' ' + (hour < 10 ? '0' + hour : hour) + ':' + (minutes < 10 ? '0' + minutes : minutes) + ':' + (seconds < 10 ? '0' + seconds : seconds);
+    },
+  },
+
+  watch: {
+    $route (value) {
+      this.tableid = value.query.tableid;
+      this.form.pointName = "";
+      this.form.autoReq = false;
+      clearInterval(this.autoReqTimmer);
+      this.autoReqTimmer = null;
+      this.getTableData();
+    }
+  }
+}
+</script>
+  
+<style lang="scss" scoped>
+.searchBox {
+  width: 80%;
+  display: flex;
+  justify-content: start;
+  align-items: center;
+  position: relative;
+
+  .btnBox {
+    position: absolute;
+    left: calc(100% + 20px);
+    top: 0;
+    display: flex;
+    justify-content: start;
+    align-items: center;
+  }
+
+  .el-input {
+    width: 150px;
+  }
+}
+
+.tableBox {
+  margin-top: 10px;
+}
+
+.paginationBox {
+  width: 100%;
+  margin-top: 20px;
+  display: flex;
+  justify-content: flex-end;
+  align-items: center;
+}
+</style>
+<style lang="scss">
+.tableBox {
+  .cell {
+    text-align: center;
+  }
+}
+.searchPage {
+  .el-dialog__body {
+    padding: 10px 20px;
+    max-height: 570px;
+    overflow: hidden;
+  }
+}
+</style>