Compare commits

..

2 Commits

Author SHA1 Message Date
clay 2bed6ea74c Merge pull request 'clay : 表单权限校验完成' (#27) from master into pro
continuous-integration/drone/push Build is passing Details
Reviewed-on: http://git.hchyun.com/clay/workflow-engine-web/pulls/27
2023-02-25 15:59:57 +00:00
clay 73219c5c04 clay : 表单权限校验完成 2023-02-25 23:59:33 +08:00
4 changed files with 47 additions and 21 deletions

View File

@ -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

View File

@ -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)
} }
} }
} }

View File

@ -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,6 +176,9 @@ export default {
}); });
}, },
submitTask() { submitTask() {
console.log("wqeqwqewqe")
this.$refs.taskViewForm.validate(valid =>{
if (valid){
let params = { let params = {
taskId: this.selectTask.taskId, taskId: this.selectTask.taskId,
formData: JSON.stringify(this.taskData.formData) formData: JSON.stringify(this.taskData.formData)
@ -192,6 +188,8 @@ export default {
this.getList(); this.getList();
this.$message.success(res.msg); this.$message.success(res.msg);
}); });
}
})
}, },
showCommentBox() { showCommentBox() {
this.commentInfo = { this.commentInfo = {

View File

@ -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, "获取到的结果数据")
}) })
}, },