<!-- * @Author: your name * @Date: 2022-01-26 20:07:52 * @LastEditTime: 2022-03-23 15:19:40 * @LastEditors: Please set LastEditors * @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE * @FilePath: /test/hello-world/src/views/components/deviceA.vue --> <template> <div class="devicea-wrapper"> <div class="title"> {{ deviceData.deviceName ? deviceData.deviceName : deviceData.stationName }} </div> <div class="close" @click="close"> <img src="@/assets/mapImages/closeBtn.png" alt="" /> </div> <!-- <div class="top flex"> <div class="group"> <div class="left">所属公司:</div> <div class="right zzz">{{ companyType[deviceData.companyType] }}</div> </div> <div class="group"> <div class="left">设备类型:</div> <div class="right zzz"> {{ deviceType[deviceData.iconType] }} </div> </div> <div class="group"> <div class="left">设备地址:</div> <div v-if="deviceData.deviceAddr" :title="deviceData.deviceAddr" class="right last zzz" > {{ deviceData.deviceAddr || "-" }} </div> <div v-else-if="deviceData.stationAddr" :title="deviceData.stationAddr" class="right last zzz" > {{ deviceData.stationAddr || "-" }} </div> <div v-else>-</div> </div> </div> --> <div class="top flex"> <div class="top-left"> <div class="group"> <div class="left">所属公司:</div> <div class="right zzz">{{ companyType[deviceData.companyType] }}</div> </div> <div class="group"> <div class="left">设备类型:</div> <div class="right zzz"> {{ deviceType[deviceData.iconType] }} </div> </div> <div class="group"> <div class="left last">设备地址:</div> <div v-if="deviceData.deviceAddr" :title="deviceData.deviceAddr" class="right last zzz" > {{ deviceData.deviceAddr || "-" }} </div> <div v-else-if="deviceData.stationAddr" :title="deviceData.stationAddr" class="right last zzz" > {{ deviceData.stationAddr || "-" }} </div> <div v-else class="right last zzz">-</div> </div> </div> <div class="top-right"> <el-image v-if="deviceData.pictureAddress" style="width: 100px; height: 100px" :src="deviceData.pictureAddress" :preview-src-list="[deviceData.pictureAddress ]" :z-index="999999" > </el-image> <div class="imgtext" v-else>暂无图片</div> </div> </div> <div class="middle">{{ profile }}</div> <div class="foot"> <div class="thead flex" v-if="list.length>0"> <div class="first">设备类型</div> <div>设备数量</div> <div>在线设备</div> <div>离线设备</div> <!-- <div>历史报警</div> <div>已处理报警</div> --> <div class="last">报警中</div> </div> <template v-if="list.length > 0"> <div class="tbody flex" v-for="deviceData in list" :key="deviceData.inAlarm+Math.random()" > <div v-unValue class="first zzz"> {{ typeList[deviceData.dataType] }} </div> <div v-unValue class="">{{ deviceData.numberPressureGauges }}</div> <div v-unValue class=""> {{ deviceData.onlineEquipment }} </div> <div v-unValue class=""> {{ deviceData.offlineEquipment }} </div> <!-- <div v-unValue class=""> {{ deviceData.historicalAlarm }} </div> <div v-unValue class=""> {{ deviceData.alarmProcessed }} </div> --> <div v-unValue class="last"> {{ deviceData.inAlarm }} </div> </div> </template> </div> <div class="btn" v-if="list.length>0"> <div @click="btnClick">感知设备</div> </div> </div> </template> <script> import { companyType, deviceType } from "@/utils/mapClass/config.js"; import { getCzDevice } from "@/api/bigWindow/getDevice.js"; export default { data() { return { companyType, deviceType, profile: "暂无备注", typeList: { // 1压力表 2流量计 3探测器 1: "压力表", 2: "流量计", 3: "工业探测器", }, list: [ // { // numberPressureGauges: "-", // onlineEquipment: "-", // offlineEquipment: "-", // historicalAlarm: "-", // alarmProcessed: "-", // inAlarm: "-", // dataType: 1, // }, // { // numberPressureGauges: "-", // onlineEquipment: "-", // offlineEquipment: "-", // historicalAlarm: "-", // alarmProcessed: "-", // inAlarm: "-", // dataType: 2, // }, // { // numberPressureGauges: "-", // onlineEquipment: "-", // offlineEquipment: "-", // historicalAlarm: "-", // alarmProcessed: "-", // inAlarm: "-", // dataType: 3, // }, ], }; }, computed: { prodTest() { return this.vueRoot.$store.state.user.systemSetting.prod_test; }, company() { return this.vueRoot.$store.state.bigWindowCompany.company; }, }, mounted() { // 如果不是测试,而是真数据,就要用帧数据的东西 if (this.prodTest != "test") { this.companyType = {}; this.company.forEach((item) => { this.companyType[item.conpanyId] = item.companyName; }); } this.myHttp() console.log(this.deviceData); }, methods: { close() { this.mapClass.infowindowClose(); }, btnClick() { const title = this.deviceData.deviceName ? this.deviceData.deviceName : this.deviceData.stationName; this.vueRoot.getTcqDevice( { devId: this.deviceData.siteStationId, relationDeviceType: 2 }, title ); }, myHttp() { getCzDevice({ deviceId: this.deviceData.siteStationId }).then((res) => { this.list = res.data[0].subordinateEquipmentList.filter(item=>item.numberPressureGauges>0); console.log("resresres",res) }); }, }, }; </script> <style lang="scss" scoped> .devicea-wrapper { background-color: rgba(9, 18, 32, 0.6); padding: 10px; position: relative; width: 500px; .title { // padding-top: 10px; // padding-left: 10px; font-size: 14px; line-height: 14px; color: #ffffff; } .close { position: absolute; right: 10px; top: 5px; cursor: pointer; } .top { margin-top: 10px; margin-bottom: 10px; border: 1px solid #cccccc; box-sizing: border-box; .top-left { flex: 1.8; .group { height: 40px; flex: 1; display: flex; justify-content: space-between; box-sizing: border-box; div { flex: 1; box-sizing: border-box; border-right: 1px solid #cccccc; border-bottom: 1px solid #cccccc; text-align: center; font-size: 14px; color: #ffffff; line-height: 40px; padding: 0 5px; &.last { border-bottom: none; } } .left { text-align: right; background-color: rgba(255, 255, 255, 0.1); } .right { flex:2; } } } .top-right { flex: 1; display: flex; justify-content: center; align-items: center; .imgtext { color: #ffffff; font-size: 30px; } } } .middle { width: 100%; padding: 5px; border: 1px solid #ffffff; box-sizing: border-box; font-size: 14px; color: #ffffff; text-indent: 2em; margin-bottom: 10px; } .foot { font-size: 14px; color: #ffffff; .thead, .tbody { border: 1px solid #cccccc; div { flex: 1; text-align: left; border-right: 1px solid #cccccc; box-sizing: border-box; padding: 0 5px; } .first { flex: 2; } .last { border-right: none; } } .tbody { border-top: none; } .thead { div { background-color: rgba(255, 255, 255, 0.1); } } } .btn { position: relative; margin-top: 10px; text-align: right; div { font-size: 14px; color: #ffffff; padding: 2px 4px; box-sizing: border-box; display: inline-block; cursor: pointer; border: 1px solid #cccccc; background-color: #1890ff; &:hover { // background: rgba(9, 18, 32, 0.6); background-color: #18baff; } } } .flex { display: flex; justify-content: space-between; } } </style>