Newer
Older
smartKitchenFront / src / views / dashboard / components / managementList.vue
<template>
  <!-- 各分类用户数量 -->
  <div class="container" :style="{ 'height': height, 'width': width }">
    <div v-for="(item, index) of management" class="device" :key="item.title">
      <div class="content">
        <div><svg-icon :icon-class="item.icon"></svg-icon></div>
        <div class="count">{{ item.userCount }}</div>
      </div>
      <div class="title">{{ item.roleName }}</div>
    </div>
  </div>
</template>
  
<script>
import SvgIcon from "@/components/SvgIcon";
import { getUserCount } from "@/api/cockpit/cockpit";
export default {
  name: "managementList",
  components: {
    SvgIcon,
  },
  data() {
    return {
      management: [],
    };
  },
  methods: {
    fetchData() {
      getUserCount().then((res) => {
        this.management = res.data.map(item => {
          return { ...item, icon: 'cockpit-' + item.roleName }
        })
      });
    },
  },
  mounted() {
    this.fetchData();
  },
};
</script>
  
<style lang="scss" scoped>
.container {
  background: #edf5f8;
  border-radius: 8px;
  margin:10px;
  padding: 10px;
  display: flex;
  justify-content: space-between;
  flex-wrap:wrap;
  align-items:center;
  color: #2076a1;
  font-size: 14px;
  font-weight: 700;
  
 
  .device {
    width:24%;
    .content {
      display: flex;
      justify-content: space-around;
      // padding: 5px;
      align-items: center;
      .count{
        font-size: 20px;
      }
      ::v-deep .svg-icon {
        width: 40px;
        height: 40px;
      }
    }
  }
  .title{
    text-align: center;
    // padding:10px ;
    margin-top: 5px;
  }
}
</style>