refactor: 重构代码结构并优化命名一致性

feat(backend): 新增模块示例和路径配置
fix(backend): 修复菜单模型名称唯一性约束
refactor(backend): 重构日志模块和路径配置
style(backend): 统一API方法命名规范
refactor(frontend): 重构API方法命名规范
fix(frontend): 修复权限校验问题
refactor: 移动定时任务测试文件到正确模块
docs: 更新模板文件路径
refactor: 优化日志记录和错误处理
fix: 修复排序默认值问题
This commit is contained in:
zhangtao
2025-11-19 02:24:16 +08:00
parent fce6333722
commit 279f547f84
132 changed files with 1670 additions and 1106 deletions
@@ -252,7 +252,7 @@
新增
</el-button>
<el-button
v-hasPerm="['module_system:dept:detail']"
v-hasPerm="['module_system:dept:query']"
type="info"
size="small"
link
@@ -381,7 +381,6 @@
<!-- 详情弹窗不需要确定按钮的提交逻辑 -->
<el-button
v-if="dialogVisible.type !== 'detail'"
v-hasPerm="['module_system:dept:submit']"
type="primary"
@click="handleSubmit"
>
@@ -389,7 +388,6 @@
</el-button>
<el-button
v-else
v-hasPerm="['module_system:dept:detail']"
type="primary"
@click="handleCloseDialog"
>
@@ -481,7 +479,7 @@ const rules = reactive({
async function handleRefresh() {
loading.value = true;
try {
const response = await DeptAPI.getDeptList(queryFormData);
const response = await DeptAPI.listDept(queryFormData);
pageTableData.value = response.data.data;
} catch (error: any) {
console.error(error);
@@ -494,7 +492,7 @@ async function handleRefresh() {
async function loadingData() {
loading.value = true;
try {
const response = await DeptAPI.getDeptList(queryFormData);
const response = await DeptAPI.listDept(queryFormData);
pageTableData.value = response.data.data;
// 加载部门选项
deptOptions.value = formatTree(response.data.data);
@@ -582,7 +580,7 @@ async function handleOpenDialog(
) {
dialogVisible.type = type;
if (id) {
const response = await DeptAPI.getDeptDetail(id);
const response = await DeptAPI.detailDept(id);
if (type === "detail") {
dialogVisible.title = "部门详情";
Object.assign(detailFormData.value, response.data.data);
@@ -664,7 +662,7 @@ async function handleMoreClick(status: boolean) {
.then(async () => {
try {
loading.value = true;
await DeptAPI.batchAvailableDept({ ids: selectIds.value, status });
await DeptAPI.batchDept({ ids: selectIds.value, status });
handleResetQuery();
} catch (error: any) {
console.error(error);
@@ -200,6 +200,7 @@
<el-table-column fixed="right" label="操作" align="center" min-width="200">
<template #default="scope">
<el-button
v-hasPerm="['module_system:dict_data:query']"
type="info"
size="small"
link
@@ -517,7 +518,7 @@ async function loadingData() {
loading.value = true;
try {
// 在查询参数中添加 dictType
const response = await DictAPI.getDictDataList(queryFormData);
const response = await DictAPI.listDictData(queryFormData);
pageTableData.value = response.data.data.items;
total.value = response.data.data.total;
} catch (error: any) {
@@ -589,7 +590,7 @@ async function handleCloseDialog() {
async function handleOpenDialog(type: "create" | "update" | "detail", id?: number) {
dialogVisible.type = type;
if (id) {
const response = await DictAPI.getDictDataDetail(id);
const response = await DictAPI.detailDictData(id);
if (type === "detail") {
dialogVisible.title = "字典数据详情";
Object.assign(detailFormData.value, response.data.data);
@@ -682,7 +683,7 @@ async function handleMoreClick(status: boolean) {
.then(async () => {
try {
loading.value = true;
await DictAPI.batchAvailableDictData({ ids: selectIds.value, status });
await DictAPI.batchDictData({ ids: selectIds.value, status });
handleResetQuery();
} catch (error: any) {
console.error(error);
@@ -723,7 +724,7 @@ const curdContentConfig = {
query.page_size = 1000;
const all: any[] = [];
while (true) {
const res = await DictAPI.getDictDataList(query);
const res = await DictAPI.listDictData(query);
const items = res.data?.data?.items || [];
const total = res.data?.data?.total || 0;
all.push(...items);
@@ -146,7 +146,7 @@
<el-col :span="1.5">
<el-tooltip content="刷新">
<el-button
v-hasPerm="['module_system:dict_type:refresh']"
v-hasPerm="['module_system:dict_type:query']"
type="primary"
icon="refresh"
circle
@@ -287,7 +287,7 @@
字典
</el-button>
<el-button
v-hasPerm="['module_system:dict_type:detail']"
v-hasPerm="['module_system:dict_type:query']"
type="info"
size="small"
link
@@ -405,7 +405,6 @@
<el-button @click="handleCloseDialog">取消</el-button>
<el-button
v-if="dialogVisible.type !== 'detail'"
v-hasPerm="['module_system:dict_type:submit']"
type="primary"
@click="handleSubmit"
>
@@ -413,7 +412,6 @@
</el-button>
<el-button
v-else
v-hasPerm="['module_system:dict_type:detail']"
type="primary"
@click="handleCloseDialog"
>
@@ -554,7 +552,7 @@ const currentDictLabel = ref("");
async function loadingData() {
loading.value = true;
try {
const response = await DictAPI.getDictTypeList(queryFormData);
const response = await DictAPI.listDictType(queryFormData);
pageTableData.value = response.data.data.items;
total.value = response.data.data.total;
} catch (error: any) {
@@ -621,7 +619,7 @@ async function handleCloseDialog() {
async function handleOpenDialog(type: "create" | "update" | "detail", id?: number) {
dialogVisible.type = type;
if (id) {
const response = await DictAPI.getDictTypeDetail(id);
const response = await DictAPI.detailDictType(id);
if (type === "detail") {
dialogVisible.title = "字典详情";
Object.assign(detailFormData.value, response.data.data);
@@ -710,7 +708,7 @@ async function handleMoreClick(status: boolean) {
.then(async () => {
try {
loading.value = true;
await DictAPI.batchAvailableDict({ ids: selectIds.value, status });
await DictAPI.batchDictType({ ids: selectIds.value, status });
handleResetQuery();
} catch (error: any) {
console.error(error);
@@ -751,7 +749,7 @@ const curdContentConfig = {
query.page_size = 1000;
const all: any[] = [];
while (true) {
const res = await DictAPI.getDictTypeList(query);
const res = await DictAPI.listDictType(query);
const items = res.data?.data?.items || [];
const total = res.data?.data?.total || 0;
all.push(...items);
@@ -116,7 +116,7 @@
<el-col :span="1.5">
<el-tooltip content="刷新">
<el-button
v-hasPerm="['module_system:log:refresh']"
v-hasPerm="['module_system:log:query']"
type="default"
icon="refresh"
circle
@@ -204,7 +204,7 @@
<el-table-column label="操作" fixed="right" align="center" min-width="150">
<template #default="scope">
<el-button
v-hasPerm="['module_system:log:detail']"
v-hasPerm="['module_system:log:query']"
type="info"
size="small"
link
@@ -434,7 +434,7 @@ const getMethodType = (method?: string) => {
async function loadingData() {
loading.value = true;
try {
const response = await LogAPI.getLogList(queryFormData);
const response = await LogAPI.listLog(queryFormData);
pageTableData.value = response.data.data.items;
total.value = response.data.data.total;
} catch (error: any) {
@@ -491,7 +491,7 @@ async function handleCloseDialog() {
async function handleOpenDialog(type: "create" | "update" | "detail", id: number) {
dialogVisible.type = type;
if (id) {
const response = await LogAPI.getLogDetail(id);
const response = await LogAPI.detailLog(id);
if (type === "detail") {
dialogVisible.title = "日志详情";
Object.assign(formData.value, response.data.data);
@@ -554,7 +554,7 @@ const curdContentConfig = {
query.page_size = 1000;
const all: any[] = [];
while (true) {
const res = await LogAPI.getLogList(query);
const res = await LogAPI.listLog(query);
const items = res.data?.data?.items || [];
const total = res.data?.data?.total || 0;
all.push(...items);
@@ -125,7 +125,7 @@
<el-col :span="1.5">
<el-tooltip content="刷新">
<el-button
v-hasPerm="['module_system:menu:refresh']"
v-hasPerm="['module_system:menu:query']"
type="primary"
icon="refresh"
circle
@@ -238,7 +238,7 @@
新增
</el-button>
<el-button
v-hasPerm="['module_system:menu:detail']"
v-hasPerm="['module_system:menu:query']"
type="info"
size="small"
link
@@ -654,7 +654,6 @@
<!-- 详情弹窗不需要确定按钮的提交逻辑 -->
<el-button
v-if="dialogVisible.type !== 'detail'"
v-hasPerm="['module_system:menu:submit']"
type="primary"
@click="handleSubmit"
>
@@ -662,7 +661,6 @@
</el-button>
<el-button
v-else
v-hasPerm="['module_system:menu:detail']"
type="primary"
@click="handleCloseDialog"
>
@@ -807,7 +805,7 @@ function handleDateRangeChange(range: [Date, Date]) {
async function handleRefresh() {
loading.value = true;
try {
const response = await MenuAPI.getMenuList(queryFormData);
const response = await MenuAPI.listMenu(queryFormData);
pageTableData.value = response.data.data;
} catch (error: any) {
console.error(error);
@@ -830,7 +828,7 @@ const filterMenuTypes = (nodes: MenuTable[]) => {
async function loadingData() {
loading.value = true;
try {
const response = await MenuAPI.getMenuList(queryFormData);
const response = await MenuAPI.listMenu(queryFormData);
pageTableData.value = response.data.data;
// 加载菜单选项,只显示目录、菜单
menuOptions.value = formatTree(filterMenuTypes(response.data.data));
@@ -913,7 +911,7 @@ async function handleOpenDialog(
) {
dialogVisible.type = type;
if (id) {
const response = await MenuAPI.getMenuDetail(id);
const response = await MenuAPI.detailMenu(id);
if (type === "detail") {
dialogVisible.title = "菜单详情";
Object.assign(detailFormData.value, response.data.data);
@@ -1004,7 +1002,7 @@ async function handleMoreClick(status: boolean) {
.then(async () => {
try {
loading.value = true;
await MenuAPI.batchAvailableMenu({ ids: selectIds.value, status });
await MenuAPI.batchMenu({ ids: selectIds.value, status });
handleResetQuery();
} catch (error: any) {
console.error(error);
@@ -158,7 +158,7 @@
<el-col :span="1.5">
<el-tooltip content="刷新">
<el-button
v-hasPerm="['module_system:notice:refresh']"
v-hasPerm="['module_system:notice:query']"
type="primary"
icon="refresh"
circle
@@ -297,7 +297,7 @@
>
<template #default="scope">
<el-button
v-hasPerm="['module_system:notice:detail']"
v-hasPerm="['module_system:notice:query']"
type="info"
size="small"
link
@@ -437,7 +437,6 @@
<el-button @click="handleCloseDialog">取消</el-button>
<el-button
v-if="dialogVisible.type !== 'detail'"
v-hasPerm="['module_system:notice:submit']"
type="primary"
@click="handleSubmit"
>
@@ -445,7 +444,6 @@
</el-button>
<el-button
v-else
v-hasPerm="['module_system:notice:detail']"
type="primary"
@click="handleCloseDialog"
>
@@ -573,7 +571,7 @@ async function handleRefresh() {
async function loadingData() {
loading.value = true;
try {
const response = await NoticeAPI.getNoticeList(queryFormData);
const response = await NoticeAPI.listNotice(queryFormData);
pageTableData.value = response.data.data.items;
total.value = response.data.data.total;
} catch (error: any) {
@@ -641,7 +639,7 @@ async function handleCloseDialog() {
async function handleOpenDialog(type: "create" | "update" | "detail", id?: number) {
dialogVisible.type = type;
if (id) {
const response = await NoticeAPI.getNoticeDetail(id);
const response = await NoticeAPI.detailNotice(id);
if (type === "detail") {
dialogVisible.title = "公告通知详情";
Object.assign(detailFormData.value, response.data.data);
@@ -732,7 +730,7 @@ async function handleMoreClick(status: boolean) {
.then(async () => {
try {
loading.value = true;
await NoticeAPI.batchAvailableNotice({ ids: selectIds.value, status });
await NoticeAPI.batchNotice({ ids: selectIds.value, status });
handleResetQuery();
} catch (error: any) {
console.error(error);
@@ -769,7 +767,7 @@ const curdContentConfig = {
query.page_size = 1000;
const all: any[] = [];
while (true) {
const res = await NoticeAPI.getNoticeList(query);
const res = await NoticeAPI.listNotice(query);
const items = res.data?.data?.items || [];
const total = res.data?.data?.total || 0;
all.push(...items);
@@ -369,7 +369,7 @@ const submitChanges = async () => {
.filter(Boolean);
// 转换为JSON字符串格式保存
const apiWhitelistJson = JSON.stringify(apiWhitelistArray);
await ParamsAPI.updateConfig(apiWhitelistConfigs.value.white_api_list_path.id, {
await ParamsAPI.updateParams(apiWhitelistConfigs.value.white_api_list_path.id, {
...apiWhitelistConfigs.value.white_api_list_path,
config_value: apiWhitelistJson,
});
@@ -382,7 +382,7 @@ const submitChanges = async () => {
.filter(Boolean);
// 转换为JSON字符串格式保存
const ipBlacklistJson = JSON.stringify(ipBlacklistArray);
await ParamsAPI.updateConfig(ipBlacklistConfigs.value.ip_black_list.id, {
await ParamsAPI.updateParams(ipBlacklistConfigs.value.ip_black_list.id, {
...ipBlacklistConfigs.value.ip_black_list,
config_value: ipBlacklistJson,
});
@@ -395,7 +395,7 @@ const submitChanges = async () => {
.filter(Boolean);
// 转换为JSON字符串格式保存
const demoIpWhitelistJson = JSON.stringify(demoIpWhitelistArray);
await ParamsAPI.updateConfig(demoConfigs.value.ip_white_list.id, {
await ParamsAPI.updateParams(demoConfigs.value.ip_white_list.id, {
...demoConfigs.value.ip_white_list,
config_value: demoIpWhitelistJson,
});
@@ -412,7 +412,7 @@ const submitChanges = async () => {
securityPrivacyConfigs.value[key as keyof typeof securityPrivacyConfigs.value] ||
userAgreementConfigs.value[key as keyof typeof userAgreementConfigs.value] ||
demoConfigs.value[key as keyof typeof demoConfigs.value];
return item && item.id ? ParamsAPI.updateConfig(item.id, { ...item }) : Promise.resolve();
return item && item.id ? ParamsAPI.updateParams(item.id, { ...item }) : Promise.resolve();
});
await Promise.all(otherUpdatePromises);
@@ -40,7 +40,7 @@
</el-form-item>
<el-form-item class="search-buttons">
<el-button
v-hasPerm="['module_system:config:query']"
v-hasPerm="['module_system:param:query']"
type="primary"
icon="search"
native-type="submit"
@@ -48,7 +48,7 @@
查询
</el-button>
<el-button
v-hasPerm="['module_system:config:query']"
v-hasPerm="['module_system:param:query']"
icon="refresh"
@click="handleResetQuery"
>
@@ -91,7 +91,7 @@
<el-row :gutter="10">
<el-col :span="1.5">
<el-button
v-hasPerm="['module_system:config:create']"
v-hasPerm="['module_system:param:create']"
type="success"
icon="plus"
@click="handleOpenDialog('create')"
@@ -101,7 +101,7 @@
</el-col>
<el-col :span="1.5">
<el-button
v-hasPerm="['module_system:config:delete']"
v-hasPerm="['module_system:param:delete']"
type="danger"
icon="delete"
:disabled="selectIds.length === 0"
@@ -117,7 +117,7 @@
<el-col :span="1.5">
<el-tooltip content="导出">
<el-button
v-hasPerm="['module_system:config:export']"
v-hasPerm="['module_system:param:export']"
type="warning"
icon="download"
circle
@@ -128,7 +128,7 @@
<el-col :span="1.5">
<el-tooltip content="刷新">
<el-button
v-hasPerm="['module_system:config:refresh']"
v-hasPerm="['module_system:param:refresh']"
type="primary"
icon="refresh"
circle
@@ -137,7 +137,7 @@
</el-tooltip>
</el-col>
<el-col :span="1.5">
<el-dropdown v-hasPerm="['module_system:config:filter']" trigger="click">
<el-dropdown v-hasPerm="['module_system:param:query']" trigger="click">
<el-button type="default" icon="operation" circle />
<template #dropdown>
<el-dropdown-menu>
@@ -264,7 +264,7 @@
>
<template #default="scope">
<el-button
v-hasPerm="['module_system:config:detail']"
v-hasPerm="['module_system:param:query']"
type="info"
size="small"
link
@@ -274,7 +274,7 @@
详情
</el-button>
<el-button
v-hasPerm="['module_system:config:update']"
v-hasPerm="['module_system:param:update']"
type="primary"
size="small"
link
@@ -284,7 +284,7 @@
编辑
</el-button>
<el-button
v-hasPerm="['module_system:config:delete']"
v-hasPerm="['module_system:param:delete']"
type="danger"
size="small"
link
@@ -388,7 +388,7 @@
<el-button @click="handleCloseDialog">取消</el-button>
<el-button
v-if="dialogVisible.type !== 'detail'"
v-hasPerm="['module_system:config:create']"
v-hasPerm="['module_system:param:create']"
type="primary"
@click="handleSubmit"
>
@@ -396,7 +396,7 @@
</el-button>
<el-button
v-else
v-hasPerm="['module_system:config:detail']"
v-hasPerm="['module_system:param:detail']"
type="primary"
@click="handleCloseDialog"
>
@@ -522,7 +522,7 @@ async function handleRefresh() {
async function loadingData() {
loading.value = true;
try {
const response = await ParamsAPI.getConfigList(queryFormData);
const response = await ParamsAPI.listParams(queryFormData);
pageTableData.value = response.data.data.items;
total.value = response.data.data.total;
} catch (error: any) {
@@ -590,7 +590,7 @@ async function handleCloseDialog() {
async function handleOpenDialog(type: "create" | "update" | "detail", id?: number) {
dialogVisible.type = type;
if (id) {
const response = await ParamsAPI.getConfigDetail(id);
const response = await ParamsAPI.detailParams(id);
if (type === "detail") {
dialogVisible.title = "系统配置详情";
Object.assign(detailFormData.value, response.data.data);
@@ -615,7 +615,7 @@ async function handleSubmit() {
const id = formData.id;
if (id) {
try {
await ParamsAPI.updateConfig(id, formData);
await ParamsAPI.updateParams(id, formData);
dialogVisible.visible = false;
resetForm();
handleResetQuery();
@@ -626,7 +626,7 @@ async function handleSubmit() {
}
} else {
try {
await ParamsAPI.createConfig(formData);
await ParamsAPI.createParams(formData);
dialogVisible.visible = false;
resetForm();
handleResetQuery();
@@ -650,7 +650,7 @@ async function handleDelete(ids: number[]) {
.then(async () => {
try {
loading.value = true;
await ParamsAPI.deleteConfig(ids);
await ParamsAPI.deleteParams(ids);
handleResetQuery();
} catch (error: any) {
console.error(error);
@@ -681,7 +681,7 @@ const exportColumns = [
// 导入/导出配置(用于导出弹窗)
const curdContentConfig = {
permPrefix: "module_system:config",
permPrefix: "module_system:param",
cols: exportColumns as any,
exportsAction: async (params: any) => {
const query: any = { ...params };
@@ -692,7 +692,7 @@ const curdContentConfig = {
query.page_size = 1000;
const all: any[] = [];
while (true) {
const res = await ParamsAPI.getConfigList(query);
const res = await ParamsAPI.listParams(query);
const items = res.data?.data?.items || [];
const total = res.data?.data?.total || 0;
all.push(...items);
@@ -270,7 +270,7 @@
>
<template #default="scope">
<el-button
v-hasPerm="['module_system:position:detail']"
v-hasPerm="['module_system:position:query']"
type="info"
size="small"
link
@@ -388,7 +388,6 @@
<el-button @click="handleCloseDialog">取消</el-button>
<el-button
v-if="dialogVisible.type !== 'detail'"
v-hasPerm="['module_system:position:submit']"
type="primary"
@click="handleSubmit"
>
@@ -396,7 +395,6 @@
</el-button>
<el-button
v-else
v-hasPerm="['module_system:position:detail']"
type="primary"
@click="handleCloseDialog"
>
@@ -523,7 +521,7 @@ async function handleRefresh() {
async function loadingData() {
loading.value = true;
try {
const response = await PositionAPI.getPositionList(queryFormData);
const response = await PositionAPI.listPosition(queryFormData);
pageTableData.value = response.data.data.items;
total.value = response.data.data.total;
} catch (error: any) {
@@ -590,7 +588,7 @@ async function handleCloseDialog() {
async function handleOpenDialog(type: "create" | "update" | "detail", id?: number) {
dialogVisible.type = type;
if (id) {
const response = await PositionAPI.getPositionDetail(id);
const response = await PositionAPI.detailPosition(id);
if (type === "detail") {
dialogVisible.title = "岗位详情";
Object.assign(detailFormData.value, response.data.data);
@@ -672,7 +670,7 @@ async function handleMoreClick(status: boolean) {
.then(async () => {
try {
loading.value = true;
await PositionAPI.batchAvailablePosition({ ids: selectIds.value, status });
await PositionAPI.batchPosition({ ids: selectIds.value, status });
handleResetQuery();
} catch (error: any) {
console.error(error);
@@ -709,7 +707,7 @@ const curdContentConfig = {
query.page_size = 1000;
const all: any[] = [];
while (true) {
const res = await PositionAPI.getPositionList(query);
const res = await PositionAPI.listPosition(query);
const items = res.data?.data?.items || [];
const total = res.data?.data?.total || 0;
all.push(...items);
@@ -734,6 +732,6 @@ onMounted(() => {
exportColumns as any, exportsAction: async (params: any) => { const query: any = { ...params }; if
(typeof query.status === 'string') { query.status = query.status === 'true'; } query.page_no = 1;
query.page_size = 1000; const all: any[] = []; while (true) { const res = await
PositionAPI.getPositionList(query); const items = res.data?.data?.items || []; const total =
PositionAPI.listPosition(query); const items = res.data?.data?.items || []; const total =
res.data?.data?.total || 0; all.push(...items); if (all.length >= total || items.length === 0)
break; query.page_no += 1; } return all; }, } as unknown as IContentConfig;
@@ -204,15 +204,15 @@ const init = async () => {
try {
// 获取全部部门树
const deptResponse = await DeptAPI.getDeptList();
const deptResponse = await DeptAPI.listDept();
deptTreeData.value = formatTree(listToTree(deptResponse.data.data));
// 获取全部菜单树
const menuResponse = await MenuAPI.getMenuList();
const menuResponse = await MenuAPI.listMenu();
menuTreeData.value = formatTree(listToTree(menuResponse.data.data));
// 获取角色详情
const roleResponse = await RoleAPI.getRoleDetail(props.roleId);
const roleResponse = await RoleAPI.detailRole(props.roleId);
// 更新权限状态
permissionState.value = {
@@ -114,7 +114,7 @@
更多
</el-button>
<template #dropdown>
<el-dropdown-menu v-hasPerm="['module_system:role:filter']">
<el-dropdown-menu>
<el-dropdown-item icon="Check" @click="handleMoreClick(true)">
批量启用
</el-dropdown-item>
@@ -143,7 +143,7 @@
<el-col :span="1.5">
<el-tooltip content="刷新">
<el-button
v-hasPerm="['module_system:role:refresh']"
v-hasPerm="['module_system:role:query']"
type="primary"
icon="refresh"
circle
@@ -308,7 +308,7 @@
分配权限
</el-button>
<el-button
v-hasPerm="['module_system:role:detail']"
v-hasPerm="['module_system:role:query']"
type="info"
size="small"
link
@@ -458,7 +458,7 @@
<template #footer>
<div class="dialog-footer">
<el-button @click="handleCloseDialog">取 消</el-button>
<el-button v-hasPerm="['module_system:role:submit']" type="primary" @click="handleSubmit">
<el-button type="primary" @click="handleSubmit">
确 定
</el-button>
</div>
@@ -574,7 +574,7 @@ const rules = reactive({
async function loadingData() {
loading.value = true;
try {
const response = await RoleAPI.getRoleList(queryFormData);
const response = await RoleAPI.listRole(queryFormData);
pageTableData.value = response.data.data.items;
total.value = response.data.data.total;
} catch (error: any) {
@@ -662,7 +662,7 @@ async function handleCloseDialog() {
async function handleOpenDialog(type: "create" | "update" | "detail", id?: number) {
dialogVisible.type = type;
if (id) {
const response = await RoleAPI.getRoleDetail(id);
const response = await RoleAPI.detailRole(id);
if (type === "detail") {
dialogVisible.title = "角色详情";
Object.assign(detailFormData.value, response.data.data);
@@ -745,7 +745,7 @@ async function handleMoreClick(status: boolean) {
.then(async () => {
try {
loading.value = true;
await RoleAPI.batchAvailableRole({ ids: selectIds.value, status });
await RoleAPI.batchRole({ ids: selectIds.value, status });
handleResetQuery();
} catch (error: any) {
console.error(error);
@@ -796,7 +796,7 @@ const curdContentConfig = {
query.page_size = 1000;
const all: any[] = [];
while (true) {
const res = await RoleAPI.getRoleList(query);
const res = await RoleAPI.listRole(query);
const items = res.data?.data?.items || [];
const total = res.data?.data?.total || 0;
all.push(...items);
@@ -38,7 +38,7 @@
<!-- 查询、重置、展开/收起按钮 -->
<el-form-item>
<el-button
v-hasPerm="['module_generator:tenant:query']"
v-hasPerm="['module_system:tenant:query']"
type="primary"
icon="search"
@click="handleQuery"
@@ -46,7 +46,7 @@
查询
</el-button>
<el-button
v-hasPerm="['module_generator:tenant:query']"
v-hasPerm="['module_system:tenant:query']"
icon="refresh"
@click="handleResetQuery"
>
@@ -89,7 +89,7 @@
<el-row :gutter="10">
<el-col :span="1.5">
<el-button
v-hasPerm="['module_generator:tenant:create']"
v-hasPerm="['module_system:tenant:create']"
type="success"
icon="plus"
@click="handleOpenDialog('create')"
@@ -99,7 +99,7 @@
</el-col>
<el-col :span="1.5">
<el-button
v-hasPerm="['module_generator:tenant:delete']"
v-hasPerm="['module_system:tenant:delete']"
type="danger"
icon="delete"
:disabled="selectIds.length === 0"
@@ -109,7 +109,7 @@
</el-button>
</el-col>
<el-col :span="1.5">
<el-dropdown v-hasPerm="['module_generator:tenant:batch']" trigger="click">
<el-dropdown v-hasPerm="['module_system:tenant:batch']" trigger="click">
<el-button type="default" :disabled="selectIds.length === 0" icon="ArrowDown">
更多
</el-button>
@@ -132,7 +132,7 @@
<el-col :span="1.5">
<el-tooltip content="导入">
<el-button
v-hasPerm="['module_generator:tenant:import']"
v-hasPerm="['module_system:tenant:import']"
type="success"
icon="upload"
circle
@@ -143,7 +143,7 @@
<el-col :span="1.5">
<el-tooltip content="导出">
<el-button
v-hasPerm="['module_generator:tenant:export']"
v-hasPerm="['module_system:tenant:export']"
type="warning"
icon="download"
circle
@@ -165,7 +165,7 @@
<el-col :span="1.5">
<el-tooltip content="刷新">
<el-button
v-hasPerm="['module_generator:tenant:refresh']"
v-hasPerm="['module_system:tenant:query']"
type="primary"
icon="refresh"
circle
@@ -276,7 +276,7 @@
>
<template #default="scope">
<el-button
v-hasPerm="['module_generator:tenant:detail']"
v-hasPerm="['module_system:tenant:query']"
type="info"
size="small"
link
@@ -286,7 +286,7 @@
详情
</el-button>
<el-button
v-hasPerm="['module_generator:tenant:update']"
v-hasPerm="['module_system:tenant:update']"
type="primary"
size="small"
link
@@ -296,7 +296,7 @@
编辑
</el-button>
<el-button
v-hasPerm="['module_generator:tenant:delete']"
v-hasPerm="['module_system:tenant:delete']"
type="danger"
size="small"
link
@@ -395,7 +395,6 @@
<el-button @click="handleCloseDialog">取消</el-button>
<el-button
v-if="dialogVisible.type !== 'detail'"
v-hasPerm="['module_generator:tenant:submit']"
type="primary"
@click="handleSubmit"
>
@@ -403,7 +402,6 @@
</el-button>
<el-button
v-else
v-hasPerm="['smodule_generator:tenant:detail']"
type="primary"
@click="handleCloseDialog"
>
@@ -446,20 +444,20 @@ import DatePicker from "@/components/DatePicker/index.vue";
import type { IContentConfig } from "@/components/CURD/types";
import { QuestionFilled, ArrowUp, ArrowDown } from "@element-plus/icons-vue";
import { formatToDateTime } from "@/utils/dateUtil";
import TenantAPI, { ObjTable, ObjForm, ObjPageQuery } from "@/api/module_system/tenant";
import TenantAPI, { TenantTable, TenantForm, TenantPageQuery } from "@/api/module_system/tenant";
const visible = ref(true);
const queryFormRef = ref();
const dataFormRef = ref();
const total = ref(0);
const selectIds = ref<number[]>([]);
const selectionRows = ref<ObjTable[]>([]);
const selectionRows = ref<TenantTable[]>([]);
const loading = ref(false);
const isExpand = ref(false);
const isExpandable = ref(true);
// 分页表单
const pageTableData = ref<ObjTable[]>([]);
const pageTableData = ref<TenantTable[]>([]);
// 表格列配置
const tableColumns = ref([
@@ -487,9 +485,9 @@ const exportColumns = [
// 导入/导出配置
const curdContentConfig = {
permPrefix: "module_generator:tenant",
permPrefix: "module_system:tenant",
cols: exportColumns as any,
importTemplate: () => TenantAPI.download(),
importTemplate: () => TenantAPI.downloadTenant(),
exportsAction: async (params: any) => {
const query: any = { ...params };
if (typeof query.status === "string") {
@@ -499,7 +497,7 @@ const curdContentConfig = {
query.page_size = 9999;
const all: any[] = [];
while (true) {
const res = await TenantAPI.list(query);
const res = await TenantAPI.listTenant(query);
const items = res.data?.data?.items || [];
const total = res.data?.data?.total || 0;
all.push(...items);
@@ -510,7 +508,7 @@ const curdContentConfig = {
},
} as unknown as IContentConfig;
// 详情表单
const detailFormData = ref<ObjTable>({});
const detailFormData = ref<TenantTable>({});
// 日期范围临时变量
const dateRange = ref<[Date, Date] | []>([]);
@@ -527,7 +525,7 @@ function handleDateRangeChange(range: [Date, Date]) {
}
// 分页查询参数
const queryFormData = reactive<ObjPageQuery>({
const queryFormData = reactive<TenantPageQuery>({
page_no: 1,
page_size: 10,
name: undefined,
@@ -538,7 +536,7 @@ const queryFormData = reactive<ObjPageQuery>({
});
// 编辑表单
const formData = reactive<ObjForm>({
const formData = reactive<TenantForm>({
id: undefined,
name: "",
code: "",
@@ -585,7 +583,7 @@ async function handleRefresh() {
async function loadingData() {
loading.value = true;
try {
const response = await TenantAPI.list(queryFormData);
const response = await TenantAPI.listTenant(queryFormData);
pageTableData.value = response.data.data.items;
total.value = response.data.data.total;
} catch (error: any) {
@@ -618,7 +616,7 @@ async function handleResetQuery() {
}
// 定义初始表单数据常量
const initialFormData: ObjForm = {
const initialFormData: TenantForm = {
id: undefined,
name: "",
code: "",
@@ -652,7 +650,7 @@ async function handleCloseDialog() {
async function handleOpenDialog(type: "create" | "update" | "detail", id?: number) {
dialogVisible.type = type;
if (id) {
const response = await TenantAPI.detail(id);
const response = await TenantAPI.detailTenant(id);
if (type === "detail") {
dialogVisible.title = "详情";
Object.assign(detailFormData.value, response.data.data);
@@ -677,7 +675,7 @@ async function handleSubmit() {
const id = formData.id;
if (id) {
try {
await TenantAPI.update(id, { id, ...formData });
await TenantAPI.updateTenant(id, { id, ...formData });
dialogVisible.visible = false;
resetForm();
handleCloseDialog();
@@ -689,7 +687,7 @@ async function handleSubmit() {
}
} else {
try {
await TenantAPI.create(formData);
await TenantAPI.createTenant(formData);
dialogVisible.visible = false;
resetForm();
handleCloseDialog();
@@ -714,7 +712,7 @@ async function handleDelete(ids: number[]) {
.then(async () => {
try {
loading.value = true;
await TenantAPI.delete(ids);
await TenantAPI.deleteTenant(ids);
handleResetQuery();
} catch (error: any) {
console.error(error);
@@ -738,7 +736,7 @@ async function handleMoreClick(status: boolean) {
.then(async () => {
try {
loading.value = true;
await TenantAPI.batch({ ids: selectIds.value, status });
await TenantAPI.batchTenant({ ids: selectIds.value, status });
handleResetQuery();
} catch (error: any) {
console.error(error);
@@ -755,7 +753,7 @@ async function handleMoreClick(status: boolean) {
// 处理上传
const handleUpload = async (formData: FormData) => {
try {
const response = await TenantAPI.import(formData);
const response = await TenantAPI.importTenant(formData);
if (response.data.code === ResultEnum.SUCCESS) {
ElMessage.success(`${response.data.msg},${response.data.data}`);
importDialogVisible.value = false;
@@ -79,7 +79,7 @@ const loading = ref(true);
onBeforeMount(() => {
loading.value = true;
DeptAPI.getDeptList(queryFormData)
DeptAPI.listDept(queryFormData)
.then((response) => {
deptOptions.value = formatTree(response.data.data);
})
@@ -69,7 +69,7 @@ const selectConfig: ISelectConfig = {
else if (query.status === "false") query.status = false;
}
// 请求用户分页列表并适配 TableSelect 需要的结构
return UserAPI.getUserList(query).then((res: any) => {
return UserAPI.listUser(query).then((res: any) => {
return {
total: res.data.data.total,
list: res.data.data.items,
+10 -12
View File
@@ -129,7 +129,7 @@
更多
</el-button>
<template #dropdown>
<el-dropdown-menu v-hasPerm="['module_system:user:filter']">
<el-dropdown-menu>
<el-dropdown-item icon="Check" @click="handleMoreClick(true)">
批量启用
</el-dropdown-item>
@@ -170,7 +170,7 @@
<el-col :span="1.5">
<el-tooltip content="刷新">
<el-button
v-hasPerm="['module_system:user:refresh']"
v-hasPerm="['module_system:user:query']"
type="default"
icon="refresh"
circle
@@ -514,7 +514,6 @@
<div class="dialog-footer">
<el-button
v-if="dialogVisible.type === 'create' || dialogVisible.type === 'update'"
v-hasPerm="['module_system:user:create']"
type="primary"
@click="handleSubmit"
>
@@ -522,7 +521,6 @@
</el-button>
<el-button
v-else
v-hasPerm="['module_system:user:detail']"
type="primary"
@click="handleCloseDialog"
>
@@ -693,7 +691,7 @@ const exportColumns = [
const curdContentConfig = {
permPrefix: "module_system:user",
cols: exportColumns as any,
importTemplate: () => UserAPI.downloadTemplate(),
importTemplate: () => UserAPI.downloadTemplateUser(),
exportsAction: async (params: any) => {
const query: any = { ...params };
if (typeof query.status === "string") {
@@ -703,7 +701,7 @@ const curdContentConfig = {
query.page_size = 9999;
const all: any[] = [];
while (true) {
const res = await UserAPI.getUserList(query);
const res = await UserAPI.listUser(query);
const items = res.data?.data?.items || [];
const total = res.data?.data?.total || 0;
all.push(...items);
@@ -740,7 +738,7 @@ async function handleRefresh() {
async function loadingData() {
loading.value = true;
try {
const response = await UserAPI.getUserList(queryFormData);
const response = await UserAPI.listUser(queryFormData);
pageTableData.value = response.data.data.items;
total.value = response.data.data.total;
} catch (error: any) {
@@ -838,7 +836,7 @@ async function handleCloseDialog() {
async function handleOpenDialog(type: "create" | "update" | "detail", id?: number) {
dialogVisible.type = type;
if (id) {
const response = await UserAPI.getUserDetail(id);
const response = await UserAPI.detailUser(id);
if (type === "detail") {
dialogVisible.title = "用户详情";
Object.assign(detailFormData.value, response.data.data);
@@ -860,12 +858,12 @@ async function handleOpenDialog(type: "create" | "update" | "detail", id?: numbe
}
// 获取部门树
const deptResponse = await DeptAPI.getDeptList(queryFormData);
const deptResponse = await DeptAPI.listDept(queryFormData);
const treeData = deptResponse.data.data;
deptOptions.value = formatTree(treeData);
// 获取角色列表
const roleResponse = await RoleAPI.getRoleList();
const roleResponse = await RoleAPI.listRole();
roleOptions.value = roleResponse.data.data.items
.filter((item) => item.id !== undefined && item.name !== undefined)
.map((item) => ({
@@ -876,7 +874,7 @@ async function handleOpenDialog(type: "create" | "update" | "detail", id?: numbe
.filter((opt) => !opt.disabled);
// 获取岗位列表
const positionResponse = await PositionAPI.getPositionList();
const positionResponse = await PositionAPI.listPosition();
positionOptions.value = positionResponse.data.data.items
.filter((item) => item.id !== undefined && item.name !== undefined)
.map((item) => ({
@@ -954,7 +952,7 @@ async function handleMoreClick(status: boolean) {
.then(async () => {
try {
loading.value = true;
await UserAPI.batchAvailableUser({ ids: selectIds.value, status });
await UserAPI.batchUser({ ids: selectIds.value, status });
handleResetQuery();
} catch (error: any) {
console.error(error);