Kaynağa Gözat

feat: 子表单 前端传模,解析 100%

luoyali 1 yıl önce
ebeveyn
işleme
64eadfc7c3

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

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

+ 18 - 8
src/components/scWorkflow/nodes/approver.vue

@@ -142,7 +142,9 @@
 							<el-form label-position="top" class="aForm">
 								<el-form-item label="添加子表单">
 									<el-button type="primary" icon="plus" round @click="selectHandle(5, form.actionUrl)">选择子表单</el-button>
-									{{ form.actionUrl }}
+									<div class="tags-list">
+										<el-tag v-for="(user, index) in form.actionUrl" :key="user.id" closable @close="delFormTemplate(index)">{{ user.name }}</el-tag>
+									</div>
 								</el-form-item>
 
 								<el-form-item label="表单权限">
@@ -252,7 +254,7 @@ export default {
 				}
 				if ([5].includes(oldType)) {
 					// 上次setType 为 选择成员 or 角色时 对 nodeAssigneeList 重置
-					this.form.actionUrl = null
+					this.form.actionUrl = []
 				}
 			}
 		}
@@ -276,7 +278,14 @@ export default {
 				return { label: item.label, id: item.id, opera: opera }
 			})
 			this.form.extendConfig = { formConfig: operateTable }
-			this.form.actionUrl = this.form?.actionUrl ? this.form.actionUrl : null // 这里后台只要一个对象,前端为了保持一致用数组包裹
+			// 将后台给的 actionUrl 重新组装
+			const newActionUrl = this.form?.actionUrl
+			if (newActionUrl) {
+				const val = newActionUrl.join(':')
+				this.form.actionUrl = [{ id: val[0], name: val[1] }]
+			} else {
+				this.form.actionUrl = []
+			}
 			this.drawer = true
 		},
 		editTitle(refName) {
@@ -323,9 +332,11 @@ export default {
 				// 选择角色
 				if (!_form.nodeAssigneeList || !_form.nodeAssigneeList.length) return this.$message.warning('请选择角色')
 			}
-			// if (_form.actionUrl && _form.actionUrl.length) {
-			// 	_form.actionUrl = _form.actionUrl[0]
-			// }
+			if (_form.actionUrl && _form.actionUrl.length) {
+				// _form.actionUrl = _form.actionUrl[0]
+				const { id, name } = _form.actionUrl[0]
+				_form.actionUrl = `${id}:${name}`
+			}
 			this.emit(_form)
 			this.drawer = false
 		},
@@ -339,11 +350,10 @@ export default {
 			this.form.nodeAssigneeList.splice(index, 1)
 		},
 		delFormTemplate(index) {
-			// this.form.actionUrl.splice(index, 1)
+			this.form.actionUrl.splice(index, 1)
 		},
 		selectHandle(type, data) {
 			// type: 1人员, 3角色 5子表单
-			console.log(data, '===selectHandle--')
 			this.select(type, data)
 		},
 		toText(nodeConfig) {