Browse Source

设备运行查询-表格展示,表格列按照设备实际点位,自动设置列名

dong 2 months ago
parent
commit
e4c29871ea
1 changed files with 36 additions and 15 deletions
  1. 36 15
      src/views/module_tpm/equipmentRunStatis/history.vue

+ 36 - 15
src/views/module_tpm/equipmentRunStatis/history.vue

@@ -102,6 +102,7 @@ export default {
       dataSource: [],
       url: {
         list: '/tpmParams/tpmParams/list',
+        listparams: '/tpmParams/tpmParams/queryByEquipId',
       },
       // 表头
       columns: [
@@ -116,23 +117,11 @@ export default {
           },
         },
         {
-          title: '点位名称',
-          align: 'center',
-          // dataIndex: 'tagname',
-          dataIndex: 'tagname',
-        },
-        {
           title: '时间',
           align: 'center',
           // dataIndex: 'logtime',
           dataIndex: 'logtime',
         },
-        {
-          title: '值',
-          align: 'center',
-          // dataIndex: 'tagvalue2',
-          dataIndex: 'tagvalue',
-        },
       ],
     }
   },
@@ -228,10 +217,42 @@ export default {
         return
       }
       _this.loading = true
-      getAction(this.url.list, _this.queryParams).then((response) => {
-        _this.dataSource = response.result
+      // 获取图表信息
+      getAction(_this.url.listparams, _this.queryParams).then((res) => {
+        if (res.success) {
+          _this.columns = [
+            {
+              title: '序号',
+              dataIndex: '',
+              key: 'rowIndex',
+              width: 60,
+              align: 'center',
+              customRender: function (t, r, index) {
+                return parseInt(index) + 1;
+              },
+            },
+            {
+              title: '时间',
+              align: 'center',
+              dataIndex: 'logtime',
+            },
+          ],
+          console.log("listparams", res.result)
+          res.result.forEach(function(item) {
+            if (item.symbol !== 'TIME') {
+              _this.columns.push({
+                title: item.symbol,
+                align: 'center',
+                dataIndex: item.symbol,
+              })
+            }
+          })
+          getAction(_this.url.list, _this.queryParams).then((response) => {
+            _this.dataSource = response.result
 
-        this.loading = false
+            _this.loading = false
+          })
+        }
       })
     },
   },