|
|
@ -104,9 +104,10 @@ |
|
|
|
ref="table" |
|
|
|
v-loading="crud.loading" |
|
|
|
lazy |
|
|
|
:data="crud.data" |
|
|
|
row-key="id" |
|
|
|
:tree-props="{ children: 'childMenus', hasChildren: 'hasChildren' }" |
|
|
|
:data="tableData" |
|
|
|
:row-key="getRowKey" |
|
|
|
:load="getSonClass" |
|
|
|
:tree-props="{children: 'children', hasChildren: 'hasChildren'}" |
|
|
|
highlight-current-row |
|
|
|
@select-all="selectAll" |
|
|
|
@select="selectTr" |
|
|
@ -178,6 +179,7 @@ export default { |
|
|
|
}, |
|
|
|
data() { |
|
|
|
return { |
|
|
|
tableData: [], |
|
|
|
classifyOptions: [], |
|
|
|
categoryDatas: [], |
|
|
|
selections: [], |
|
|
@ -210,17 +212,24 @@ export default { |
|
|
|
created() { |
|
|
|
}, |
|
|
|
methods: { |
|
|
|
getRowKey(row) { |
|
|
|
return row.id |
|
|
|
}, |
|
|
|
// 获取数据前设置默认参数 |
|
|
|
[CRUD.HOOK.beforeRefresh]() { |
|
|
|
this.tableData = [] |
|
|
|
this.crud.query.categoryId = this.selectedCategory.id |
|
|
|
}, |
|
|
|
[CRUD.HOOK.afterRefresh]() { |
|
|
|
}, |
|
|
|
// 新增 |
|
|
|
[CRUD.HOOK.beforeToAdd](crud, form) { |
|
|
|
}, |
|
|
|
// 新增/编辑后 |
|
|
|
[CRUD.HOOK.afterSubmit]() { |
|
|
|
[CRUD.HOOK.afterRefresh](crud) { |
|
|
|
crud.data.forEach(function(item, index) { |
|
|
|
if (item.sonNum !== 0) { |
|
|
|
item.hasChildren = true |
|
|
|
item.children = null |
|
|
|
} else { |
|
|
|
item.hasChildren = false |
|
|
|
} |
|
|
|
}) |
|
|
|
this.tableData = this.crud.data |
|
|
|
}, |
|
|
|
// 提交前做的操作 |
|
|
|
[CRUD.HOOK.afterValidateCU](crud) { |
|
|
@ -230,13 +239,8 @@ export default { |
|
|
|
}, |
|
|
|
changeIsTop(val) { |
|
|
|
if (this.crud.status.edit) { |
|
|
|
if (val === '0') { |
|
|
|
// const params = { |
|
|
|
// 'fondsId': this.form.fondsId, |
|
|
|
// 'fondsName': this.form.fondsName, |
|
|
|
// 'status': 1 |
|
|
|
// } |
|
|
|
// this.getDepts(params) |
|
|
|
if (val === '1') { |
|
|
|
this.form.pid = null |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
@ -301,9 +305,25 @@ export default { |
|
|
|
}) |
|
|
|
} |
|
|
|
}, |
|
|
|
getSonClass(tree, treeNode, resolve) { |
|
|
|
setTimeout(() => { |
|
|
|
crudClassify.FetchSonArchivesClass({ pid: tree.id }).then(res => { |
|
|
|
const data = res.map(function(obj) { |
|
|
|
if (obj.sonNum !== 0 && obj.sonNum) { |
|
|
|
obj.hasChildren = true |
|
|
|
obj.children = null |
|
|
|
} else { |
|
|
|
obj.hasChildren = false |
|
|
|
} |
|
|
|
return obj |
|
|
|
}) |
|
|
|
resolve(data) |
|
|
|
}) |
|
|
|
}, 100) |
|
|
|
}, |
|
|
|
selectAll() { |
|
|
|
this.isAllSelect = !this.isAllSelect |
|
|
|
const data = this.crud.data |
|
|
|
const data = this.tableData |
|
|
|
this.toggleSelect(data, this.isAllSelect, 'all') |
|
|
|
}, |
|
|
|
// 选择某行 |
|
|
|