fix:代码生成编辑信息后跳转列表不刷新问题

This commit is contained in:
不做码农 2022-10-17 16:01:04 +08:00
parent 5f42a5ff41
commit 5179e6773b

View File

@ -78,7 +78,7 @@ import importTable from './importTable'
import hljs from 'highlight.js' import hljs from 'highlight.js'
import 'highlight.js/styles/dark.css' // import 'highlight.js/styles/dark.css' //
import { useClipboard } from '@vueuse/core' import { useClipboard } from '@vueuse/core'
// const route = useRoute() const route = useRoute()
const router = useRouter() const router = useRouter()
const { proxy } = getCurrentInstance() const { proxy } = getCurrentInstance()
@ -98,17 +98,28 @@ const data = reactive({
pageNum: 1, pageNum: 1,
pageSize: 10, pageSize: 10,
tableName: undefined, tableName: undefined,
t: 0
}, },
preview: { preview: {
open: false, open: false,
title: '代码预览', title: '代码预览',
data: {}, data: {},
activeName: '0', activeName: '0'
}, }
}) })
const { queryParams, preview } = toRefs(data) const { queryParams, preview } = toRefs(data)
watch(
route,
(val) => {
if (val) {
getList()
}
},
{
immediate: true
}
)
/** 查询表集合 */ /** 查询表集合 */
function getList() { function getList() {
tableloading.value = true tableloading.value = true
@ -137,7 +148,7 @@ function handleGenTable(row) {
codeGenerator({ codeGenerator({
tableId: currentSelected.value.tableId, tableId: currentSelected.value.tableId,
tableName: currentSelected.value.name, tableName: currentSelected.value.name,
VueVersion: 3, VueVersion: 3
}) })
.then((res) => { .then((res) => {
const { data } = res const { data } = res
@ -205,7 +216,7 @@ function handleEditTable(row) {
router.push({ router.push({
path: '/gen/editTable', path: '/gen/editTable',
query: { tableId: row.tableId }, query: { tableId: row.tableId }
}) })
} }
/** 删除按钮操作 */ /** 删除按钮操作 */
@ -215,7 +226,7 @@ function handleDelete(row) {
.$confirm('此操作将永久删除该文件, 是否继续?', '提示', { .$confirm('此操作将永久删除该文件, 是否继续?', '提示', {
confirmButtonText: '确定', confirmButtonText: '确定',
cancelButtonText: '取消', cancelButtonText: '取消',
type: 'warning', type: 'warning'
}) })
.then(() => { .then(() => {
delTable(Ids.toString()).then((res) => { delTable(Ids.toString()).then((res) => {
@ -229,7 +240,7 @@ function handleDelete(row) {
.catch(() => { .catch(() => {
proxy.$message({ proxy.$message({
type: 'info', type: 'info',
message: '已取消删除', message: '已取消删除'
}) })
}) })
} }