Parcourir la source

feat: 调整业务流程发起,设计表单100%,系统表单待测试验证

luoyali il y a 1 an
Parent
commit
04b276bf81

+ 1 - 1
.env

@@ -4,7 +4,7 @@ VITE_APP_TITLE = aizuda
 # 公共基础路径
 VITE_PUBLIC_PATH = /
 
-VITE_APP_BASE_API = 'http://api.boot.aizuda.com'
+VITE_APP_BASE_API = 'https://apiboot.aizuda.com'
 
 # 打包时是否删除 console
 VITE_DROP_CONSOLE = true

+ 2 - 2
.env.development

@@ -1,5 +1,5 @@
 ## 开发环境
 NODE_ENV='development'
 # 测试接口
-VITE_APP_BASE_API = 'http://api.boot.aizuda.com'
-# VITE_APP_BASE_API = 'http://localhost:8088'
+VITE_APP_BASE_API = 'https://apiboot.aizuda.com'
+# VITE_APP_BASE_API = 'http://localhost:8088'

+ 1 - 1
.env.production

@@ -1,4 +1,4 @@
 ## 生产环境
 NODE_ENV='production'
 # 生产接口
-VITE_APP_BASE_API = 'http://api.boot.aizuda.com'
+VITE_APP_BASE_API = 'https://apiboot.aizuda.com'

+ 1 - 1
.env.staging

@@ -1,4 +1,4 @@
 ## 模拟环境
 NODE_ENV='staging'
 # 预发布接口
-VITE_APP_BASE_API = 'http://api.boot.aizuda.com'
+VITE_APP_BASE_API = 'https://apiboot.aizuda.com'

+ 1 - 1
.env.test

@@ -1,5 +1,5 @@
 ## 测试环境
 NODE_ENV='production'
 # 测试接口
-VITE_APP_BASE_API = 'http://api.boot.aizuda.com'
+VITE_APP_BASE_API = 'https://apiboot.aizuda.com'
 

+ 1 - 0
src/components/Flow/FlowTrend.vue

@@ -51,6 +51,7 @@
 
 <script setup lang="ts">
 import { ref, computed, reactive } from 'vue'
+import FlowNodeAvatar from '@/components/Flow/FlowNodeAvatar.vue'
 import UseSelect from '@/components/scWorkflow/select.vue'
 import { setTypeOptions_config } from '@/components/scWorkflow/nodes/config'
 import type { ModelContentConfig } from '@/views/approve/components/config.ts'

+ 49 - 28
src/views/flow/test/businessLaunch.vue

@@ -20,7 +20,7 @@
 
 			<!-- vue自定义 -->
 			<template v-if="record.formTemplate.type === 1">
-				<component :is="dyVueComponent"></component>
+				<component :is="dyVueComponent" ref="dyVueComponentRef"></component>
 			</template>
 
 			<el-divider content-position="left">审批流程</el-divider>
@@ -73,48 +73,69 @@ const uploadFileApi = ref(`${VITE_APP_BASE_API}/v1/oss/upload`)
 const EReditorRef = ref()
 const modelContentConfig = ref<ModelContentConfig | any>({})
 const dyVueComponent = ref(undefined)
+const dyVueComponentRef = ref()
 const flowTrendRef = ref()
 
 const onSubmit = async () => {
 	const processId = props.record.processId
-	const form = EReditorRef.value.getSelfFormRef()
-	form.validate((valid: any) => {
-		if (valid) {
+	const { type } = props.record.formTemplate
+	let params = {}
+	// 这里要从子节点获取流程图信息 进行保存
+	const _assigneeMap = flowTrendRef.value.getAssigneeMap()
+	const assigneeMap_ = Object.keys(_assigneeMap).reduce((obj, nodeKey: string) => {
+		const _o = _assigneeMap[nodeKey]
+		obj[nodeKey] = {
+			assigneeList: _o.assignees,
+			type: _o.type
+		}
+		return obj
+	}, {} as { [nodeKey: string]: any })
+	if (!type) {
+		// type: 0 表单设计  1 vue自定义表单
+		const form = EReditorRef.value.getSelfFormRef()
+		form.validate((valid: any) => {
+			if (!valid) return false
 			// 表单验证通过 进行保存
 			validateForm.value.loading = true
 			const formData = EReditorRef.value.getData()
 			let processForm = JSON.parse(cur_processForm_str)
 			processForm = { ...processForm, formData }
-			// 这里要从子节点获取流程图信息 进行保存
-			const _assigneeMap = flowTrendRef.value.getAssigneeMap()
-			const assigneeMap_ = Object.keys(_assigneeMap).reduce((obj, nodeKey: string) => {
-				const _o = _assigneeMap[nodeKey]
-				obj[nodeKey] = {
-					assigneeList: _o.assignees,
-					type: _o.type
-				}
-				return obj
-			}, {} as { [nodeKey: string]: any })
-			const params = {
+			params = {
 				id: props.record.rowId,
-				test: 'formTemplate',
+				test: '',
 				processStart: {
 					processId, // 流程ID
 					processForm: JSON.stringify(processForm), // 流程表单JSON内容 & local_value 保存
 					assigneeMap: assigneeMap_
 				}
 			}
-			purchaseOrder
-				.postlaunchApi(params)
-				.then(res => {
-					ElMessage.success('提交成功')
-					updateModelValue(false)
-				})
-				.finally(() => {
-					validateForm.value.loading = false
-				})
+		})
+	} else {
+		const formData = dyVueComponentRef.value.getData()
+		const testData = {
+			formStructure: '表单主体vue地址',
+			formData: formData
+		}
+		params = {
+			id: props.record.rowId,
+			test: JSON.stringify(testData),
+			processStart: {
+				processId, // 流程ID
+				processForm: '', // 流程表单JSON内容 & local_value 保存
+				assigneeMap: assigneeMap_
+			}
 		}
-	})
+	}
+
+	purchaseOrder
+		.postlaunchApi(params)
+		.then(res => {
+			ElMessage.success('提交成功')
+			updateModelValue(false)
+		})
+		.finally(() => {
+			validateForm.value.loading = false
+		})
 }
 
 // 获取当前表单中的详情
@@ -127,8 +148,8 @@ const getDetailInfo = () => {
 	const { content, type } = props.record.formTemplate
 	if (!type) {
 		// type: 0 表单设计  1 vue自定义表单
-		cur_processForm_str = content || '{}' //  processForm 这个是后台返回来的
-		const formStructure = JSON.parse(cur_processForm_str)
+		cur_processForm_str = `{"formStructure":${content}}` || '{}' //  processForm 这个是后台返回来的
+		const { formStructure } = JSON.parse(cur_processForm_str)
 		EReditorRef.value.setData(formStructure)
 	} else {
 		dyVueComponent.value = markRaw(defineAsyncComponent(() => import('./test1.vue')))

+ 9 - 0
src/views/flow/test/test1.vue

@@ -61,4 +61,13 @@ const form = reactive({
 const onSubmit = () => {
 	console.log('submit!')
 }
+
+const getData = () => {
+	return form
+}
+
+defineExpose({
+	// 把数据暴露给父节点使用
+	getData
+})
 </script>