From 9b4a2bc5d5033ef934044785886c52dd9f343616 Mon Sep 17 00:00:00 2001 From: aeizzz Date: Fri, 10 Feb 2023 10:59:22 +0800 Subject: [PATCH] =?UTF-8?q?:sparkles:=20Introducing=20new=20features.=20?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E4=BB=A4=E7=89=8C=E7=AE=A1=E7=90=86=E5=8A=9F?= =?UTF-8?q?=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/admin/token.ts | 16 ++++ src/hooks/table.ts | 40 ++++++--- src/utils/other.ts | 5 +- src/views/admin/dict/index.vue | 4 +- src/views/admin/log/index.vue | 4 +- src/views/admin/token/i18n/en.ts | 11 +++ src/views/admin/token/i18n/zh-cn.ts | 12 +++ src/views/admin/token/index.vue | 120 +++++++++++++++++++++++++++ src/views/daemon/job-manage/form.vue | 9 +- 9 files changed, 203 insertions(+), 18 deletions(-) create mode 100644 src/api/admin/token.ts create mode 100644 src/views/admin/token/i18n/en.ts create mode 100644 src/views/admin/token/i18n/zh-cn.ts create mode 100644 src/views/admin/token/index.vue diff --git a/src/api/admin/token.ts b/src/api/admin/token.ts new file mode 100644 index 00000000..6225095a --- /dev/null +++ b/src/api/admin/token.ts @@ -0,0 +1,16 @@ +import request from "/@/utils/request" + +export function fetchList(query: object) { + return request({ + url: '/admin/token/page', + method: 'post', + data: query + }) +} + +export function delObj(token:string) { + return request({ + url: '/admin/token/' + token, + method: 'delete' + }) +} diff --git a/src/hooks/table.ts b/src/hooks/table.ts index 7daaf9d3..d6686345 100644 --- a/src/hooks/table.ts +++ b/src/hooks/table.ts @@ -1,5 +1,5 @@ import { ElMessage } from "element-plus"; -import other from "../utils/other"; +import other, { deepMerge } from "../utils/other"; export interface BasicTableProps { // 是否在创建页面时,调用数据列表接口 @@ -22,6 +22,10 @@ export interface BasicTableProps { loading?: Boolean selectObjs?: any[] + + descs?: string[] + + ascs?: string[] } export interface Pagination { @@ -54,7 +58,9 @@ export function useTable(options?: BasicTableProps) { } as Pagination, dataListSelections: [], loading: false, - selectObjs: [] + selectObjs: [], + descs: [], + ascs: [] } const mergeDefaultOptions = (options: any, props: any): BasicTableProps => { @@ -67,7 +73,7 @@ export function useTable(options?: BasicTableProps) { } // 覆盖默认值 - const state = mergeDefaultOptions(defaultOptions, options) + const state = mergeDefaultOptions(defaultOptions,options) const query = () => { @@ -77,10 +83,12 @@ export function useTable(options?: BasicTableProps) { ...state.queryForm, current: state.pagination?.current, size: state.pagination?.size, - }).then(res => { + descs: state.descs, + ascs: state.ascs + }).then((res: any) => { state.dataList = state.isPage ? res.data.records : res.data state.pagination!.total = state.isPage ? res.data.total : 0 - }).catch(err => { + }).catch((err: any) => { ElMessage.error(err.data.msg) }).finally(() => { state.loading = false; @@ -110,12 +118,22 @@ export function useTable(options?: BasicTableProps) { const sortChangeHandle = (column: any) => { const prop = other.toUnderline(column.prop); if (column.order === 'descending') { - state.queryForm!.descs.push(prop) - state.queryForm!.ascs.splice(state.queryForm!.ascs.indexOf(prop), 1) - } - if (column.order === 'ascending') { - state.queryForm!.ascs.push(prop) - state.queryForm!.descs.splice(state.queryForm!.descs.indexOf(prop), 1) + state.descs?.push(prop) + if(state.ascs!.indexOf(prop) >=0){ + state.ascs?.splice(state.ascs.indexOf(prop), 1) + } + }else if (column.order === 'ascending') { + state.ascs?.push(prop) + if(state.descs!.indexOf(prop) >=0){ + state.descs?.splice(state.descs.indexOf(prop), 1) + } + }else{ + if(state.ascs!.indexOf(prop) >=0){ + state.ascs?.splice(state.ascs.indexOf(prop), 1) + } + if(state.descs!.indexOf(prop) >=0){ + state.descs?.splice(state.descs.indexOf(prop), 1) + } } query(); } diff --git a/src/utils/other.ts b/src/utils/other.ts index fd5dcbf2..ae24c76d 100644 --- a/src/utils/other.ts +++ b/src/utils/other.ts @@ -10,6 +10,8 @@ import { Local } from '/@/utils/storage'; import { verifyUrl } from '/@/utils/toolsValidate'; import request from "/@/utils/request"; import { useMessage } from "/@/hooks/message"; +import { cloneDeep } from 'lodash-es'; +import { isObject } from './is'; // @ts-ignore import * as CryptoJS from "crypto-js"; @@ -325,7 +327,7 @@ export function handleTree(data, id, parentId, children, rootId) { } /** - * + * * @param str 驼峰转下划线 * @returns 下划线 */ @@ -333,5 +335,6 @@ export function toUnderline(str: string) { return str.replace(/([A-Z])/g, "_$1").toLowerCase() } + // 统一批量导出 export default other; diff --git a/src/views/admin/dict/index.vue b/src/views/admin/dict/index.vue index de7b4dae..1259bae2 100644 --- a/src/views/admin/dict/index.vue +++ b/src/views/admin/dict/index.vue @@ -37,14 +37,14 @@ - + - +