Bläddra i källkod

Merge branch 'master' of http://182.92.126.35:3000/hrx/mky-vent-base

lxh 8 månader sedan
förälder
incheckning
c3bc633b91

+ 31 - 85
src/views/vent/gas/gasPumpSetting/components/unitTable.vue

@@ -7,89 +7,8 @@
   import { BasicTable } from '/@/components/Table';
   import { useListPage } from '/@/hooks/system/useListPage';
   import { UnitTableColumns } from '../gasPumpSetting.data';
-
-  const tableData = [
-    {
-      key: '1',
-      name: '胡歌',
-      age: 32,
-      dep: '朝阳区林萃路1号',
-      ret: '朝阳区林萃路1号',
-      oba: '朝阳区林萃路1号',
-    },
-    {
-      key: '1',
-      name: '胡歌',
-      age: 32,
-      dep: '朝阳区林萃路1号',
-      ret: '朝阳区林萃路1号',
-      oba: '朝阳区林萃路1号',
-    },
-    {
-      key: '1',
-      name: '胡歌',
-      age: 32,
-      dep: '朝阳区林萃路1号',
-      ret: '朝阳区林萃路1号',
-      oba: '朝阳区林萃路1号',
-    },
-    {
-      key: '1',
-      name: '胡歌',
-      age: 32,
-      dep: '朝阳区林萃路1号',
-      ret: '朝阳区林萃路1号',
-      oba: '朝阳区林萃路1号',
-    },
-    {
-      key: '1',
-      name: '胡歌',
-      age: 32,
-      dep: '朝阳区林萃路1号',
-      ret: '朝阳区林萃路1号',
-      oba: '朝阳区林萃路1号',
-    },
-    {
-      key: '1',
-      name: '胡歌',
-      age: 32,
-      dep: '朝阳区林萃路1号',
-      ret: '朝阳区林萃路1号',
-      oba: '朝阳区林萃路1号',
-    },
-    {
-      key: '1',
-      name: '胡歌',
-      age: 32,
-      dep: '朝阳区林萃路1号',
-      ret: '朝阳区林萃路1号',
-      oba: '朝阳区林萃路1号',
-    },
-    {
-      key: '1',
-      name: '胡歌',
-      age: 32,
-      dep: '朝阳区林萃路1号',
-      ret: '朝阳区林萃路1号',
-      oba: '朝阳区林萃路1号',
-    },
-    {
-      key: '1',
-      name: '胡歌',
-      age: 32,
-      dep: '朝阳区林萃路1号',
-      ret: '朝阳区林萃路1号',
-      oba: '朝阳区林萃路1号',
-    },
-    {
-      key: '1',
-      name: '胡歌',
-      age: 32,
-      dep: '朝阳区林萃路1号',
-      ret: '朝阳区林萃路1号',
-      oba: '朝阳区林萃路1号',
-    },
-  ];
+  import { getEvaluationUnitList } from '../gasPumpSetting.api';
+  import { onMounted, onUnmounted } from 'vue';
 
   const { tableContext } = useListPage({
     designScope: 'basic-table-demo',
@@ -97,11 +16,38 @@
       columns: UnitTableColumns,
       size: 'small',
       useSearchForm: false,
-      api: () => Promise.resolve(tableData),
       showActionColumn: false,
       showTableSetting: false,
     },
   });
   // BasicTable绑定注册
-  const [registerTable] = tableContext;
+  const [registerTable, { setPagination, setLoading, setTableData }] = tableContext;
+
+  function fetchTableData() {
+    setLoading(true);
+    return getEvaluationUnitList({})
+      .then(({ current, total, records }) => {
+        setPagination({
+          current,
+          total,
+        });
+        setTableData(records);
+      })
+      .finally(() => {
+        setLoading(false);
+      });
+  }
+
+  let timer: any = null;
+
+  onMounted(() => {
+    timer = setInterval(() => {
+      fetchTableData();
+    }, 10000);
+    fetchTableData();
+  });
+
+  onUnmounted(() => {
+    timer = clearInterval(timer);
+  });
 </script>

+ 10 - 10
src/views/vent/gas/gasPumpSetting/gasPumpSetting.data.ts

@@ -461,8 +461,8 @@ export const ManualSettingHeaderConfig = {
 export const UnitTableColumns: BasicColumn[] = [
   {
     title: '评价单元',
-    dataIndex: 'name',
-    key: 'name',
+    dataIndex: 'deviceInfoName',
+    key: 'deviceInfoName',
     rowSpan: 4,
     customCell: (_, index = 0) => {
       // 每4行合并为一列
@@ -475,22 +475,22 @@ export const UnitTableColumns: BasicColumn[] = [
   },
   {
     title: '取样位置',
-    dataIndex: 'age',
-    key: 'age',
+    dataIndex: 'samplingLocation',
+    key: 'samplingLocation',
   },
   {
     title: '采样深度(m)',
-    dataIndex: 'dep',
-    key: 'dep',
+    dataIndex: 'samplingDepth',
+    key: 'samplingDepth',
   },
   {
     title: '残余瓦斯含量',
-    dataIndex: 'ret',
-    key: 'ret',
+    dataIndex: 'residualGasContent',
+    key: 'residualGasContent',
   },
   {
     title: '可解吸瓦斯含量',
-    dataIndex: 'oba',
-    key: 'oba',
+    dataIndex: 'desorbableGasContent',
+    key: 'desorbableGasContent',
   },
 ];