<template>
  <MOSTY.PageTree :pageTitle="pageTitle" :searchType="'01'" @getDeptId="getdeptId">
    <template #titleright>
      <div class="head">
        <div class="toggle" :class="{ active: isOpen }" @click="isOpen = !isOpen">
          <span>统计</span>
          <!-- {{ isOpen ? "收起" : "展开" }} -->
          <el-icon>
            <DArrowLeft />
          </el-icon>
        </div>
      </div>
    </template>
    <template #table>
      <Apparatus :equipmentType="equipmentType" :obj='listQuery' :type='"aqqc"' :isShowTotal="isOpen"
        :tableHeight='isOpen ? "15vh" : "60vh"' />
    </template>
  </MOSTY.PageTree>

</template>

<script setup>
import * as MOSTY from "@/components/MyComponents/index";
import { reactive, ref, onMounted, watch } from "vue";
import Apparatus from '@/components/MyComponents/TabList/Apparatus.vue'
import { useRoute } from 'vue-router'
const route = useRoute()
const isOpen = ref(false);
const listQuery = reactive({
  type: '0',
  saveBtnShow: true,
});
// 消防器材 0 安防器材 1
const equipmentType = ref(0)
const pageTitle = ref('消防器材')
//获取部门数据
const getdeptId = (val) => {
  listQuery.orgid = val.id;
  listQuery.orgname = val.orgname;
};
onMounted(() => {
  switch (route.path) {
    // 消防器材
    case '/dm/equipment/xfsbss/safety':
      equipmentType.value = 0
      pageTitle.value = '消防器材'
      break;
    // 安防器材
    case '/dm/equipment/afsbss/safety':
      equipmentType.value = 1
      pageTitle.value = '安防器材'
      break;
    default:
      break;
  }
})
</script>

<style lang="scss" scoped>
.head {
  display: flex;
  justify-content: space-between;
  align-items: center;

  .toggle {
    height: 40px;
    cursor: pointer;
    display: flex;
    align-items: center;
    color: #0f3916;

    .el-icon {
      transform: rotate(90deg);
      transition: all 0.25s ease;
    }

    &.active {
      .el-icon {
        transform: rotate(-90deg);
      }
    }
  }
}



::v-deep .el-pagination {
  justify-content: end !important;
}
</style>