系统数据字典同步(临时提交版)

This commit is contained in:
1378012178@qq.com 2025-05-07 14:17:42 +08:00
parent 0f391c0c47
commit b2c1554aab
2 changed files with 39 additions and 2 deletions

View File

@ -21,6 +21,7 @@ enum Api {
dictItemCheck = '/sys/dictItem/dictItemCheck', dictItemCheck = '/sys/dictItem/dictItemCheck',
refreshCache = '/sys/dict/refleshCache', refreshCache = '/sys/dict/refleshCache',
queryAllDictItems = '/sys/dict/queryAllDictItems', queryAllDictItems = '/sys/dict/queryAllDictItems',
async = '/sys/dict/async',
} }
/** /**
* api * api
@ -154,3 +155,11 @@ export const refreshCache = () => defHttp.get({ url: Api.refreshCache }, { isTra
* @param params * @param params
*/ */
export const queryAllDictItems = () => defHttp.get({ url: Api.queryAllDictItems }, { isTransformResponse: false }); export const queryAllDictItems = () => defHttp.get({ url: Api.queryAllDictItems }, { isTransformResponse: false });
/**
*
* @param params
*/
export const asyncData = (params) => {
return defHttp.post({ url: Api.async, params });
};

View File

@ -25,7 +25,7 @@
</template> </template>
<!--操作栏--> <!--操作栏-->
<template #action="{ record }"> <template #action="{ record }">
<TableAction :actions="getTableAction(record)" /> <TableAction :actions="getTableAction(record)" :dropDownActions="getTableDropDownAction(record)" />
</template> </template>
</BasicTable> </BasicTable>
<!--字典弹窗--> <!--字典弹窗-->
@ -48,7 +48,7 @@ import DictRecycleBinModal from './components/DictRecycleBinModal.vue';
import { useMessage } from '/src/hooks/web/useMessage'; import { useMessage } from '/src/hooks/web/useMessage';
import { removeAuthCache, setAuthCache } from '/src/utils/auth'; import { removeAuthCache, setAuthCache } from '/src/utils/auth';
import { columns, searchFormSchema } from './dict.data'; 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 { DB_DICT_DATA_KEY } from '/src/enums/cacheEnum';
import { useUserStore } from '/@/store/modules/user'; 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)
}
</script> </script>
<style scoped></style> <style scoped></style>