新增页面保存后,跳转为详情页,同时关闭新增页。(即路由detail/1?type=1,变为detail/2/2?type=2id=2)
新增页面保存后,跳转为详情页,同时关闭新增页。
如若依系统,路由 detail/1?type=1,变为 detail/2/1?type=2&id=1
refreshView() {// In order to make the cached page re-renderedthis.$store.dispatch('tagsView/delCachedView', this.$route).then(() => {const { fullPath } = this.$routethis.$nextTick(() => {this.$router.replace({path: '/redirect' + fullPath})})})},// 调用保存接口handleSave() {const params = this.handleParams()this.loading = truesaveApply(params).then(res => {if (res.code === 200) {const applyId = res.data?.id || nullthis.loading = falseif (this.routeType === '1') { // 新增页,保存后,需关闭新增页,跳转至详情页this.refreshView()// 调用全局挂载的方法,关闭当前页this.$store.dispatch('tagsView/delView', this.$route)this.$nextTick(() => {this.toDetail(applyId) // 跳转至详情页})} else {this.getDetail() // 详情页再次编辑,保存后直接刷新数据}} else {this.$message.error(res.msg)}}).catch(() => {}).finally(() => {this.loading = false})},