|
|
|
<template>
|
|
|
|
<div>
|
|
|
|
<!--引用表格-->
|
|
|
|
<BasicTable @register="registerTable" :rowSelection="rowSelection" @change="handleTableChange">
|
|
|
|
<BasicTable @register="registerTable" :rowSelection="rowSelection">
|
|
|
|
<!--插槽:table标题-->
|
|
|
|
<template #tableTitle>
|
|
|
|
<a-button type="primary" v-auth="'airagbutton:airag_button:add'" @click="handleAdd" preIcon="ant-design:plus-outlined"> 新增</a-button>
|
|
...
|
...
|
@@ -41,60 +41,37 @@ |
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts" name="airagbutton-airagButton" setup>
|
|
|
|
import {ref, reactive, computed} from 'vue';
|
|
|
|
import { ref, reactive } from 'vue';
|
|
|
|
import { BasicTable, TableAction } from '/@/components/Table';
|
|
|
|
import { useModal } from '/@/components/Modal';
|
|
|
|
import { useListPage } from '/@/hooks/system/useListPage';
|
|
|
|
import AiragButtonModal from './components/AiragButtonModal.vue';
|
|
|
|
import { columns, searchFormSchema, superQuerySchema } from './AiragButton.data';
|
|
|
|
import { list, deleteOne, batchDelete, getImportUrl, getExportUrl, saveOrUpdate } from './AiragButton.api';
|
|
|
|
import { list, deleteOne, batchDelete, getImportUrl, getExportUrl } from './AiragButton.api';
|
|
|
|
import { useUserStore } from '/@/store/modules/user';
|
|
|
|
const queryParam = reactive<any>({});
|
|
|
|
const checkedKeys = ref<Array<string | number>>([]);
|
|
|
|
const userStore = useUserStore();
|
|
|
|
|
|
|
|
// 分页信息
|
|
|
|
const pagination = ref({
|
|
|
|
current: 1,
|
|
|
|
pageSize: 10,
|
|
|
|
total: 0,
|
|
|
|
});
|
|
|
|
|
|
|
|
// 处理表格变化事件(包括分页变化)
|
|
|
|
function handleTableChange(pag) {
|
|
|
|
if (pag) {
|
|
|
|
pagination.value = {
|
|
|
|
current: pag.current,
|
|
|
|
pageSize: pag.pageSize,
|
|
|
|
total: pag.total,
|
|
|
|
};
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// 创建带序号列的列配置
|
|
|
|
const tableColumns = computed(() => {
|
|
|
|
return columns.map((col) => {
|
|
|
|
if (col.dataIndex === 'index') {
|
|
|
|
// 序号列特殊处理
|
|
|
|
return {
|
|
|
|
...col,
|
|
|
|
customRender: ({ index }) => {
|
|
|
|
return (pagination.value.current - 1) * pagination.value.pageSize + index + 1;
|
|
|
|
},
|
|
|
|
};
|
|
|
|
}
|
|
|
|
return col;
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
//注册model
|
|
|
|
const [registerModal, { openModal }] = useModal();
|
|
|
|
//注册table数据
|
|
|
|
const { prefixCls, tableContext, onExportXls, onImportXls } = useListPage({
|
|
|
|
tableProps: {
|
|
|
|
title: '按钮表单',
|
|
|
|
api: list,
|
|
|
|
columns: tableColumns.value,
|
|
|
|
api: async (params) => {
|
|
|
|
const res = await list(params);
|
|
|
|
// 处理序号 - 关键修改
|
|
|
|
if (res?.records && Array.isArray(res.records)) {
|
|
|
|
const startIndex = (params.pageNo - 1) * params.pageSize + 1;
|
|
|
|
res.records = res.records.map((item, index) => ({
|
|
|
|
...item,
|
|
|
|
index: startIndex + index,
|
|
|
|
}));
|
|
|
|
}
|
|
|
|
return res;
|
|
|
|
},
|
|
|
|
columns,
|
|
|
|
canResize: false,
|
|
|
|
formConfig: {
|
|
|
|
//labelWidth: 120,
|
|
...
|
...
|
@@ -104,13 +81,6 @@ import {ref, reactive, computed} from 'vue'; |
|
|
|
fieldMapToNumber: [],
|
|
|
|
fieldMapToTime: [],
|
|
|
|
},
|
|
|
|
pagination: {
|
|
|
|
current: 1,
|
|
|
|
pageSize: 10,
|
|
|
|
showSizeChanger: true,
|
|
|
|
pageSizeOptions: ['10', '20', '30'],
|
|
|
|
showTotal: (total) => `共 ${total} 条`,
|
|
|
|
},
|
|
|
|
actionColumn: {
|
|
|
|
width: 120,
|
|
|
|
fixed: 'right',
|
|
...
|
...
|
@@ -131,7 +101,6 @@ import {ref, reactive, computed} from 'vue'; |
|
|
|
});
|
|
|
|
|
|
|
|
const [registerTable, { reload }, { rowSelection, selectedRowKeys }] = tableContext;
|
|
|
|
|
|
|
|
// 高级查询配置
|
|
|
|
const superQueryConfig = reactive(superQuerySchema);
|
|
|
|
|
...
|
...
|
|