diff --git a/packages/wechat/AppAddressBook/components/List.vue b/packages/wechat/AppAddressBook/components/List.vue index bd8d77c0..ebc7b9fe 100644 --- a/packages/wechat/AppAddressBook/components/List.vue +++ b/packages/wechat/AppAddressBook/components/List.vue @@ -34,17 +34,17 @@
+ :filter-node-method="filterNode" + ref="tree" + :props="defaultProps" + node-key="id" + :data="unitList" + highlight-current + @node-contextmenu="nodeContextmenu" + :current-node-key="search.departmentId" + :default-expanded-keys="defaultExpanded" + :default-checked-keys="defaultChecked" + @current-change="onTreeChange">
@@ -82,8 +89,14 @@ export default { noArea: [], staData: [], name: '', + isShowMenu: false, search: { bind: '' + }, + menuInfo: { + x: '', + y: '', + node: {} } } }, @@ -91,6 +104,10 @@ export default { handleShow() { this.$emit('update:show', !this.show) }, + + bindEvent() { + this.isShowMenu = false + }, getDevices() { this.ins.post("/app/appzyvideoequipment/tree", null, { params: {size: 999} @@ -103,6 +120,25 @@ export default { } }) }, + + handleTreeCommand (e, node) { + this.$emit('treeCommand', { + type: e, + node + }) + }, + + nodeContextmenu(e, node) { + this.isShowMenu = true + let y = e.y + 6 + if (y + 202 > document.body.clientHeight) { + y = y - 202 + } + this.menuInfo = { + x: e.x + 16, y, + node + } + }, handleNodeClick(data) { this.$emit('select', data) }, @@ -124,6 +160,10 @@ export default { created() { this.dict.load("deviceStatus") this.getDevices() + }, + + mounted () { + document.querySelector('html').addEventListener('click', this.bindEvent) } } @@ -134,12 +174,36 @@ export default { align-items: center; flex-shrink: 0; color: #fff; + overflow: hidden; div[flex] { display: flex; align-items: center; } + .deviceList { + overflow: auto; + + ::v-deep .el-tree { + width: -webkit-fit-content; + width: -moz-fit-content; + width: fit-content; + min-width: 100%; + } + &::-webkit-scrollbar { + width : 10px; + height: 15px; + } + &::-webkit-scrollbar-thumb { + box-shadow: inset 0 0 3px rgba(0, 0, 0, 0.2); + background: #535353; + } + &::-webkit-scrollbar-track { + box-shadow: inset 0 0 3px rgba(0, 0, 0, 0.2); + background: #fff; + } + } + div[fill] { flex: 1; min-width: 0;