| | |
| | | <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" |
| | | <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" |
| | |
| | | :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' }"> |
| | | <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 |
| | | 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> |
| | | class="device-image" |
| | | ></div> |
| | | </div> |
| | | <div class="device-id" :style="{fontSize: item.fontSize+'px'}"> |
| | | {{item.equipmentId}} |
| | |
| | | |
| | | export default { |
| | | components: { |
| | | VueDragResize |
| | | VueDragResize, |
| | | }, |
| | | data() { |
| | | return { |
| | |
| | | { |
| | | label: '关机', |
| | | value: 0, |
| | | color: '#A8A8A8' |
| | | color: '#A8A8A8', |
| | | }, |
| | | { |
| | | label: '待机', |
| | | value: 2, |
| | | color: '#FFFF00' |
| | | color: '#FFFF00', |
| | | }, |
| | | { |
| | | label: '运行', |
| | | value: 3, |
| | | color: '#00EE00' |
| | | color: '#00EE00', |
| | | }, |
| | | { |
| | | label: '报警', |
| | | value: 22, |
| | | color: '#FF0000' |
| | | } |
| | | ] // 设备状态指示灯列表 |
| | | color: '#FF0000', |
| | | }, |
| | | ], // 设备状态指示灯列表 |
| | | } |
| | | }, |
| | | watch: { |
| | |
| | | this.timingAcquisition = null |
| | | } |
| | | }, |
| | | immediate: true |
| | | } |
| | | immediate: true, |
| | | }, |
| | | }, |
| | | methods: { |
| | | /** |
| | |
| | | */ |
| | | 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: res.message |
| | | description: res.message, |
| | | }) |
| | | this.isOperatingDevice = false |
| | | if (this.isSwitchChecked) { |
| | |
| | | } else { |
| | | this.$notification.warning({ |
| | | message: '消息', |
| | | description: '请开启功能后再进行保存' |
| | | 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 |
| | | } |
| | | }, |
| | | }, |
| | | created() { |
| | | if (this.$route.params.id) { |
| | |
| | | // 确保销毁定时器及回收资源 |
| | | clearInterval(this.timingAcquisition) |
| | | this.timingAcquisition = null |
| | | } |
| | | }, |
| | | } |
| | | </script> |
| | | |
| | |
| | | } |
| | | } |
| | | } |
| | | |
| | | } |
| | | } |
| | | </style> |