|
|
|
|
@ -60,6 +60,8 @@ export default { |
|
|
|
|
}, |
|
|
|
|
// 根据可读可写,过滤avue column
|
|
|
|
|
filterAvueColumn(column, taskForm, props = { label: 'label', prop: 'prop' }) { |
|
|
|
|
const _this = this |
|
|
|
|
|
|
|
|
|
if (!column || column.length == 0) return { column, vars: [] } |
|
|
|
|
|
|
|
|
|
const values = [] |
|
|
|
|
@ -69,7 +71,7 @@ export default { |
|
|
|
|
if (c && c.readable) { |
|
|
|
|
if (c.writable) { // 可写,记录需要提交的字段、处理字段默认值
|
|
|
|
|
vars.push(col[props.prop]) |
|
|
|
|
if (col.value) col.value = this.getDefaultValues(col.value) |
|
|
|
|
if (col.value) col.value = _this.getDefaultValues(col.value) |
|
|
|
|
} else { // 不可写,清除校验与默认值
|
|
|
|
|
if (col.type == 'dynamic') { |
|
|
|
|
col.children.addBtn = false |
|
|
|
|
@ -82,13 +84,21 @@ export default { |
|
|
|
|
delete col.value |
|
|
|
|
} |
|
|
|
|
if (col.type == 'dynamic') { // 处理子表单
|
|
|
|
|
col.children.column = this.filterAvueColumn(col.children.column, taskForm).column |
|
|
|
|
col.children.column = _this.filterAvueColumn(col.children.column, taskForm).column |
|
|
|
|
} |
|
|
|
|
if (col.rules && col.pattern) { |
|
|
|
|
if (col.rules && col.pattern) { // 处理正则
|
|
|
|
|
col.rules.forEach(c => { |
|
|
|
|
if (c.pattern) c.pattern = new RegExp(col.pattern) |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 处理事件
|
|
|
|
|
let event = ['change', 'blur', 'click', 'focus'] |
|
|
|
|
event.forEach(e => { |
|
|
|
|
if (col[e]) col[e] = eval((col[e] + '').replace(/this/g, '_this')) |
|
|
|
|
}) |
|
|
|
|
if (col.event) Object.keys(col.event).forEach(key => col.event[key] = eval((col.event[key] + '').replace(/this/g, '_this'))) |
|
|
|
|
|
|
|
|
|
values.push(col) |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
|