|
@@ -476,6 +476,7 @@ const getTaskDetail = () => {
|
|
|
const formConfig = data.formConfig || []
|
|
|
let newFormStructure = formStructure // 存储一份
|
|
|
let newFields = newFormStructure.fields
|
|
|
+ let newFieldsList = newFormStructure.list
|
|
|
// pendingApproval, 除了[待审批]这个状态, 其余只能读取
|
|
|
if (props.currentTaskType !== 'pendingApproval') {
|
|
|
newFields.map(item1 => (item1.options.disabled = true))
|
|
@@ -483,52 +484,32 @@ const getTaskDetail = () => {
|
|
|
// data.formConfig
|
|
|
newFields.forEach(item => {
|
|
|
const matchingFormItem = formConfig.find(formItem => formItem.id == item.id)
|
|
|
- if (matchingFormItem) {
|
|
|
+ // 如果找到匹配的对象,且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
|
|
|
}
|
|
|
})
|
|
|
|
|
|
- // newFields.forEach(item => {
|
|
|
- // // 在formConfig中查找是否有相同id的对象
|
|
|
- // let configMatch = formConfig.find(config => config.id == item.id)
|
|
|
- //
|
|
|
- // // 如果找到匹配的对象,且opera为'2',则删除newFields中的对象
|
|
|
- // if (configMatch && configMatch.opera === '2') {
|
|
|
- // newFields = newFields.filter(t => t.id !== item.id)
|
|
|
- // } else if (configMatch) {
|
|
|
- // // 否则,将opera属性添加到newFields中的对象
|
|
|
- // item.opera = configMatch.opera
|
|
|
- // // '0': 只读 '1': 编辑 '2': 隐藏
|
|
|
- // item.options.disabled = ['0', '1'].indexOf(configMatch.opera) > -1 ? !Number(configMatch.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)
|
|
|
+ }
|
|
|
+ })
|
|
|
}
|
|
|
- // console.log(newFields, '=====')
|
|
|
newFormStructure = {
|
|
|
...newFormStructure,
|
|
|
- fields: newFields
|
|
|
+ fields: newFields,
|
|
|
+ list: newFieldsList
|
|
|
}
|
|
|
EReditorRef.value.setData(newFormStructure, formData)
|
|
|
validateForm.value.rule = newFields
|
|
|
- return
|
|
|
- // 以下代码作废 todo delete
|
|
|
- // if (Array.isArray(forms)) {
|
|
|
- // validateForm.value.rule = forms
|
|
|
- // const api = validateForm.value.api
|
|
|
- // api.setValue(
|
|
|
- // forms.reduce((obj, item) => {
|
|
|
- // obj[item.field] = item.local_value
|
|
|
- // return obj
|
|
|
- // }, {})
|
|
|
- // )
|
|
|
- // api.nextTick(() => {
|
|
|
- // // 是否有编辑权限 操作
|
|
|
- // api.disabled(false /*true*/)
|
|
|
- // })
|
|
|
- // }
|
|
|
- // 以下代码作废 todo delete
|
|
|
} catch (e) {
|
|
|
console.error('解析 descItems 数据出现问题', e)
|
|
|
// descItemsData.value.list = []
|