Ver código fonte

新增流程保存逻辑

hubin 1 ano atrás
pai
commit
ff6db5d989
1 arquivos alterados com 21 adições e 9 exclusões
  1. 21 9
      src/views/flow/create/index.vue

+ 21 - 9
src/views/flow/create/index.vue

@@ -41,10 +41,12 @@ import ExtendSetTab from './components/ExtendSet.vue'
 import FlowDesignTab from './components/FlowDesign.vue'
 import FormDesignTab from './components/FormDesign.vue'
 import { useRoute } from 'vue-router'
+import process from '@/api/flow/process'
 
 const route = useRoute()
 const flowStore = useFlowStore()
-const { flowName, basicInfo } = storeToRefs(flowStore)
+const { flowName, flowProcessId, basicInfo, modelContent, processForm, processSetting } = storeToRefs(flowStore)
+
 const dyncComponent = ref() // 实例化子组件
 const componentsArr = [
 	{
@@ -74,25 +76,35 @@ const componentsArr = [
 ]
 const activeName = ref('基础信息')
 
-const submitHandler = () => {
+const submitHandler = async () => {
 	// 基础信息
 	// 表单设计
 	// 流程设计
-	if (activeName.value === '流程设计') {
-		dyncComponent.value.validate().then(res => {
-			dyncComponent.value.saveDesign(res)
-		})
-	}
 	// 扩展设置
+	changeTab()
+	const params = {
+		...basicInfo.value,
+		processId: flowProcessId.value,
+		processForm: processForm.value,
+		modelContent: modelContent.value,
+		processSetting: processSetting.value
+	}
+	const res = await process.progressCreateApi(params)
+	console.log('---r-e-s----', res)
+	alert('保存成功')
 }
 
-const activeComponent = item => {
-	console.log('====processKey====', basicInfo)
+// 切换选项卡
+const changeTab = () => {
 	if (activeName.value === '表单设计') {
 		dyncComponent.value.exportJsonEv()
 	} else if (activeName.value === '流程设计') {
 		dyncComponent.value.saveDesign()
 	}
+}
+
+const activeComponent = item => {
+	changeTab()
 	activeName.value = item.label
 }