| | |
| | | <!-- |
| | | * @Date: 2024-01-05 23:47:53 |
| | | * @LastEditors: Sneed |
| | | * @LastEditTime: 2024-01-30 20:41:19 |
| | | * @LastEditTime: 2024-02-03 00:01:58 |
| | | * @FilePath: /belleson-frontend/Users/mache/Documents/demo/mdc/src/container/mapPreview/Map.vue |
| | | --> |
| | | <template> |
| | |
| | | :width="v.colspan * height + 'px'" :height="v.rowspan * height + 'px'" v-for="v in item" |
| | | :rowspan="v.rowspan" :colspan="v.colspan" :key="v.rowIndex + '-' + v.colIndex"> |
| | | <div class="td-div" :style="{width:v.colspan * height - 2 + 'px',height: v.rowspan * height - 2 + 'px',overflow:'hidden'}"> |
| | | <Device v-if="v.id" :id="v.id" style="width: 100%;height: 100%;" |
| | | <Device @toDetail="toDetail(v)" v-if="v.id" :id="v.id" style="width: 100%;height: 100%;" |
| | | :deviceList="deviceList" :plantDeviceList="plantDeviceList"></Device> |
| | | </div> |
| | | </td> |
| | |
| | | } |
| | | import mixins from '@/mixins/index' |
| | | import Device from '../workshop/device.vue' |
| | | import { getRequest, getUrl } from '@/api/Api' |
| | | export default { |
| | | mixins: [mixins], |
| | | components: { |
| | |
| | | map: null, // 地图数据 |
| | | leftMax: 0, |
| | | marginLeft: 0, |
| | | direction: true |
| | | direction: true, |
| | | plantDeviceList: [] |
| | | } |
| | | }, |
| | | watch: { |
| | |
| | | this.height = (document.querySelector('.table').getBoundingClientRect().height - 30) / 20 |
| | | }, |
| | | id: { |
| | | handler() { |
| | | |
| | | handler(val) { |
| | | if (this.move) { |
| | | this.marginLeft = 0 |
| | | this.$nextTick(() => { |
| | |
| | | } |
| | | }) |
| | | } |
| | | |
| | | if(val) { |
| | | getRequest('machineList',{plantId: val}).then(res => { |
| | | this.plantDeviceList = res.list.map(item => { |
| | | return { |
| | | machineId: item.id, |
| | | machineName: item.machineName |
| | | } |
| | | }) || [] |
| | | }) |
| | | } |
| | | }, |
| | | immediate: true |
| | | } |
| | |
| | | } |
| | | }, |
| | | methods: { |
| | | toDetail(v) { |
| | | if(this.move) return |
| | | let info = {} |
| | | if (v.id) { |
| | | info = this.plantDeviceList.find(item => item.id == v.id) |
| | | } |
| | | window.localStorage.setItem('deviceInfo',JSON.stringify(info)) |
| | | this.$router.push({ |
| | | name: 'mapPreviewDetail', |
| | | query: { |
| | | id: v.id, |
| | | name: info.workshop |
| | | } |
| | | }) |
| | | }, |
| | | moveFn() { |
| | | if (this.marginLeft <= this.leftMax && this.marginLeft >= -5) { |
| | | if (this.direction) { |