|
@@ -500,27 +500,27 @@ const getTaskDetail = () => {
|
|
|
if (props.currentTaskType !== 'pendingApproval') {
|
|
|
newFields.map(item1 => (item1.options.disabled = true))
|
|
|
} else {
|
|
|
- // data.formConfig
|
|
|
- newFields.forEach(item => {
|
|
|
- const matchingFormItem = formConfig.find(formItem => formItem.id == item.id)
|
|
|
- // 如果找到匹配的对象,且opera为'2',则删除newFields中的对象
|
|
|
- if (matchingFormItem && matchingFormItem.opera === '2') {
|
|
|
- newFields = newFields.filter(t => t.id !== item.id)
|
|
|
- } else if (matchingFormItem) {
|
|
|
- // 否则,将opera属性添加到newFields中的对象
|
|
|
- item.opera = matchingFormItem.opera
|
|
|
- // '0': 只读 '1': 编辑 '2': 隐藏
|
|
|
- item.options.disabled = ['0', '1'].indexOf(matchingFormItem.opera) > -1 ? !Number(matchingFormItem.opera) : false
|
|
|
- }
|
|
|
- })
|
|
|
-
|
|
|
- newFieldsList.forEach(item => {
|
|
|
- const matchingFormItem = formConfig.find(formItem => formItem.id == item.id)
|
|
|
- // 如果找到匹配的对象,且opera为'2',则删除newFields中的对象
|
|
|
- if (matchingFormItem && matchingFormItem.opera === '2') {
|
|
|
- newFieldsList = newFieldsList.filter(t => t.id !== item.id)
|
|
|
+ let idx = 0
|
|
|
+ while (idx < newFields.length - 1) {
|
|
|
+ const _field = newFields[idx]
|
|
|
+ const matchingFormItem = formConfig.find(formItem => formItem.id == _field.id)
|
|
|
+ if (matchingFormItem) {
|
|
|
+ // 如果找到匹配的对象,且opera为'2',则删除newFields中的对象
|
|
|
+ if (matchingFormItem.opera === '2') {
|
|
|
+ // fields 配置是准确的
|
|
|
+ newFields.splice(idx, 1)
|
|
|
+ // list 配置是跟随 fields 配置 顺序来(通过id 查找 id 只在第一次创建 才有效(修改编辑不会同步))
|
|
|
+ newFieldsList.splice(idx, 1)
|
|
|
+ idx--
|
|
|
+ } else {
|
|
|
+ // 否则,将opera属性添加到newFields中的对象
|
|
|
+ _field.opera = matchingFormItem.opera
|
|
|
+ // '0': 只读 '1': 编辑 '2': 隐藏
|
|
|
+ _field.options.disabled = ['0', '1'].indexOf(matchingFormItem.opera) > -1 ? !Number(matchingFormItem.opera) : false
|
|
|
+ }
|
|
|
}
|
|
|
- })
|
|
|
+ idx++
|
|
|
+ }
|
|
|
}
|
|
|
cur_formStructure = {
|
|
|
...cur_formStructure,
|
|
@@ -529,7 +529,7 @@ const getTaskDetail = () => {
|
|
|
}
|
|
|
cur_formData = formData
|
|
|
console.log(cur_formStructure, '=/////====newFormStructure');
|
|
|
- console.log(formData, '=/////====newFormStructure');
|
|
|
+ console.log(formData, '=/////====newFormStructure formData');
|
|
|
EReditorRef.value.setData(cur_formStructure, formData)
|
|
|
validateForm.value.rule = newFields
|
|
|
/* 这里主要是表单设计的逻辑 end */
|