浏览代码

修复子表单创建BUG

hubin 1 年之前
父节点
当前提交
eed93f50dd
共有 2 个文件被更改,包括 16 次插入17 次删除
  1. 2 1
      src/components/scWorkflow/nodes/addNode.vue
  2. 14 16
      src/components/scWorkflow/nodes/approver.vue

+ 2 - 1
src/components/scWorkflow/nodes/addNode.vue

@@ -68,7 +68,8 @@ export default {
 					directorMode: 0, //连续主管审批方式
 					childNode: this.modelValue,
 					typeOfApprover: '1', // 审批类型 1:人工审批 2:自动通过 3:自动拒绝
-					actionUrl: [] // 子表单, 到时候缓存后台需要的 'id:name'格式
+					actionUrl: undefined, // 子表单, 到时候缓存后台需要的 'id:name'格式
+					subform: [] // 子表单
 				}
 			} else if (type === 2) {
 				node = {

+ 14 - 16
src/components/scWorkflow/nodes/approver.vue

@@ -142,11 +142,11 @@
 							<el-form label-position="top" class="aForm">
 								<el-form-item label="添加子表单">
 									<div class="flex flex-align-center">
-										<el-button type="primary" icon="plus" round @click="selectHandle(5, form.actionUrl)">选择子表单</el-button>
+										<el-button type="primary" icon="plus" round @click="selectHandle(5, form.subform)">选择子表单</el-button>
 										<div class="tags-list inline">
-											<el-tag v-for="(user, index) in form.actionUrl" :key="user.id" closable @close="delFormTemplate(index)">{{ user.name }}</el-tag>
+											<el-tag v-for="(user, index) in form.subform" :key="user.id" closable @close="delFormTemplate(index)">{{ user.name }}</el-tag>
 										</div>
-										<div v-if="form.actionUrl.length" class="tags-list inline">
+										<div v-if="form.subform.length" class="tags-list inline">
 											<el-link :underline="false" @click.stop="showFormEv">
 												表单预览<el-icon class="el-icon--right"><View /></el-icon>
 											</el-link>
@@ -261,14 +261,13 @@ export default {
 		},
 		'form.setType': {
 			handler(type, oldType) {
-				// console.error(type, 'type, oldType', oldType)
 				if ([1, 3].includes(oldType)) {
 					// 上次setType 为 选择成员 or 角色时 对 nodeAssigneeList 重置
 					this.form.nodeAssigneeList = []
 				}
 				if ([5].includes(oldType)) {
 					// 上次setType 为 选择成员 or 角色时 对 nodeAssigneeList 重置
-					this.form.actionUrl = []
+					this.form.subform = []
 				}
 			}
 		}
@@ -292,13 +291,12 @@ export default {
 				return { label: item.label, id: item.id, opera: opera }
 			})
 			this.form.extendConfig = { formConfig: operateTable }
-			// 将后台给的 actionUrl 重新组装
-			const newActionUrl = this.form?.actionUrl
-			if (newActionUrl) {
-				const val = newActionUrl.split(':')
-				this.form.actionUrl = [{ id: val[0], name: val[1] }]
+			const actionUrl = this.form?.actionUrl
+			if (actionUrl) {
+				const val = actionUrl.split(':')
+				this.form.subform = [{ id: val[0], name: val[1] }]
 			} else {
-				this.form.actionUrl = []
+				this.form.subform = []
 			}
 			this.drawer = true
 		},
@@ -346,9 +344,8 @@ export default {
 				// 选择角色
 				if (!_form.nodeAssigneeList || !_form.nodeAssigneeList.length) return this.$message.warning('请选择角色')
 			}
-			if (_form.actionUrl && _form.actionUrl.length) {
-				// _form.actionUrl = _form.actionUrl[0]
-				const { id, name } = _form.actionUrl[0]
+			if (_form.subform && _form.subform.length) {
+				const { id, name } = _form.subform[0]
 				_form.actionUrl = `${id}:${name}`
 			}
 			this.emit(_form)
@@ -364,7 +361,8 @@ export default {
 			this.form.nodeAssigneeList.splice(index, 1)
 		},
 		delFormTemplate(index) {
-			this.form.actionUrl.splice(index, 1)
+			this.form.subform.splice(index, 1)
+			this.form.actionUrl = undefined
 		},
 		selectHandle(type, data) {
 			// type: 1人员, 3角色 5子表单
@@ -398,7 +396,7 @@ export default {
 			}*/
 		},
 		showFormEv() {
-			this.templateId = this.form.actionUrl[0].id
+			this.templateId = this.form.subform[0].id
 			this.visibleFormDetail = !this.visibleFormDetail
 		}
 	}