Sfoglia il codice sorgente

feat(tool): 添加清理系统数据功能

- 新增清理系统数据的API接口- 在代码生成工具页面添加清理系统数据按钮
- 实现清理系统数据的确认弹窗和成功提示
- 引入清理系统数据的API调用方法
fugui001 2 mesi fa
parent
commit
cbe4881f87
2 ha cambiato i file con 22 aggiunte e 0 eliminazioni
  1. 10 0
      src/api/system/business/apiUsers/index.ts
  2. 12 0
      src/views/tool/gen/index.vue

+ 10 - 0
src/api/system/business/apiUsers/index.ts

@@ -95,3 +95,13 @@ export const updateUserPhone = (data: UserForm) => {
     data: data
   });
 };
+
+/**
+ * 移除系统数据
+ */
+export const removeUserCacheSystemData = () => {
+  return request({
+    url: '/business/user/removeUserCacheSystemData',
+    method: 'post'
+  });
+};

+ 12 - 0
src/views/tool/gen/index.vue

@@ -52,6 +52,11 @@
               删除
             </el-button>
           </el-col>
+          <el-col :span="1.5">
+            <el-button v-hasPermi="['tool:gen:remove']" type="danger" plain icon="Delete" @click="removeUserCacheSystemDataClick()">
+              清理系统数据
+            </el-button>
+          </el-col>
           <right-toolbar v-model:show-search="showSearch" @query-table="getList"></right-toolbar>
         </el-row>
       </template>
@@ -117,6 +122,7 @@ import { delTable, genCode, getDataNames, listTable, previewTable, synchDb } fro
 import { TableQuery, TableVO } from '@/api/tool/gen/types';
 import router from '@/router';
 import ImportTable from './importTable.vue';
+import { removeUserCacheSystemData } from '@/api/system/business/apiUsers';
 
 const route = useRoute();
 const { proxy } = getCurrentInstance() as ComponentInternalInstance;
@@ -236,6 +242,12 @@ const handleDelete = async (row?: TableVO) => {
   proxy?.$modal.msgSuccess('删除成功');
 };
 
+const removeUserCacheSystemDataClick = async () => {
+  await proxy?.$modal.confirm('是否确认清理数据库数据项?');
+  await removeUserCacheSystemData();
+  proxy?.$modal.msgSuccess('清理成功');
+};
+
 onMounted(() => {
   const time = route.query.t;
   if (time != null && time != uniqueId.value) {