reactor: 重构 XTable

pull/2/head
xingyu 2023-01-03 11:21:27 +08:00
parent a984eac965
commit f352c4d941
32 changed files with 250 additions and 285 deletions

View File

@ -118,45 +118,64 @@ const getColumnsConfig = (options: XTableProps) => {
// //
const getProxyConfig = (options: XTableProps) => { const getProxyConfig = (options: XTableProps) => {
const { getListApi, proxyConfig, data } = options const { getListApi, proxyConfig, data, isList } = options
if (proxyConfig || data) return if (proxyConfig || data) return
if (getListApi && isFunction(getListApi)) { if (getListApi && isFunction(getListApi) && !isList) {
options.proxyConfig = { if (!isList) {
seq: true, // options.proxyConfig = {
form: proxyForm, // reload seq: true, //
props: { result: 'list', total: 'total' }, form: proxyForm, // reload
ajax: { props: { result: 'list', total: 'total' },
query: async ({ page, form }) => { ajax: {
let queryParams: any = Object.assign({}, JSON.parse(JSON.stringify(form))) query: async ({ page, form }) => {
if (options.params) { let queryParams: any = Object.assign({}, JSON.parse(JSON.stringify(form)))
queryParams = Object.assign(queryParams, options.params) if (options.params) {
} queryParams = Object.assign(queryParams, options.params)
if (!options?.treeConfig) {
queryParams.pageSize = page.pageSize
queryParams.pageNo = page.currentPage
}
return new Promise(async (resolve) => {
resolve(await getListApi(queryParams))
})
},
delete: ({ body }) => {
return new Promise(async (resolve) => {
if (options.deleteApi) {
resolve(await options.deleteApi(JSON.stringify(body)))
} else {
Promise.reject('未设置deleteApi')
} }
}) if (!options?.treeConfig) {
}, queryParams.pageSize = page.pageSize
queryAll: ({ form }) => { queryParams.pageNo = page.currentPage
const queryParams = Object.assign({}, JSON.parse(JSON.stringify(form))) }
return new Promise(async (resolve) => { return new Promise(async (resolve) => {
if (options.getAllListApi) {
resolve(await options.getAllListApi(queryParams))
} else {
resolve(await getListApi(queryParams)) resolve(await getListApi(queryParams))
})
},
delete: ({ body }) => {
return new Promise(async (resolve) => {
if (options.deleteApi) {
resolve(await options.deleteApi(JSON.stringify(body)))
} else {
Promise.reject('未设置deleteApi')
}
})
},
queryAll: ({ form }) => {
const queryParams = Object.assign({}, JSON.parse(JSON.stringify(form)))
return new Promise(async (resolve) => {
if (options.getAllListApi) {
resolve(await options.getAllListApi(queryParams))
} else {
resolve(await getListApi(queryParams))
}
})
}
}
}
} else {
options.proxyConfig = {
seq: true, //
form: true, // reload
props: { result: 'data' },
ajax: {
query: ({ form }) => {
let queryParams: any = Object.assign({}, JSON.parse(JSON.stringify(form)))
if (options?.params) {
queryParams = Object.assign(queryParams, options.params)
} }
}) return new Promise(async (resolve) => {
resolve(await getListApi(queryParams))
})
}
} }
} }
} }
@ -232,14 +251,14 @@ const getPageConfig = (options: XTableProps) => {
// tool bar // tool bar
const getToolBarConfig = (options: XTableProps) => { const getToolBarConfig = (options: XTableProps) => {
const { toolBar, toolbarConfig } = options const { toolBar, toolbarConfig, topActionSlots } = options
if (toolbarConfig) return if (toolbarConfig) return
if (toolBar) { if (toolBar) {
if (!isBoolean(toolBar)) { if (!isBoolean(toolBar)) {
options.toolbarConfig = toolBar options.toolbarConfig = toolBar
return return
} }
} else { } else if (!topActionSlots) {
options.toolbarConfig = { options.toolbarConfig = {
slots: { buttons: 'toolbar_buttons' } slots: { buttons: 'toolbar_buttons' }
} }

View File

@ -6,6 +6,7 @@ export type XTableProps<D = any> = VxeGridProps<D> & {
height?: number // 高度 默认730 height?: number // 高度 默认730
topActionSlots?: boolean // 是否开启表格内顶部操作栏插槽 topActionSlots?: boolean // 是否开启表格内顶部操作栏插槽
treeConfig?: VxeTablePropTypes.TreeConfig // 树形表单配置 treeConfig?: VxeTablePropTypes.TreeConfig // 树形表单配置
isList?: boolean // 是否不带分页的list
getListApi?: Function getListApi?: Function
getAllListApi?: Function getAllListApi?: Function
deleteApi?: Function deleteApi?: Function

View File

@ -1,7 +1,7 @@
<template> <template>
<ContentWrap> <ContentWrap>
<!-- 列表 --> <!-- 列表 -->
<vxe-grid ref="xGrid" v-bind="gridOptions" class="xtable-scrollbar"> <XTable @register="registerTable">
<template #duration_default="{ row }"> <template #duration_default="{ row }">
<span>{{ row.duration + 'ms' }}</span> <span>{{ row.duration + 'ms' }}</span>
</template> </template>
@ -17,7 +17,7 @@
@click="handleDetail(row)" @click="handleDetail(row)"
/> />
</template> </template>
</vxe-grid> </XTable>
</ContentWrap> </ContentWrap>
<XModal v-model="dialogVisible" :title="dialogTitle"> <XModal v-model="dialogVisible" :title="dialogTitle">
<!-- 对话框(详情) --> <!-- 对话框(详情) -->
@ -38,15 +38,14 @@
<script setup lang="ts" name="ApiAccessLog"> <script setup lang="ts" name="ApiAccessLog">
import { ref } from 'vue' import { ref } from 'vue'
import { useI18n } from '@/hooks/web/useI18n' import { useI18n } from '@/hooks/web/useI18n'
import { useVxeGrid } from '@/hooks/web/useVxeGrid' import { useXTable } from '@/hooks/web/useXTable'
import { VxeGridInstance } from 'vxe-table'
import { allSchemas } from './apiAccessLog.data' import { allSchemas } from './apiAccessLog.data'
import * as ApiAccessLogApi from '@/api/infra/apiAccessLog' import * as ApiAccessLogApi from '@/api/infra/apiAccessLog'
const { t } = useI18n() // const { t } = useI18n() //
// //
const xGrid = ref<VxeGridInstance>() // Grid Ref const [registerTable] = useXTable({
const { gridOptions } = useVxeGrid<ApiAccessLogApi.ApiAccessLogVO>({
allSchemas: allSchemas, allSchemas: allSchemas,
topActionSlots: false, topActionSlots: false,
getListApi: ApiAccessLogApi.getApiAccessLogPageApi getListApi: ApiAccessLogApi.getApiAccessLogPageApi

View File

@ -1,7 +1,7 @@
<template> <template>
<ContentWrap> <ContentWrap>
<!-- 列表 --> <!-- 列表 -->
<vxe-grid ref="xGrid" v-bind="gridOptions" class="xtable-scrollbar"> <XTable @register="registerTable">
<!-- 操作导出 --> <!-- 操作导出 -->
<template #toolbar_buttons> <template #toolbar_buttons>
<XButton <XButton
@ -40,7 +40,7 @@
@click="handleProcessClick(row, InfraApiErrorLogProcessStatusEnum.IGNORE, '已忽略')" @click="handleProcessClick(row, InfraApiErrorLogProcessStatusEnum.IGNORE, '已忽略')"
/> />
</template> </template>
</vxe-grid> </XTable>
</ContentWrap> </ContentWrap>
<XModal v-model="dialogVisible" :title="dialogTitle"> <XModal v-model="dialogVisible" :title="dialogTitle">
<!-- 对话框(详情) --> <!-- 对话框(详情) -->
@ -54,18 +54,17 @@
<script setup lang="ts" name="ApiErrorLog"> <script setup lang="ts" name="ApiErrorLog">
import { ref } from 'vue' import { ref } from 'vue'
import { useI18n } from '@/hooks/web/useI18n' import { useI18n } from '@/hooks/web/useI18n'
import { useVxeGrid } from '@/hooks/web/useVxeGrid' import { useXTable } from '@/hooks/web/useXTable'
import { VxeGridInstance } from 'vxe-table'
import { allSchemas } from './apiErrorLog.data' import { allSchemas } from './apiErrorLog.data'
import * as ApiErrorLogApi from '@/api/infra/apiErrorLog' import * as ApiErrorLogApi from '@/api/infra/apiErrorLog'
import { InfraApiErrorLogProcessStatusEnum } from '@/utils/constants' import { InfraApiErrorLogProcessStatusEnum } from '@/utils/constants'
import { useMessage } from '@/hooks/web/useMessage' import { useMessage } from '@/hooks/web/useMessage'
const message = useMessage()
const { t } = useI18n() // const { t } = useI18n() //
const message = useMessage()
// ========== ========== // ========== ==========
const xGrid = ref<VxeGridInstance>() // Grid Ref const [registerTable, { reload, exportList }] = useXTable({
const { gridOptions, getList, exportList } = useVxeGrid<ApiErrorLogApi.ApiErrorLogVO>({
allSchemas: allSchemas, allSchemas: allSchemas,
getListApi: ApiErrorLogApi.getApiErrorLogPageApi, getListApi: ApiErrorLogApi.getApiErrorLogPageApi,
exportListApi: ApiErrorLogApi.exportApiErrorLogApi exportListApi: ApiErrorLogApi.exportApiErrorLogApi
@ -84,7 +83,7 @@ const handleDetail = (row: ApiErrorLogApi.ApiErrorLogVO) => {
} }
// //
const handleExport = async () => { const handleExport = async () => {
await exportList(xGrid, '错误数据.xls') await exportList('错误数据.xls')
} }
// //
const handleProcessClick = ( const handleProcessClick = (
@ -100,7 +99,7 @@ const handleProcessClick = (
}) })
.finally(async () => { .finally(async () => {
// //
await getList(xGrid) await reload()
}) })
.catch(() => {}) .catch(() => {})
} }

View File

@ -1,7 +1,7 @@
<template> <template>
<ContentWrap> <ContentWrap>
<!-- 列表 --> <!-- 列表 -->
<vxe-grid ref="xGrid" v-bind="gridOptions" class="xtable-scrollbar"> <XTable @register="registerTable">
<template #toolbar_buttons> <template #toolbar_buttons>
<!-- 操作导入 --> <!-- 操作导入 -->
<XButton <XButton
@ -49,7 +49,7 @@
@click="handleGenTable(row)" @click="handleGenTable(row)"
/> />
</template> </template>
</vxe-grid> </XTable>
</ContentWrap> </ContentWrap>
<!-- 弹窗导入表 --> <!-- 弹窗导入表 -->
<ImportTable ref="importRef" @ok="handleQuery()" /> <ImportTable ref="importRef" @ok="handleQuery()" />
@ -59,10 +59,9 @@
<script setup lang="ts" name="Codegen"> <script setup lang="ts" name="Codegen">
import { ref } from 'vue' import { ref } from 'vue'
import { useRouter } from 'vue-router' import { useRouter } from 'vue-router'
import { VxeGridInstance } from 'vxe-table'
import { useI18n } from '@/hooks/web/useI18n' import { useI18n } from '@/hooks/web/useI18n'
import { useMessage } from '@/hooks/web/useMessage' import { useMessage } from '@/hooks/web/useMessage'
import { useVxeGrid } from '@/hooks/web/useVxeGrid' import { useXTable } from '@/hooks/web/useXTable'
import download from '@/utils/download' import download from '@/utils/download'
import * as CodegenApi from '@/api/infra/codegen' import * as CodegenApi from '@/api/infra/codegen'
import { CodegenTableVO } from '@/api/infra/codegen/types' import { CodegenTableVO } from '@/api/infra/codegen/types'
@ -73,8 +72,7 @@ const { t } = useI18n() // 国际化
const message = useMessage() // const message = useMessage() //
const { push } = useRouter() // const { push } = useRouter() //
// //
const xGrid = ref<VxeGridInstance>() // Grid Ref const [registerTable, { reload, deleteData }] = useXTable({
const { gridOptions, getList, deleteData } = useVxeGrid<CodegenTableVO>({
allSchemas: allSchemas, allSchemas: allSchemas,
getListApi: CodegenApi.getCodegenTablePageApi, getListApi: CodegenApi.getCodegenTablePageApi,
deleteApi: CodegenApi.deleteCodegenTableApi deleteApi: CodegenApi.deleteCodegenTableApi
@ -112,10 +110,10 @@ const handleGenTable = async (row: CodegenTableVO) => {
} }
// //
const handleDelete = async (rowId: number) => { const handleDelete = async (rowId: number) => {
await deleteData(xGrid, rowId) await deleteData(rowId)
} }
// //
const handleQuery = async () => { const handleQuery = async () => {
await getList(xGrid) await reload()
} }
</script> </script>

View File

@ -1,7 +1,7 @@
<template> <template>
<ContentWrap> <ContentWrap>
<!-- 列表 --> <!-- 列表 -->
<vxe-grid ref="xGrid" v-bind="gridOptions" class="xtable-scrollbar"> <XTable @register="registerTable">
<template #toolbar_buttons> <template #toolbar_buttons>
<!-- 操作新增 --> <!-- 操作新增 -->
<XButton <XButton
@ -46,7 +46,7 @@
@click="handleDelete(row.id)" @click="handleDelete(row.id)"
/> />
</template> </template>
</vxe-grid> </XTable>
</ContentWrap> </ContentWrap>
<XModal v-model="dialogVisible" :title="dialogTitle"> <XModal v-model="dialogVisible" :title="dialogTitle">
@ -87,8 +87,7 @@
import { ref, unref } from 'vue' import { ref, unref } from 'vue'
import { useI18n } from '@/hooks/web/useI18n' import { useI18n } from '@/hooks/web/useI18n'
import { useMessage } from '@/hooks/web/useMessage' import { useMessage } from '@/hooks/web/useMessage'
import { useVxeGrid } from '@/hooks/web/useVxeGrid' import { useXTable } from '@/hooks/web/useXTable'
import { VxeGridInstance } from 'vxe-table'
import { FormExpose } from '@/components/Form' import { FormExpose } from '@/components/Form'
// import // import
import * as ConfigApi from '@/api/infra/config' import * as ConfigApi from '@/api/infra/config'
@ -97,8 +96,7 @@ import { rules, allSchemas } from './config.data'
const { t } = useI18n() // const { t } = useI18n() //
const message = useMessage() // const message = useMessage() //
// //
const xGrid = ref<VxeGridInstance>() // Grid Ref const [registerTable, { reload, deleteData, exportList }] = useXTable({
const { gridOptions, getList, deleteData, exportList } = useVxeGrid<ConfigApi.ConfigVO>({
allSchemas: allSchemas, allSchemas: allSchemas,
getListApi: ConfigApi.getConfigPageApi, getListApi: ConfigApi.getConfigPageApi,
deleteApi: ConfigApi.deleteConfigApi, deleteApi: ConfigApi.deleteConfigApi,
@ -127,7 +125,7 @@ const handleCreate = () => {
// //
const handleExport = async () => { const handleExport = async () => {
await exportList(xGrid, '配置.xls') await exportList('配置.xls')
} }
// //
@ -147,7 +145,7 @@ const handleDetail = async (rowId: number) => {
// //
const handleDelete = async (rowId: number) => { const handleDelete = async (rowId: number) => {
await deleteData(xGrid, rowId) await deleteData(rowId)
} }
// //
@ -171,7 +169,7 @@ const submitForm = async () => {
} finally { } finally {
actionLoading.value = false actionLoading.value = false
// //
await getList(xGrid) await reload()
} }
} }
}) })

View File

@ -1,7 +1,7 @@
<template> <template>
<ContentWrap> <ContentWrap>
<!-- 列表 --> <!-- 列表 -->
<vxe-grid ref="xGrid" v-bind="gridOptions" class="xtable-scrollbar"> <XTable @register="registerTable">
<template #toolbar_buttons> <template #toolbar_buttons>
<XButton <XButton
type="primary" type="primary"
@ -34,7 +34,7 @@
@click="handleDelete(row.id)" @click="handleDelete(row.id)"
/> />
</template> </template>
</vxe-grid> </XTable>
</ContentWrap> </ContentWrap>
<XModal v-model="dialogVisible" :title="dialogTitle"> <XModal v-model="dialogVisible" :title="dialogTitle">
<!-- 对话框(添加 / 修改) --> <!-- 对话框(添加 / 修改) -->
@ -69,9 +69,8 @@
// import // import
import { ref, unref } from 'vue' import { ref, unref } from 'vue'
import { useI18n } from '@/hooks/web/useI18n' import { useI18n } from '@/hooks/web/useI18n'
import { useXTable } from '@/hooks/web/useXTable'
import { useMessage } from '@/hooks/web/useMessage' import { useMessage } from '@/hooks/web/useMessage'
import { useVxeGrid } from '@/hooks/web/useVxeGrid'
import { VxeGridInstance } from 'vxe-table'
import { FormExpose } from '@/components/Form' import { FormExpose } from '@/components/Form'
// import // import
import * as DataSourceConfiggApi from '@/api/infra/dataSourceConfig' import * as DataSourceConfiggApi from '@/api/infra/dataSourceConfig'
@ -80,8 +79,7 @@ import { rules, allSchemas } from './dataSourceConfig.data'
const { t } = useI18n() // const { t } = useI18n() //
const message = useMessage() // const message = useMessage() //
// //
const xGrid = ref<VxeGridInstance>() // Grid Ref const [registerTable, { reload, deleteData }] = useXTable({
const { gridOptions, getList, deleteData } = useVxeGrid<DataSourceConfiggApi.DataSourceConfigVO>({
allSchemas: allSchemas, allSchemas: allSchemas,
isList: true, isList: true,
getListApi: DataSourceConfiggApi.getDataSourceConfigListApi, getListApi: DataSourceConfiggApi.getDataSourceConfigListApi,
@ -125,7 +123,7 @@ const handleDetail = async (rowId: number) => {
// //
const handleDelete = async (rowId: number) => { const handleDelete = async (rowId: number) => {
await deleteData(xGrid, rowId) await deleteData(rowId)
} }
// //
@ -149,7 +147,7 @@ const submitForm = async () => {
} finally { } finally {
loading.value = false loading.value = false
// //
await getList(xGrid) await reload()
} }
} }
}) })

View File

@ -1,7 +1,7 @@
<template> <template>
<ContentWrap> <ContentWrap>
<!-- 列表 --> <!-- 列表 -->
<vxe-grid ref="xGrid" v-bind="gridOptions" class="xtable-scrollbar"> <XTable @register="registerTable">
<template #toolbar_buttons> <template #toolbar_buttons>
<!-- 操作新增 --> <!-- 操作新增 -->
<XButton <XButton
@ -44,7 +44,7 @@
@click="handleDelete(row.id)" @click="handleDelete(row.id)"
/> />
</template> </template>
</vxe-grid> </XTable>
</ContentWrap> </ContentWrap>
<XModal v-model="dialogVisible" :title="dialogTitle"> <XModal v-model="dialogVisible" :title="dialogTitle">
<!-- 对话框(添加 / 修改) --> <!-- 对话框(添加 / 修改) -->
@ -173,8 +173,7 @@ import {
} from 'element-plus' } from 'element-plus'
import { useI18n } from '@/hooks/web/useI18n' import { useI18n } from '@/hooks/web/useI18n'
import { useMessage } from '@/hooks/web/useMessage' import { useMessage } from '@/hooks/web/useMessage'
import { useVxeGrid } from '@/hooks/web/useVxeGrid' import { useXTable } from '@/hooks/web/useXTable'
import { VxeGridInstance } from 'vxe-table'
// import // import
import * as FileConfigApi from '@/api/infra/fileConfig' import * as FileConfigApi from '@/api/infra/fileConfig'
import { rules, allSchemas } from './fileConfig.data' import { rules, allSchemas } from './fileConfig.data'
@ -183,8 +182,7 @@ import { getIntDictOptions, DICT_TYPE } from '@/utils/dict'
const { t } = useI18n() // const { t } = useI18n() //
const message = useMessage() // const message = useMessage() //
// //
const xGrid = ref<VxeGridInstance>() // Grid Ref const [registerTable, { reload, deleteData }] = useXTable({
const { gridOptions, getList, deleteData } = useVxeGrid<FileConfigApi.FileConfigVO>({
allSchemas: allSchemas, allSchemas: allSchemas,
getListApi: FileConfigApi.getFileConfigPageApi, getListApi: FileConfigApi.getFileConfigPageApi,
deleteApi: FileConfigApi.deleteFileConfigApi deleteApi: FileConfigApi.deleteFileConfigApi
@ -276,7 +274,7 @@ const handleMaster = (row: FileConfigApi.FileConfigVO) => {
.confirm('是否确认修改配置【 ' + row.name + ' 】为主配置?', t('common.reminder')) .confirm('是否确认修改配置【 ' + row.name + ' 】为主配置?', t('common.reminder'))
.then(async () => { .then(async () => {
await FileConfigApi.updateFileConfigMasterApi(row.id) await FileConfigApi.updateFileConfigMasterApi(row.id)
await getList(xGrid) await reload()
}) })
} }
@ -287,7 +285,7 @@ const handleTest = async (rowId: number) => {
// //
const handleDelete = async (rowId: number) => { const handleDelete = async (rowId: number) => {
await deleteData(xGrid, rowId) await deleteData(rowId)
} }
// //
@ -308,7 +306,7 @@ const submitForm = async (formEl: FormInstance | undefined) => {
dialogVisible.value = false dialogVisible.value = false
} finally { } finally {
actionLoading.value = false actionLoading.value = false
await getList(xGrid) await reload()
} }
} }
}) })

View File

@ -1,7 +1,7 @@
<template> <template>
<ContentWrap> <ContentWrap>
<!-- 列表 --> <!-- 列表 -->
<vxe-grid ref="xGrid" v-bind="gridOptions" class="xtable-scrollbar"> <XTable @register="registerTable">
<template #toolbar_buttons> <template #toolbar_buttons>
<XButton <XButton
type="primary" type="primary"
@ -24,7 +24,7 @@
@click="handleDelete(row.id)" @click="handleDelete(row.id)"
/> />
</template> </template>
</vxe-grid> </XTable>
</ContentWrap> </ContentWrap>
<XModal v-model="dialogVisible" :title="dialogTitle"> <XModal v-model="dialogVisible" :title="dialogTitle">
<!-- 对话框(详情) --> <!-- 对话框(详情) -->
@ -85,8 +85,7 @@
import { ref, unref } from 'vue' import { ref, unref } from 'vue'
import { useI18n } from '@/hooks/web/useI18n' import { useI18n } from '@/hooks/web/useI18n'
import { useMessage } from '@/hooks/web/useMessage' import { useMessage } from '@/hooks/web/useMessage'
import { useVxeGrid } from '@/hooks/web/useVxeGrid' import { useXTable } from '@/hooks/web/useXTable'
import { VxeGridInstance } from 'vxe-table'
import { ElUpload, ElImage, UploadInstance, UploadRawFile } from 'element-plus' import { ElUpload, ElImage, UploadInstance, UploadRawFile } from 'element-plus'
// import // import
import { allSchemas } from './fileList.data' import { allSchemas } from './fileList.data'
@ -98,8 +97,7 @@ const { t } = useI18n() // 国际化
const message = useMessage() // const message = useMessage() //
// //
const xGrid = ref<VxeGridInstance>() // Grid Ref const [registerTable, { reload, deleteData }] = useXTable({
const { gridOptions, getList, deleteData } = useVxeGrid<FileApi.FileVO>({
allSchemas: allSchemas, allSchemas: allSchemas,
getListApi: FileApi.getFilePageApi, getListApi: FileApi.getFilePageApi,
deleteApi: FileApi.deleteFileApi deleteApi: FileApi.deleteFileApi
@ -145,7 +143,7 @@ const handleFileSuccess = async (response: any): Promise<void> => {
message.success('上传成功') message.success('上传成功')
uploadDialogVisible.value = false uploadDialogVisible.value = false
uploadDisabled.value = false uploadDisabled.value = false
await getList(xGrid) await reload()
} }
// //
const handleExceed = (): void => { const handleExceed = (): void => {
@ -166,7 +164,7 @@ const handleDetail = (row: FileApi.FileVO) => {
// //
const handleDelete = async (rowId: number) => { const handleDelete = async (rowId: number) => {
await deleteData(xGrid, rowId) await deleteData(rowId)
} }
// ========== ========== // ========== ==========

View File

@ -1,7 +1,7 @@
<template> <template>
<ContentWrap> <ContentWrap>
<!-- 列表 --> <!-- 列表 -->
<vxe-grid ref="xGrid" v-bind="gridOptions" class="xtable-scrollbar"> <XTable @register="registerTable">
<template #toolbar_buttons> <template #toolbar_buttons>
<XButton <XButton
type="warning" type="warning"
@ -29,7 +29,7 @@
@click="handleDetail(row)" @click="handleDetail(row)"
/> />
</template> </template>
</vxe-grid> </XTable>
</ContentWrap> </ContentWrap>
<XModal v-model="dialogVisible" :title="dialogTitle"> <XModal v-model="dialogVisible" :title="dialogTitle">
<!-- 对话框(详情) --> <!-- 对话框(详情) -->
@ -51,15 +51,13 @@
import { ref } from 'vue' import { ref } from 'vue'
import dayjs from 'dayjs' import dayjs from 'dayjs'
import { useI18n } from '@/hooks/web/useI18n' import { useI18n } from '@/hooks/web/useI18n'
import { useVxeGrid } from '@/hooks/web/useVxeGrid' import { useXTable } from '@/hooks/web/useXTable'
import { VxeGridInstance } from 'vxe-table'
import * as JobLogApi from '@/api/infra/jobLog' import * as JobLogApi from '@/api/infra/jobLog'
import { allSchemas } from './jobLog.data' import { allSchemas } from './jobLog.data'
const { t } = useI18n() // const { t } = useI18n() //
// //
const xGrid = ref<VxeGridInstance>() // Grid Ref const [registerTable, { exportList }] = useXTable({
const { gridOptions, exportList } = useVxeGrid<JobLogApi.JobLogVO>({
allSchemas: allSchemas, allSchemas: allSchemas,
getListApi: JobLogApi.getJobLogPageApi, getListApi: JobLogApi.getJobLogPageApi,
exportListApi: JobLogApi.exportJobLogApi exportListApi: JobLogApi.exportJobLogApi
@ -81,6 +79,6 @@ const handleDetail = async (row: JobLogApi.JobLogVO) => {
} }
// //
const handleExport = async () => { const handleExport = async () => {
await exportList(xGrid, '定时任务详情.xls') await exportList('定时任务详情.xls')
} }
</script> </script>

View File

@ -1,7 +1,7 @@
<template> <template>
<ContentWrap> <ContentWrap>
<!-- 列表 --> <!-- 列表 -->
<vxe-grid ref="xGrid" v-bind="gridOptions" class="xtable-scrollbar"> <XTable @register="registerTable">
<template #toolbar_buttons> <template #toolbar_buttons>
<!-- 操作新增 --> <!-- 操作新增 -->
<XButton <XButton
@ -83,7 +83,7 @@
</template> </template>
</el-dropdown> </el-dropdown>
</template> </template>
</vxe-grid> </XTable>
</ContentWrap> </ContentWrap>
<XModal v-model="dialogVisible" :title="dialogTitle"> <XModal v-model="dialogVisible" :title="dialogTitle">
<!-- 对话框(添加 / 修改) --> <!-- 对话框(添加 / 修改) -->
@ -134,8 +134,7 @@ import { useRouter } from 'vue-router'
import { ElDropdown, ElDropdownMenu, ElDropdownItem } from 'element-plus' import { ElDropdown, ElDropdownMenu, ElDropdownItem } from 'element-plus'
import { useI18n } from '@/hooks/web/useI18n' import { useI18n } from '@/hooks/web/useI18n'
import { useMessage } from '@/hooks/web/useMessage' import { useMessage } from '@/hooks/web/useMessage'
import { useVxeGrid } from '@/hooks/web/useVxeGrid' import { useXTable } from '@/hooks/web/useXTable'
import { VxeGridInstance } from 'vxe-table'
import { FormExpose } from '@/components/Form' import { FormExpose } from '@/components/Form'
import { Crontab } from '@/components/Crontab' import { Crontab } from '@/components/Crontab'
import * as JobApi from '@/api/infra/job' import * as JobApi from '@/api/infra/job'
@ -147,8 +146,7 @@ const message = useMessage() // 消息弹窗
const { push } = useRouter() const { push } = useRouter()
// //
const xGrid = ref<VxeGridInstance>() // Grid Ref const [registerTable, { reload, deleteData, exportList }] = useXTable({
const { gridOptions, getList, deleteData, exportList } = useVxeGrid<JobApi.JobVO>({
allSchemas: allSchemas, allSchemas: allSchemas,
getListApi: JobApi.getJobPageApi, getListApi: JobApi.getJobPageApi,
deleteApi: JobApi.deleteJobApi, deleteApi: JobApi.deleteJobApi,
@ -183,7 +181,7 @@ const handleCreate = () => {
// //
const handleExport = async () => { const handleExport = async () => {
await exportList(xGrid, '定时任务.xls') await exportList('定时任务.xls')
} }
// //
@ -252,7 +250,7 @@ const parseTime = (time) => {
// //
const handleDelete = async (rowId: number) => { const handleDelete = async (rowId: number) => {
await deleteData(xGrid, rowId) await deleteData(rowId)
} }
const handleChangeStatus = async (row: JobApi.JobVO) => { const handleChangeStatus = async (row: JobApi.JobVO) => {
const text = row.status === InfraJobStatusEnum.STOP ? '开启' : '关闭' const text = row.status === InfraJobStatusEnum.STOP ? '开启' : '关闭'
@ -267,7 +265,7 @@ const handleChangeStatus = async (row: JobApi.JobVO) => {
: InfraJobStatusEnum.STOP : InfraJobStatusEnum.STOP
await JobApi.updateJobStatusApi(row.id, status) await JobApi.updateJobStatusApi(row.id, status)
message.success(text + '成功') message.success(text + '成功')
await getList(xGrid) await reload()
}) })
.catch(() => { .catch(() => {
row.status = row.status =
@ -289,7 +287,7 @@ const handleRun = (row: JobApi.JobVO) => {
message.confirm('确认要立即执行一次' + row.name + '?', t('common.reminder')).then(async () => { message.confirm('确认要立即执行一次' + row.name + '?', t('common.reminder')).then(async () => {
await JobApi.runJobApi(row.id) await JobApi.runJobApi(row.id)
message.success('执行成功') message.success('执行成功')
await getList(xGrid) await reload()
}) })
} }
// //
@ -312,7 +310,7 @@ const submitForm = async () => {
dialogVisible.value = false dialogVisible.value = false
} finally { } finally {
actionLoading.value = false actionLoading.value = false
await getList(xGrid) await reload()
} }
} }
}) })

View File

@ -1,7 +1,7 @@
<template> <template>
<ContentWrap> <ContentWrap>
<!-- 列表 --> <!-- 列表 -->
<vxe-grid ref="xGrid" v-bind="gridOptions" class="xtable-scrollbar"> <XTable @register="registerTable">
<template #toolbar_buttons> <template #toolbar_buttons>
<!-- 操作新增 --> <!-- 操作新增 -->
<XButton <XButton
@ -43,7 +43,7 @@
@click="handleDelete(row.id)" @click="handleDelete(row.id)"
/> />
</template> </template>
</vxe-grid> </XTable>
</ContentWrap> </ContentWrap>
<XModal v-model="dialogVisible" :title="dialogTitle"> <XModal v-model="dialogVisible" :title="dialogTitle">
@ -79,8 +79,7 @@
import { ref, unref } from 'vue' import { ref, unref } from 'vue'
import { useI18n } from '@/hooks/web/useI18n' import { useI18n } from '@/hooks/web/useI18n'
import { useMessage } from '@/hooks/web/useMessage' import { useMessage } from '@/hooks/web/useMessage'
import { useVxeGrid } from '@/hooks/web/useVxeGrid' import { useXTable } from '@/hooks/web/useXTable'
import { VxeGridInstance } from 'vxe-table'
import { FormExpose } from '@/components/Form' import { FormExpose } from '@/components/Form'
import { rules, allSchemas } from './app.data' import { rules, allSchemas } from './app.data'
import * as AppApi from '@/api/pay/app' import * as AppApi from '@/api/pay/app'
@ -89,8 +88,7 @@ const { t } = useI18n() // 国际化
const message = useMessage() // const message = useMessage() //
// //
const xGrid = ref<VxeGridInstance>() // Grid Ref const [registerTable, { reload, deleteData, exportList }] = useXTable({
const { gridOptions, getList, deleteData, exportList } = useVxeGrid<AppApi.AppVO>({
allSchemas: allSchemas, allSchemas: allSchemas,
getListApi: AppApi.getAppPageApi, getListApi: AppApi.getAppPageApi,
deleteApi: AppApi.deleteAppApi, deleteApi: AppApi.deleteAppApi,
@ -119,7 +117,7 @@ const handleCreate = () => {
// //
const handleExport = async () => { const handleExport = async () => {
await exportList(xGrid, '应用信息.xls') await exportList('应用信息.xls')
} }
// //
@ -139,7 +137,7 @@ const handleDetail = async (rowId: number) => {
// //
const handleDelete = async (rowId: number) => { const handleDelete = async (rowId: number) => {
await deleteData(xGrid, rowId) await deleteData(rowId)
} }
// //
@ -163,7 +161,7 @@ const submitForm = async () => {
} finally { } finally {
actionLoading.value = false actionLoading.value = false
// //
await getList(xGrid) await reload()
} }
} }
}) })

View File

@ -1,7 +1,7 @@
<template> <template>
<ContentWrap> <ContentWrap>
<!-- 列表 --> <!-- 列表 -->
<vxe-grid ref="xGrid" v-bind="gridOptions" class="xtable-scrollbar"> <XTable @register="registerTable">
<template #toolbar_buttons> <template #toolbar_buttons>
<!-- 操作新增 --> <!-- 操作新增 -->
<XButton <XButton
@ -43,7 +43,7 @@
@click="handleDelete(row.id)" @click="handleDelete(row.id)"
/> />
</template> </template>
</vxe-grid> </XTable>
</ContentWrap> </ContentWrap>
<XModal v-model="dialogVisible" :title="dialogTitle"> <XModal v-model="dialogVisible" :title="dialogTitle">
<!-- 对话框(添加 / 修改) --> <!-- 对话框(添加 / 修改) -->
@ -78,8 +78,7 @@
import { ref, unref } from 'vue' import { ref, unref } from 'vue'
import { useI18n } from '@/hooks/web/useI18n' import { useI18n } from '@/hooks/web/useI18n'
import { useMessage } from '@/hooks/web/useMessage' import { useMessage } from '@/hooks/web/useMessage'
import { useVxeGrid } from '@/hooks/web/useVxeGrid' import { useXTable } from '@/hooks/web/useXTable'
import { VxeGridInstance } from 'vxe-table'
import { FormExpose } from '@/components/Form' import { FormExpose } from '@/components/Form'
import { rules, allSchemas } from './merchant.data' import { rules, allSchemas } from './merchant.data'
import * as MerchantApi from '@/api/pay/merchant' import * as MerchantApi from '@/api/pay/merchant'
@ -87,8 +86,7 @@ import * as MerchantApi from '@/api/pay/merchant'
const { t } = useI18n() // const { t } = useI18n() //
const message = useMessage() // const message = useMessage() //
// //
const xGrid = ref<VxeGridInstance>() // Grid Ref const [registerTable, { reload, deleteData, exportList }] = useXTable({
const { gridOptions, getList, deleteData, exportList } = useVxeGrid<MerchantApi.MerchantVO>({
allSchemas: allSchemas, allSchemas: allSchemas,
getListApi: MerchantApi.getMerchantPageApi, getListApi: MerchantApi.getMerchantPageApi,
deleteApi: MerchantApi.deleteMerchantApi, deleteApi: MerchantApi.deleteMerchantApi,
@ -117,7 +115,7 @@ const handleCreate = () => {
// //
const handleExport = async () => { const handleExport = async () => {
await exportList(xGrid, '商户列表.xls') await exportList('商户列表.xls')
} }
// //
@ -137,7 +135,7 @@ const handleDetail = async (rowId: number) => {
// //
const handleDelete = async (rowId: number) => { const handleDelete = async (rowId: number) => {
await deleteData(xGrid, rowId) await deleteData(rowId)
} }
// //
@ -161,7 +159,7 @@ const submitForm = async () => {
} finally { } finally {
actionLoading.value = false actionLoading.value = false
// //
await getList(xGrid) await reload()
} }
} }
}) })

View File

@ -1,7 +1,7 @@
<template> <template>
<ContentWrap> <ContentWrap>
<!-- 列表 --> <!-- 列表 -->
<vxe-grid ref="xGrid" v-bind="gridOptions" class="xtable-scrollbar"> <XTable @register="registerTable">
<template #toolbar_buttons> <template #toolbar_buttons>
<!-- 操作新增 --> <!-- 操作新增 -->
<XButton <XButton
@ -29,7 +29,7 @@
@click="handleDetail(row.id)" @click="handleDetail(row.id)"
/> />
</template> </template>
</vxe-grid> </XTable>
</ContentWrap> </ContentWrap>
<XModal v-model="dialogVisible" :title="dialogTitle"> <XModal v-model="dialogVisible" :title="dialogTitle">
<!-- 对话框(详情) --> <!-- 对话框(详情) -->
@ -44,15 +44,13 @@
<script setup lang="ts" name="Order"> <script setup lang="ts" name="Order">
import { ref } from 'vue' import { ref } from 'vue'
import { useI18n } from '@/hooks/web/useI18n' import { useI18n } from '@/hooks/web/useI18n'
import { useVxeGrid } from '@/hooks/web/useVxeGrid' import { useXTable } from '@/hooks/web/useXTable'
import { VxeGridInstance } from 'vxe-table'
import { allSchemas } from './order.data' import { allSchemas } from './order.data'
import * as OrderApi from '@/api/pay/order' import * as OrderApi from '@/api/pay/order'
const { t } = useI18n() // const { t } = useI18n() //
// //
const xGrid = ref<VxeGridInstance>() // Grid Ref const [registerTable, { exportList }] = useXTable({
const { gridOptions, exportList } = useVxeGrid<OrderApi.OrderVO>({
allSchemas: allSchemas, allSchemas: allSchemas,
getListApi: OrderApi.getOrderPageApi, getListApi: OrderApi.getOrderPageApi,
exportListApi: OrderApi.exportOrderApi exportListApi: OrderApi.exportOrderApi
@ -76,7 +74,7 @@ const handleCreate = () => {
} }
// //
const handleExport = async () => { const handleExport = async () => {
await exportList(xGrid, '订单数据.xls') await exportList('订单数据.xls')
} }
// //

View File

@ -1,7 +1,7 @@
<template> <template>
<ContentWrap> <ContentWrap>
<!-- 列表 --> <!-- 列表 -->
<vxe-grid ref="xGrid" v-bind="gridOptions" class="xtable-scrollbar"> <XTable @register="registerTable">
<template #toolbar_buttons> <template #toolbar_buttons>
<!-- 操作导出 --> <!-- 操作导出 -->
<XButton <XButton
@ -21,7 +21,7 @@
@click="handleDetail(row.id)" @click="handleDetail(row.id)"
/> />
</template> </template>
</vxe-grid> </XTable>
</ContentWrap> </ContentWrap>
<XModal v-model="dialogVisible" :title="t('action.detail')"> <XModal v-model="dialogVisible" :title="t('action.detail')">
@ -36,16 +36,14 @@
<script setup lang="ts" name="Refund"> <script setup lang="ts" name="Refund">
import { ref } from 'vue' import { ref } from 'vue'
import { useI18n } from '@/hooks/web/useI18n' import { useI18n } from '@/hooks/web/useI18n'
import { useVxeGrid } from '@/hooks/web/useVxeGrid' import { useXTable } from '@/hooks/web/useXTable'
import { VxeGridInstance } from 'vxe-table'
import { allSchemas } from './refund.data' import { allSchemas } from './refund.data'
import * as RefundApi from '@/api/pay/refund' import * as RefundApi from '@/api/pay/refund'
const { t } = useI18n() // const { t } = useI18n() //
// //
const xGrid = ref<VxeGridInstance>() // Grid Ref const [registerTable, { exportList }] = useXTable({
const { gridOptions, exportList } = useVxeGrid<RefundApi.RefundVO>({
allSchemas: allSchemas, allSchemas: allSchemas,
getListApi: RefundApi.getRefundPageApi, getListApi: RefundApi.getRefundPageApi,
exportListApi: RefundApi.exportRefundApi exportListApi: RefundApi.exportRefundApi
@ -53,7 +51,7 @@ const { gridOptions, exportList } = useVxeGrid<RefundApi.RefundVO>({
// //
const handleExport = async () => { const handleExport = async () => {
await exportList(xGrid, '退款订单.xls') await exportList('退款订单.xls')
} }
// ========== CRUD ========== // ========== CRUD ==========

View File

@ -1,7 +1,7 @@
<template> <template>
<ContentWrap> <ContentWrap>
<!-- 列表 --> <!-- 列表 -->
<vxe-grid ref="xGrid" v-bind="gridOptions" show-overflow class="xtable-scrollbar"> <XTable @register="registerTable" show-overflow>
<template #toolbar_buttons> <template #toolbar_buttons>
<!-- 操作新增 --> <!-- 操作新增 -->
<XButton <XButton
@ -33,7 +33,7 @@
@click="handleDelete(row.id)" @click="handleDelete(row.id)"
/> />
</template> </template>
</vxe-grid> </XTable>
</ContentWrap> </ContentWrap>
<!-- 添加或修改菜单对话框 --> <!-- 添加或修改菜单对话框 -->
<XModal id="deptModel" v-model="dialogVisible" :title="dialogTitle"> <XModal id="deptModel" v-model="dialogVisible" :title="dialogTitle">
@ -81,7 +81,7 @@ import { VxeGridInstance } from 'vxe-table'
import { handleTree, defaultProps } from '@/utils/tree' import { handleTree, defaultProps } from '@/utils/tree'
import { useI18n } from '@/hooks/web/useI18n' import { useI18n } from '@/hooks/web/useI18n'
import { useMessage } from '@/hooks/web/useMessage' import { useMessage } from '@/hooks/web/useMessage'
import { useVxeGrid } from '@/hooks/web/useVxeGrid' import { useXTable } from '@/hooks/web/useXTable'
import { FormExpose } from '@/components/Form' import { FormExpose } from '@/components/Form'
import { allSchemas, rules } from './dept.data' import { allSchemas, rules } from './dept.data'
import * as DeptApi from '@/api/system/dept' import * as DeptApi from '@/api/system/dept'
@ -119,7 +119,7 @@ const getTree = async () => {
dept.children = handleTree(res) dept.children = handleTree(res)
deptOptions.value.push(dept) deptOptions.value.push(dept)
} }
const { gridOptions, getList, deleteData } = useVxeGrid<DeptApi.DeptVO>({ const [registerTable, { reload, deleteData }] = useXTable({
allSchemas: allSchemas, allSchemas: allSchemas,
treeConfig: treeConfig, treeConfig: treeConfig,
getListApi: DeptApi.getDeptPageApi, getListApi: DeptApi.getDeptPageApi,
@ -168,7 +168,7 @@ const submitForm = async () => {
dialogVisible.value = false dialogVisible.value = false
} finally { } finally {
actionLoading.value = false actionLoading.value = false
await getList(xGrid) await reload()
} }
} }
}) })
@ -176,7 +176,7 @@ const submitForm = async () => {
// //
const handleDelete = async (rowId: number) => { const handleDelete = async (rowId: number) => {
await deleteData(xGrid, rowId) await deleteData(rowId)
} }
const userNicknameFormat = (row) => { const userNicknameFormat = (row) => {

View File

@ -1,7 +1,7 @@
<template> <template>
<ContentWrap> <ContentWrap>
<!-- 列表 --> <!-- 列表 -->
<vxe-grid ref="xGrid" v-bind="gridOptions" class="xtable-scrollbar"> <XTable @register="registerTable">
<!-- 操作新增 --> <!-- 操作新增 -->
<template #toolbar_buttons> <template #toolbar_buttons>
<XButton <XButton
@ -35,7 +35,7 @@
@click="handleDelete(row.id)" @click="handleDelete(row.id)"
/> />
</template> </template>
</vxe-grid> </XTable>
</ContentWrap> </ContentWrap>
<!-- 弹窗 --> <!-- 弹窗 -->
<XModal id="errorCodeModel" v-model="dialogVisible" :title="dialogTitle"> <XModal id="errorCodeModel" v-model="dialogVisible" :title="dialogTitle">
@ -71,8 +71,7 @@
import { ref, unref } from 'vue' import { ref, unref } from 'vue'
import { useI18n } from '@/hooks/web/useI18n' import { useI18n } from '@/hooks/web/useI18n'
import { useMessage } from '@/hooks/web/useMessage' import { useMessage } from '@/hooks/web/useMessage'
import { useVxeGrid } from '@/hooks/web/useVxeGrid' import { useXTable } from '@/hooks/web/useXTable'
import { VxeGridInstance } from 'vxe-table'
import { FormExpose } from '@/components/Form' import { FormExpose } from '@/components/Form'
// import // import
import { rules, allSchemas } from './errorCode.data' import { rules, allSchemas } from './errorCode.data'
@ -81,8 +80,7 @@ import * as ErrorCodeApi from '@/api/system/errorCode'
const { t } = useI18n() // const { t } = useI18n() //
const message = useMessage() // const message = useMessage() //
// //
const xGrid = ref<VxeGridInstance>() // grid Ref const [registerTable, { reload, deleteData }] = useXTable({
const { gridOptions, getList, deleteData } = useVxeGrid<ErrorCodeApi.ErrorCodeVO>({
allSchemas: allSchemas, allSchemas: allSchemas,
getListApi: ErrorCodeApi.getErrorCodePageApi, getListApi: ErrorCodeApi.getErrorCodePageApi,
deleteApi: ErrorCodeApi.deleteErrorCodeApi deleteApi: ErrorCodeApi.deleteErrorCodeApi
@ -125,7 +123,7 @@ const handleDetail = async (rowId: number) => {
// //
const handleDelete = async (rowId: number) => { const handleDelete = async (rowId: number) => {
await deleteData(xGrid, rowId) await deleteData(rowId)
} }
// / // /
@ -149,7 +147,7 @@ const submitForm = async () => {
} finally { } finally {
actionLoading.value = false actionLoading.value = false
// //
await getList(xGrid) await reload()
} }
} }
}) })

View File

@ -1,7 +1,7 @@
<template> <template>
<ContentWrap> <ContentWrap>
<!-- 列表 --> <!-- 列表 -->
<vxe-grid ref="xGrid" v-bind="gridOptions" class="xtable-scrollbar"> <XTable @register="registerTable">
<!-- 操作导出 --> <!-- 操作导出 -->
<template #toolbar_buttons> <template #toolbar_buttons>
<XButton <XButton
@ -15,7 +15,7 @@
<!-- 操作详情 --> <!-- 操作详情 -->
<XTextButton preIcon="ep:view" :title="t('action.detail')" @click="handleDetail(row)" /> <XTextButton preIcon="ep:view" :title="t('action.detail')" @click="handleDetail(row)" />
</template> </template>
</vxe-grid> </XTable>
</ContentWrap> </ContentWrap>
<!-- 弹窗 --> <!-- 弹窗 -->
<XModal id="postModel" v-model="dialogVisible" :title="dialogTitle"> <XModal id="postModel" v-model="dialogVisible" :title="dialogTitle">
@ -31,16 +31,14 @@
// import // import
import { ref } from 'vue' import { ref } from 'vue'
import { useI18n } from '@/hooks/web/useI18n' import { useI18n } from '@/hooks/web/useI18n'
import { useVxeGrid } from '@/hooks/web/useVxeGrid' import { useXTable } from '@/hooks/web/useXTable'
import { VxeGridInstance } from 'vxe-table'
// import // import
import { allSchemas } from './loginLog.data' import { allSchemas } from './loginLog.data'
import { getLoginLogPageApi, exportLoginLogApi, LoginLogVO } from '@/api/system/loginLog' import { getLoginLogPageApi, exportLoginLogApi, LoginLogVO } from '@/api/system/loginLog'
const { t } = useI18n() // const { t } = useI18n() //
// //
const xGrid = ref<VxeGridInstance>() // Grid Ref const [registerTable, { exportList }] = useXTable({
const { gridOptions, exportList } = useVxeGrid<LoginLogVO>({
allSchemas: allSchemas, allSchemas: allSchemas,
getListApi: getLoginLogPageApi, getListApi: getLoginLogPageApi,
exportListApi: exportLoginLogApi exportListApi: exportLoginLogApi
@ -59,6 +57,6 @@ const handleDetail = async (row: LoginLogVO) => {
// //
const handleExport = async () => { const handleExport = async () => {
await exportList(xGrid, '登录列表.xls') await exportList('登录列表.xls')
} }
</script> </script>

View File

@ -1,7 +1,7 @@
<template> <template>
<ContentWrap> <ContentWrap>
<!-- 列表 --> <!-- 列表 -->
<vxe-grid ref="xGrid" v-bind="gridOptions" show-overflow class="xtable-scrollbar"> <XTable @register="registerTable" show-overflow>
<template #toolbar_buttons> <template #toolbar_buttons>
<!-- 操作新增 --> <!-- 操作新增 -->
<XButton <XButton
@ -34,7 +34,7 @@
@click="handleDelete(row.id)" @click="handleDelete(row.id)"
/> />
</template> </template>
</vxe-grid> </XTable>
</ContentWrap> </ContentWrap>
<!-- 添加或修改菜单对话框 --> <!-- 添加或修改菜单对话框 -->
<XModal id="menuModel" v-model="dialogVisible" :title="dialogTitle"> <XModal id="menuModel" v-model="dialogVisible" :title="dialogTitle">
@ -201,7 +201,7 @@ import { SystemMenuTypeEnum, CommonStatusEnum } from '@/utils/constants'
import { handleTree, defaultProps } from '@/utils/tree' import { handleTree, defaultProps } from '@/utils/tree'
import * as MenuApi from '@/api/system/menu' import * as MenuApi from '@/api/system/menu'
import { allSchemas, rules } from './menu.data' import { allSchemas, rules } from './menu.data'
import { useVxeGrid } from '@/hooks/web/useVxeGrid' import { useXTable } from '@/hooks/web/useXTable'
const { t } = useI18n() // const { t } = useI18n() //
const message = useMessage() // const message = useMessage() //
@ -215,7 +215,7 @@ const treeConfig = {
parentField: 'parentId', parentField: 'parentId',
expandAll: false expandAll: false
} }
const { gridOptions, getList, deleteData } = useVxeGrid<MenuApi.MenuVO>({ const [registerTable, { reload, deleteData }] = useXTable({
allSchemas: allSchemas, allSchemas: allSchemas,
treeConfig: treeConfig, treeConfig: treeConfig,
getListApi: MenuApi.getMenuListApi, getListApi: MenuApi.getMenuListApi,
@ -326,7 +326,7 @@ const submitForm = async () => {
actionLoading.value = false actionLoading.value = false
wsCache.delete(CACHE_KEY.ROLE_ROUTERS) wsCache.delete(CACHE_KEY.ROLE_ROUTERS)
// //
await getList(xGrid) await reload()
} }
} }
@ -338,6 +338,6 @@ const isExternal = (path: string) => {
// ========== ========== // ========== ==========
// //
const handleDelete = async (rowId: number) => { const handleDelete = async (rowId: number) => {
await deleteData(xGrid, rowId) await deleteData(rowId)
} }
</script> </script>

View File

@ -1,7 +1,7 @@
<template> <template>
<ContentWrap> <ContentWrap>
<!-- 列表 --> <!-- 列表 -->
<vxe-grid ref="xGrid" v-bind="gridOptions" class="xtable-scrollbar"> <XTable @register="registerTable">
<!-- 操作新增 --> <!-- 操作新增 -->
<template #toolbar_buttons> <template #toolbar_buttons>
<XButton <XButton
@ -35,7 +35,7 @@
@click="handleDelete(row.id)" @click="handleDelete(row.id)"
/> />
</template> </template>
</vxe-grid> </XTable>
</ContentWrap> </ContentWrap>
<!-- 弹窗 --> <!-- 弹窗 -->
<XModal id="noticeModel" v-model="dialogVisible" :title="dialogTitle"> <XModal id="noticeModel" v-model="dialogVisible" :title="dialogTitle">
@ -75,8 +75,7 @@
import { ref, unref } from 'vue' import { ref, unref } from 'vue'
import { useI18n } from '@/hooks/web/useI18n' import { useI18n } from '@/hooks/web/useI18n'
import { useMessage } from '@/hooks/web/useMessage' import { useMessage } from '@/hooks/web/useMessage'
import { useVxeGrid } from '@/hooks/web/useVxeGrid' import { useXTable } from '@/hooks/web/useXTable'
import { VxeGridInstance } from 'vxe-table'
import { FormExpose } from '@/components/Form' import { FormExpose } from '@/components/Form'
// import // import
import * as NoticeApi from '@/api/system/notice' import * as NoticeApi from '@/api/system/notice'
@ -86,8 +85,7 @@ import { Editor } from '@/components/Editor'
const { t } = useI18n() // const { t } = useI18n() //
const message = useMessage() // const message = useMessage() //
// //
const xGrid = ref<VxeGridInstance>() // Grid Ref const [registerTable, { reload, deleteData }] = useXTable({
const { gridOptions, getList, deleteData } = useVxeGrid<NoticeApi.NoticeVO>({
allSchemas: allSchemas, allSchemas: allSchemas,
getListApi: NoticeApi.getNoticePageApi, getListApi: NoticeApi.getNoticePageApi,
deleteApi: NoticeApi.deleteNoticeApi deleteApi: NoticeApi.deleteNoticeApi
@ -130,7 +128,7 @@ const handleDetail = async (rowId: number) => {
// //
const handleDelete = async (rowId: number) => { const handleDelete = async (rowId: number) => {
await deleteData(xGrid, rowId) await deleteData(rowId)
} }
// / // /
@ -153,7 +151,7 @@ const submitForm = async () => {
dialogVisible.value = false dialogVisible.value = false
} finally { } finally {
actionLoading.value = false actionLoading.value = false
await getList(xGrid) await reload()
} }
} }
}) })

View File

@ -1,7 +1,7 @@
<template> <template>
<ContentWrap> <ContentWrap>
<!-- 列表 --> <!-- 列表 -->
<vxe-grid ref="xGrid" v-bind="gridOptions" class="xtable-scrollbar"> <XTable @register="registerTable">
<template #toolbar_buttons> <template #toolbar_buttons>
<!-- 操作新增 --> <!-- 操作新增 -->
<XButton <XButton
@ -51,7 +51,7 @@
@click="handleDelete(row.id)" @click="handleDelete(row.id)"
/> />
</template> </template>
</vxe-grid> </XTable>
</ContentWrap> </ContentWrap>
<!-- 弹窗 --> <!-- 弹窗 -->
<XModal id="postModel" v-model="dialogVisible" :title="dialogTitle"> <XModal id="postModel" v-model="dialogVisible" :title="dialogTitle">
@ -135,8 +135,7 @@ import { ref, unref } from 'vue'
import { ElTag } from 'element-plus' import { ElTag } from 'element-plus'
import { useI18n } from '@/hooks/web/useI18n' import { useI18n } from '@/hooks/web/useI18n'
import { useMessage } from '@/hooks/web/useMessage' import { useMessage } from '@/hooks/web/useMessage'
import { useVxeGrid } from '@/hooks/web/useVxeGrid' import { useXTable } from '@/hooks/web/useXTable'
import { VxeGridInstance } from 'vxe-table'
import { FormExpose } from '@/components/Form' import { FormExpose } from '@/components/Form'
// import // import
import * as ClientApi from '@/api/system/oauth2/client' import * as ClientApi from '@/api/system/oauth2/client'
@ -146,8 +145,7 @@ const { t } = useI18n() // 国际化
const message = useMessage() // const message = useMessage() //
// //
const xGrid = ref<VxeGridInstance>() // Grid Ref const [registerTable, { reload, deleteData }] = useXTable({
const { gridOptions, getList, deleteData } = useVxeGrid<ClientApi.OAuth2ClientVO>({
allSchemas: allSchemas, allSchemas: allSchemas,
getListApi: ClientApi.getOAuth2ClientPageApi, getListApi: ClientApi.getOAuth2ClientPageApi,
deleteApi: ClientApi.deleteOAuth2ClientApi deleteApi: ClientApi.deleteOAuth2ClientApi
@ -188,7 +186,7 @@ const handleDetail = async (rowId: number) => {
// //
const handleDelete = async (rowId: number) => { const handleDelete = async (rowId: number) => {
await deleteData(xGrid, rowId) await deleteData(rowId)
} }
// / // /
@ -212,7 +210,7 @@ const submitForm = async () => {
} finally { } finally {
actionLoading.value = false actionLoading.value = false
// //
await getList(xGrid) await reload()
} }
} }
}) })

View File

@ -1,7 +1,7 @@
<template> <template>
<ContentWrap> <ContentWrap>
<!-- 列表 --> <!-- 列表 -->
<vxe-grid ref="xGrid" v-bind="gridOptions" class="xtable-scrollbar"> <XTable @register="registerTable">
<template #actionbtns_default="{ row }"> <template #actionbtns_default="{ row }">
<!-- 操作详情 --> <!-- 操作详情 -->
<XTextButton preIcon="ep:view" :title="t('action.detail')" @click="handleDetail(row)" /> <XTextButton preIcon="ep:view" :title="t('action.detail')" @click="handleDetail(row)" />
@ -13,7 +13,7 @@
@click="handleForceLogout(row.id)" @click="handleForceLogout(row.id)"
/> />
</template> </template>
</vxe-grid> </XTable>
</ContentWrap> </ContentWrap>
<XModal v-model="dialogVisible" :title="dialogTitle"> <XModal v-model="dialogVisible" :title="dialogTitle">
<!-- 对话框(详情) --> <!-- 对话框(详情) -->
@ -28,8 +28,7 @@
import { ref } from 'vue' import { ref } from 'vue'
import { useI18n } from '@/hooks/web/useI18n' import { useI18n } from '@/hooks/web/useI18n'
import { useMessage } from '@/hooks/web/useMessage' import { useMessage } from '@/hooks/web/useMessage'
import { useVxeGrid } from '@/hooks/web/useVxeGrid' import { useXTable } from '@/hooks/web/useXTable'
import { VxeGridInstance } from 'vxe-table'
import { allSchemas } from './token.data' import { allSchemas } from './token.data'
import * as TokenApi from '@/api/system/oauth2/token' import * as TokenApi from '@/api/system/oauth2/token'
@ -37,8 +36,7 @@ import * as TokenApi from '@/api/system/oauth2/token'
const { t } = useI18n() // const { t } = useI18n() //
const message = useMessage() // const message = useMessage() //
// //
const xGrid = ref<VxeGridInstance>() // Grid Ref const [registerTable, { reload }] = useXTable({
const { gridOptions, getList } = useVxeGrid<TokenApi.OAuth2TokenVO>({
allSchemas: allSchemas, allSchemas: allSchemas,
topActionSlots: false, topActionSlots: false,
getListApi: TokenApi.getAccessTokenPageApi getListApi: TokenApi.getAccessTokenPageApi
@ -65,7 +63,7 @@ const handleForceLogout = (rowId: number) => {
}) })
.finally(async () => { .finally(async () => {
// //
await getList(xGrid) await reload()
}) })
} }
</script> </script>

View File

@ -1,7 +1,7 @@
<template> <template>
<ContentWrap> <ContentWrap>
<!-- 列表 --> <!-- 列表 -->
<vxe-grid ref="xGrid" v-bind="gridOptions" class="xtable-scrollbar"> <XTable @register="registerTable">
<template #toolbar_buttons> <template #toolbar_buttons>
<!-- 操作新增 --> <!-- 操作新增 -->
<XButton <XButton
@ -22,7 +22,7 @@
<!-- 操作详情 --> <!-- 操作详情 -->
<XTextButton preIcon="ep:view" :title="t('action.detail')" @click="handleDetail(row)" /> <XTextButton preIcon="ep:view" :title="t('action.detail')" @click="handleDetail(row)" />
</template> </template>
</vxe-grid> </XTable>
</ContentWrap> </ContentWrap>
<!-- 弹窗 --> <!-- 弹窗 -->
<XModal id="postModel" v-model="dialogVisible" :title="t('action.detail')"> <XModal id="postModel" v-model="dialogVisible" :title="t('action.detail')">
@ -45,16 +45,14 @@
// import // import
import { ref } from 'vue' import { ref } from 'vue'
import { useI18n } from '@/hooks/web/useI18n' import { useI18n } from '@/hooks/web/useI18n'
import { useVxeGrid } from '@/hooks/web/useVxeGrid' import { useXTable } from '@/hooks/web/useXTable'
import { VxeGridInstance } from 'vxe-table'
// import // import
import * as OperateLogApi from '@/api/system/operatelog' import * as OperateLogApi from '@/api/system/operatelog'
import { allSchemas } from './operatelog.data' import { allSchemas } from './operatelog.data'
const { t } = useI18n() // const { t } = useI18n() //
// //
const xGrid = ref<VxeGridInstance>() // Grid Ref const [registerTable, { exportList }] = useXTable({
const { gridOptions, exportList } = useVxeGrid<OperateLogApi.OperateLogVO>({
allSchemas: allSchemas, allSchemas: allSchemas,
getListApi: OperateLogApi.getOperateLogPageApi, getListApi: OperateLogApi.getOperateLogPageApi,
exportListApi: OperateLogApi.exportOperateLogApi exportListApi: OperateLogApi.exportOperateLogApi
@ -73,6 +71,6 @@ const handleDetail = (row: OperateLogApi.OperateLogVO) => {
// //
const handleExport = async () => { const handleExport = async () => {
await exportList(xGrid, '操作日志.xls') await exportList('操作日志.xls')
} }
</script> </script>

View File

@ -1,7 +1,7 @@
<template> <template>
<ContentWrap> <ContentWrap>
<!-- 列表 --> <!-- 列表 -->
<vxe-grid ref="xGrid" v-bind="gridOptions" class="xtable-scrollbar"> <XTable @register="registerTable">
<template #toolbar_buttons> <template #toolbar_buttons>
<!-- 操作新增 --> <!-- 操作新增 -->
<XButton <XButton
@ -43,7 +43,7 @@
@click="handleDelete(row.id)" @click="handleDelete(row.id)"
/> />
</template> </template>
</vxe-grid> </XTable>
</ContentWrap> </ContentWrap>
<!-- 弹窗 --> <!-- 弹窗 -->
<XModal id="postModel" :loading="modelLoading" v-model="modelVisible" :title="modelTitle"> <XModal id="postModel" :loading="modelLoading" v-model="modelVisible" :title="modelTitle">
@ -79,8 +79,7 @@
import { ref, unref } from 'vue' import { ref, unref } from 'vue'
import { useI18n } from '@/hooks/web/useI18n' import { useI18n } from '@/hooks/web/useI18n'
import { useMessage } from '@/hooks/web/useMessage' import { useMessage } from '@/hooks/web/useMessage'
import { useVxeGrid } from '@/hooks/web/useVxeGrid' import { useXTable } from '@/hooks/web/useXTable'
import { VxeGridInstance } from 'vxe-table'
import { FormExpose } from '@/components/Form' import { FormExpose } from '@/components/Form'
// import // import
import * as PostApi from '@/api/system/post' import * as PostApi from '@/api/system/post'
@ -89,8 +88,7 @@ import { rules, allSchemas } from './post.data'
const { t } = useI18n() // const { t } = useI18n() //
const message = useMessage() // const message = useMessage() //
// //
const xGrid = ref<VxeGridInstance>() // Grid Ref const [registerTable, { reload, deleteData, exportList }] = useXTable({
const { gridOptions, getList, deleteData, exportList } = useVxeGrid<PostApi.PostVO>({
allSchemas: allSchemas, allSchemas: allSchemas,
getListApi: PostApi.getPostPageApi, getListApi: PostApi.getPostPageApi,
deleteApi: PostApi.deletePostApi, deleteApi: PostApi.deletePostApi,
@ -121,7 +119,7 @@ const handleCreate = () => {
// //
const handleExport = async () => { const handleExport = async () => {
await exportList(xGrid, '岗位列表.xls') await exportList('岗位列表.xls')
} }
// //
@ -143,7 +141,7 @@ const handleDetail = async (rowId: number) => {
// //
const handleDelete = async (rowId: number) => { const handleDelete = async (rowId: number) => {
await deleteData(xGrid, rowId) await deleteData(rowId)
} }
// / // /
@ -167,7 +165,7 @@ const submitForm = async () => {
} finally { } finally {
actionLoading.value = false actionLoading.value = false
// //
await getList(xGrid) await reload()
} }
} }
}) })

View File

@ -1,7 +1,7 @@
<template> <template>
<ContentWrap> <ContentWrap>
<!-- 列表 --> <!-- 列表 -->
<vxe-grid ref="xGrid" v-bind="gridOptions" class="xtable-scrollbar"> <XTable @register="registerTable">
<!-- 操作新增 --> <!-- 操作新增 -->
<template #toolbar_buttons> <template #toolbar_buttons>
<XButton <XButton
@ -49,7 +49,7 @@
@click="handleDelete(row.id)" @click="handleDelete(row.id)"
/> />
</template> </template>
</vxe-grid> </XTable>
</ContentWrap> </ContentWrap>
<XModal v-model="dialogVisible" :title="dialogTitle"> <XModal v-model="dialogVisible" :title="dialogTitle">
@ -159,11 +159,10 @@ import {
ElSwitch, ElSwitch,
ElTag ElTag
} from 'element-plus' } from 'element-plus'
import { VxeGridInstance } from 'vxe-table'
import { FormExpose } from '@/components/Form' import { FormExpose } from '@/components/Form'
import { useI18n } from '@/hooks/web/useI18n' import { useI18n } from '@/hooks/web/useI18n'
import { useMessage } from '@/hooks/web/useMessage' import { useMessage } from '@/hooks/web/useMessage'
import { useVxeGrid } from '@/hooks/web/useVxeGrid' import { useXTable } from '@/hooks/web/useXTable'
import { handleTree, defaultProps } from '@/utils/tree' import { handleTree, defaultProps } from '@/utils/tree'
import { SystemDataScopeEnum } from '@/utils/constants' import { SystemDataScopeEnum } from '@/utils/constants'
import { DICT_TYPE, getIntDictOptions } from '@/utils/dict' import { DICT_TYPE, getIntDictOptions } from '@/utils/dict'
@ -176,8 +175,7 @@ import * as PermissionApi from '@/api/system/permission'
const { t } = useI18n() // const { t } = useI18n() //
const message = useMessage() // const message = useMessage() //
// //
const xGrid = ref<VxeGridInstance>() // Grid Ref const [registerTable, { reload, deleteData }] = useXTable({
const { gridOptions, getList, deleteData } = useVxeGrid<RoleApi.RoleVO>({
allSchemas: allSchemas, allSchemas: allSchemas,
getListApi: RoleApi.getRolePageApi, getListApi: RoleApi.getRolePageApi,
deleteApi: RoleApi.deleteRoleApi deleteApi: RoleApi.deleteRoleApi
@ -221,7 +219,7 @@ const handleDetail = async (rowId: number) => {
// //
const handleDelete = async (rowId: number) => { const handleDelete = async (rowId: number) => {
await deleteData(xGrid, rowId) await deleteData(rowId)
} }
// //
@ -245,7 +243,7 @@ const submitForm = async () => {
} finally { } finally {
actionLoading.value = false actionLoading.value = false
// //
await getList(xGrid) await reload()
} }
} }
}) })

View File

@ -1,7 +1,7 @@
<template> <template>
<ContentWrap> <ContentWrap>
<!-- 列表 --> <!-- 列表 -->
<vxe-grid ref="xGrid" v-bind="gridOptions" class="xtable-scrollbar"> <XTable @register="registerTable">
<template #toolbar_buttons> <template #toolbar_buttons>
<!-- 操作新增 --> <!-- 操作新增 -->
<XButton <XButton
@ -53,7 +53,7 @@
@click="handleDelete(row.id)" @click="handleDelete(row.id)"
/> />
</template> </template>
</vxe-grid> </XTable>
</ContentWrap> </ContentWrap>
<XModal v-model="dialogVisible" :title="dialogTitle"> <XModal v-model="dialogVisible" :title="dialogTitle">
@ -106,8 +106,7 @@
import { onMounted, ref, unref } from 'vue' import { onMounted, ref, unref } from 'vue'
import { useI18n } from '@/hooks/web/useI18n' import { useI18n } from '@/hooks/web/useI18n'
import { useMessage } from '@/hooks/web/useMessage' import { useMessage } from '@/hooks/web/useMessage'
import { useVxeGrid } from '@/hooks/web/useVxeGrid' import { useXTable } from '@/hooks/web/useXTable'
import { VxeGridInstance } from 'vxe-table'
import { FormExpose } from '@/components/Form' import { FormExpose } from '@/components/Form'
import { ElTag, ElSelect, ElOption } from 'element-plus' import { ElTag, ElSelect, ElOption } from 'element-plus'
import * as SensitiveWordApi from '@/api/system/sensitiveWord' import * as SensitiveWordApi from '@/api/system/sensitiveWord'
@ -116,14 +115,12 @@ import { rules, allSchemas } from './sensitiveWord.data'
const { t } = useI18n() // const { t } = useI18n() //
const message = useMessage() // const message = useMessage() //
// //
const xGrid = ref<VxeGridInstance>() // Grid Ref const [registerTable, { reload, deleteData, exportList }] = useXTable({
const { gridOptions, getList, deleteData, exportList } = allSchemas: allSchemas,
useVxeGrid<SensitiveWordApi.SensitiveWordVO>({ getListApi: SensitiveWordApi.getSensitiveWordPageApi,
allSchemas: allSchemas, deleteApi: SensitiveWordApi.deleteSensitiveWordApi,
getListApi: SensitiveWordApi.getSensitiveWordPageApi, exportListApi: SensitiveWordApi.exportSensitiveWordApi
deleteApi: SensitiveWordApi.deleteSensitiveWordApi, })
exportListApi: SensitiveWordApi.exportSensitiveWordApi
})
const actionLoading = ref(false) // const actionLoading = ref(false) //
const actionType = ref('') // const actionType = ref('') //
const dialogVisible = ref(false) // const dialogVisible = ref(false) //
@ -152,7 +149,7 @@ const handleCreate = () => {
// //
const handleExport = async () => { const handleExport = async () => {
await exportList(xGrid, '敏感词数据.xls') await exportList('敏感词数据.xls')
} }
// //
@ -172,7 +169,7 @@ const handleDetail = async (rowId: number) => {
// //
const handleDelete = async (rowId: number) => { const handleDelete = async (rowId: number) => {
await deleteData(xGrid, rowId) await deleteData(rowId)
} }
// //
@ -196,7 +193,7 @@ const submitForm = async () => {
} finally { } finally {
actionLoading.value = false actionLoading.value = false
// //
await getList(xGrid) await reload()
} }
} }
}) })

View File

@ -1,7 +1,7 @@
<template> <template>
<ContentWrap> <ContentWrap>
<!-- 列表 --> <!-- 列表 -->
<vxe-grid ref="xGrid" v-bind="gridOptions" class="xtable-scrollbar"> <XTable @register="registerTable">
<!-- 操作新增 --> <!-- 操作新增 -->
<template #toolbar_buttons> <template #toolbar_buttons>
<XButton <XButton
@ -35,7 +35,7 @@
@click="handleDelete(row.id)" @click="handleDelete(row.id)"
/> />
</template> </template>
</vxe-grid> </XTable>
</ContentWrap> </ContentWrap>
<XModal id="smsChannel" v-model="dialogVisible" :title="dialogTitle"> <XModal id="smsChannel" v-model="dialogVisible" :title="dialogTitle">
@ -72,8 +72,7 @@
import { ref, unref } from 'vue' import { ref, unref } from 'vue'
import { useI18n } from '@/hooks/web/useI18n' import { useI18n } from '@/hooks/web/useI18n'
import { useMessage } from '@/hooks/web/useMessage' import { useMessage } from '@/hooks/web/useMessage'
import { useVxeGrid } from '@/hooks/web/useVxeGrid' import { useXTable } from '@/hooks/web/useXTable'
import { VxeGridInstance } from 'vxe-table'
import { FormExpose } from '@/components/Form' import { FormExpose } from '@/components/Form'
// import // import
import * as SmsChannelApi from '@/api/system/sms/smsChannel' import * as SmsChannelApi from '@/api/system/sms/smsChannel'
@ -83,8 +82,7 @@ const { t } = useI18n() // 国际化
const message = useMessage() // const message = useMessage() //
// //
const xGrid = ref<VxeGridInstance>() // Grid Ref const [registerTable, { reload, deleteData }] = useXTable({
const { gridOptions, getList, deleteData } = useVxeGrid<SmsChannelApi.SmsChannelVO>({
allSchemas: allSchemas, allSchemas: allSchemas,
getListApi: SmsChannelApi.getSmsChannelPageApi, getListApi: SmsChannelApi.getSmsChannelPageApi,
deleteApi: SmsChannelApi.deleteSmsChannelApi deleteApi: SmsChannelApi.deleteSmsChannelApi
@ -127,7 +125,7 @@ const handleDetail = async (rowId: number) => {
// //
const handleDelete = async (rowId: number) => { const handleDelete = async (rowId: number) => {
await deleteData(xGrid, rowId) await deleteData(rowId)
} }
// //
@ -151,7 +149,7 @@ const submitForm = async () => {
} finally { } finally {
actionLoading.value = false actionLoading.value = false
// //
await getList(xGrid) await reload()
} }
} }
}) })

View File

@ -1,7 +1,7 @@
<template> <template>
<ContentWrap> <ContentWrap>
<!-- 列表 --> <!-- 列表 -->
<vxe-grid ref="xGrid" v-bind="gridOptions" class="xtable-scrollbar"> <XTable @register="registerTable">
<!-- 操作导出 --> <!-- 操作导出 -->
<template #toolbar_buttons> <template #toolbar_buttons>
<XButton <XButton
@ -14,7 +14,7 @@
<template #actionbtns_default="{ row }"> <template #actionbtns_default="{ row }">
<XTextButton preIcon="ep:view" :title="t('action.detail')" @click="handleDetail(row)" /> <XTextButton preIcon="ep:view" :title="t('action.detail')" @click="handleDetail(row)" />
</template> </template>
</vxe-grid> </XTable>
</ContentWrap> </ContentWrap>
<XModal id="smsLog" v-model="dialogVisible" :title="dialogTitle"> <XModal id="smsLog" v-model="dialogVisible" :title="dialogTitle">
@ -34,15 +34,13 @@
// import // import
import { ref } from 'vue' import { ref } from 'vue'
import { useI18n } from '@/hooks/web/useI18n' import { useI18n } from '@/hooks/web/useI18n'
import { useVxeGrid } from '@/hooks/web/useVxeGrid' import { useXTable } from '@/hooks/web/useXTable'
import { VxeGridInstance } from 'vxe-table'
import { allSchemas } from './sms.log.data' import { allSchemas } from './sms.log.data'
import * as SmsLoglApi from '@/api/system/sms/smsLog' import * as SmsLoglApi from '@/api/system/sms/smsLog'
const { t } = useI18n() // const { t } = useI18n() //
// //
const xGrid = ref<VxeGridInstance>() // Grid Ref const [registerTable, { exportList }] = useXTable({
const { gridOptions, exportList } = useVxeGrid<SmsLoglApi.SmsLogVO>({
allSchemas: allSchemas, allSchemas: allSchemas,
getListApi: SmsLoglApi.getSmsLogPageApi, getListApi: SmsLoglApi.getSmsLogPageApi,
exportListApi: SmsLoglApi.exportSmsLogApi exportListApi: SmsLoglApi.exportSmsLogApi
@ -62,6 +60,6 @@ const handleDetail = (row: SmsLoglApi.SmsLogVO) => {
// //
const handleExport = async () => { const handleExport = async () => {
await exportList(xGrid, '短信日志.xls') await exportList('短信日志.xls')
} }
</script> </script>

View File

@ -1,7 +1,7 @@
<template> <template>
<ContentWrap> <ContentWrap>
<!-- 列表 --> <!-- 列表 -->
<vxe-grid ref="xGrid" v-bind="gridOptions" class="xtable-scrollbar"> <XTable @register="registerTable">
<!-- 操作新增 --> <!-- 操作新增 -->
<template #toolbar_buttons> <template #toolbar_buttons>
<XButton <XButton
@ -41,7 +41,7 @@
@click="handleDelete(row.id)" @click="handleDelete(row.id)"
/> />
</template> </template>
</vxe-grid> </XTable>
</ContentWrap> </ContentWrap>
<XModal id="smsTemplate" v-model="dialogVisible" :title="dialogTitle"> <XModal id="smsTemplate" v-model="dialogVisible" :title="dialogTitle">
<!-- 对话框(添加 / 修改) --> <!-- 对话框(添加 / 修改) -->
@ -113,8 +113,7 @@
import { ref, unref } from 'vue' import { ref, unref } from 'vue'
import { useI18n } from '@/hooks/web/useI18n' import { useI18n } from '@/hooks/web/useI18n'
import { useMessage } from '@/hooks/web/useMessage' import { useMessage } from '@/hooks/web/useMessage'
import { useVxeGrid } from '@/hooks/web/useVxeGrid' import { useXTable } from '@/hooks/web/useXTable'
import { VxeGridInstance } from 'vxe-table'
import { FormExpose } from '@/components/Form' import { FormExpose } from '@/components/Form'
import { ElForm, ElFormItem, ElInput } from 'element-plus' import { ElForm, ElFormItem, ElInput } from 'element-plus'
// import // import
@ -125,8 +124,7 @@ const { t } = useI18n() // 国际化
const message = useMessage() // const message = useMessage() //
// //
const xGrid = ref<VxeGridInstance>() // Grid Ref const [registerTable, { reload, deleteData }] = useXTable({
const { gridOptions, getList, deleteData } = useVxeGrid<SmsTemplateApi.SmsTemplateVO>({
allSchemas: allSchemas, allSchemas: allSchemas,
getListApi: SmsTemplateApi.getSmsTemplatePageApi, getListApi: SmsTemplateApi.getSmsTemplatePageApi,
deleteApi: SmsTemplateApi.deleteSmsTemplateApi deleteApi: SmsTemplateApi.deleteSmsTemplateApi
@ -170,7 +168,7 @@ const handleDetail = async (rowId: number) => {
// //
const handleDelete = async (rowId: number) => { const handleDelete = async (rowId: number) => {
await deleteData(xGrid, rowId) await deleteData(rowId)
} }
// //
@ -194,7 +192,7 @@ const submitForm = async () => {
} finally { } finally {
actionLoading.value = false actionLoading.value = false
// //
await getList(xGrid) await reload()
} }
} }
}) })

View File

@ -1,7 +1,7 @@
<template> <template>
<ContentWrap> <ContentWrap>
<!-- 列表 --> <!-- 列表 -->
<vxe-grid ref="xGrid" v-bind="gridOptions" class="xtable-scrollbar"> <XTable @register="registerTable">
<template #toolbar_buttons> <template #toolbar_buttons>
<!-- 操作新增 --> <!-- 操作新增 -->
<XButton <XButton
@ -49,7 +49,7 @@
@click="handleDelete(row.id)" @click="handleDelete(row.id)"
/> />
</template> </template>
</vxe-grid> </XTable>
</ContentWrap> </ContentWrap>
<XModal v-model="dialogVisible" :title="dialogTitle"> <XModal v-model="dialogVisible" :title="dialogTitle">
<!-- 对话框(添加 / 修改) --> <!-- 对话框(添加 / 修改) -->
@ -89,8 +89,7 @@
import { ref, unref } from 'vue' import { ref, unref } from 'vue'
import { useI18n } from '@/hooks/web/useI18n' import { useI18n } from '@/hooks/web/useI18n'
import { useMessage } from '@/hooks/web/useMessage' import { useMessage } from '@/hooks/web/useMessage'
import { useVxeGrid } from '@/hooks/web/useVxeGrid' import { useXTable } from '@/hooks/web/useXTable'
import { VxeGridInstance } from 'vxe-table'
import { ElTag } from 'element-plus' import { ElTag } from 'element-plus'
import { FormExpose } from '@/components/Form' import { FormExpose } from '@/components/Form'
import * as TenantApi from '@/api/system/tenant' import * as TenantApi from '@/api/system/tenant'
@ -99,8 +98,7 @@ import { rules, allSchemas, tenantPackageOption } from './tenant.data'
const { t } = useI18n() // const { t } = useI18n() //
const message = useMessage() // const message = useMessage() //
// //
const xGrid = ref<VxeGridInstance>() // Grid Ref const [registerTable, { reload, deleteData, exportList }] = useXTable({
const { gridOptions, getList, deleteData, exportList } = useVxeGrid<TenantApi.TenantVO>({
allSchemas: allSchemas, allSchemas: allSchemas,
getListApi: TenantApi.getTenantPageApi, getListApi: TenantApi.getTenantPageApi,
deleteApi: TenantApi.deleteTenantApi, deleteApi: TenantApi.deleteTenantApi,
@ -153,12 +151,12 @@ const handleDetail = async (rowId: number) => {
// //
const handleDelete = async (rowId: number) => { const handleDelete = async (rowId: number) => {
await deleteData(xGrid, rowId) await deleteData(rowId)
} }
// //
const handleExport = async () => { const handleExport = async () => {
await exportList(xGrid, '租户列表.xls') await exportList('租户列表.xls')
} }
// //
@ -183,7 +181,7 @@ const submitForm = async () => {
} finally { } finally {
actionLoading.value = false actionLoading.value = false
// //
await getList(xGrid) await reload()
} }
} }
}) })

View File

@ -1,7 +1,7 @@
<template> <template>
<ContentWrap> <ContentWrap>
<!-- 列表 --> <!-- 列表 -->
<vxe-grid ref="xGrid" v-bind="gridOptions" class="xtable-scrollbar"> <XTable @register="registerTable">
<template #toolbar_buttons> <template #toolbar_buttons>
<XButton <XButton
type="primary" type="primary"
@ -14,7 +14,7 @@
<XTextButton preIcon="ep:edit" :title="t('action.edit')" @click="handleUpdate(row.id)" /> <XTextButton preIcon="ep:edit" :title="t('action.edit')" @click="handleUpdate(row.id)" />
<XTextButton preIcon="ep:delete" :title="t('action.del')" @click="handleDelete(row.id)" /> <XTextButton preIcon="ep:delete" :title="t('action.del')" @click="handleDelete(row.id)" />
</template> </template>
</vxe-grid> </XTable>
</ContentWrap> </ContentWrap>
<XModal v-model="dialogVisible" :title="dialogTitle"> <XModal v-model="dialogVisible" :title="dialogTitle">
<!-- 对话框(添加 / 修改) --> <!-- 对话框(添加 / 修改) -->
@ -69,8 +69,7 @@ import { onMounted, ref, unref } from 'vue'
import { handleTree, defaultProps } from '@/utils/tree' import { handleTree, defaultProps } from '@/utils/tree'
import { useI18n } from '@/hooks/web/useI18n' import { useI18n } from '@/hooks/web/useI18n'
import { useMessage } from '@/hooks/web/useMessage' import { useMessage } from '@/hooks/web/useMessage'
import { useVxeGrid } from '@/hooks/web/useVxeGrid' import { useXTable } from '@/hooks/web/useXTable'
import { VxeGridInstance } from 'vxe-table'
import { FormExpose } from '@/components/Form' import { FormExpose } from '@/components/Form'
import { ElCard, ElSwitch, ElTree } from 'element-plus' import { ElCard, ElSwitch, ElTree } from 'element-plus'
// import // import
@ -86,7 +85,6 @@ const menuExpand = ref(false)
const menuNodeAll = ref(false) const menuNodeAll = ref(false)
const treeRef = ref<InstanceType<typeof ElTree>>() const treeRef = ref<InstanceType<typeof ElTree>>()
const treeNodeAll = ref(false) const treeNodeAll = ref(false)
const xGrid = ref<VxeGridInstance>() // Grid Ref
const formRef = ref<FormExpose>() // Ref const formRef = ref<FormExpose>() // Ref
const loading = ref(false) // const loading = ref(false) //
const actionType = ref('') // const actionType = ref('') //
@ -102,7 +100,7 @@ const getTree = async () => {
menuOptions.value = handleTree(res) menuOptions.value = handleTree(res)
} }
const { gridOptions, getList, deleteData } = useVxeGrid<TenantPackageApi.TenantPackageVO>({ const [registerTable, { reload, deleteData }] = useXTable({
allSchemas: allSchemas, allSchemas: allSchemas,
getListApi: TenantPackageApi.getTenantPackageTypePageApi, getListApi: TenantPackageApi.getTenantPackageTypePageApi,
deleteApi: TenantPackageApi.deleteTenantPackageTypeApi deleteApi: TenantPackageApi.deleteTenantPackageTypeApi
@ -136,7 +134,7 @@ const handleUpdate = async (rowId: number) => {
// //
const handleDelete = async (rowId: number) => { const handleDelete = async (rowId: number) => {
await deleteData(xGrid, rowId) await deleteData(rowId)
} }
// //
@ -162,7 +160,7 @@ const submitForm = async () => {
} finally { } finally {
loading.value = false loading.value = false
// //
await getList(xGrid) await reload()
} }
} }
}) })

View File

@ -27,7 +27,7 @@
</div> </div>
</template> </template>
<!-- 列表 --> <!-- 列表 -->
<vxe-grid ref="xGrid" v-bind="gridOptions" class="xtable-scrollbar"> <XTable @register="registerTable">
<template #toolbar_buttons> <template #toolbar_buttons>
<!-- 操作新增 --> <!-- 操作新增 -->
<XButton <XButton
@ -119,7 +119,7 @@
</template> </template>
</el-dropdown> </el-dropdown>
</template> </template>
</vxe-grid> </XTable>
</el-card> </el-card>
</div> </div>
<XModal v-model="dialogVisible" :title="dialogTitle"> <XModal v-model="dialogVisible" :title="dialogTitle">
@ -283,14 +283,13 @@ import {
UploadRawFile UploadRawFile
} from 'element-plus' } from 'element-plus'
import { useRouter } from 'vue-router' import { useRouter } from 'vue-router'
import { VxeGridInstance } from 'vxe-table'
import { handleTree, defaultProps } from '@/utils/tree' import { handleTree, defaultProps } from '@/utils/tree'
import download from '@/utils/download' import download from '@/utils/download'
import { CommonStatusEnum } from '@/utils/constants' import { CommonStatusEnum } from '@/utils/constants'
import { getAccessToken, getTenantId } from '@/utils/auth' import { getAccessToken, getTenantId } from '@/utils/auth'
import { useI18n } from '@/hooks/web/useI18n' import { useI18n } from '@/hooks/web/useI18n'
import { useMessage } from '@/hooks/web/useMessage' import { useMessage } from '@/hooks/web/useMessage'
import { useVxeGrid } from '@/hooks/web/useVxeGrid' import { useXTable } from '@/hooks/web/useXTable'
import { FormExpose } from '@/components/Form' import { FormExpose } from '@/components/Form'
import { rules, allSchemas } from './user.data' import { rules, allSchemas } from './user.data'
import * as UserApi from '@/api/system/user' import * as UserApi from '@/api/system/user'
@ -312,10 +311,9 @@ const queryParams = reactive({
// ========== ========== // ========== ==========
const tableTitle = ref('用户列表') const tableTitle = ref('用户列表')
// //
const xGrid = ref<VxeGridInstance>() // Grid Ref const [registerTable, { reload, deleteData, exportList }] = useXTable({
const { gridOptions, getList, deleteData, exportList } = useVxeGrid<UserApi.UserVO>({
allSchemas: allSchemas, allSchemas: allSchemas,
queryParams: queryParams, params: queryParams,
getListApi: UserApi.getUserPageApi, getListApi: UserApi.getUserPageApi,
deleteApi: UserApi.deleteUserApi, deleteApi: UserApi.deleteUserApi,
exportListApi: UserApi.exportUserApi exportListApi: UserApi.exportUserApi
@ -334,7 +332,7 @@ const filterNode = (value: string, data: Tree) => {
} }
const handleDeptNodeClick = async (row: { [key: string]: any }) => { const handleDeptNodeClick = async (row: { [key: string]: any }) => {
queryParams.deptId = row.id queryParams.deptId = row.id
await getList(xGrid) await reload()
} }
const { push } = useRouter() const { push } = useRouter()
const handleDeptEdit = () => { const handleDeptEdit = () => {
@ -409,7 +407,7 @@ const handleDetail = async (rowId: number) => {
} }
// //
const handleDelete = async (rowId: number) => { const handleDelete = async (rowId: number) => {
await deleteData(xGrid, rowId) await deleteData(rowId)
} }
// //
const submitForm = async () => { const submitForm = async () => {
@ -428,7 +426,7 @@ const submitForm = async () => {
} finally { } finally {
// unref(formRef)?.setSchema(allSchemas.formSchema) // unref(formRef)?.setSchema(allSchemas.formSchema)
// //
await getList(xGrid) await reload()
loading.value = false loading.value = false
} }
} }
@ -443,7 +441,7 @@ const handleStatusChange = async (row: UserApi.UserVO) => {
await UserApi.updateUserStatusApi(row.id, row.status) await UserApi.updateUserStatusApi(row.id, row.status)
message.success(text + '成功') message.success(text + '成功')
// //
await getList(xGrid) await reload()
}) })
.catch(() => { .catch(() => {
row.status = row.status =
@ -544,7 +542,7 @@ const handleFileSuccess = async (response: any): Promise<void> => {
text += '< ' + username + ': ' + data.failureUsernames[username] + ' >' text += '< ' + username + ': ' + data.failureUsernames[username] + ' >'
} }
message.alert(text) message.alert(text)
await getList(xGrid) await reload()
} }
// //
const handleExceed = (): void => { const handleExceed = (): void => {