¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <dv-full-screen-container class="full-screen-container"> |
| | | <div> |
| | | <!--页头åºå--> |
| | | <header class="page-header" :style="{height: pageHeaderHeight+'px'}"> |
| | | <a-row style="height: 100%"> |
| | | <a-col :span="7" class="header-left"> |
| | | <a-space> |
| | | <span v-if="!isSwitchChecked">å¼å¯åè½</span> |
| | | <span v-else>å
³éåè½</span> |
| | | <a-switch |
| | | checked-children="å¼" |
| | | un-checked-children="å
³" |
| | | @change="handleSwitchChange" |
| | | v-model="isSwitchChecked" |
| | | :disabled="isSwitchChecked" |
| | | /> |
| | | <a-button type="primary" icon="save" size="large" @click="saveDevicePositionAndSizeByApi">ä¿åä½ç½®</a-button> |
| | | </a-space> |
| | | </a-col> |
| | | |
| | | <a-col :span="10" class="workshop-name">{{ workshopDetails.workshopName }}</a-col> |
| | | |
| | | <a-col :span="7" class="device-status-info"> |
| | | <!--<a-space v-for="item in deviceStatusList" :key="item.value" class="single-status-info"--> |
| | | <!--@click="handleScreenDevive(item)">--> |
| | | <!--<div :style="{color:item.checked?'#1890FF':'#fff'}">{{ item.label }}</div>--> |
| | | <!--<div class="status-square" :style="{ backgroundColor: item.color }"></div>--> |
| | | <!--<!–<a-checkbox :checked="item.checked" @change="checkboxChange(item)"></a-checkbox>–>--> |
| | | <!--<div>{{getDeviceNumberByStatus(item.value) }}</div>--> |
| | | <!--</a-space>--> |
| | | <a-space v-for="item in deviceStatusList" :key="item.value" class="single-status-info"> |
| | | <div :style="{color:item.checked?'#1890FF':'#fff'}">{{ item.label }}</div> |
| | | <div class="status-square" :style="{ backgroundColor: item.color }"></div> |
| | | <!--<a-checkbox :checked="item.checked" @change="checkboxChange(item)"></a-checkbox>--> |
| | | <div>{{getDeviceNumberByStatus(item.value) }}</div> |
| | | </a-space> |
| | | </a-col> |
| | | </a-row> |
| | | </header> |
| | | |
| | | <!--ææ½è®¾å¤åºå--> |
| | | <div class="content-container" ref="deviceContainerRef" style="overflow: auto"> |
| | | <img :src="imgSrc" width="1920" height="900"> |
| | | <div class="guideline guidelineX" :style="{top:guidelineXTop+'px',display:showGuideline}"></div> |
| | | <div class="guideline guidelineY" :style="{left:guidelineYLeft+'px',display:showGuideline}"></div> |
| | | <VueDragResize |
| | | v-for="(item, index) in deviceList" |
| | | :key="item.equipmentId" |
| | | :w="item.vw" |
| | | :h="item.vh" |
| | | :x="item.coordinateLeft" |
| | | :y="item.coordinateTop" |
| | | v-on:resizing="resize($event, index)" |
| | | v-on:dragging="resize($event, index)" |
| | | :parentLimitation="parentLimitation" |
| | | :parentH="parentH" |
| | | :parentW="parentW" |
| | | :minw="70" |
| | | :minh="70" |
| | | :isDraggable="isDraggable" |
| | | :isResizable="isResizable" |
| | | :stickSize="6" |
| | | @deactivated="showGuideline = 'none'" |
| | | > |
| | | <div class="single-device" :style="{ width: item.vw + 'px', height: item.vh + 'px' }" |
| | | @click="openDetail(item)"> |
| | | <div class="device-status"> |
| | | <div |
| | | v-if="item.equipmentStatus == 2 || item.equipmentStatus == 1" |
| | | :style="{ backgroundImage: `url(${require('@/assets/yellow.png')})` }" |
| | | class="status-image" |
| | | ></div> |
| | | <div |
| | | v-if="item.equipmentStatus == 22" |
| | | :style="{ backgroundImage: `url(${require('@/assets/red.png')})` }" |
| | | class="status-image" |
| | | ></div> |
| | | <div |
| | | v-if="item.equipmentStatus == 0" |
| | | :style="{ backgroundImage: `url(${require('@/assets/gray.png')})` }" |
| | | class="status-image" |
| | | ></div> |
| | | <div |
| | | v-if="item.equipmentStatus == 3" |
| | | :style="{ backgroundImage: `url(${require('@/assets/green.png')})` }" |
| | | class="status-image" |
| | | ></div> |
| | | <div |
| | | :style="{ backgroundImage: `url(${getImgView(item.equipmentImage)})` }" |
| | | class="device-image" |
| | | ></div> |
| | | </div> |
| | | <div class="device-id" id="deviceId" |
| | | :style="{ color:workshopDetails.equipmentIdColor }"> |
| | | {{ item.equipmentId }} |
| | | </div> |
| | | </div> |
| | | </VueDragResize> |
| | | </div> |
| | | |
| | | <EquipmentDetailModal ref="EquipmentDetailModal"></EquipmentDetailModal> |
| | | </div> |
| | | </dv-full-screen-container> |
| | | </template> |
| | | |
| | | <script> |
| | | import VueDragResize from 'vue-drag-resize' |
| | | import api from '@/api/mdc' |
| | | import { getFileAccessHttpUrl } from '@/api/manage' |
| | | import EquipmentDetailModal from './modules/DeviceBaseInfo/EquipmentDetailModal.vue' |
| | | import { message } from 'ant-design-vue' |
| | | |
| | | message.config({ |
| | | maxCount: 3 |
| | | }) |
| | | |
| | | export default { |
| | | components: { |
| | | VueDragResize, |
| | | EquipmentDetailModal |
| | | }, |
| | | data() { |
| | | return { |
| | | pageHeaderHeight: 80,// 页头é«åº¦ |
| | | workshopDetails: {}, // 车é´è¯¦ç»ä¿¡æ¯, |
| | | isDraggable: false, // æ¯å¦å¼å¯ææ½ |
| | | isResizable: false, // æ¯å¦å¼å¯ç¼©æ¾ |
| | | isSwitchChecked: false, // æ¯å¦å¼å¯åè½ |
| | | timingAcquisition: null, // 宿¶å·æ°æ¯å¦å¼å¯ |
| | | parentH: 5000,//ç¶çº§é«åº¦ |
| | | parentW: 1920,//ç¶çº§å®½åº¦ |
| | | showGuideline: 'none', |
| | | guidelineXTop: 0, |
| | | guidelineYLeft: 0, |
| | | deviceList: [ |
| | | // { |
| | | // equipmentId: '123213213123232',// 设å¤ID |
| | | // equipmentImage: require('@/assets/8.png'), // 设å¤å¾ç |
| | | // coordinateTop: 200, // ææ½å
ç´ è·çåé¡¶è·ç¦» |
| | | // coordinateLeft: 100, // ææ½å
ç´ è·çå左侧è·ç¦» |
| | | // vw: 100, // 缩æ¾å
ç´ å®½åº¦ |
| | | // vh: 100, // 缩æ¾å
ç´ é«åº¦ |
| | | // equipmentStatus: 1 // 设å¤ç¶æ 0:å
³æº 22:æ¥è¦ 2:å¾
æº 3:è¿è¡ 弿º:1ï¼æ²¡æåè²ç¯æ è¯å½ä¸ºå¾
æºï¼ |
| | | // } |
| | | ], // 设å¤ä¿¡æ¯å表 |
| | | deviceList_copy: [], |
| | | deviceStatusList: [ |
| | | // { |
| | | // label: 'å
¨é¨', |
| | | // value: 99, |
| | | // color: '#fff', |
| | | // checked: true |
| | | // }, |
| | | { |
| | | label: 'å
³æº', |
| | | value: 0, |
| | | color: '#A8A8A8', |
| | | checked: false |
| | | }, |
| | | { |
| | | label: 'å¾
æº', |
| | | value: 2, |
| | | color: '#FFFF00', |
| | | checked: false |
| | | }, |
| | | { |
| | | label: 'è¿è¡', |
| | | value: 3, |
| | | color: '#00EE00', |
| | | checked: false |
| | | }, |
| | | { |
| | | label: 'æ¥è¦', |
| | | value: 22, |
| | | color: '#FF0000', |
| | | checked: false |
| | | } |
| | | ],// 设å¤ç¶ææç¤ºç¯åè¡¨ï¼ |
| | | windowHeight: null,// å½åæµè§å¨å¯è§åºåé«åº¦ï¼ï¼ä¸å
æ¬å·¥å
·æ ã书ç¾ãåºé¨ä»»å¡æ ï¼ |
| | | isFullScreen: false,// è¿å
¥çæ¿é¡µé¢æ¶æ¯å¦ä¸ºå
¨å±æ¨¡å¼ï¼ä¸å
æ¬æ£å¸¸æ¨¡å¼è¿å
¥ååæ¢ä¸ºå
¨å±æ¨¡å¼ |
| | | parentLimitation: false,// ææ½åºåæ¯å¦éå¶å¨ç¶å
ç´ åºåå
, |
| | | checkedStatusCount: null,// å·²å¾éçéç¶æä¸ªæ° |
| | | imgSrc: ''// 车é´å¾çº¸å°å |
| | | } |
| | | }, |
| | | watch: { |
| | | isSwitchChecked: { |
| | | handler(newVal) { |
| | | if (!newVal) { |
| | | console.log('宿¶å¨å¼å¯ä¸') |
| | | this.timingAcquisition = setInterval(() => { |
| | | this.getDeviceListByApi(this.$route.params.id) |
| | | }, 2000) |
| | | } else { |
| | | console.log('å
³é宿¶å¨') |
| | | clearInterval(this.timingAcquisition) |
| | | this.timingAcquisition = null |
| | | } |
| | | }, |
| | | immediate: true |
| | | } |
| | | }, |
| | | methods: { |
| | | /** |
| | | * éè¿è½¦é´Idè°ç¨æ¥å£è·å设å¤ä¿¡æ¯å表 |
| | | * @param id 车é´Id |
| | | */ |
| | | getDeviceListByApi(id) { |
| | | console.log('éæ°å·æ°') |
| | | api.getDeviceListInWorkshopSignagePageApi(id).then((res) => { |
| | | if (res.result && res.result.length > 0) { |
| | | this.deviceList = res.result |
| | | this.deviceList_copy = res.result |
| | | } |
| | | }) |
| | | }, |
| | | |
| | | /** |
| | | * éè¿è½¦é´Idè°ç¨æ¥å£è·å车é´è¯¦ç»ä¿¡æ¯ |
| | | * @param id 车é´Id |
| | | */ |
| | | getWorkshopDetailsByApi(id) { |
| | | api.getWorkshopDetailByWorkshopIdApi(id).then((res) => { |
| | | this.workshopDetails = res.result |
| | | // this.$refs.deviceContainerRef.style.backgroundImage = `url(${this.getImgView( |
| | | // this.workshopDetails.backgroundImage |
| | | // )})` |
| | | this.imgSrc = this.getImgView(this.workshopDetails.backgroundImage) |
| | | this.$refs.deviceContainerRef.style.height = (this.windowHeight - this.pageHeaderHeight) + 'px' |
| | | // this.parentH = this.windowHeight - this.pageHeaderHeight |
| | | this.parentH = 900 |
| | | this.parentLimitation = true // å¨ç¶å
ç´ é«åº¦è®¾ç½®åå设置éå¶ææ½åºåï¼ä¸è¿æ ·ææ¦ç导è´ç¶å
ç´ é«åº¦æªè®¾ç½®å°±éå¶ææ½ |
| | | }) |
| | | }, |
| | | |
| | | /** |
| | | * å¾çé¢è§ |
| | | * @param text å¾çå°å |
| | | */ |
| | | getImgView(text) { |
| | | if (text && text.indexOf(',') > 0) { |
| | | text = text.substring(0, text.indexOf(',')) |
| | | } |
| | | return getFileAccessHttpUrl(text) |
| | | }, |
| | | |
| | | /** |
| | | * ç¹å»ä¿åæé®è°ç¨æ¥å£ä¿åææ½åçä½ç½®ä¸è®¾å¤å¾æ 尺寸 |
| | | */ |
| | | saveDevicePositionAndSizeByApi() { |
| | | console.log('触åä¿å') |
| | | if (this.isOperatingDevice) { |
| | | api.saveDevicePositionAndSizeApi(this.deviceList).then((res) => { |
| | | if (res.code === 200) { |
| | | this.$notification.success({ |
| | | message: 'æ¶æ¯', |
| | | description: res.message |
| | | }) |
| | | this.isOperatingDevice = false |
| | | if (this.isSwitchChecked) { |
| | | this.isSwitchChecked = false |
| | | this.isResizable = !this.isResizable |
| | | this.isDraggable = !this.isDraggable |
| | | } |
| | | this.getDeviceListByApi(this.$route.params.id) |
| | | } |
| | | }) |
| | | } else { |
| | | this.$notification.warning({ |
| | | message: 'æ¶æ¯', |
| | | description: '请å¼å¯åè½ååè¿è¡ä¿å' |
| | | }) |
| | | } |
| | | }, |
| | | |
| | | /** |
| | | * è®¾å¤ææ½æç¼©æ¾æ¶è§¦åäºä»¶ |
| | | * @param newRect ææ½æç¼©æ¾åç尺寸åè·ç¦» |
| | | * @param index ææ½è®¾å¤å¨æ°ç»ä¸ç䏿 |
| | | */ |
| | | resize(newRect, index) { |
| | | // if (newRect.width > 100) { |
| | | // if (newRect.width / newRect.height < 2) { |
| | | // this.deviceList[index].fontSize = newRect.width / 10 |
| | | // } else { |
| | | // this.deviceList[index].fontSize = newRect.height / 5 |
| | | // } |
| | | // } else { |
| | | // this.deviceList[index].fontSize = 12 |
| | | // } |
| | | this.showGuideline = 'block' |
| | | this.deviceList[index].vw = newRect.width |
| | | this.deviceList[index].vh = newRect.height |
| | | this.deviceList[index].coordinateTop = newRect.top |
| | | this.deviceList[index].coordinateLeft = newRect.left |
| | | this.guidelineXTop = newRect.top + newRect.height / 2 |
| | | this.guidelineYLeft = newRect.left + newRect.width / 2 |
| | | }, |
| | | |
| | | /** |
| | | * æ ¹æ®è®¾å¤ç¶æå¼è·å对åºè®¾å¤æ°é |
| | | * @param value 设å¤ç¶æå¼ |
| | | * @returns {number} è®¾å¤æ°é |
| | | */ |
| | | getDeviceNumberByStatus(value) { |
| | | if (value === 99) return this.deviceList_copy.length |
| | | return this.deviceList_copy.filter((item) => item.equipmentStatus === value).length |
| | | }, |
| | | |
| | | /** |
| | | * å¼å¯åè½è§¦åäºä»¶ |
| | | * @param checked å½åswitchç¶æï¼æ¯å¦å¼å¯ï¼åå§ä¸ºfalse |
| | | */ |
| | | handleSwitchChange(checked) { |
| | | this.isOperatingDevice = true |
| | | this.isResizable = !this.isResizable |
| | | this.isDraggable = !this.isDraggable |
| | | }, |
| | | |
| | | openDetail(item) { |
| | | if (!this.isSwitchChecked) { |
| | | if (item.equipmentStatus == 0) { |
| | | this.$message.warning('设å¤å¤äºå
³æºç¶æï¼') |
| | | return false |
| | | } |
| | | console.log(item) |
| | | console.log(this.$refs.EquipmentDetailModal) |
| | | this.$refs.EquipmentDetailModal.initData(item.equId) |
| | | this.$refs.EquipmentDetailModal.timerModel(item.equId) |
| | | // this.equipMessageTimer = setInterval(() => { |
| | | // setTimeout( this.$refs.equmentDetaiModel.initData(item.equipmentId),0) |
| | | // },1000*10) |
| | | } |
| | | }, |
| | | |
| | | /** |
| | | * æµè§å¨å°ºå¯¸åçæ¹åæ¶è§¦å |
| | | */ |
| | | handleWindowSizeChange() { |
| | | // this.isFullScreen = !this.isFullScreen |
| | | // if (!this.isFullScreen) location.reload() // å¦æä¸ºå
¨å±æ¨¡å¼ï¼åå¨åæ¢æ¨¡å¼æ¶éæ°å 载页é¢ä»¥éæ°è·åæµè§å¨å¯è§åºåé«åº¦ |
| | | const windowHeight = |
| | | window.innerHeight || |
| | | document.documentElement.clientHeight || |
| | | document.body.clientHeight |
| | | // this.parentH = 99999 |
| | | // const scaleRate = windowHeight / this.windowHeight |
| | | // this.windowHeight = windowHeight |
| | | this.$refs.deviceContainerRef.style.height = (windowHeight - this.pageHeaderHeight) + 'px' |
| | | // const timer = setTimeout(() => { |
| | | // this.deviceList.forEach(item => { |
| | | // item.coordinateTop = item.coordinateTop * scaleRate |
| | | // item.vh = item.vh * scaleRate |
| | | // console.log('vh', item.vh) |
| | | // }) |
| | | // this.parentH = windowHeight - this.pageHeaderHeight |
| | | // console.log('changeDeviceList', this.deviceList) |
| | | // }, 500) |
| | | // console.log('scaleRate', scaleRate) |
| | | }, |
| | | |
| | | checkboxChange(obj) { |
| | | //éè¦å¤ææ¯å¦å¼å¯åè½ï¼ç®çæ¯ä¸ºäºå
³é宿¶å¨é¿å
çéå设å¤è¢«å®æ¶å·æ°çæ°è®¾å¤è¦ç |
| | | if (this.isOperatingDevice) { |
| | | obj.checked = !obj.checked |
| | | if (obj.value !== 99) { |
| | | if (obj.checked) this.checkedStatusCount++ |
| | | else this.checkedStatusCount-- |
| | | } |
| | | |
| | | if (obj.value == 99) { |
| | | this.deviceStatusList.forEach(item => { |
| | | if (item.value !== obj.value) item.checked = obj.checked |
| | | }) |
| | | if (obj.checked) { |
| | | this.deviceList = this.deviceList_copy |
| | | this.checkedStatusCount = this.deviceStatusList.length - 1 |
| | | } else { |
| | | this.deviceList = [] |
| | | this.checkedStatusCount = 0 |
| | | } |
| | | } else { |
| | | this.deviceStatusList.forEach(item => { |
| | | if (item.value === 99) { |
| | | if (this.checkedStatusCount !== this.deviceStatusList.length - 1 || this.checkedStatusCount === 0) item.checked = false |
| | | if (this.checkedStatusCount === this.deviceStatusList.length - 1) item.checked = true |
| | | } |
| | | }) |
| | | if (obj.checked) { |
| | | this.deviceList.push(...this.deviceList_copy.filter(item => item.equipmentStatus === obj.value)) |
| | | } else { |
| | | this.deviceList = this.deviceList.filter(item => item.equipmentStatus !== obj.value) |
| | | } |
| | | } |
| | | } else { |
| | | this.$notification.warning({ |
| | | message: 'æ¶æ¯', |
| | | description: '请å¼å¯åè½ååè¿è¡çé' |
| | | }) |
| | | } |
| | | }, |
| | | |
| | | handleScreenDevive(obj) { |
| | | //éè¦å¤ææ¯å¦å¼å¯åè½ï¼ç®çæ¯ä¸ºäºå
³é宿¶å¨é¿å
çéå设å¤è¢«å®æ¶å·æ°çæ°è®¾å¤è¦ç |
| | | if (this.isOperatingDevice) { |
| | | obj.checked = true |
| | | this.deviceList = this.deviceList_copy |
| | | this.deviceStatusList.forEach(item => { |
| | | if (item.value !== obj.value) item.checked = false |
| | | }) |
| | | |
| | | if (obj.value == 99) this.deviceList = this.deviceList_copy |
| | | else this.deviceList = this.deviceList.filter(item => item.equipmentStatus === obj.value) |
| | | |
| | | } else { |
| | | this.$notification.warning({ |
| | | message: 'æ¶æ¯', |
| | | description: '请å¼å¯åè½ååè¿è¡çé' |
| | | }) |
| | | } |
| | | } |
| | | }, |
| | | created() { |
| | | if (this.$route.params.id) { |
| | | this.getDeviceListByApi(this.$route.params.id) |
| | | this.getWorkshopDetailsByApi(this.$route.params.id) |
| | | } |
| | | this.checkedStatusCount = this.deviceStatusList.length - 1 |
| | | }, |
| | | mounted() { |
| | | // ç¦æ¢ç¨æ·éä¸å
容 |
| | | document.onselectstart = () => false |
| | | |
| | | this.windowHeight = |
| | | window.innerHeight || |
| | | document.documentElement.clientHeight || |
| | | document.body.clientHeight |
| | | |
| | | // 夿æµè§å¨å¯è§åºåé«åº¦æ¯å¦çäºå辨çï¼è¥ç¸çå表示è¿å
¥æ¶æµè§å¨ä¸ºå
¨å±æ¨¡å¼ |
| | | // if (this.windowHeight === screen.height) this.isFullScreen = true |
| | | |
| | | window.addEventListener('resize', this.handleWindowSizeChange) |
| | | }, |
| | | beforeDestroy() { |
| | | // ç¡®ä¿éæ¯å®æ¶å¨ãäºä»¶ååæ¶èµæº |
| | | clearInterval(this.timingAcquisition) |
| | | this.timingAcquisition = null |
| | | } |
| | | } |
| | | </script> |
| | | |
| | | <style scoped lang="less"> |
| | | .full-screen-container { |
| | | background-image: url('../../../assets/Bj.jpg'); |
| | | background-size: 100% 100%; |
| | | color: #fff; |
| | | |
| | | .page-header { |
| | | /*font-size: 50px;*/ |
| | | /*text-align: center;*/ |
| | | /*position: relative;*/ |
| | | |
| | | .header-left { |
| | | height: 100%; |
| | | display: flex; |
| | | justify-content: center; |
| | | align-items: center; |
| | | padding-top: 20px; |
| | | } |
| | | |
| | | .workshop-name { |
| | | display: flex; |
| | | justify-content: center; |
| | | align-items: center; |
| | | font-size: 50px; |
| | | } |
| | | |
| | | .device-status-info { |
| | | height: 100%; |
| | | display: flex; |
| | | justify-content: flex-end; |
| | | align-items: center; |
| | | padding-top: 20px; |
| | | |
| | | .single-status-info { |
| | | margin: 10px; |
| | | cursor: pointer; |
| | | |
| | | .status-square { |
| | | width: 14px; |
| | | height: 14px; |
| | | border: 1px solid #fff; |
| | | border-radius: 3px; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | .content-container { |
| | | width: 100%; |
| | | background-repeat: no-repeat; |
| | | background-size: 100% 100%; |
| | | position: relative; |
| | | |
| | | .guideline { |
| | | position: absolute; |
| | | border: 1px dashed #ccc; |
| | | } |
| | | |
| | | .guidelineX { |
| | | width: 1920px; |
| | | left: 0; |
| | | } |
| | | |
| | | .guidelineY { |
| | | top: 0; |
| | | height: 900px; |
| | | } |
| | | |
| | | .single-device { |
| | | position: absolute; |
| | | border: 1px solid transparent; |
| | | padding: 10px; |
| | | display: flex; |
| | | flex-direction: column; |
| | | align-items: center; |
| | | justify-content: space-between; |
| | | cursor: default; |
| | | |
| | | &:active { |
| | | border: 1px solid #1890ff; |
| | | } |
| | | |
| | | .device-status { |
| | | width: 100%; |
| | | height: 100%; |
| | | display: flex; |
| | | -webkit-align-items: flex-end; |
| | | -moz-align-items: flex-end; |
| | | -ms-align-items: flex-end; |
| | | |
| | | .status-image { |
| | | background-size: 100% 100%; |
| | | background-repeat: no-repeat; |
| | | width: 10px; |
| | | height: 60%; |
| | | margin-right: 5px; |
| | | } |
| | | |
| | | .device-image { |
| | | background-size: 100% 100%; |
| | | background-repeat: no-repeat; |
| | | width: 100%; |
| | | height: 100%; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | /deep/ .ant-checkbox-inner { |
| | | background-color: transparent; |
| | | border-color: #fff; |
| | | } |
| | | </style> |