|
|
@@ -1,46 +1,48 @@
|
|
|
<template>
|
|
|
<div
|
|
|
v-loading="loading"
|
|
|
- class="l-flex--col u-color--black u-font-size--sm u-relative"
|
|
|
- :class="{ shrink: shrinkState }"
|
|
|
+ class="l-flex--col c-device-tree u-color--black u-font-size--sm u-relative"
|
|
|
+ :class="{ 'support-shrink': shrink, shrink: shrinkState }"
|
|
|
>
|
|
|
- <el-tabs
|
|
|
- v-if="exact"
|
|
|
- v-model="active"
|
|
|
- class="c-tabs has-bottom-padding"
|
|
|
- >
|
|
|
- <el-tab-pane
|
|
|
- label="按部门"
|
|
|
- name="group"
|
|
|
- />
|
|
|
- <el-tab-pane
|
|
|
- label="按分辨率"
|
|
|
- name="ratio"
|
|
|
- />
|
|
|
- <el-tab-pane
|
|
|
- label="按宽高比"
|
|
|
- name="productType"
|
|
|
- />
|
|
|
- </el-tabs>
|
|
|
- <warning
|
|
|
- v-if="error"
|
|
|
- @click="getDevices"
|
|
|
- />
|
|
|
- <template v-else>
|
|
|
- <div class="l-flex__none l-flex--row c-sibling-item--v u-overflow--hidden">
|
|
|
- <div class="l-flex__auto" />
|
|
|
- <search-input
|
|
|
- v-model.trim="deviceName"
|
|
|
- class="l-flex__none"
|
|
|
- placeholder="设备名称"
|
|
|
- @search="onSearch"
|
|
|
+ <div class="l-flex__fill l-flex--col c-device-tree__content">
|
|
|
+ <el-tabs
|
|
|
+ v-if="exact"
|
|
|
+ v-model="active"
|
|
|
+ class="c-tabs has-bottom-padding"
|
|
|
+ >
|
|
|
+ <el-tab-pane
|
|
|
+ label="按部门"
|
|
|
+ name="group"
|
|
|
+ />
|
|
|
+ <el-tab-pane
|
|
|
+ label="按分辨率"
|
|
|
+ name="ratio"
|
|
|
+ />
|
|
|
+ <el-tab-pane
|
|
|
+ label="按宽高比"
|
|
|
+ name="productType"
|
|
|
/>
|
|
|
- </div>
|
|
|
- <c-tree
|
|
|
- class="l-flex__fill c-sibling-item--v"
|
|
|
- :root-option="rootOption"
|
|
|
+ </el-tabs>
|
|
|
+ <warning
|
|
|
+ v-if="error"
|
|
|
+ @click="getDevices"
|
|
|
/>
|
|
|
- </template>
|
|
|
+ <template v-else>
|
|
|
+ <div class="l-flex__none l-flex--row c-sibling-item--v u-overflow--hidden">
|
|
|
+ <div class="l-flex__auto" />
|
|
|
+ <search-input
|
|
|
+ v-model.trim="deviceName"
|
|
|
+ class="l-flex__none"
|
|
|
+ placeholder="设备名称"
|
|
|
+ @search="onSearch"
|
|
|
+ />
|
|
|
+ </div>
|
|
|
+ <c-tree
|
|
|
+ class="l-flex__fill c-sibling-item--v"
|
|
|
+ :root-option="rootOption"
|
|
|
+ />
|
|
|
+ </template>
|
|
|
+ </div>
|
|
|
<i
|
|
|
v-if="shrink"
|
|
|
class="o-shrink-icon u-color--black u-font-size--lg has-active"
|
|
|
@@ -137,6 +139,7 @@ export default {
|
|
|
if (this.exact) {
|
|
|
this.$productCache = productCacheOptions.cache
|
|
|
}
|
|
|
+ this.$emit('loaded', data)
|
|
|
return this.getDevicesByActive()
|
|
|
})
|
|
|
},
|
|
|
@@ -218,7 +221,7 @@ export default {
|
|
|
},
|
|
|
onSearch () {
|
|
|
const regx = this.deviceName ? new RegExp(this.deviceName) : null
|
|
|
- const rootOption = this.createNode()
|
|
|
+ const rootOption = this.createRootNode()
|
|
|
this.setNodes(rootOption, this.onFilter(rootOption, this.$nodes, regx))
|
|
|
this.rootOption = rootOption
|
|
|
this.customExpand = !!this.deviceName
|
|
|
@@ -254,15 +257,26 @@ export default {
|
|
|
</script>
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
-.shrink {
|
|
|
- box-sizing: border-box;
|
|
|
- width: $spacing !important;
|
|
|
+.c-device-tree {
|
|
|
+ &.support-shrink {
|
|
|
+ padding-right: $spacing--lg !important;
|
|
|
+
|
|
|
+ &.shrink {
|
|
|
+ box-sizing: border-box;
|
|
|
+ width: $spacing--lg !important;
|
|
|
+
|
|
|
+ .c-device-tree__content {
|
|
|
+ width: 0;
|
|
|
+ overflow: hidden;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
.o-shrink-icon {
|
|
|
position: absolute;
|
|
|
top: 50%;
|
|
|
- right: 0;
|
|
|
+ right: calc(($spacing--lg - $spacing) / 2);
|
|
|
transform: translateY(-50%);
|
|
|
}
|
|
|
</style>
|