安琪酵母(西藏)益生菌信息采集中心智能实验室
longyvfengyun
2023-07-06 a3c6e3a5177b15021dad5788688294b1d863717a
src/views/home/index.vue
@@ -1,9 +1,14 @@
<script setup>
import {onMounted, onUnmounted, watch} from "vue";
import {onMounted, onUnmounted, ref, watch} from "vue";
import MapPin from "@/components/MapPin.vue";
import slideMenu from "@/views/mainLayout/js/slideMenu";
import homeContentModule from "@/views/home/js/homeContentModule";
import homeInfoModule from "@/views/home/js/homeInfoModule";
import homeDetailModule from "@/views/home/js/homeDetailModule";
import HomeDetail from "@/views/home/components/homeDetail.vue";
import {ElMessage} from "element-plus";
const isShowMapPin = ref(true);
const {
   isCollapse
@@ -17,9 +22,24 @@
} = homeContentModule();
const {homeInfo} = homeInfoModule();
const {getHomeDetailInfo} = homeDetailModule();
const homeItemDialog = ref(false);
const homeDetailInfo = ref({});
const handleClick = (info)=>{
   let rs = getHomeDetailInfo(info.num);
   if(rs.code === 1) {
      homeDetailInfo.value = rs.data;
      homeItemDialog.value = true;
   }else {
      ElMessage(rs.msg);
   }
}
watch(isCollapse, ()=>{
   isShowMapPin.value = false;
   setTimeout(()=>{
      isShowMapPin.value = true;
      setContainerSize();
   }, 500);
});
@@ -40,16 +60,25 @@
<template>
   <div class="home-content" ref="homeContentDom">
      <map-pin
         v-if="isShowMapPin"
         v-for="(item, index) in homeInfo" :key="'key'+index"
         :visible="item.pos.visible"
         :name="item.name"
         :c-width="cWidth" :c-height="cHeight"
         :d-width="dWidth" :d-height="dHeight"
         :x="item.pos.x" :y="item.pos.y"></map-pin>
      <div class="card-box-list">
      </div>
         :x="item.pos.x" :y="item.pos.y"
         :info="item.info" @click="handleClick"></map-pin>
      <el-dialog
         v-model="homeItemDialog"
         title="机房详情"
         width="auto"
         class="center-dialog"
         modal-class="high-level-dialog"
         align-center>
         <home-detail :info="homeDetailInfo"></home-detail>
      </el-dialog>
   </div>
</template>
<style scoped>