From b2c1554aabc99360fbd5690f28ff59cd4e514efe Mon Sep 17 00:00:00 2001 From: "1378012178@qq.com" <1378012178@qq.com> Date: Wed, 7 May 2025 14:17:42 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E7=B3=BB=E7=BB=9F=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E5=AD=97=E5=85=B8=E5=90=8C=E6=AD=A5=EF=BC=88=E4=B8=B4=E6=97=B6?= =?UTF-8?q?=E6=8F=90=E4=BA=A4=E7=89=88=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/system/dict/dict.api.ts | 9 +++++++++ src/views/system/dict/index.vue | 32 +++++++++++++++++++++++++++++-- 2 files changed, 39 insertions(+), 2 deletions(-) diff --git a/src/views/system/dict/dict.api.ts b/src/views/system/dict/dict.api.ts index 36fe729..7a1ec9e 100644 --- a/src/views/system/dict/dict.api.ts +++ b/src/views/system/dict/dict.api.ts @@ -21,6 +21,7 @@ enum Api { dictItemCheck = '/sys/dictItem/dictItemCheck', refreshCache = '/sys/dict/refleshCache', queryAllDictItems = '/sys/dict/queryAllDictItems', + async = '/sys/dict/async', } /** * 导出api @@ -154,3 +155,11 @@ export const refreshCache = () => defHttp.get({ url: Api.refreshCache }, { isTra * @param params */ export const queryAllDictItems = () => defHttp.get({ url: Api.queryAllDictItems }, { isTransformResponse: false }); + +/** + * 同步数据 + * @param params + */ +export const asyncData = (params) => { + return defHttp.post({ url: Api.async, params }); +}; \ No newline at end of file diff --git a/src/views/system/dict/index.vue b/src/views/system/dict/index.vue index 9e8c784..f1e3737 100644 --- a/src/views/system/dict/index.vue +++ b/src/views/system/dict/index.vue @@ -25,7 +25,7 @@ @@ -48,7 +48,7 @@ import DictRecycleBinModal from './components/DictRecycleBinModal.vue'; import { useMessage } from '/src/hooks/web/useMessage'; import { removeAuthCache, setAuthCache } from '/src/utils/auth'; import { columns, searchFormSchema } from './dict.data'; -import { list, deleteDict, batchDeleteDict, getExportUrl, getImportUrl, refreshCache, queryAllDictItems } from './dict.api'; +import { list, deleteDict, batchDeleteDict, getExportUrl, getImportUrl, refreshCache, queryAllDictItems, asyncData } from './dict.api'; import { DB_DICT_DATA_KEY } from '/src/enums/cacheEnum'; import { useUserStore } from '/@/store/modules/user'; @@ -191,6 +191,34 @@ function getTableAction(record) { }, ]; } + +function getTableDropDownAction(record) { + return [ + { + label: '同步数据', + onClick: handleAsync.bind(null, record), + }, + { + label: '同步结果', + onClick: AsyncResultFunc.bind(null, record), + }, + ] +} +/** + * 同步 + */ +function handleAsync(record) { + asyncData(record).then(res => { + createMessage.success("操作成功,请在同步结果中进行查看!") + }) +} +/** + * 同步结果 + */ +function AsyncResultFunc(record) { + console.log("🌊 ~ AsyncResultFunc ~ record:", record) + +} From a504218a393b591c08c9ef8407c58e48b7c697e7 Mon Sep 17 00:00:00 2001 From: "1378012178@qq.com" <1378012178@qq.com> Date: Thu, 8 May 2025 16:22:07 +0800 Subject: [PATCH 2/4] =?UTF-8?q?1=E3=80=81=E7=B3=BB=E7=BB=9F=E7=BA=A7?= =?UTF-8?q?=E5=88=AB=E6=95=B0=E6=8D=AE=E5=AD=97=E5=85=B8=E5=90=8C=E6=AD=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/dataAsync/AsyncMain.api.ts | 21 ++++---- src/views/system/dict/dict.api.ts | 10 ++++ src/views/system/dict/index.vue | 60 +++++++++++++++++++++-- 3 files changed, 78 insertions(+), 13 deletions(-) diff --git a/src/components/dataAsync/AsyncMain.api.ts b/src/components/dataAsync/AsyncMain.api.ts index be57271..a1a6c7f 100644 --- a/src/components/dataAsync/AsyncMain.api.ts +++ b/src/components/dataAsync/AsyncMain.api.ts @@ -1,12 +1,12 @@ import { defHttp } from '/@/utils/http/axios'; -import { useMessage } from "/@/hooks/web/useMessage"; +import { useMessage } from '/@/hooks/web/useMessage'; const { createConfirm } = useMessage(); enum Api { list = '/asyncmain/asyncMain/list', - save='/asyncmain/asyncMain/add', - edit='/asyncmain/asyncMain/edit', + save = '/asyncmain/asyncMain/add', + edit = '/asyncmain/asyncMain/edit', deleteOne = '/asyncmain/asyncMain/delete', deleteBatch = '/asyncmain/asyncMain/deleteBatch', importExcel = '/asyncmain/asyncMain/importExcel', @@ -35,11 +35,11 @@ export const list = (params) => defHttp.get({ url: Api.list, params }); * @param params * @param handleSuccess */ -export const deleteOne = (params,handleSuccess) => { - return defHttp.delete({url: Api.deleteOne, params}, {joinParamsToUrl: true}).then(() => { +export const deleteOne = (params, handleSuccess) => { + return defHttp.delete({ url: Api.deleteOne, params }, { joinParamsToUrl: true }).then(() => { handleSuccess(); }); -} +}; /** * 批量删除 @@ -54,12 +54,12 @@ export const batchDelete = (params, handleSuccess) => { okText: '确认', cancelText: '取消', onOk: () => { - return defHttp.delete({url: Api.deleteBatch, data: params}, {joinParamsToUrl: true}).then(() => { + return defHttp.delete({ url: Api.deleteBatch, data: params }, { joinParamsToUrl: true }).then(() => { handleSuccess(); }); - } + }, }); -} +}; /** * 保存或者更新 @@ -69,4 +69,5 @@ export const batchDelete = (params, handleSuccess) => { export const saveOrUpdate = (params, isUpdate) => { let url = isUpdate ? Api.edit : Api.save; return defHttp.post({ url: url, params }, { isTransformResponse: false }); -} +}; + diff --git a/src/views/system/dict/dict.api.ts b/src/views/system/dict/dict.api.ts index 7a1ec9e..4ba5a5e 100644 --- a/src/views/system/dict/dict.api.ts +++ b/src/views/system/dict/dict.api.ts @@ -22,6 +22,7 @@ enum Api { refreshCache = '/sys/dict/refleshCache', queryAllDictItems = '/sys/dict/queryAllDictItems', async = '/sys/dict/async', + listByType = '/asyncmain/asyncMain/listByType', } /** * 导出api @@ -162,4 +163,13 @@ export const queryAllDictItems = () => defHttp.get({ url: Api.queryAllDictItems */ export const asyncData = (params) => { return defHttp.post({ url: Api.async, params }); +}; + +/** + * 查询同步结果 + * @param params + * @returns + */ +export const listByType = (params) => { + return defHttp.post({ url: Api.listByType, params }); }; \ No newline at end of file diff --git a/src/views/system/dict/index.vue b/src/views/system/dict/index.vue index f1e3737..19c2b27 100644 --- a/src/views/system/dict/index.vue +++ b/src/views/system/dict/index.vue @@ -34,11 +34,28 @@ + + + + + + + + + + + + + + From 5bda280088674dd3de565308c30dc19a8580c73e Mon Sep 17 00:00:00 2001 From: "1378012178@qq.com" <1378012178@qq.com> Date: Fri, 9 May 2025 11:27:26 +0800 Subject: [PATCH 3/4] =?UTF-8?q?=E4=BC=98=E5=8C=96=E7=B3=BB=E7=BB=9F?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E5=AD=97=E5=85=B8=E5=90=8C=E6=AD=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/system/dict/index.vue | 151 +++++++++++++++++++++++++++----- 1 file changed, 131 insertions(+), 20 deletions(-) diff --git a/src/views/system/dict/index.vue b/src/views/system/dict/index.vue index 19c2b27..c46c495 100644 --- a/src/views/system/dict/index.vue +++ b/src/views/system/dict/index.vue @@ -1,7 +1,6 @@