Parcourir la source

修复代码生成页面数据编辑保存之后总是跳转第一页的问题

RuoYi il y a 4 ans
Parent
commit
14771f0ab4

+ 1 - 1
ruoyi-ui/src/router/index.js

@@ -144,7 +144,7 @@ export const constantRoutes = [
144
     hidden: true,
144
     hidden: true,
145
     children: [
145
     children: [
146
       {
146
       {
147
-        path: 'index/:tableId(\\d+)',
147
+        path: 'index',
148
         component: (resolve) => require(['@/views/tool/gen/editTable'], resolve),
148
         component: (resolve) => require(['@/views/tool/gen/editTable'], resolve),
149
         name: 'GenEdit',
149
         name: 'GenEdit',
150
         meta: { title: '修改生成配置', activeMenu: '/tool/gen'}
150
         meta: { title: '修改生成配置', activeMenu: '/tool/gen'}

+ 2 - 2
ruoyi-ui/src/views/tool/gen/editTable.vue

@@ -157,7 +157,7 @@ export default {
157
     };
157
     };
158
   },
158
   },
159
   created() {
159
   created() {
160
-    const tableId = this.$route.params && this.$route.params.tableId;
160
+    const tableId = this.$route.query && this.$route.query.tableId;
161
     if (tableId) {
161
     if (tableId) {
162
       // 获取表详细信息
162
       // 获取表详细信息
163
       getGenTable(tableId).then(res => {
163
       getGenTable(tableId).then(res => {
@@ -212,7 +212,7 @@ export default {
212
     /** 关闭按钮 */
212
     /** 关闭按钮 */
213
     close() {
213
     close() {
214
       this.$store.dispatch("tagsView/delView", this.$route);
214
       this.$store.dispatch("tagsView/delView", this.$route);
215
-      this.$router.push({ path: "/tool/gen", query: { t: Date.now()}})
215
+      this.$router.push({ path: "/tool/gen", query: { t: Date.now(), pageNum: this.$route.query.pageNum } })
216
     }
216
     }
217
   },
217
   },
218
   mounted() {
218
   mounted() {

+ 3 - 2
ruoyi-ui/src/views/tool/gen/index.vue

@@ -238,7 +238,8 @@ export default {
238
     const time = this.$route.query.t;
238
     const time = this.$route.query.t;
239
     if (time != null && time != this.uniqueId) {
239
     if (time != null && time != this.uniqueId) {
240
       this.uniqueId = time;
240
       this.uniqueId = time;
241
-      this.resetQuery();
241
+      this.queryParams.pageNum = Number(this.$route.query.pageNum);
242
+      this.getList();
242
     }
243
     }
243
   },
244
   },
244
   methods: {
245
   methods: {
@@ -319,7 +320,7 @@ export default {
319
     /** 修改按钮操作 */
320
     /** 修改按钮操作 */
320
     handleEditTable(row) {
321
     handleEditTable(row) {
321
       const tableId = row.tableId || this.ids[0];
322
       const tableId = row.tableId || this.ids[0];
322
-      this.$router.push("/tool/gen-edit/index/" + tableId);
323
+      this.$router.push({ path: '/tool/gen-edit/index', query: { tableId: tableId, pageNum: this.queryParams.pageNum } });
323
     },
324
     },
324
     /** 删除按钮操作 */
325
     /** 删除按钮操作 */
325
     handleDelete(row) {
326
     handleDelete(row) {