clay : 表单权限校验完成 #27
			
				
			
		
		
		
	|  | @ -51,7 +51,6 @@ export default { | ||||||
|   }, |   }, | ||||||
|   methods: { |   methods: { | ||||||
|     validate(call) { |     validate(call) { | ||||||
|       console.log("我被触发了") |  | ||||||
|       let success = true |       let success = true | ||||||
|       this.$refs.form.validate(valid => { |       this.$refs.form.validate(valid => { | ||||||
|         success = valid |         success = valid | ||||||
|  |  | ||||||
|  | @ -1,5 +1,5 @@ | ||||||
| <template> | <template> | ||||||
|   <el-form class="process-form" label-position="top" :rules="rules" :model="_value"> |   <el-form ref="formView" class="process-form" label-position="top" :rules="rules" :model="_value"> | ||||||
|     <div v-for="(item, index) in formItems" :key="item.name + index"> |     <div v-for="(item, index) in formItems" :key="item.name + index"> | ||||||
|       <el-form-item v-if="item.name !== 'SpanLayout' && item.name !== 'Description'" |       <el-form-item v-if="item.name !== 'SpanLayout' && item.name !== 'Description'" | ||||||
|                     :prop="item.id" :label="item.title"> |                     :prop="item.id" :label="item.title"> | ||||||
|  | @ -62,8 +62,35 @@ export default { | ||||||
|     this.loadFormConfig(this.formItems) |     this.loadFormConfig(this.formItems) | ||||||
|   }, |   }, | ||||||
|   methods: { |   methods: { | ||||||
|  |     validate(call) { | ||||||
|  |       console.log("我被执行了") | ||||||
|  | 
 | ||||||
|  |       let success = true | ||||||
|  |       this.$refs.formView.validate(valid => { | ||||||
|  |         success = valid | ||||||
|  |         if(valid){ | ||||||
|  |           //校验成功再校验内部 | ||||||
|  |           for (let i = 0; i < this.formItems.length; i++) { | ||||||
|  |             if (this.formItems[i].name === 'TableList'){ | ||||||
|  |               let formRef = this.$refs[`sub-item_${this.formItems[i].id}`] | ||||||
|  |               if (formRef && Array.isArray(formRef) && formRef.length > 0){ | ||||||
|  |                 formRef[0].validate(subValid => { | ||||||
|  |                   success = subValid | ||||||
|  |                 }) | ||||||
|  |                 if (!success){ | ||||||
|  |                   break | ||||||
|  |                 } | ||||||
|  |               } | ||||||
|  |             } | ||||||
|  |           } | ||||||
|  |         } | ||||||
|  |         call(success) | ||||||
|  |       }); | ||||||
|  |     }, | ||||||
|     loadFormConfig(formItems) { |     loadFormConfig(formItems) { | ||||||
|  |       console.log(formItems) | ||||||
|       formItems.forEach(item => { |       formItems.forEach(item => { | ||||||
|  |         console.log(item.perm === 'E',item,"item") | ||||||
|         if (item.name === 'SpanLayout') { |         if (item.name === 'SpanLayout') { | ||||||
|           this.loadFormConfig(item.props.items) |           this.loadFormConfig(item.props.items) | ||||||
|         } else { |         } else { | ||||||
|  | @ -71,8 +98,11 @@ export default { | ||||||
|           if (this.isPreview) { |           if (this.isPreview) { | ||||||
|             this.$set(item, 'perm', this.model) |             this.$set(item, 'perm', this.model) | ||||||
|           } |           } | ||||||
|  |           console.log(item.perm === 'E',item,"item") | ||||||
|           if (item.perm === 'E') { |           if (item.perm === 'E') { | ||||||
|  |             console.log("进去了") | ||||||
|             if (item.props.required) { |             if (item.props.required) { | ||||||
|  |               console.log("开始制作权限了") | ||||||
|               this.$set(this.rules, item.id, [{ |               this.$set(this.rules, item.id, [{ | ||||||
|                 type: item.valueType === 'Array' ? 'array' : undefined, |                 type: item.valueType === 'Array' ? 'array' : undefined, | ||||||
|                 required: true, |                 required: true, | ||||||
|  | @ -82,6 +112,7 @@ export default { | ||||||
|           } |           } | ||||||
|         } |         } | ||||||
|       }) |       }) | ||||||
|  |       console.log(this.rules) | ||||||
|     } |     } | ||||||
|   } |   } | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -169,13 +169,6 @@ export default { | ||||||
|       let that = this; |       let that = this; | ||||||
|       this.init(); |       this.init(); | ||||||
|       getTaskInfo(taskId).then(res => { |       getTaskInfo(taskId).then(res => { | ||||||
|         let data = res.data |  | ||||||
|         data.formItems.map(item => { |  | ||||||
|           if (item.props.required) { |  | ||||||
|             item.props.required = !item.props.required |  | ||||||
|           } |  | ||||||
|           return item |  | ||||||
|         }) |  | ||||||
|         that.taskData = res.data; |         that.taskData = res.data; | ||||||
|         that.$store.state.design = that.taskData; |         that.$store.state.design = that.taskData; | ||||||
|         that.$store.state.userTaskOption = that.taskData.userTaskOption; |         that.$store.state.userTaskOption = that.taskData.userTaskOption; | ||||||
|  | @ -183,15 +176,20 @@ export default { | ||||||
|       }); |       }); | ||||||
|     }, |     }, | ||||||
|     submitTask() { |     submitTask() { | ||||||
|       let params = { |       console.log("wqeqwqewqe") | ||||||
|         taskId: this.selectTask.taskId, |       this.$refs.taskViewForm.validate(valid =>{ | ||||||
|         formData: JSON.stringify(this.taskData.formData) |         if (valid){ | ||||||
|       }; |           let params = { | ||||||
|       completeTask(params).then(res => { |             taskId: this.selectTask.taskId, | ||||||
|         this.approveOpen = false; |             formData: JSON.stringify(this.taskData.formData) | ||||||
|         this.getList(); |           }; | ||||||
|         this.$message.success(res.msg); |           completeTask(params).then(res => { | ||||||
|       }); |             this.approveOpen = false; | ||||||
|  |             this.getList(); | ||||||
|  |             this.$message.success(res.msg); | ||||||
|  |           }); | ||||||
|  |         } | ||||||
|  |       }) | ||||||
|     }, |     }, | ||||||
|     showCommentBox() { |     showCommentBox() { | ||||||
|       this.commentInfo = { |       this.commentInfo = { | ||||||
|  |  | ||||||
|  | @ -1,4 +1,3 @@ | ||||||
| <script src="../../api/processInstance.js"></script> |  | ||||||
| <template> | <template> | ||||||
|   <div> |   <div> | ||||||
|     <el-table :data="tableData" |     <el-table :data="tableData" | ||||||
|  | @ -90,7 +89,7 @@ | ||||||
| </template> | </template> | ||||||
| 
 | 
 | ||||||
| <script> | <script> | ||||||
| import FormRenderView from '@/views/common/form/FormRender' | import FormRenderView from '@/views/common/form/FormRenderView' | ||||||
| import ProcessDiagramViewer from "../admin/layout/ProcessDiagramViewer"; | import ProcessDiagramViewer from "../admin/layout/ProcessDiagramViewer"; | ||||||
| import {getInitiatedInstanceList, getInitiatedInstanceInfo} from "@/api/processInstance"; | import {getInitiatedInstanceList, getInitiatedInstanceInfo} from "@/api/processInstance"; | ||||||
| import {timeLength} from '@/utils/date' | import {timeLength} from '@/utils/date' | ||||||
|  | @ -134,7 +133,6 @@ export default { | ||||||
|         that.$store.state.endList = data.endList; |         that.$store.state.endList = data.endList; | ||||||
|         that.$store.state.noTakeList = data.noTakeList; |         that.$store.state.noTakeList = data.noTakeList; | ||||||
|         this.loading = false; |         this.loading = false; | ||||||
|         console.log(data, "获取到的结果数据") |  | ||||||
|       }) |       }) | ||||||
|     }, |     }, | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue