Browse Source

perf: 创建流程成功 关闭Tab 优化

lanceJiang 1 year ago
parent
commit
1cb9accf4f
1 changed files with 18 additions and 3 deletions
  1. 18 3
      src/views/flow/create/index.vue

+ 18 - 3
src/views/flow/create/index.vue

@@ -40,9 +40,11 @@ import BasicInfoTab from './components/BasicInfo.vue'
 import ExtendSetTab from './components/ExtendSet.vue'
 import FlowDesignTab from './components/FlowDesign.vue'
 import FormDesignTab from './components/FormDesign.vue'
-import { useRoute } from 'vue-router'
+import { useRoute, useRouter } from 'vue-router'
 import process from '@/api/flow/process'
-
+import useStore from '@/store'
+const { tagsView } = useStore()
+const router = useRouter()
 const route = useRoute()
 const flowStore = useFlowStore()
 const { categoryId, processId, processIcon, processKey, processName, remark, modelContent, processForm, processSetting } = storeToRefs(flowStore)
@@ -75,7 +77,18 @@ const componentsArr = [
 	}
 ]
 const activeName = ref('基础信息')
-
+const removeCurTab = () => {
+	const _view = tagsView.visitedViews.find(v => v.path === '/flow_create/index')
+	if (_view)
+		tagsView.delView(_view).then(res => {
+			const latestView = res.visitedViews.slice(-1)[0]
+			if (latestView && latestView.fullPath) {
+				router.push(latestView.fullPath)
+			} else {
+				router.push('/')
+			}
+		})
+}
 const submitHandler = async () => {
 	// 基础信息
 	// 表单设计
@@ -99,6 +112,8 @@ const submitHandler = async () => {
 	}
 	const res = await process.progressCreateApi(params)
 	console.log('---r-e-s----', res)
+	// 创建完成 删除 当前tab页
+	removeCurTab()
 }
 
 // 切换选项卡