|
|
|
@ -1,12 +1,15 @@ |
|
|
|
<template> |
|
|
|
<template> |
|
|
|
<el-dialog ref="nf-dialog" |
|
|
|
<el-dialog |
|
|
|
|
|
|
|
ref="nf-dialog" |
|
|
|
class="nf-dialog" |
|
|
|
class="nf-dialog" |
|
|
|
v-model="visible" |
|
|
|
v-model="visible" |
|
|
|
title="部门选择" |
|
|
|
title="部门选择" |
|
|
|
width="60%" |
|
|
|
width="60%" |
|
|
|
:before-close="handleClose" |
|
|
|
:before-close="handleClose" |
|
|
|
append-to-body> |
|
|
|
append-to-body |
|
|
|
<avue-crud v-if="isInit" |
|
|
|
> |
|
|
|
|
|
|
|
<avue-crud |
|
|
|
|
|
|
|
v-if="isInit && visible" |
|
|
|
:option="option" |
|
|
|
:option="option" |
|
|
|
:table-loading="loading" |
|
|
|
:table-loading="loading" |
|
|
|
:data="data" |
|
|
|
:data="data" |
|
|
|
@ -17,18 +20,15 @@ |
|
|
|
@selection-change="selectionList = $event" |
|
|
|
@selection-change="selectionList = $event" |
|
|
|
@row-click="rowClick" |
|
|
|
@row-click="rowClick" |
|
|
|
@on-load="onLoad" |
|
|
|
@on-load="onLoad" |
|
|
|
@tree-load="treeLoad"> |
|
|
|
@tree-load="treeLoad" |
|
|
|
|
|
|
|
> |
|
|
|
</avue-crud> |
|
|
|
</avue-crud> |
|
|
|
<template #footer> |
|
|
|
<template #footer> |
|
|
|
<span class="dialog-footer"> |
|
|
|
<span class="dialog-footer"> |
|
|
|
<el-button @click="handleClose" |
|
|
|
<el-button @click="handleClose" size="default">取消</el-button> |
|
|
|
size="default">取消</el-button> |
|
|
|
<el-button type="primary" @click="handleConfirm" size="default">确定</el-button> |
|
|
|
<el-button type="primary" |
|
|
|
|
|
|
|
@click="handleConfirm" |
|
|
|
|
|
|
|
size="default">确定</el-button> |
|
|
|
|
|
|
|
</span> |
|
|
|
</span> |
|
|
|
</template> |
|
|
|
</template> |
|
|
|
|
|
|
|
|
|
|
|
</el-dialog> |
|
|
|
</el-dialog> |
|
|
|
</template> |
|
|
|
</template> |
|
|
|
<script> |
|
|
|
<script> |
|
|
|
@ -161,14 +161,19 @@ export default { |
|
|
|
this.$refs.crud.toggleSelection([row]) |
|
|
|
this.$refs.crud.toggleSelection([row]) |
|
|
|
}, |
|
|
|
}, |
|
|
|
changeDefaultChecked() { |
|
|
|
changeDefaultChecked() { |
|
|
|
this.selectionClear() |
|
|
|
// this.selectionClear() |
|
|
|
if (this.defaultChecked) { |
|
|
|
if (this.defaultChecked) { |
|
|
|
const checks = this.defaultChecked.split(",") |
|
|
|
const checks = this.defaultChecked.split(",") |
|
|
|
if (checks.length > 0) { |
|
|
|
if (checks.length > 0) { |
|
|
|
|
|
|
|
setTimeout(() => { |
|
|
|
checks.forEach(c => { |
|
|
|
checks.forEach(c => { |
|
|
|
const row = this.findRow(this.data, c) |
|
|
|
let row = this.findRow(this.data, c) |
|
|
|
if (row) this.$refs.crud.toggleRowSelection(row, true) |
|
|
|
if (!row) { |
|
|
|
|
|
|
|
row = this.selectionList.find(d => d.id == c) // 勾选列表查找 |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (row && this.$refs.crud) this.$refs.crud.toggleRowSelection(row, true) |
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
|
}, 500) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
@ -189,12 +194,18 @@ export default { |
|
|
|
this.$axios.get(this.url, { params: param }).then(res => { |
|
|
|
this.$axios.get(this.url, { params: param }).then(res => { |
|
|
|
this.data = this.getAsVal(res, this.props.data) || [] |
|
|
|
this.data = this.getAsVal(res, this.props.data) || [] |
|
|
|
this.loading = false |
|
|
|
this.loading = false |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.changeDefaultChecked() |
|
|
|
}) |
|
|
|
}) |
|
|
|
}, |
|
|
|
}, |
|
|
|
treeLoad(tree, treeNode, resolve) { |
|
|
|
treeLoad(tree, treeNode, resolve) { |
|
|
|
const parentId = tree.id; |
|
|
|
const parentId = tree.id; |
|
|
|
this.$axios.get(this.url, { params: { parentId } }).then(res => { |
|
|
|
this.$axios.get(this.url, { params: { parentId } }).then(res => { |
|
|
|
resolve(this.getAsVal(res, this.props.data) || []); |
|
|
|
const list = this.getAsVal(res, this.props.data) || [] |
|
|
|
|
|
|
|
resolve(list) |
|
|
|
|
|
|
|
const parent = this.findRow(this.data, parentId) |
|
|
|
|
|
|
|
parent.children = list |
|
|
|
|
|
|
|
this.changeDefaultChecked() |
|
|
|
}) |
|
|
|
}) |
|
|
|
}, |
|
|
|
}, |
|
|
|
getAsVal(obj, bind = '') { |
|
|
|
getAsVal(obj, bind = '') { |
|
|
|
|