Browse Source

代码生成编辑修改后同步列表显示

RuoYi 3 years ago
parent
commit
6d63e64505
3 changed files with 16 additions and 3 deletions
  1. 1 1
      src/router/index.js
  2. 1 1
      src/views/tool/gen/editTable.vue
  3. 14 1
      src/views/tool/gen/index.vue

+ 1 - 1
src/router/index.js

@@ -139,7 +139,7 @@ export const constantRoutes = [
     hidden: true,
     hidden: true,
     children: [
     children: [
       {
       {
-        path: 'index',
+        path: 'index/:tableId(\\d+)',
         component: () => import('@/views/tool/gen/editTable'),
         component: () => import('@/views/tool/gen/editTable'),
         name: 'GenEdit',
         name: 'GenEdit',
         meta: { title: '修改生成配置', activeMenu: '/tool/gen' }
         meta: { title: '修改生成配置', activeMenu: '/tool/gen' }

+ 1 - 1
src/views/tool/gen/editTable.vue

@@ -181,7 +181,7 @@ function close() {
 }
 }
 
 
 (() => {
 (() => {
-  const tableId = route.query && route.query.tableId;
+  const tableId = route.params && route.params.tableId;
   if (tableId) {
   if (tableId) {
     // 获取表详细信息
     // 获取表详细信息
     getGenTable(tableId).then(res => {
     getGenTable(tableId).then(res => {

+ 14 - 1
src/views/tool/gen/index.vue

@@ -176,6 +176,7 @@ import { listTable, previewTable, delTable, genCode, synchDb } from "@/api/tool/
 import router from "@/router";
 import router from "@/router";
 import importTable from "./importTable";
 import importTable from "./importTable";
 
 
+const route = useRoute();
 const { proxy } = getCurrentInstance();
 const { proxy } = getCurrentInstance();
 
 
 const tableList = ref([]);
 const tableList = ref([]);
@@ -187,6 +188,7 @@ const multiple = ref(true);
 const total = ref(0);
 const total = ref(0);
 const tableNames = ref([]);
 const tableNames = ref([]);
 const dateRange = ref([]);
 const dateRange = ref([]);
+const uniqueId = ref("");
 
 
 const data = reactive({
 const data = reactive({
   queryParams: {
   queryParams: {
@@ -205,6 +207,17 @@ const data = reactive({
 
 
 const { queryParams, preview } = toRefs(data);
 const { queryParams, preview } = toRefs(data);
 
 
+onActivated(() => {
+  const time = route.query.t;
+  if (time != null && time != uniqueId.value) {
+    uniqueId.value = time;
+    queryParams.value.pageNum = Number(route.query.pageNum);
+    dateRange.value = [];
+    proxy.resetForm("queryForm");
+    getList();
+  }
+})
+
 /** 查询表集合 */
 /** 查询表集合 */
 function getList() {
 function getList() {
   loading.value = true;
   loading.value = true;
@@ -271,7 +284,7 @@ function handleSelectionChange(selection) {
 /** 修改按钮操作 */
 /** 修改按钮操作 */
 function handleEditTable(row) {
 function handleEditTable(row) {
   const tableId = row.tableId || ids.value[0];
   const tableId = row.tableId || ids.value[0];
-  router.push({ path: "/tool/gen-edit/index", query: { tableId: tableId, pageNum: queryParams.value.pageNum } });
+  router.push({ path: "/tool/gen-edit/index/" + tableId, query: { pageNum: queryParams.value.pageNum } });
 }
 }
 /** 删除按钮操作 */
 /** 删除按钮操作 */
 function handleDelete(row) {
 function handleDelete(row) {