Browse Source

优化流程创建逻辑支持

hubin 1 year ago
parent
commit
45505c0b98

+ 10 - 9
src/components/scWorkflow/nodes/approver.vue

@@ -206,16 +206,17 @@ export default {
 	methods: {
 		show() {
 			this.form = JSON.parse(JSON.stringify(this.nodeConfig))
-			const formConfig = this.form.extendConfig.formConfig
+			let formConfig = []
+			if (this.form.extendConfig) {
+				formConfig = this.form.extendConfig.formConfig
+			}
 			const operateTable = JSON.parse(this.processForm).map(item => {
-				let opera = '0'
-				if (formConfig) {
-					formConfig.map(i => {
-						if (item.title === i.title) {
-							opera = i.opera
-						}
-					})
-				}
+				let opera = '1'
+				formConfig.map(i => {
+					if (item.title === i.title) {
+						opera = i.opera
+					}
+				})
 				return { title: item.title, opera: opera }
 			})
 			this.form.extendConfig = { formConfig: operateTable }

+ 0 - 1
src/layout/components/Tabs/index.vue

@@ -206,7 +206,6 @@ const tabClick = (tabItem: TabsPaneContext) => {
 
 // Remove Tab
 const tabRemove = (path: TabPaneName) => {
-	console.error('tabRemove', path)
 	const curTab = tabsMenuList.value.find(v => v.path === path)
 	tagsView.delView(curTab).then((res: any) => {
 		// if (isActive(curTab)) {

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

@@ -45,7 +45,7 @@ import process from '@/api/flow/process'
 
 const route = useRoute()
 const flowStore = useFlowStore()
-const { categoryId, processId, processKey, processName, remark, modelContent, processForm, processSetting } = storeToRefs(flowStore)
+const { categoryId, processId, processIcon, processKey, processName, remark, modelContent, processForm, processSetting } = storeToRefs(flowStore)
 
 const dyncComponent = ref() // 实例化子组件
 const componentsArr = [
@@ -84,15 +84,19 @@ const submitHandler = async () => {
 	changeTab()
 	const params = {
 		categoryId: categoryId.value,
+		processIcon: processIcon.value,
 		processKey: processKey.value,
 		processName: processName.value,
 		remark: remark.value,
 		processId: processId.value,
 		processForm: processForm.value,
-		modelContent: modelContent.value,
+		modelContent: JSON.stringify({
+			key: processKey.value,
+			name: processName.value,
+			nodeConfig: JSON.parse(modelContent.value)
+		}),
 		processSetting: processSetting.value
 	}
-	console.log('---r-e-s--params--', params)
 	const res = await process.progressCreateApi(params)
 	console.log('---r-e-s----', res)
 }
@@ -117,16 +121,20 @@ const currentComponent = computed(() => {
 
 const queryObj = computed(() => route.query)
 const getCurrentProcessDetailEv = () => {
-	process.processDetailApi(queryObj.value.id).then(res => {
-		processId.value = res.processId
-		categoryId.value = res.categoryId
-		processKey.value = res.processKey
-		processName.value = res.processName
-		remark.value = res.remark
-		modelContent.value = res.modelContent
-		processForm.value = res.processForm
-		flowStore.setProcessForm(processForm)
-	})
+	let _id = queryObj.value.id
+	if (_id) {
+		process.processDetailApi(_id).then(res => {
+			processId.value = res.processId
+			categoryId.value = res.categoryId
+			processIcon.value = res.processIcon
+			processKey.value = res.processKey
+			processName.value = res.processName
+			remark.value = res.remark
+			modelContent.value = res.modelContent
+			processForm.value = res.processForm
+			flowStore.setProcessForm(processForm)
+		})
+	}
 }
 
 getCurrentProcessDetailEv()

+ 0 - 4
src/views/flow/group/components/listGroup.vue

@@ -190,26 +190,22 @@ const editFlowGroup = async (type, item, idx) => {
 const stopEv = async (id: any) => {
 	await process.progressDeleteApi({ id })
 	flowGroupListAll()
-	console.log('停用')
 }
 
 // 禁用
 const enabledEv = async (id: any, state: number) => {
 	await process.processUpdateStateApi({ id, state: state })
 	flowGroupListAll()
-	console.log('禁用')
 }
 
 // 复制
 const copyEv = async (id: any) => {
 	await process.progressCloneApi({ id })
 	flowGroupListAll()
-	console.log('复制')
 }
 
 // 修改
 const updateEv = async (id: any) => {
-	console.log('修改')
 	router.push('/flow_create?id=' + id)
 }