소스 검색

feat: 流程创建 发起人 标题 支持编辑

lanceJiang 4 달 전
부모
커밋
9e09344192

+ 3 - 0
src/components/scWorkflow/nodes/branch.vue

@@ -228,6 +228,9 @@ export default {
 			})
 		},
 		saveTitle() {
+			if (!this.nodeConfig.nodeName) {
+				return ElMessage.warning('标题不能为空')
+			}
 			this.isEditTitle = false
 		},
 		save() {

+ 3 - 0
src/components/scWorkflow/nodes/delayProcess.vue

@@ -161,6 +161,9 @@ export default {
 			})
 		},
 		saveTitle() {
+			if (!this.nodeConfig.nodeName) {
+				return ElMessage.warning('标题不能为空')
+			}
 			this.isEditTitle = false
 		},
 		save() {

+ 3 - 0
src/components/scWorkflow/nodes/mergeBranch.vue

@@ -236,6 +236,9 @@ export default {
 			})
 		},
 		saveTitle() {
+			if (!this.nodeConfig.nodeName) {
+				return ElMessage.warning('标题不能为空')
+			}
 			this.isEditTitle = false
 		},
 		save() {

+ 4 - 0
src/components/scWorkflow/nodes/parallelBranch.vue

@@ -71,6 +71,7 @@ import addNode from './addNode.vue'
 import { Delete, Plus, ArrowLeft, Close, ArrowRight, Edit } from '@element-plus/icons-vue'
 import { getNodeKey } from '@/utils/workflow'
 import _ from 'lodash-es'
+import { ElMessage } from 'element-plus'
 export default {
 	components: {
 		addNode
@@ -114,6 +115,9 @@ export default {
 			})
 		},
 		saveTitle() {
+			if (!this.nodeConfig.nodeName) {
+				return ElMessage.warning('标题不能为空')
+			}
 			this.isEditTitle = false
 		},
 		save() {

+ 16 - 1
src/components/scWorkflow/nodes/promoter.vue

@@ -4,7 +4,18 @@
 		<div class="node-wrap-box start-node" :class="[disabled ? 'node-wrap-box--disabled' : '', `node-wrap-box--${nodeConfig.local_status}`]">
 			<div class="title" style="background: var(--el-color-info)">
 				<el-icon class="icon"><user-filled /></el-icon>
-				<span class="title_label">{{ nodeConfig.nodeName }}</span>
+				<span v-show="!isEditTitle" class="title_label" @click="editTitle('box_nodeTitle')"
+					>{{ nodeConfig.nodeName }}<el-icon v-if="!disabled" class="edit-icon"><edit /></el-icon
+				></span>
+				<el-input
+					v-show="isEditTitle"
+					ref="box_nodeTitle"
+					v-model="nodeConfig.nodeName"
+					clearable
+					size="small"
+					@blur="saveTitle"
+					@keyup.enter="saveTitle"
+				></el-input>
 			</div>
 			<div class="content" @click="show">
 				<span>{{ toText(nodeConfig) }}</span>
@@ -127,6 +138,10 @@ export default {
 			})
 		},
 		saveTitle() {
+			// form.nodeName
+			if (!this.nodeConfig.nodeName) {
+				return ElMessage.warning('标题不能为空')
+			}
 			this.isEditTitle = false
 		},
 		selectHandle(type, assignees) {

+ 3 - 0
src/components/scWorkflow/nodes/routeBranch.vue

@@ -290,6 +290,9 @@ export default {
 			})
 		},
 		saveTitle() {
+			if (!this.nodeConfig.nodeName) {
+				return ElMessage.warning('标题不能为空')
+			}
 			this.isEditTitle = false
 		},
 		save() {

+ 3 - 0
src/components/scWorkflow/nodes/send.vue

@@ -113,6 +113,9 @@ export default {
 			})
 		},
 		saveTitle() {
+			if (!this.nodeConfig.nodeName) {
+				return ElMessage.warning('标题不能为空')
+			}
 			this.isEditTitle = false
 		},
 		save() {

+ 3 - 0
src/components/scWorkflow/nodes/subProcess.vue

@@ -195,6 +195,9 @@ export default {
 			})
 		},
 		saveTitle() {
+			if (!this.nodeConfig.nodeName) {
+				return ElMessage.warning('标题不能为空')
+			}
 			this.isEditTitle = false
 		},
 		save() {

+ 3 - 0
src/components/scWorkflow/nodes/trigger.vue

@@ -178,6 +178,9 @@ export default {
 			})
 		},
 		saveTitle() {
+			if (!this.nodeConfig.nodeName) {
+				return ElMessage.warning('标题不能为空')
+			}
 			this.isEditTitle = false
 		},
 		save() {

+ 31 - 12
src/views/approve/components/config.ts

@@ -1,4 +1,4 @@
-type ModelContentConfig = {
+type ChildNodeCommon = {
 	nodeKey: string
 	nodeName: string
 	// 0:发起人 1:审批人 2:抄送人 3:条件审批 4:条件分支 5:办理子流程 6:定时器在务 7:触发器在务 8:并行路由 9:包容路由 10:路由分支
@@ -8,15 +8,6 @@ type ModelContentConfig = {
 	p_nodeNames?: string[] // 填充自定义状态
 	p_nodeKeys?: string[] // 填充自定义状态
 	childNode: ModelContentConfig | null
-	// lastNode_local_status?: string // 结束标记状态标记
-	conditionNodes?: {
-		nodeKey: string
-		nodeName: string
-		// 填充自定义状态 0: 已执行(success) 1:执行中(error) // 默认未执行(info)
-		local_status?: string
-		conditionList: any[]
-		childNode: ModelContentConfig
-	}[]
 	// 备选数据
 	nodeCandidate?: {
 		// 0:用户 1: 角色
@@ -24,6 +15,35 @@ type ModelContentConfig = {
 		assignees?: { name: string; id: string }[]
 	}
 }
+type ModelContentConfig = ChildNodeCommon & {
+	/*nodeKey: string
+	nodeName: string
+	// 0:发起人 1:审批人 2:抄送人 3:条件审批 4:条件分支 5:办理子流程 6:定时器在务 7:触发器在务 8:并行路由 9:包容路由 10:路由分支
+	type: number
+	// 填充自定义状态 0: 已执行(success) 1:执行中(error) // 默认未执行(info)
+	local_status?: string
+	p_nodeNames?: string[] // 填充自定义状态
+	p_nodeKeys?: string[] // 填充自定义状态
+	childNode: ModelContentConfig | null
+	// lastNode_local_status?: string // 结束标记状态标记*/
+	// 条件路由节点(type:4): conditionNodes[]
+	conditionNodes?: (ChildNodeCommon & {
+		// nodeKey: string
+		// nodeName: string
+		// // 填充自定义状态 0: 已执行(success) 1:执行中(error) // 默认未执行(info)
+		// local_status?: string
+		// childNode: ModelContentConfig
+		conditionList?: any[]
+	})[]
+	// 并行路由节点(type:8): parallelNodes[]
+	parallelNodes?: (ChildNodeCommon & {
+		// conditionList?: any[]
+	})[]
+	// 包容路由节点(type:9): inclusiveNodes[]
+	inclusiveNodes?: (ChildNodeCommon & {
+		// conditionList?: any[]
+	})[]
+}
 type RenderNodes = {
 	[key: string]: 0 | 1 // 0已执行 1执行中
 }
@@ -31,7 +51,7 @@ export const package_modelContentConfig = (data: ModelContentConfig, renderNodes
 	/**local_status: 0: 已执行(success) 1:执行中(error) // 默认未执行(info)*/
 	// 通过nodeName 作为唯一值 记录 每个key(nodeName) 对应的childNode 信息
 	const nodeKeyObj: { [nodeKey: string]: ModelContentConfig } = {}
-	const fn = (data: ModelContentConfig, p_nodeKeys: string[] = []) => {
+	const fn = (data: ModelContentConfig | null, p_nodeKeys: string[] = []) => {
 		if (!data) return
 		data.p_nodeKeys = p_nodeKeys
 		// console.log(p_nodeKeys, 'p_nodeKeys')
@@ -43,7 +63,6 @@ export const package_modelContentConfig = (data: ModelContentConfig, renderNodes
 			// 条件分支节点
 			data.conditionNodes.forEach(v => {
 				fn(v.childNode, _p_nodeKeys)
-				// fn(v.childNode, [...p_nodeNames])
 			})
 		}
 		if (data.childNode) {