<!-- * @Author: your name * @Date: 2022-01-26 20:07:52 * @LastEditTime: 2022-03-17 09:05:30 * @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.nickName }} </div> <div class="close" @click="close"> <img src="@/assets/mapImages/closeBtn.png" alt="" /> </div> <div class="top flex top-top"> <div class="group"> <div class="left">联系人:</div> <div class="right zzz">{{ 1 }}</div> </div> <div class="group"> <div class="left">联系电话:</div> <div v-unValue class="right zzz"> {{ deviceData.phone }} </div> </div> <div class="group"> <div class="left">联系地址:</div> <div :title="deviceData.address" class="right last zzz"> {{ deviceData.address || "-" }} </div> </div> </div> <div class="top flex top-bottom"> <div class="group"> <div class="left">联系地址:</div> <div :title="deviceData.address" class="right last zzz"> {{ deviceData.address || "-" }} </div> </div> </div> <template v-if="deviceData.detectorCountList"> <div class="foot"> <div class="thead flex"> <div class="first">设备类型</div> <div>设备数量</div> <div>在线设备</div> <div>离线设备</div> <!-- <div>历史报警</div> <div>已处理报警</div> --> <div class="last">报警中</div> </div> <div v-for="data in deviceData.detectorCountList" :key="data.userId" class="tbody flex" > <div v-unValue class="first zzz">{{ data.detectorType }}</div> <div class="">{{ data.detectorCount }}</div> <div v-unValue class=""> {{ data.onLineNum }} </div> <div v-unValue class=""> {{ data.offLineNum }} </div> <!-- <div v-unValue class=""> {{ data.historyAlarmNum }} </div> <div v-unValue class=""> {{ data.cancelAlarmNum }} </div> --> <div v-unValue class="last zzz"> {{ data.processingAlarmNum }} </div> </div> </div> </template> <div class="btn"> <div @click="btnClick">感知设备</div> </div> </div> </template> <script> import { companyType, deviceType } from "@/utils/mapClass/config.js"; import { listDetectorInfo } from "@/api/detector/detectorInfo"; import { detectorUserList } from "@/api/detector/detectorUser"; export default { data() { return { companyType, deviceType, }; }, 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() { // this.vueRoot.centerDataFunc(this.deviceData.pressureFlows); this.vueRoot.getDetectorInfoList( listDetectorInfo, { userId: this.deviceData.userId }, this.deviceData.nickName ); }, myHttp() { detectorUserList({ userId: this.deviceData.userId }).then((res) => { if (res.code == 200) { const data = res.data.filter( (item) => item.userId == this.deviceData.userId )[0].detectorCountList; this.deviceData.detectorCountList = data; } }); }, }, }; </script> <style lang="scss" scoped> .devicea-wrapper { background-color: rgba(9, 18, 32, 0.6); padding: 10px; position: relative; width: 600px; .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-top { div{ width: 33%; } } .group { height: 30px; flex: 1; display: flex; justify-content: space-between; box-sizing: border-box; div { flex: 1; box-sizing: border-box; border-right: 1px solid #cccccc; text-align: center; font-size: 14px; color: #ffffff; line-height: 30px; padding: 0 5px; &.last { border-right: none; } } .left { text-align: right; background-color: rgba(255, 255, 255, 0.1); } } &.top-bottom { .left { flex: none; width: 192px !important; } .right { flex: 1; } } } .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>