rev:opc页面
This commit is contained in:
@@ -108,8 +108,8 @@
|
||||
style="width: 100%"
|
||||
row-key="opc_id"
|
||||
border
|
||||
default-expand-all
|
||||
:tree-props="{children: 'children', has_children: 'has_children'}"
|
||||
:default-expand-all="true"
|
||||
:tree-props="{children: 'children', hasChildren: 'hasChildren'}"
|
||||
@select="crud.selectChange"
|
||||
@select-all="crud.selectAllChange"
|
||||
@selection-change="crud.selectionChangeHandler"
|
||||
@@ -232,6 +232,25 @@ export default {
|
||||
[CRUD.HOOK.beforeRefresh]() {
|
||||
return true
|
||||
},
|
||||
[CRUD.HOOK.afterRefresh]() {
|
||||
this.crud.data = this.processTreeData(this.crud.data)
|
||||
},
|
||||
processTreeData(data) {
|
||||
if (!data || !Array.isArray(data)) return data
|
||||
return data.map(item => {
|
||||
if (item.hasOwnProperty('hasChildren')) {
|
||||
item.hasChildren = item.hasChildren === '1' || item.hasChildren === 1 || item.hasChildren === true
|
||||
} else if (item.children && item.children.length > 0) {
|
||||
item.hasChildren = true
|
||||
} else {
|
||||
item.hasChildren = false
|
||||
}
|
||||
if (item.children && Array.isArray(item.children)) {
|
||||
item.children = this.processTreeData(item.children)
|
||||
}
|
||||
return item
|
||||
})
|
||||
},
|
||||
handleClick(row, flag) {
|
||||
// flag为0是新增,flag为1是编辑,flag为2是删除
|
||||
// 如果是父类操作
|
||||
|
||||
Reference in New Issue
Block a user