| | |
| | | <template> |
| | | <dv-full-screen-container class="full-screen-container"> |
| | | <header class="page-header"> |
| | | {{workshopDetails.workshopName}} |
| | | {{ workshopDetails.workshopName }} |
| | | <div class="header-right" v-has="'home:saveDevicePositionAndSize'"> |
| | | <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-switch |
| | | checked-children="开" |
| | | un-checked-children="关" |
| | | @change="handleSwitchChange" |
| | | v-model="isSwitchChecked" |
| | | :disabled="isSwitchChecked" |
| | | /> |
| | | </a-space> |
| | | <a-button type="primary" icon="save" size="large" @click="saveDevicePositionAndSizeByApi" |
| | | >保存位置 |
| | | </a-button> |
| | | <a-button type="primary" icon="save" size="large" @click="saveDevicePositionAndSizeByApi">保存位置</a-button> |
| | | </div> |
| | | </header> |
| | | |
| | | <dv-border-box-8> |
| | | <div class="content-container" ref="deviceContainerRef"> |
| | | <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="true" |
| | | :minw="100" |
| | | :minh="100" |
| | | :isDraggable="isDraggable" |
| | | :isResizable="isResizable" |
| | | :stickSize="6" |
| | | <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="true" |
| | | :minw="100" |
| | | :minh="100" |
| | | :isDraggable="isDraggable" |
| | | :isResizable="isResizable" |
| | | :stickSize="6" |
| | | > |
| | | <div class="single-device" |
| | | :style="{width: item.vw+ 'px',height:item.vh+'px'}"> |
| | | <div class="single-device" :style="{ width: item.vw + 'px', height: item.vh + 'px' }" |
| | | @mouseenter="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)||require('@/assets/8.png')})`}" |
| | | class="device-image"></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) || require('@/assets/8.png')})` }" |
| | | class="device-image" |
| | | ></div> |
| | | </div> |
| | | <div class="device-id" :style="{fontSize: item.fontSize+'px'}"> |
| | | {{item.equipmentId}} |
| | | <div class="device-id" :style="{ fontSize: item.fontSize + 'px' }"> |
| | | {{ item.equipmentId }} |
| | | </div> |
| | | </div> |
| | | </VueDragResize> |
| | | <div class="device-status-info"> |
| | | <div v-for="item in deviceStatusList" :key="item.value" class="single-status-info"> |
| | | <div>{{item.label}}</div> |
| | | <div class="status-square" :style="{backgroundColor:item.color}"></div> |
| | | <div>{{getDeviceNumberByStatus(item.value)}}</div> |
| | | <div>{{ item.label }}</div> |
| | | <div class="status-square" :style="{ backgroundColor: item.color }"></div> |
| | | <div>{{ getDeviceNumberByStatus(item.value) }}</div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </dv-border-box-8> |
| | | |
| | | <EquipmentDetailModal ref="EquipmentDetailModal"></EquipmentDetailModal> |
| | | </dv-full-screen-container> |
| | | </template> |
| | | |
| | |
| | | import VueDragResize from 'vue-drag-resize' |
| | | import api from '@/api/mdc' |
| | | import { getFileAccessHttpUrl } from '@/api/manage' |
| | | import EquipmentDetailModal from './mdc/base/modules/WorkshopSignage/EquipmentDetailModal' |
| | | import { message } from 'ant-design-vue' |
| | | |
| | | message.config({ |
| | | maxCount: 3 |
| | | }) |
| | | |
| | | export default { |
| | | components: { |
| | | VueDragResize |
| | | VueDragResize, |
| | | EquipmentDetailModal |
| | | }, |
| | | data() { |
| | | return { |
| | |
| | | */ |
| | | getDeviceListByApi(id) { |
| | | console.log('重新刷新') |
| | | api.getDeviceListInWorkshopSignagePageApi(id).then(res => { |
| | | api.getDeviceListInWorkshopSignagePageApi(id).then((res) => { |
| | | if (res.result && res.result.length > 0) { |
| | | this.deviceList = res.result |
| | | } |
| | |
| | | * @param id 车间Id |
| | | */ |
| | | getWorkshopDetailsByApi(id) { |
| | | api.getWorkshopDetailByWorkshopIdApi(id).then(res => { |
| | | api.getWorkshopDetailByWorkshopIdApi(id).then((res) => { |
| | | this.workshopDetails = res.result |
| | | this.$refs.deviceContainerRef.style.backgroundImage = `url(${this.getImgView(this.workshopDetails.backgroundImage)})` |
| | | this.$refs.deviceContainerRef.style.backgroundImage = `url(${this.getImgView( |
| | | this.workshopDetails.backgroundImage |
| | | )})` |
| | | }) |
| | | }, |
| | | |
| | |
| | | saveDevicePositionAndSizeByApi() { |
| | | console.log('触发保存') |
| | | if (this.isOperatingDevice) { |
| | | api.saveDevicePositionAndSizeApi(this.deviceList).then(res => { |
| | | api.saveDevicePositionAndSizeApi(this.deviceList).then((res) => { |
| | | if (res.code === 200) { |
| | | this.$notification.success({ |
| | | message: '消息', |
| | |
| | | description: '请开启功能后再进行保存' |
| | | }) |
| | | } |
| | | |
| | | }, |
| | | |
| | | /** |
| | |
| | | * @returns {number} 设备数量 |
| | | */ |
| | | getDeviceNumberByStatus(value) { |
| | | return this.deviceList.filter(item => item.equipmentStatus === value).length |
| | | return this.deviceList.filter((item) => item.equipmentStatus === value).length |
| | | }, |
| | | |
| | | /** |
| | |
| | | this.isOperatingDevice = true |
| | | this.isResizable = !this.isResizable |
| | | this.isDraggable = !this.isDraggable |
| | | }, |
| | | |
| | | openDetail(item) { |
| | | if (!this.isSwitchChecked) { |
| | | if (item.equipmentStatus == 0) { |
| | | // this.$message.warn("设备处于关机状态!"); |
| | | 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) |
| | | } |
| | | } |
| | | |
| | | }, |
| | | created() { |
| | | if (this.$route.params.id) { |
| | |
| | | } |
| | | } |
| | | } |
| | | |
| | | } |
| | | } |
| | | </style> |