Prechádzať zdrojové kódy

[Style 0000] 修复历史数据相关组件改变尺寸、改变分页时分页组件不可见的问题

houzekong 4 týždňov pred
rodič
commit
e8da4d5140

+ 44 - 10
src/views/vent/comment/history/HistoryTable.vue

@@ -51,10 +51,10 @@
   //      温度        安装位置
   // 取forcFan1Temp    取name
   // 当设备字段不含数据字典关键词(forcFan)时不做处理,当设备字段包含关键词但已指定编号(即字段包含数字)时不做处理
-  import { onMounted, ref, shallowRef } from 'vue';
+  import { computed, onMounted, ref, shallowRef } from 'vue';
   import { BasicColumn, PaginationProps, BasicTable } from '/@/components/Table';
   import { getTableHeaderColumns } from '/@/hooks/web/useWebColumns';
-  import { defaultFormProps, defaultPaginationProps, getDefaultSchemas, defaultTableProps } from './history.data';
+  import { getDefaultSchemas } from './history.data';
   import { adaptFormData, getDeviceList, getExportUrl, list } from './history.api';
   import { useListPage } from '/@/hooks/system/useListPage';
   import { initDictOptions } from '/@/utils/dict';
@@ -85,19 +85,57 @@
     {
       deviceCode: '',
       dictCode: '',
+      pagination: (): PaginationProps => ({
+        current: 1,
+        pageSize: 10,
+        pageSizeOptions: ['10', '30', '50', '100'],
+        showQuickJumper: false,
+      }),
     }
   );
 
   // 创建表格,此表格目前不具备常用功能,需要初始化后使用(props指定表格配置时除外)
   let originColumns: BasicColumn[] = [];
+  const scroll = computed(() => {
+    return { ...props.scroll, y: props.scroll.y - 100 };
+  });
   const { tableContext, onExportXls, onExportXlsPost } = useListPage({
-    tableProps: defaultTableProps,
+    tableProps: {
+      columns: [
+        {
+          align: 'center',
+          dataIndex: 'strinstallpos',
+          defaultHidden: false,
+          title: '安装位置',
+          width: 80,
+        },
+      ],
+      formConfig: {
+        labelAlign: 'left',
+        labelWidth: 80,
+        showAdvancedButton: false,
+        showSubmitButton: false,
+        showResetButton: false,
+        actionColOptions: {
+          xxl: 4,
+        },
+      },
+      canResize: true,
+      showTableSetting: false,
+      showActionColumn: false,
+      bordered: false,
+      size: 'small',
+      showIndexColumn: true,
+      tableLayout: 'auto',
+      scroll: scroll,
+      pagination: props.pagination,
+    },
     exportConfig: {
       name: '设备历史列表',
       url: () => getExportUrl(deviceInfo.value),
     },
   });
-  const [register, { getForm, setLoading, getPaginationRef, setPagination, setProps, setColumns }] = tableContext;
+  const [register, { getForm, setLoading, getPaginationRef, setPagination, setColumns }] = tableContext;
 
   /**
    * 初始化表格,该方法将根据参数设定新的表头、表单,如果提供了自定义的表头、表单配置则不作操作。
@@ -116,12 +154,8 @@
         break;
       }
     }
-    setProps({
-      formConfig: {
-        ...defaultFormProps,
-        schemas: defaultSchemas,
-      },
-      pagination: props.pagination || defaultPaginationProps,
+    getForm().setProps({
+      schemas: defaultSchemas,
     });
   }
 

+ 1 - 35
src/views/vent/comment/history/history.data.ts

@@ -1,5 +1,5 @@
 import dayjs from 'dayjs';
-import { BasicTableProps, PaginationProps, FormProps, FormSchema } from '/@/components/Table';
+import { FormSchema } from '/@/components/Table';
 import { getAutoScrollContainer } from '/@/utils/common/compUtils';
 import { get } from 'lodash-es';
 
@@ -145,37 +145,3 @@ export const getDefaultSchemas: (dictOptions: any[], deviceOptions: any[], onDev
     },
   ];
 };
-
-/** 默认的表格props,参考 BasicTable 组件 */
-export const defaultTableProps: BasicTableProps = {
-  columns: [
-    {
-      align: 'center',
-      dataIndex: 'strinstallpos',
-      defaultHidden: false,
-      title: '安装位置',
-      width: 80,
-    },
-  ],
-  bordered: false,
-  size: 'small',
-  showIndexColumn: true,
-  showActionColumn: false,
-};
-
-/** 默认的查询表单props,参考 BasicForm 组件 */
-export const defaultFormProps: FormProps = {
-  labelAlign: 'left',
-  labelWidth: 80,
-  showAdvancedButton: false,
-  showSubmitButton: false,
-  showResetButton: false,
-};
-
-/** 默认的表格分页props,参考 BasicTable 组件 */
-export const defaultPaginationProps: PaginationProps = {
-  current: 1,
-  pageSize: 10,
-  pageSizeOptions: ['10', '30', '50', '100'],
-  showQuickJumper: false,
-};