fix: 表单配置group时,发起流程报错的问题

saber
ssc 5 years ago
parent a7d32ce6ed
commit aba7017566
  1. 55
      src/views/plugin/workflow/process/components/detail.vue
  2. 47
      src/views/plugin/workflow/process/components/form.vue

@ -11,7 +11,7 @@
name="first">
<el-card shadow="never">
<div ref="printBody">
<avue-form v-if="option && option.column && option.column.length > 0"
<avue-form v-if="option && ((option.column && option.column.length > 0) || (option.group && option.group.length > 0))"
v-model="form"
ref="form"
:option="option">
@ -79,7 +79,7 @@
v-loading="submitLoading"
@click="handleCompleteTask(false)">驳回</el-button>
<el-button v-if="buttonList.find(b => b.key == 'wf_transfer')"
type="warning"
type="primary"
size="medium"
v-loading="submitLoading"
@click="handleUserSelect('transfer')">转办</el-button>
@ -89,7 +89,7 @@
v-loading="submitLoading"
@click="handleUserSelect('delegate')">委托</el-button>
<el-button v-if="buttonList.find(b => b.key == 'wf_print')"
type="warning"
type="info"
size="medium"
v-loading="submitLoading"
@click="handlePrint()">打印</el-button>
@ -202,19 +202,46 @@ export default {
option.menuBtn = false
if (status != 'todo') option.detail = true
else {
const arr = []
const columnArr = []
const groupArr = []
const vars = []
taskForm.forEach(task => {
const column = option.column.find(c => c.prop == task.id)
if (task.readable && column) {
if (!task.writable) {
column.readonly = true
column.disabled = true
} else vars.push(column.prop)
const { column, group } = option
if (column && column.length > 0) { // column
column.forEach(col => {
const c = taskForm.find(s => s.id == col.prop)
if (c && c.readable) {
if (!c.writable) {
col.readonly = true
col.disabled = true
delete col.rules
} else vars.push(col.prop)
columnArr.push(col)
}
})
}
if (group && group.length > 0) { // group
group.forEach(gro => {
if (gro.column && gro.column.length > 0) {
const groupColumnArr = []
gro.column.forEach(col => {
const c = taskForm.find(s => s.id == col.prop)
if (c && c.readable) {
if (!c.writable) {
col.readonly = true
col.disabled = true
delete col.rules
} else vars.push(col.prop)
groupColumnArr.push(col)
}
arr.push(column)
})
option.column = arr
gro.column = groupColumnArr
}
if (gro.column.length > 0) groupArr.push(gro)
})
}
option.column = columnArr
option.group = groupArr
this.vars = vars
}
@ -271,6 +298,8 @@ export default {
}).catch(() => {
this.submitLoading = false
})
} else {
this.submitLoading = false
}
})
},

@ -3,7 +3,7 @@
<avue-title style="margin-bottom: 20px; "
:styles="{fontSize: '20px'}"
:value="process.name"></avue-title>
<avue-form v-if="option && option.column && option.column.length > 0"
<avue-form v-if="option && ((option.column && option.column.length > 0) || (option.group && option.group.length > 0))"
v-model="form"
:option="option"
@submit="handleSubmit">
@ -48,18 +48,45 @@ export default {
const option = eval('(' + form + ')')
// option.menuBtn = false
const arr = []
startForm.forEach(s => {
const column = option.column.find(c => c.prop == s.id)
if (s.readable && column) {
if (!s.writable) {
column.readonly = true
column.disabled = true
const columnArr = []
const groupArr = []
const { column, group } = option
if (column && column.length > 0) { // column
column.forEach(col => {
const c = startForm.find(s => s.id == col.prop)
if (c && c.readable) {
if (!c.writable) {
col.readonly = true
col.disabled = true
delete col.rules
}
columnArr.push(col)
}
arr.push(column)
})
option.column = arr
}
if (group && group.length > 0) { // group
group.forEach(gro => {
if (gro.column && gro.column.length > 0) {
const groupColumnArr = []
gro.column.forEach(col => {
const c = startForm.find(s => s.id == col.prop)
if (c && c.readable) {
if (!c.writable) {
col.readonly = true
col.disabled = true
delete col.rules
}
groupColumnArr.push(col)
}
})
gro.column = groupColumnArr
}
if (gro.column.length > 0) groupArr.push(gro)
})
}
option.column = columnArr
option.group = groupArr
this.option = option
}

Loading…
Cancel
Save