gaosp
2024-01-16 f8901c0adf0afada9620203eeeebb4fe59e7ce89
修改地图
已修改5个文件
122 ■■■■ 文件已修改
src/container/mapPreview/Map.vue 61 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/container/mapPreview/index.vue 25 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/container/preview/index.vue 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/container/workshop/device.vue 17 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/mixins/index.js 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/container/mapPreview/Map.vue
@@ -1,34 +1,13 @@
<!--
 * @Date: 2024-01-05 23:47:53
 * @LastEditors: Sneed
 * @LastEditTime: 2024-01-14 16:50:48
 * @FilePath: /belleson-frontend/Users/mache/Documents/demo/mdc/src/container/Map/Map.vue
 * @LastEditTime: 2024-01-16 22:37:15
 * @FilePath: /belleson-frontend/Users/mache/Documents/demo/mdc/src/container/mapPreview/Map.vue
-->
<template>
    <div class="map">
        <div class="map-container" v-if="!addStatus">
            <div class="table-tool" v-if="status !== 2">
                <el-button style="width: 150px;" type="primary" size="mini" @click="save">保存</el-button>
                <el-button style="width: 150px;" size="mini" @click="out">退出</el-button>
                <el-input v-show="status !==2" v-model="rows" />
                <el-input v-show="status !==2" v-model="cols" />
                <el-button size="mini" v-show="status !==2" @click="createMap">生成地图</el-button>
                <div class="plant-name" v-if="status===2">{{plantName}}</div>
                <el-input class="plant-name" v-if="status!==2" v-model="plantName" placeholder="请输入厂名"/>
            </div>
            <div class="table" :class="$route.name ==='preview' ? 'active' : ''" >
                <div class="table-action" :style="position" v-show="showAction && status !== 2">
                    <div @click="merge">合并</div>
                    <div @click="split">拆分</div>
                    <div @click="sign(1)">过道</div>
                    <div @click="sign(2)">机床</div>
                    <div @click="sign(0)">取消</div>
                    <div @click="edit" v-if="showEdit">修改机床</div>
                    <!-- <div>增加行</div> -->
                    <!-- <div>删除行</div> -->
                    <!-- <div>增加列</div> -->
                    <!-- <div>删除列</div> -->
                </div>
                <div :style="{width: (cols * height + 'px'),height: rows * height + 'px'}">
                    <table >
                        <tr v-for="(item, index) in map" :key="index">
@@ -38,45 +17,15 @@
                            :class="{'active': (range.x !=='' && v.rowIndex >=range.x && v.rowIndex<=range.x1 && v.colIndex>=range.y && v.colIndex<=range.y1),aisle: v.type ===1}" @mousedown="e => onMousedown(e, v)" @mousemove="e => onMouseMove(e, v)" v-for="v in item"
                                :rowspan="v.rowspan" :colspan="v.colspan" :key="v.rowIndex + '-' + v.colIndex">
                                <img @click="addDevice($event,v)" @mousedown="e => e.stopPropagation()" v-if="v.type ===2 && status!==2 && !v.id" src="./img/+.png" alt="">
                                <!-- <div  v-show="v.id" class="machine">
                                    <p>YKX123123213</p>
                                    <div>
                                        <div class="img">
                                            <img src="./img/machine.png" alt="">
                                        </div>
                                        <ul>
                                            <li>
                                                <img src="./img/sd.png" alt="">
                                                <div>
                                                    <p>0.00%</p>
                                                    <p>能力利用率</p>
                                                </div>
                                            </li>
                                            <li>
                                                <img src="./img/sd.png" alt="">
                                                <div>
                                                    <p>0.00%</p>
                                                    <p>能力利用率</p>
                                                </div>
                                            </li>
                                            <li>
                                                <img src="./img/sd.png" alt="">
                                                <div>
                                                    <p>0.00%</p>
                                                    <p>能力利用率</p>
                                                </div>
                                            </li>
                                        </ul>
                                    </div>
                                </div> -->
                                <Device v-if="v.id" :id="v.id" style="width: 100%;height: 100%;"></Device>
                                <!-- <Device v-if="v.id" :id="v.id" style="width: 100%;height: 100%;"></Device> -->
                                <Device v-if="v.id" :id="v.id" style="width: 100%;height: 100%;" :deviceList="deviceList"
:plantDeviceList="plantDeviceList" ::info="info"></Device>
                            </td>
                        </tr>
                    </table>
                </div>
            </div>
        </div>
        <addMachine :id="id" :machineid="machineid" @setmachineId="setmachineId" v-else @close="close"/>
    </div>
    
</template>
src/container/mapPreview/index.vue
@@ -1,19 +1,14 @@
<!--
 * @Date: 2024-01-05 22:26:22
 * @LastEditors: Sneed
 * @LastEditTime: 2024-01-15 22:09:41
 * @LastEditTime: 2024-01-16 22:50:48
 * @FilePath: /belleson-frontend/Users/mache/Documents/demo/mdc/src/container/mapPreview/index.vue
-->
<template>
    <div class="workshop">
        <Map v-if="status === 0 || status === 1 && id" :status="status" :currentMap="currentMap" :name="plantName" :id="id"
            @out="out" />
        <div v-else class="preview">
        <div class="preview">
            <LeftStatus class="left" :info="info">
                <template>
                    <!-- <div @click="editMap" class="edit-btn">
                        {{ id ? '进入编辑状态' : '新增' }}
                    </div> -->
                    <el-select clearable class="left-select" v-model="id" placeholder="请选择">
                        <el-option v-for="item in mapList" :key="item.id" :label="item.name" :value="item.id">
                        </el-option>
@@ -23,7 +18,7 @@
            <div class="right">
                <Status v-show="id" :info="info" />
                <div class="preview-map">
                    <Map v-if="id" :status="2" :currentMap="currentMap" @out="out" />
                    <Map v-if="id" :id="id" :status="2" :currentMap="currentMap" @out="out" />
                </div>
            </div>
        </div>
@@ -35,6 +30,7 @@
import LeftStatus from './LeftStatus.vue'
import { getRequest, getUrl } from '@/api/Api'
import { mapGetters } from 'vuex'
export default {
    components: {
        Map,
@@ -97,8 +93,6 @@
    },
    methods: {
        getMapList() {
            // this.$store.dispatch('GetPlanList', {})
            this.$store.dispatch('GetPlanList', {}).then(res => {
                try {
                    this.mapList = this.workshopList.filter(v => v.gridSetting && v.gridSetting != '{}')
@@ -110,17 +104,6 @@
                    console.error(error)
                }
            })
        },
        editMap() {
            if (this.id) {
                this.status = 1
            } else {
                this.status = 0
            }
        },
        out() {
            this.status = 2
            this.getMapList()
        },
    },
    mounted() {
src/container/preview/index.vue
@@ -1,7 +1,7 @@
<!--
 * @Date: 2024-01-05 22:26:22
 * @LastEditors: Sneed
 * @LastEditTime: 2024-01-13 23:03:31
 * @LastEditTime: 2024-01-16 22:54:39
 * @FilePath: /belleson-frontend/Users/mache/Documents/demo/mdc/src/container/preview/index.vue
-->
<template>
@@ -22,14 +22,14 @@
            <div class="right">
                <Status v-show="id" :info="info"/>
                <div class="preview-map">
                    <Map v-if="id" :status="2" :currentMap="currentMap"  @out="out" />
                    <Map v-if="id" :id="id" :status="2" :currentMap="currentMap"  @out="out" />
                </div>
            </div>
        </div>
    </div>
</template>
<script>
    import Map from '../Map/Map.vue';
    import Map from '../mapPreview/Map.vue';
    import Status from '@/components/newComp/Status'
    import LeftStatus from '../Map/LeftStatus.vue'
    import { getRequest, getUrl } from '@/api/Api'
@@ -99,16 +99,12 @@
                try {
                    this.mapList = this.workshopList.filter (v => v.gridSetting && v.gridSetting!='{}')
                    if (this.mapList.length === 0) {
                        this.status = 0
                        this.status = 2
                    }
                    this.id =this.mapList[0].id
                } catch (error) {
                    console.error(error)
                }
            },
            out () {
                this.status = 2
                this.getMapList()
            },
        },
        mounted () {
src/container/workshop/device.vue
@@ -1,7 +1,7 @@
<!--
 * @Date: 2024-01-13 20:46:33
 * @LastEditors: Sneed
 * @LastEditTime: 2024-01-16 01:08:39
 * @LastEditTime: 2024-01-16 22:57:59
 * @FilePath: /belleson-frontend/Users/mache/Documents/demo/mdc/src/container/workshop/device.vue
-->
<template>
@@ -85,13 +85,18 @@
            return this.info.cycleCount || 0
        },
        machineName () {
            debugger
            let machineName = ''
            try {
                let arr = [...this.deviceList,...this.plantDeviceList]
                return arr.find(item => item.machineId=== this.id).machineName
            } catch (error) {
                return this.id
                machineName =  this.deviceList.find(item => item.machineId=== this.id).machineName
            } catch (error) {console.error(error)}
            try {
                machineName =  this.plantDeviceList.find(item => item.machineId=== this.id).machineName
            } catch (error) {console.error(error)}
            if (machineName) {
                return machineName
            }
            return ''
        }
    },
    methods: {
src/mixins/index.js
@@ -1,7 +1,7 @@
/*
 * @Date: 2024-01-07 22:18:41
 * @LastEditors: Sneed
 * @LastEditTime: 2024-01-16 01:10:15
 * @LastEditTime: 2024-01-16 22:46:42
 * @FilePath: /belleson-frontend/Users/mache/Documents/demo/mdc/src/mixins/index.js
 */
import { getUseDpts, getRequest } from '@/api/Api'
@@ -29,8 +29,8 @@
        id: {
            handler (val) {
                if(val) {
                    debugger
                    getRequest('machineList',{plantId: val}).then(res => {
                        debugger
                        this.plantDeviceList = res.data.list.map(item => {
                            return {
                                machineId: item.id,
@@ -50,7 +50,8 @@
                        }
                    })
                }
            }
            },
            immediate:true
        }
    },
    mounted () {