| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253 |
- <template>
- <!--定义表格-->
- <BasicTable @register="registerTable" />
- </template>
- <script lang="ts" name="basic-table-demo" setup>
- import { BasicTable } from '/@/components/Table';
- import { useListPage } from '/@/hooks/system/useListPage';
- import { UnitTableColumns } from '../gasPumpSetting.data';
- import { getEvaluationUnitList } from '../gasPumpSetting.api';
- import { onMounted, onUnmounted } from 'vue';
- const { tableContext } = useListPage({
- designScope: 'basic-table-demo',
- tableProps: {
- columns: UnitTableColumns,
- size: 'small',
- useSearchForm: false,
- showActionColumn: false,
- showTableSetting: false,
- },
- });
- // BasicTable绑定注册
- 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>
|