瀏覽代碼

解决台账筛选功能错误问题

zhangyu 5 年之前
父節點
當前提交
5739edcdbd

+ 4 - 4
src/components/ledger/handsontables/assets.vue

@@ -249,10 +249,6 @@ export default {
           })
           })
           this.copyMain = tools.deepCopy(this.tableData)
           this.copyMain = tools.deepCopy(this.tableData)
           this.page.total = res.Total
           this.page.total = res.Total
-          if (this.hot) {
-            this.hot.destroy()
-            this.hot = null
-          }
           if (this.tableData && this.tableData.length) {
           if (this.tableData && this.tableData.length) {
             // if (this.onlyRead) {
             // if (this.onlyRead) {
             //   this.getBatch(this.tableData)
             //   this.getBatch(this.tableData)
@@ -484,6 +480,10 @@ export default {
     initTable() {
     initTable() {
       var container = document.getElementById("handsontable");
       var container = document.getElementById("handsontable");
       let winHeight = document.documentElement.clientHeight;
       let winHeight = document.documentElement.clientHeight;
+      if (this.hot) {
+        this.hot.destroy();
+        this.hot = null;
+      }
       this.hot = new Handsontable(container, {
       this.hot = new Handsontable(container, {
         data: this.tableData,
         data: this.tableData,
         fixedColumnsLeft: 4,
         fixedColumnsLeft: 4,

+ 5 - 17
src/components/ledger/handsontables/device.vue

@@ -246,10 +246,6 @@ export default {
           this.tableData = res.Content;
           this.tableData = res.Content;
           this.copyMain = tools.deepCopy(this.tableData);
           this.copyMain = tools.deepCopy(this.tableData);
           this.page.total = res.Total;
           this.page.total = res.Total;
-          if (this.hot) {
-            this.hot.destroy();
-            this.hot = null;
-          }
           if (this.tableData && this.tableData.length) {
           if (this.tableData && this.tableData.length) {
             if (this.onlyRead) {
             if (this.onlyRead) {
               this.getBatch(this.tableData)
               this.getBatch(this.tableData)
@@ -425,6 +421,10 @@ export default {
     initTable() {
     initTable() {
       var container = document.getElementById("handsontable");
       var container = document.getElementById("handsontable");
       let winHeight = document.documentElement.clientHeight;
       let winHeight = document.documentElement.clientHeight;
+      if (this.hot) {
+        this.hot.destroy();
+        this.hot = null;
+      }
       this.hot = new Handsontable(container, {
       this.hot = new Handsontable(container, {
         data: this.tableData,
         data: this.tableData,
         fixedColumnsLeft: 6,
         fixedColumnsLeft: 6,
@@ -457,8 +457,7 @@ export default {
         afterChange: this.handleUpdataTable, //修改后
         afterChange: this.handleUpdataTable, //修改后
         afterFilter: this.trimmedRows, //排序前
         afterFilter: this.trimmedRows, //排序前
         afterRemoveRow: this.handleDeleteTableRow, //右键删除
         afterRemoveRow: this.handleDeleteTableRow, //右键删除
-        afterOnCellMouseDown: this.eventClick, //鼠标点击
-        // beforeColumnSort: this.sort
+        afterOnCellMouseDown: this.eventClick //鼠标点击
       });
       });
       let pro = document.getElementById("hot-display-license-info");
       let pro = document.getElementById("hot-display-license-info");
       if (!!pro) {
       if (!!pro) {
@@ -466,17 +465,6 @@ export default {
       }
       }
       this.isLoading = false;
       this.isLoading = false;
     },
     },
-    // sort(currentSortConfig, destinationSortConfigs){
-    //   const columnSortPlugin = this.hot.getPlugin('columnSorting');
-    //   debugger
-    //   columnSortPlugin.setSortConfig(destinationSortConfigs);
-    //   debugger
-    //   // const newData = ... // Calculated data set, ie. from an AJAX call.
-
-    //   // this.loadData(newData);
-
-    //   return false; // The blockade for the default sort action.
-    // },
     //表格中的点击
     //表格中的点击
     eventClick(el, rowArr) {
     eventClick(el, rowArr) {
       //点击的是表头
       //点击的是表头

+ 4 - 4
src/components/ledger/handsontables/system.vue

@@ -195,10 +195,6 @@ export default {
           _this.tableData = res.Content;
           _this.tableData = res.Content;
           _this.copyMain = tools.deepCopy(res.Content);
           _this.copyMain = tools.deepCopy(res.Content);
           _this.page.total = res.Total;
           _this.page.total = res.Total;
-          if (_this.hot) {
-            _this.hot.destroy();
-            _this.hot = null;
-          }
           if (res.Content && res.Content.length) {
           if (res.Content && res.Content.length) {
             if (this.onlyRead) {
             if (this.onlyRead) {
               this.getBatch(res.Content)
               this.getBatch(res.Content)
@@ -332,6 +328,10 @@ export default {
     initTable() {
     initTable() {
       var container = document.getElementById("handsontable");
       var container = document.getElementById("handsontable");
       let winHeight = document.documentElement.clientHeight;
       let winHeight = document.documentElement.clientHeight;
+      if (this.hot) {
+        this.hot.destroy();
+        this.hot = null;
+      }
       this.hot = new Handsontable(container, {
       this.hot = new Handsontable(container, {
         data: this.tableData,
         data: this.tableData,
         fixedColumnsLeft: 4,
         fixedColumnsLeft: 4,