ソースを参照

feat: 子表单 100%,查表单查看

luoyali 1 年間 前
コミット
683a33d93e

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

@@ -67,7 +67,8 @@ export default {
 					approveSelf: 0, //审批人与提交人为同一人时
 					directorMode: 0, //连续主管审批方式
 					childNode: this.modelValue,
-					typeOfApprover: '1' // 审批类型 1:人工审批 2:自动通过 3:自动拒绝
+					typeOfApprover: '1', // 审批类型 1:人工审批 2:自动通过 3:自动拒绝
+					actionUrl: [] // 子表单
 				}
 			} else if (type === 2) {
 				node = {

+ 15 - 4
src/components/scWorkflow/nodes/approver.vue

@@ -141,9 +141,9 @@
 						<div v-show="radio1 === '2'">
 							<el-form label-position="top" class="aForm">
 								<el-form-item label="添加子表单">
-									<el-button type="primary" icon="plus" round @click="selectHandle(5, form.nodeAssigneeList)">选择子表单</el-button>
+									<el-button type="primary" icon="plus" round @click="selectHandle(5, form.actionUrl)">选择子表单</el-button>
 									<div class="tags-list">
-										<el-tag v-for="(user, index) in form.nodeAssigneeList" :key="user.id" closable @close="delUser(index)">{{ user.name }}</el-tag>
+										<el-tag v-for="(user, index) in form.actionUrl" :key="user.id" closable @close="delFormTemplate(index)">{{ user.name }}</el-tag>
 									</div>
 								</el-form-item>
 
@@ -252,6 +252,10 @@ export default {
 					// 上次setType 为 选择成员 or 角色时 对 nodeAssigneeList 重置
 					this.form.nodeAssigneeList = []
 				}
+				if ([5].includes(oldType)) {
+					// 上次setType 为 选择成员 or 角色时 对 nodeAssigneeList 重置
+					this.form.actionUrl = []
+				}
 			}
 		}
 	},
@@ -273,8 +277,8 @@ export default {
 				})
 				return { label: item.label, id: item.id, opera: opera }
 			})
-			this.$log('这里打印出表单设计中的值===', JSON.stringify(operateTable))
 			this.form.extendConfig = { formConfig: operateTable }
+			this.form.actionUrl = this.form?.actionUrl ? [this.form.actionUrl] : [] // 这里后台只要一个对象,前端为了保持一致用数组包裹
 			this.drawer = true
 		},
 		editTitle(refName) {
@@ -322,6 +326,9 @@ export default {
 				if (!_form.nodeAssigneeList || !_form.nodeAssigneeList.length) return this.$message.warning('请选择角色')
 			}
 
+      if ( _form.actionUrl && _form.actionUrl.length ) {
+        _form.actionUrl = _form.actionUrl[0]
+      }
 			this.emit(_form)
 			this.drawer = false
 		},
@@ -334,8 +341,12 @@ export default {
 		delRole(index) {
 			this.form.nodeAssigneeList.splice(index, 1)
 		},
+		delFormTemplate(index) {
+			this.form.actionUrl.splice(index, 1)
+		},
 		selectHandle(type, data) {
-			// type: 1人员, 3角色
+			// type: 1人员, 3角色 5子表单
+			console.log(data, '===selectHandle--')
 			this.select(type, data)
 		},
 		toText(nodeConfig) {

+ 12 - 4
src/components/scWorkflow/select.vue

@@ -136,7 +136,7 @@
 					<div class="sc-user-select__search">
 						<el-input v-model="keyword" prefix-icon="Search" placeholder="搜索表单">
 							<template #append>
-								<el-button icon="Search" @click="search"></el-button>
+								<el-button icon="Search" @click="searchTemplate"></el-button>
 							</template>
 						</el-input>
 					</div>
@@ -144,7 +144,7 @@
 						<div class="sc-user-select__tree">
 							<el-scrollbar>
 								<el-tree
-									ref="formCategoryTree"
+									ref="formCategoryTreeRef"
 									class="menu"
 									:data="formCategoryTree"
 									:node-key="formCategoryProps.key"
@@ -386,6 +386,13 @@ export default {
 			this.currentPage = 1
 			this.getUser()
 		},
+		// 表单模板搜索
+		searchTemplate() {
+			this.formCategoryId = ''
+			this.$refs.formCategoryTreeRef.setCurrentKey(this.formCategoryId)
+			this.currentPage = 1
+			this.getFormTemplateListEv()
+		},
 		//删除已选
 		deleteSelected(index) {
 			this.selected.splice(index, 1)
@@ -393,6 +400,8 @@ export default {
 				this.$refs.userTree.setCheckedKeys(this.selectedIds)
 			} else if (this.type === 3) {
 				this.$refs.groupTree.setCheckedKeys(this.selectedIds)
+			} else if (this.type === 5) {
+				this.$refs.formTemplateTree.setCheckedKeys(this.selectedIds)
 			}
 		},
 		//角色点击
@@ -415,7 +424,7 @@ export default {
 			// 最小限制
 			const minSelected = this.minSelected
 			// 最大限制
-			const maxSelected = this.maxSelected
+			const maxSelected = this.type === 5 ? 1 : this.maxSelected
 			const selected_l = this.selected.length
 			if (selected_l < minSelected) {
 				return this.$message.warning(`选中的数据个数不能小于${minSelected}条`)
@@ -449,7 +458,6 @@ export default {
 				pageSize: this.pageSize
 			}
 			const data = await formtemplate.formTemplateSimpleListApi(params)
-			console.log(data, '=')
 			this.formTemplate = data.records
 			this.total = data.total || 0
 			this.$refs.formTemplateScrollbar.setScrollTop(0)