From a4a67b81dea2f5b7b00549d8b279add37ecc4208 Mon Sep 17 00:00:00 2001 From: lzq <2495532633@qq.com> Date: Fri, 19 Dec 2025 13:44:14 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=86=E9=A1=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/common/utils/http-util.ts | 15 ++-- src/pages/sys/dict/DictCategory.vue | 47 ++++++------- src/pages/sys/endpoint/Endpoint.vue | 36 +++++----- src/pages/sys/gen/db-table/DbTable.vue | 44 +++++------- src/pages/sys/gen/tpl/Tpl.vue | 33 +++++---- src/pages/sys/menus/Menus.vue | 9 ++- src/pages/sys/role/Role.vue | 23 +++++- src/pages/sys/sn-config/SnConfig.vue | 89 +++++++++++++++++------- src/pages/sys/sn-config/sn-config-api.ts | 7 +- src/pages/sys/user/User.vue | 21 +++++- 10 files changed, 189 insertions(+), 135 deletions(-) diff --git a/src/common/utils/http-util.ts b/src/common/utils/http-util.ts index bf4c3f1..6dc9e11 100644 --- a/src/common/utils/http-util.ts +++ b/src/common/utils/http-util.ts @@ -1,7 +1,4 @@ -import { - closeUrl, - serverBaseUrl, -} from '@/common' +import { serverBaseUrl } from '@/common' import axios, { type AxiosRequestConfig, type AxiosResponse, @@ -26,7 +23,7 @@ export interface R { } type AxiosConfig = Pick -const closeUrls = closeUrl.split(',') +// const closeUrls = closeUrl.split(',') // type ParamsSerializerType = Extract; /** @@ -124,9 +121,9 @@ httpUtil.interceptors.response.use( * @param disposeErr 是否处理错误响应,默认-->true */ export function get(url: string, params?: any, disposeErr: boolean = true) { - if (closeUrls.includes(url)) { + /* if (closeUrls.includes(url)) { return Promise.reject({code: 0, success: true, msg: '', message: '', data: null} as R) - } + } */ return httpUtil.get>(url, {params, paramsSerializer, responseType: 'json'}) .then(({data}) => data) .catch(res => { @@ -144,9 +141,9 @@ export function get(url: string, params?: any, disposeErr: boolean = tr * @param disposeErr 是否处理错误响应,默认-->true */ export function post(url: string, body?: any, params?: any, disposeErr: boolean = true) { - if (closeUrls.includes(url)) { + /* if (closeUrls.includes(url)) { return Promise.reject({code: 0, success: true, msg: '', message: '', data: null} as R) - } + } */ return httpUtil.post>(url, body, {responseType: 'json', params}) .then(({data}) => data) .catch(res => { diff --git a/src/pages/sys/dict/DictCategory.vue b/src/pages/sys/dict/DictCategory.vue index c97b4c6..ba9920b 100644 --- a/src/pages/sys/dict/DictCategory.vue +++ b/src/pages/sys/dict/DictCategory.vue @@ -50,11 +50,14 @@ + v-model:current-page="searchForm.current" + v-model:page-size="searchForm.size" + :hide-on-single-page="false" + :page-sizes="[10, 20, 50, 100, 500]" + :teleported="false" + :total="totalCount" + layout="->, sizes, total, prev, pager, next" + @change="paging"/> @@ -63,22 +66,16 @@ import DictApi from '@/pages/sys/dict/dict-api.ts' import { elIcons } from '@/common/element/element.ts' import DictForm from '@/pages/sys/dict/DictForm.vue' +const totalCount = ref(0) const tableData = ref([]) -const searchForm = reactive( - { - orders: 'dict_key,id', - current: 1, - size: 20, - }) -const searching = ref(false) -const deling = ref(false) -const dictFormIns = useTemplateRef>('dictForm') -const pagination = reactive({ - total: 0, - pages: 0, +const searchForm = ref({ + orders: 'dict_key,id', current: 1, size: 20, }) +const searching = ref(false) +const deling = ref(false) +const dictFormIns = useTemplateRef>('dictForm') function showDialog(data?: DictTypes.SearchDictResult) { dictFormIns.value?.open(data) @@ -117,21 +114,20 @@ function pageChangeHandler(currentPage: number, pageSize: number) { } function reset() { - Object.assign(searchForm, {}) + searchForm.value = { + orders: 'dict_key,id', + current: 1, + size: 20, + } paging() } function paging() { searching.value = true - DictApi.paging(searchForm) + DictApi.paging(searchForm.value) .then(res => { + totalCount.value = res.data?.total ?? 0 tableData.value = res.data?.records ?? [] - Object.assign(pagination, { - total: res.data?.total ?? 0, - pages: res.data?.pages ?? 0, - current: res.data?.current ?? 1, - size: res.data?.size ?? 20, - }) }) .finally(() => { searching.value = false @@ -145,6 +141,7 @@ onMounted(() => { diff --git a/src/pages/sys/sn-config/sn-config-api.ts b/src/pages/sys/sn-config/sn-config-api.ts index 72c90b5..8e8509b 100644 --- a/src/pages/sys/sn-config/sn-config-api.ts +++ b/src/pages/sys/sn-config/sn-config-api.ts @@ -4,11 +4,8 @@ import { } from '@/common/utils/http-util.ts' export default { - paging(data: SnConfigTypes.SearchSnConfigParam, {size, current, orders}: G.PageParam) { - return get>('/sys_sn_config/paging', { - size, current, orders, - ...data, - }) + paging(data: SnConfigTypes.SearchSnConfigParam) { + return get>('/sys_sn_config/paging', data) }, modify(data: SnConfigTypes.ModifySnConfigParam) { return post('/sys_sn_config/modify', data) diff --git a/src/pages/sys/user/User.vue b/src/pages/sys/user/User.vue index 4124d9f..4896ba9 100644 --- a/src/pages/sys/user/User.vue +++ b/src/pages/sys/user/User.vue @@ -77,6 +77,15 @@ + @@ -94,8 +103,9 @@ import AppApi from '@/common/app/app-api.ts' import BindRole from '@/pages/sys/user/BindRole.vue' import ClientUtil from '@/common/utils/client-util.ts' +const totalCount = ref(0) const tableData = ref([]) -const searchForm = reactive({ +const searchForm = ref({ current: 1, size: 20, }) @@ -153,7 +163,10 @@ function addHandler() { } function reset() { - Object.assign(searchForm, {}) + searchForm.value = { + current: 1, + size: 20, + } paging() } @@ -185,8 +198,9 @@ function disabledUserHandler(val: string | number | boolean, id: string) { function paging() { searching.value = true - UserApi.paging(searchForm) + UserApi.paging(searchForm.value) .then(res => { + totalCount.value = res.data?.total ?? 0 tableData.value = res.data?.records ?? [] tableData.value.map(it => { it.account.clients = ClientUtil.getClients(it.account.clientCode!).map(it => it.val) @@ -205,6 +219,7 @@ onMounted(() => {