| | |
| | | width="65%" |
| | | :destroy-on-close="true" |
| | | :close-on-click-modal="false" |
| | | :modal="false" |
| | | :before-close="close"> |
| | | <el-tree |
| | | ref="tree" |
| | | :data="deptTree" |
| | | show-checkbox |
| | | node-key="id" |
| | | :check-strictly="true" |
| | | :default-expanded-keys="['dept:100']" |
| | | @check-change="handleCheckChange" |
| | | :default-checked-keys="checkeds"> |
| | | > |
| | | </el-tree> |
| | | <span slot="footer" class="dialog-footer"> |
| | | <el-button @click="close">取 消</el-button> |
| | |
| | | type: Boolean |
| | | }, |
| | | checkeds: { |
| | | required: true, |
| | | type: Array |
| | | required: true |
| | | } |
| | | }, |
| | | // watch: { |
| | | // checkeds: { |
| | | // handler(newV) { |
| | | // if (newV) { |
| | | // console.log("djjdjdjdjdjdjj") |
| | | // this.checkedAfterHandler = newV.map(item => {const arr = item.split(':'); return parseInt(arr[1])}) |
| | | // } |
| | | // }, |
| | | // deep: true |
| | | // } |
| | | // }, |
| | | watch: { |
| | | show: { |
| | | handler(newV) { |
| | | this.$nextTick(() => { |
| | | if (this.$refs.tree && this.checkeds) { |
| | | this.$refs.tree.setCheckedKeys(this.checkeds); |
| | | } |
| | | }); |
| | | }, |
| | | deep: true |
| | | } |
| | | }, |
| | | data() { |
| | | return { |
| | | deptTree: [], |
| | |
| | | }) |
| | | }, |
| | | methods: { |
| | | setCheckList(value) { |
| | | this.checkList = value |
| | | this.$nextTick(() => { |
| | | if (this.$refs.tree && this.checkeds) { |
| | | this.$refs.tree.setCheckedKeys(this.checkeds); |
| | | } |
| | | }); |
| | | }, |
| | | handleCheckChange(data, checked, indeterminate) { |
| | | if (checked) { |
| | | this.checkList.push(data) |
| | | if (this.checkList.indexOf(data) === -1) { |
| | | this.checkList.push(data) |
| | | } |
| | | } else { |
| | | this.checkList = this.checkList.filter(item => item !== data) |
| | | } |