😎代码格式化
This commit is contained in:
parent
3d3c32084d
commit
1d12c06676
@ -9,8 +9,7 @@ import 'vxe-table-plugin-element/dist/style.css';
|
|||||||
import VxeUI, { VxeComponentSizeType } from 'vxe-pc-ui';
|
import VxeUI, { VxeComponentSizeType } from 'vxe-pc-ui';
|
||||||
import ExcelJS from 'exceljs';
|
import ExcelJS from 'exceljs';
|
||||||
import { useThemeConfig } from '/@/stores/themeConfig';
|
import { useThemeConfig } from '/@/stores/themeConfig';
|
||||||
const vxeSize:VxeComponentSizeType = useThemeConfig().themeConfig.globalComponentSize == 'small' ? 'mini'
|
const vxeSize: VxeComponentSizeType = useThemeConfig().themeConfig.globalComponentSize == 'small' ? 'mini' : useThemeConfig().themeConfig.globalComponentSize == 'default' ? 'small' : 'medium';
|
||||||
: useThemeConfig().themeConfig.globalComponentSize == 'default' ? 'small' : 'medium';
|
|
||||||
|
|
||||||
export const setupVXETable = (app: App) => {
|
export const setupVXETable = (app: App) => {
|
||||||
// 加载插件
|
// 加载插件
|
||||||
@ -109,4 +108,4 @@ export const setupVXETable = (app: App) => {
|
|||||||
// app.config.globalProperties.$XPrint = VxeUI.print
|
// app.config.globalProperties.$XPrint = VxeUI.print
|
||||||
// app.config.globalProperties.$XSaveFile = VxeUI.saveFile
|
// app.config.globalProperties.$XSaveFile = VxeUI.saveFile
|
||||||
// app.config.globalProperties.$XReadFile = VxeUI.readFile
|
// app.config.globalProperties.$XReadFile = VxeUI.readFile
|
||||||
};
|
};
|
||||||
|
|||||||
@ -1,11 +1,10 @@
|
|||||||
import { dayjs } from 'element-plus';
|
import { dayjs } from 'element-plus';
|
||||||
import { reactive } from 'vue';
|
import { reactive } from 'vue';
|
||||||
import { VxeGridProps, VxeGridPropTypes,VxeComponentSizeType } from 'vxe-table';
|
import { VxeGridProps, VxeGridPropTypes, VxeComponentSizeType } from 'vxe-table';
|
||||||
import { useThemeConfig } from '/@/stores/themeConfig';
|
import { useThemeConfig } from '/@/stores/themeConfig';
|
||||||
import { merge } from 'lodash-es';
|
import { merge } from 'lodash-es';
|
||||||
|
|
||||||
const vxeSize:VxeComponentSizeType = useThemeConfig().themeConfig.globalComponentSize == 'small' ? 'mini'
|
const vxeSize: VxeComponentSizeType = useThemeConfig().themeConfig.globalComponentSize == 'small' ? 'mini' : useThemeConfig().themeConfig.globalComponentSize == 'default' ? 'small' : 'medium';
|
||||||
: useThemeConfig().themeConfig.globalComponentSize == 'default' ? 'small' : 'medium';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {String} id 表格唯一标识,为空时自动随机产生;
|
* @param {String} id 表格唯一标识,为空时自动随机产生;
|
||||||
|
|||||||
@ -122,7 +122,7 @@ const options = useVxeTable<SysConfig>(
|
|||||||
// vxeGrid配置参数(此处可覆写任何参数),参考vxe-table官方文档
|
// vxeGrid配置参数(此处可覆写任何参数),参考vxe-table官方文档
|
||||||
{
|
{
|
||||||
// 代理配置
|
// 代理配置
|
||||||
proxyConfig: { autoLoad: true, ajax: { query: ({ page, sort }) => handleQueryApi(page, sort) } },
|
proxyConfig: { autoLoad: true, ajax: { query: ({ page, sort }) => handleQueryApi(page, sort) } },
|
||||||
// 排序配置
|
// 排序配置
|
||||||
sortConfig: { defaultSort: Local.get(localPageParamKey)?.defaultSort || state.localPageParam.defaultSort },
|
sortConfig: { defaultSort: Local.get(localPageParamKey)?.defaultSort || state.localPageParam.defaultSort },
|
||||||
// 分页配置
|
// 分页配置
|
||||||
|
|||||||
@ -79,7 +79,7 @@
|
|||||||
<script lang="ts" setup name="sysMenu">
|
<script lang="ts" setup name="sysMenu">
|
||||||
import { reactive, ref } from 'vue';
|
import { reactive, ref } from 'vue';
|
||||||
import { ElMessageBox, ElMessage } from 'element-plus';
|
import { ElMessageBox, ElMessage } from 'element-plus';
|
||||||
import { VxeGridInstance,VxeGridListeners } from 'vxe-table';
|
import { VxeGridInstance, VxeGridListeners } from 'vxe-table';
|
||||||
import { useVxeTable } from '/@/hooks/useVxeTableOptionsHook';
|
import { useVxeTable } from '/@/hooks/useVxeTableOptionsHook';
|
||||||
import SvgIcon from '/@/components/svgIcon/index.vue';
|
import SvgIcon from '/@/components/svgIcon/index.vue';
|
||||||
|
|
||||||
@ -130,7 +130,7 @@ const options = useVxeTable<SysMenu>(
|
|||||||
pagerConfig: { enabled: false },
|
pagerConfig: { enabled: false },
|
||||||
// 工具栏配置
|
// 工具栏配置
|
||||||
toolbarConfig: { export: false },
|
toolbarConfig: { export: false },
|
||||||
treeConfig: { expandAll: false},
|
treeConfig: { expandAll: false },
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -143,7 +143,7 @@ const handleQueryApi = async () => {
|
|||||||
// 查询操作
|
// 查询操作
|
||||||
const handleQuery = async () => {
|
const handleQuery = async () => {
|
||||||
// 调用vxe-grid的commitProxy(query)方法,触发表格重新加载数据
|
// 调用vxe-grid的commitProxy(query)方法,触发表格重新加载数据
|
||||||
await xGrid.value?.commitProxy('query')
|
await xGrid.value?.commitProxy('query');
|
||||||
};
|
};
|
||||||
|
|
||||||
// 重置操作
|
// 重置操作
|
||||||
@ -151,14 +151,14 @@ const resetQuery = async () => {
|
|||||||
state.queryParams.title = undefined;
|
state.queryParams.title = undefined;
|
||||||
state.queryParams.type = undefined;
|
state.queryParams.type = undefined;
|
||||||
// 调用vxe-grid的commitProxy(reload)方法,触发表格重新加载数据
|
// 调用vxe-grid的commitProxy(reload)方法,触发表格重新加载数据
|
||||||
await xGrid.value?.commitProxy('reload')
|
await xGrid.value?.commitProxy('reload');
|
||||||
};
|
};
|
||||||
|
|
||||||
// 表格事件
|
// 表格事件
|
||||||
const gridEvents: VxeGridListeners<SysMenu> = {
|
const gridEvents: VxeGridListeners<SysMenu> = {
|
||||||
// 只对 proxy-config.ajax.query 配置时有效,当手动点击查询时会触发该事件
|
// 只对 proxy-config.ajax.query 配置时有效,当手动点击查询时会触发该事件
|
||||||
async proxyQuery() {
|
async proxyQuery() {
|
||||||
state.menuData = xGrid.value?.getTableData().tableData?? []
|
state.menuData = xGrid.value?.getTableData().tableData ?? [];
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user