| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061 | <template>    <el-scrollbar class="el-scrollbar-byself thisColor" style="width: 100%">        <el-tree class="" :data="tenantsTree" @node-click="treeClick" node-key="value" :props="treedefaultProps" ref="tenantstree">        </el-tree>    </el-scrollbar></template><script>export default {    props: ['params'],    data() {        return {            tenantsTree: [],            treedefaultProps: {                children: 'children',                label: 'name'            },            unitPa: {                buildingId: '',                buildingName: '',                unitId: '',                unitName: '',                houseId: '',                houseName: '',                type: ''            }        };    },    computed: {},    mounted() {},    methods: {        submit() {            if (this.unitPa.type === 'room') {                this.params.callback && this.params.callback(this.unitPa);                this.$emit('close');            } else {                this.$message.error('请先选择到房间');                return;            }        },        treeClick(e) {            this.unitPa.type = e.type;            if (e.type == 'room') {                this.unitPa.buildingId = this.$refs.tenantstree.getNode(e).parent.parent.data.value;                this.unitPa.buildingName = this.$refs.tenantstree.getNode(e).parent.parent.data.name;                this.unitPa.unitId = this.$refs.tenantstree.getNode(e).parent.data.value;                this.unitPa.unitName = this.$refs.tenantstree.getNode(e).parent.data.name;                this.unitPa.houseId = e.value;                this.unitPa.houseName = e.name;            }        }    },    created() {        this.tenantsTree = this.params.tenantsTree;    }};</script><style lang="scss" scoped>.thisColor /deep/ .el-tree .is-current {    color: #56c6ff;}</style>
 |