zdys.vue 1.84 KB
<!--
 * @Author: yangwei
 * @Date: 2023-02-28 16:29:04
 * @LastEditors: yangwei
 * @LastEditTime: 2023-09-15 14:57:10
 * @FilePath: \bdcdj-web\src\views\lpb\lpbContent\zdys.vue
 * @Description:
 *
 * Copyright (c) 2023 by ${git_name_email}, All Rights Reserved.
-->
<template>
  <div class="zdys-wrap">
    <div v-for="zdy in realZdys" :key="zdy.bsm">
      <!-- 幢单元名称 -->
      <p class="lpb-xmmc">
        <el-checkbox @change="zdySelectAll($event,zdy.bsm)" v-if="!onlyShow">{{
          zdy.zdymc
        }}</el-checkbox>
        <span v-else>{{zdy.zdymc}}</span>
      </p>
      <!-- 每个幢单元下的层户 -->
      <ch-cpn :ref="zdy.bsm" :ch="zdy.cs" />
    </div>
  </div>
</template>

<script>
import chCpn from "./ch.vue";
export default {
  name: "BdcdjWebZdys",
  components: { chCpn },
  props: {
    zdys: {
      type: Array,
      default: function () {
        return [];
      },
    },
    onlyShow:{
      type: Boolean,
      default: true,
    }
  },
  data() {
    return {};
  },

  mounted() {},

  methods: {
    //幢单元全选
    /**
     * @description: 幢单元全选
     * @param {*} val
     * @param {*} r
     * @author: renchao
     */
    zdySelectAll(val,r) {
      this.$refs[r][0].zdySelectAll(val)
    },
    /**
     * @description: 逻辑幢全选点击后逻辑幢下的幢单元全选
     * @param {*} val
     * @return {*}
     */
    selectAll(val){
      this.realZdys.forEach(i=>{
        this.zdySelectAll(val,i.bsm)
      })
    }
  },
  computed: {
    realZdys() {
      return this.zdys.sort((a, b) => {
        return a.zdysxh > b.zdysxh ? 1 : -1;
      });
    },
  },
};
</script>

<style lang="scss" scoped>
.zdys-wrap {
  display: flex;
  flex-direction: row;
  > div {
    margin-right: 20px;
    display: flex;
    flex-direction: column-reverse;
    .lpb-xmmc {
      border-top: 0;
    }
  }
}
</style>