gaosp
2024-02-03 4145f51803841d33fa68673f2b6aa6e451bf9461
修改地图操作
已修改10个文件
已添加1个文件
488 ■■■■ 文件已修改
src/api/MdcApi.js 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/container/Map/Map.vue 118 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/container/Map/index.vue 84 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/container/list/index.vue 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/container/mapList/index.vue 176 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/container/mapPreview/Map.vue 37 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/container/mapPreview/index.vue 40 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/container/mapPreviewDetail/index.vue 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/container/preview/index.vue 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/router/index.js 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/utils/ajax.js 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/MdcApi.js
@@ -116,7 +116,7 @@
  WEB_SOCKET_URL: ''
}
export function getPlanList (params) {
  return ajax.post(HttpConstants.GET_PLANTLIST, params)
  return ajax.get(HttpConstants.GET_PLANTLIST, params)
}
// å½“前用户
export function initApplicationCfg() {
src/container/Map/Map.vue
@@ -1,7 +1,7 @@
<!--
 * @Date: 2024-01-05 23:47:53
 * @LastEditors: Sneed
 * @LastEditTime: 2024-01-31 21:10:02
 * @LastEditTime: 2024-02-03 00:01:53
 * @FilePath: /belleson-frontend/Users/mache/Documents/demo/mdc/src/container/Map/Map.vue
-->
<template>
@@ -9,17 +9,18 @@
        <div class="map-container">
            <div class="table-tool">
                <slot name="tool"></slot>
                <el-button v-show="!id" class="input" type="ghost" size="mini" @click="out">退出</el-button>
                <el-button class="input" type="ghost" size="mini" @click="save">保存</el-button>
                <el-button v-show="id" class="input" type="ghost" size="mini" @click="del">删除该地图</el-button>
                <span>行数:</span>
                <el-input style="width: 70px;" class="input" v-show="status !== 2" v-model="rows" />
                <span>列数:</span>
                <el-input style="width: 70px;" class="input" v-show="status !== 2" v-model="cols" />
                <!-- <el-button v-show="!id" class="input" type="ghost" size="mini" @click="out">退出</el-button> -->
                <!-- <el-button v-show="id" class="input" type="ghost" size="mini" @click="del">删除该地图</el-button> -->
                <!-- <span>行数:</span> -->
                <!-- <el-input style="width: 70px;" class="input" v-show="status !== 2" v-model="rows" /> -->
                <!-- <span>列数:</span> -->
                <!-- <el-input style="width: 70px;" class="input" v-show="status !== 2" v-model="cols" /> -->
                <!-- <div class="plant-name" v-if="status===2">{{plantName}}</div> -->
                <span>名称:</span>
                <el-input style="width: 150px;" class="input"  v-model="plantName" placeholder="请输入地图名称" />
                <el-button class="input" size="mini" type="primary" v-show="status !== 2" @click="createMap">生成地图</el-button>
                <el-input style="width: 150px;" class="input" v-model="plantName" placeholder="请输入地图名称" />
                <el-button class="input" type="ghost" size="mini" @click="save">保存</el-button>
                <!-- <el-button class="input" size="mini" type="primary" v-show="status !== 2" @click="createMap">生成地图</el-button> -->
            </div>
            <div class="table" :class="$route.name === 'preview' ? 'active' : ''">
                <div class="table-actions" :style="position" v-show="showAction && status !== 2">
@@ -34,18 +35,18 @@
                <div :style="{ width: (cols * height + 'px'), height: rows * height + 'px' }">
                    <table>
                        <tr v-for="(item, index) in map" :key="index">
                            <td v-if="v.rowspan !== 0 && v.colspan !== 0"
                                :width="v.colspan * height + 'px'"
                            <td v-if="v.rowspan !== 0 && v.colspan !== 0" :width="v.colspan * height + 'px'"
                                :height="v.rowspan * height + 'px'"
                                :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"
                                @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">
                                <div class="td-div" :style="{width:v.colspan * height - 2 + 'px',height: v.rowspan * height - 2 + 'px',overflow:'hidden'}">
                                <div class="td-div"
                                    :style="{ width: v.colspan * height - 2 + 'px', height: v.rowspan * height - 2 + 'px', overflow: 'hidden' }">
                                    <img @click="addDevice($event, v)" @mousedown="e => e.stopPropagation()"
                                    v-if="v.type === 2 && status !== 2 && !v.id" src="./img/+.png" alt="添加机床" title="添加机床">
                                    <Device v-if="v.id" :id="v.id" style="width: 100%;height: 100%;" :deviceList="deviceList"
                                        :plantDeviceList="plantDeviceList" ::info="info"></Device>
                                        v-if="v.type === 2 && status !== 2 && !v.id" src="./img/+.png" alt="添加机床"
                                        title="添加机床">
                                    <Device v-if="v.id" :id="v.id" style="width: 100%;height: 100%;"
                                        :deviceList="deviceList" :plantDeviceList="plantDeviceList" ::info="info"></Device>
                                </div>
                            </td>
                        </tr>
@@ -53,14 +54,31 @@
                </div>
            </div>
        </div>
        <el-dialog class="add-device" title="放置设备" top="94px" :close-on-click-modal="false" width="400px" :visible.sync="addStatus" >
        <el-dialog class="add-device" title="放置设备" top="94px" :close-on-click-modal="false" width="400px"
            :visible.sync="addStatus" @close="addStatus = false">
            <el-select class="wkshoplist" clearable v-model="deviceId" placeholder="请选择">
                <el-option v-show="!hasPushed.includes(item.machineId)" v-for="item in deviceList" :key="item.machineId" :label="item.machineName"
                    :value="item.machineId">
                <el-option v-show="!hasPushed.includes(item.machineId)" v-for="item in deviceList" :key="item.machineId"
                    :label="item.machineName" :value="item.machineId">
                </el-option>
            </el-select>
            <span slot="footer" class="dialog-footer">
                <el-button size="mini" type="primary" style="background-color: #409EFF;" @click="saveDevice">保存</el-button>
            </span>
        </el-dialog>
        <el-dialog class="add-device" title="生成地图" top="94px" :close-on-click-modal="false" width="400px"
            :visible.sync="showMapSet" :show-close="false">
            <div>
                <p>
                    <span>行数:</span>
                    <el-input style="width: 100px;" class="input" v-show="status !== 2" v-model="rows" />
                </p>
                <p style="margin-top: 20px;">
                    <span>列数:</span>
                    <el-input style="width: 100px;" class="input" v-show="status !== 2" v-model="cols" />
                </p>
            </div>
            <span slot="footer" class="dialog-footer">
                <el-button size="mini" type="primary" style="background-color: #409EFF;" @click="createMap">生成地图</el-button>
            </span>
        </el-dialog>
    </div>
@@ -76,6 +94,7 @@
import mixins from '@/mixins/index'
import Device from '../workshop/device.vue'
import { mapGetters } from 'vuex'
import { getRequest, getUrl } from '@/api/Api'
export default {
    mixins: [mixins],
    components: {
@@ -83,10 +102,6 @@
        Device
    },
    props: {
        status: {
            type: Number,
            default: 0
        },
        currentMap: {
            default: []
        },
@@ -188,14 +203,14 @@
            if (!val) {
                this.map = []
            } else {
                // getRequest('machineList',{plantId: val}).then(res => {
                //         this.plantDeviceList = res.list.map(item => {
                //             return {
                //                 machineId: item.id,
                //                 machineName: item.machineName
                //             }
                //         }) || []
                //     })
                getRequest('machineList',{plantId: val}).then(res => {
                        this.plantDeviceList = res.list.map(item => {
                            return {
                                machineId: item.id,
                                machineName: item.machineName
                            }
                        }) || []
                    })
            }
        },
        currentMap: {
@@ -219,6 +234,11 @@
        },
        map() {
            this.height = (document.querySelector('.table').getBoundingClientRect().height - 30) / 20
        }
    },
    created () {
        if (!this.id) {
            this.showMapSet = true
        }
    },
    mounted() {
@@ -249,10 +269,15 @@
        }
    },
    methods: {
        back() {
            this.$router.push({
                name: 'mapList'
            })
        },
        addRow() {
            this.rows +=1
            this.rows += 1
            let row = []
            for(var i=0;i<this.cols;i++) {
            for (var i = 0; i < this.cols; i++) {
                row.push({
                    rowspan: 1,
                    colspan: 1,
@@ -267,13 +292,13 @@
        },
        addCol() {
            this.cols += 1
            for(var i=0;i<this.rows;i++) {
            for (var i = 0; i < this.rows; i++) {
                this.map[i].push(
                    {
                        rowspan: 1,
                        colspan: 1,
                        rowIndex: this.rows - 1,
                        colIndex: i,
                        rowIndex: i,
                        colIndex: this.cols - 1,
                        type: ''
                    }
                )
@@ -306,6 +331,7 @@
                    data.push(arr)
                }
                this.map = data
                this.showMapSet = false
            }
        },
        contextmenu(e) {
@@ -332,7 +358,7 @@
        },
        onMousedown(e, v) {
            console.log('-----',v)
            console.log('-----', v)
            if (e.button !== 0) return
            this.tdMounseDown = true
            this.showAction = false
@@ -407,8 +433,8 @@
            e.stopPropagation()
            this.addStatus = true
            let hasPushed = []
            this.map.forEach(item  => {
                item.forEach(v =>  {
            this.map.forEach(item => {
                item.forEach(v => {
                    if (v.id) {
                        hasPushed.push(v.id)
                    }
@@ -457,7 +483,6 @@
                        message: '操作成功'
                    })
                    this.$emit('out')
                    console.log(res)
                })
            } else {
                this.$http.postJson('/plant/modify', {
@@ -470,7 +495,6 @@
                        message: '操作成功'
                    })
                    this.$emit('out')
                    console.log(res)
                })
            }
@@ -591,10 +615,11 @@
        z-index: 999;
        color: #fff;
        width: 100px;
        background: rgba(22,26,25,.8);
        background: rgba(22, 26, 25, .8);
        border: 2px solid #416071;
        color: #ADAEAE;
        text-align: center;
        div {
            cursor: pointer;
            padding: 8px 0;
@@ -613,6 +638,7 @@
        overflow: hidden;
        border-radius: 10px;
        display: table;
        // box-sizing: border-box;
        td {
            // width: 50px;
@@ -621,17 +647,19 @@
            border: 1px solid #1662DB;
            vertical-align: middle;
            text-align: center;
            .td-div {
                display: flex;
                align-items: center;
                justify-content: center;
                &>img {
                    width: 20px;
                    height: 20px;
                    cursor: pointer;
                }
            }
            .machine {
                width: 100%;
src/container/Map/index.vue
@@ -1,20 +1,27 @@
<!--
 * @Date: 2024-01-05 22:26:22
 * @LastEditors: Sneed
 * @LastEditTime: 2024-01-31 21:07:07
 * @LastEditTime: 2024-02-02 23:37:37
 * @FilePath: /belleson-frontend/Users/mache/Documents/demo/mdc/src/container/Map/index.vue
-->
<template>
    <div class="workshop">
        <Map :id="id" :status="status" :currentMap="currentMap" @out="out" :name="plantName">
        <Nav :name="nav">
            <template>
                <span class="back" @click="back">
                    è¿”回
                </span>
            </template>
        </Nav>
        <Map :id="id" :currentMap="currentMap" @out="out" :name="plantName">
            <template slot="tool">
                <div class="workshop-tool">
                    <span v-show="id">车间地图:</span>
                    <el-select style="width: 150px" v-show="id" class="wkshoplist" v-model="id" placeholder="请选择">
                    <!-- <span v-show="id">车间地图:</span> -->
                    <!-- <el-select style="width: 150px" v-show="id" class="wkshoplist" v-model="id" placeholder="请选择">
                        <el-option v-for="item in mapList" :key="item.id" :label="item.name" :value="item.id">
                        </el-option>
                    </el-select>
                    <el-button size="mini" type="ghost" @click="id=''" v-show="id">新增</el-button>
                    </el-select> -->
                    <!-- <el-button size="mini" type="ghost" @click="id=''" v-show="id">新增</el-button> -->
                </div>
            </template>
        </Map>
@@ -22,48 +29,20 @@
</template>
<script>
import Map from './Map.vue';
import Nav from '@/components/nav'
import { getRequest, getUrl } from '@/api/Api'
import { mapGetters } from 'vuex'
export default {
    components: {
        Map,
        Nav
    },
    computed: {
        ...mapGetters(['workshopList'])
    },
    watch: {
        id(val) {
            if (!val) {
                this.currentMap = ''
                this.plantName = ''
                return
            }
            try {
                this.currentMap = JSON.parse(this.mapList.find(item => item.id === this.id).gridSetting)
                this.plantName = this.mapList.find(item => item.id === this.id).name
            } catch (error) {
            }
            // getRequest('machineList', {
            //     plantId: this.id,
            // }).then(res => {
            //     // this.list = res.data.list
            //     this.info = {
            //         runRate: res.data.runRate,
            //         cutRate: res.data.cutRate,
            //         alarmRate: res.data.alarmRate,
            //         threeShiftRate: res.data.threeShiftRate,
            //         twoShiftRate: res.data.twoShiftRate,
            //         run: res.data.run,
            //         alarm: res.data.alarm,
            //         stop: res.data.stop,
            //         idle: res.data.idle
            //     }
            // })
        }
    },
    data() {
        return {
            nav: '',
            id: '',
            currentMap: [],
            plantName: '',
@@ -72,32 +51,39 @@
        }
    },
    methods: {
        back () {
            this.$router.push({
                name: 'mapList'
            })
        },
        getMapList() {
            // this.$store.dispatch('GetPlanList', {})
            this.$store.dispatch('GetPlanList', {}).then(res => {
                try {
                    this.mapList = this.workshopList.filter(v => v.gridSetting && v.gridSetting != '{}')
                    if (this.mapList.length === 0) {
                        this.status = 0
                    }
                    this.id = this.mapList[0].id
                    this.status = 1
                } catch (error) {
                    console.error(error)
                }
            })
        },
        addMap() {
            this.status = 0
            this.id = ''
        },
        out() {
            this.getMapList()
            this.back()
        },
    },
    mounted() {
        this.getMapList()
    created() {
        if (this.$route.query.id) {
            this.currentMap = JSON.parse(localStorage.getItem('map'))
            this.plantName = this.$route.query.name
            this.id = this.$route.query.id
            this.nav = '编辑地图'
        }  else {
            this.nav = '新增地图'
        }
        // this.getMapList()
    }
}
</script>
@@ -128,5 +114,9 @@
            margin-right: 20px;
        }
    }
    .back {
        margin-left: auto;
        cursor: pointer;
    }
}
</style>
src/container/list/index.vue
@@ -1,12 +1,12 @@
<!--
 * @Date: 2024-01-06 17:40:19
 * @LastEditors: Sneed
 * @LastEditTime: 2024-01-29 23:07:39
 * @LastEditTime: 2024-02-02 22:12:14
 * @FilePath: /belleson-frontend/Users/mache/Documents/demo/mdc/src/container/list/index.vue
-->
<template>
    <div class="list">
        <div class="search">
        <div class="search" v-show="!hideSearchBox">
            <slot name="search"></slot>
        </div>
        <div class="table">
@@ -53,6 +53,10 @@
        props: {
            url: {
                type: String
            },
            hideSearchBox: {
                type: Boolean,
                default: false
            }
        },
        data () {
src/container/mapList/index.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,176 @@
<!--
 * @Date: 2024-01-06 17:40:19
 * @LastEditors: Sneed
 * @LastEditTime: 2024-02-02 23:08:14
 * @FilePath: /belleson-frontend/Users/mache/Documents/demo/mdc/src/container/mapList/index.vue
-->
<template>
    <div class="maintenance">
        <Nav name="车间地图"></Nav>
        <List ref="list" url="/plant/pageQuery" :hideSearchBox="true">
            <template slot="table-tool">
                <el-button type="primary" size="mini" @click="add">新增地图</el-button>
            </template>
            <template slot="columns">
                <el-table-column type="index" label="序号" align="center" width="55">
                </el-table-column>
                <el-table-column label="名称" align="center" prop="name">
                </el-table-column>
                <el-table-column label="设备数量" align="center" prop="machineCount">
                </el-table-column>
                <el-table-column width="" fixed="right" align="center" label="操作">
                    <template slot-scope="scope">
                        <a class="table-action table-edit" @click="view(scope.row)">查看</a>
                        <a class="table-action table-edit" @click="edit(scope.row)">编辑</a>
                        <a class="table-action table-del"  @click="del(scope.row)">删除</a>
                    </template>
                </el-table-column>
            </template>
        </List>
    </div>
</template>
<script>
import { getUseDpts, getRequest } from '@/api/Api'
import List from '../list/index.vue'
import Nav from '@/components/nav'
export default {
    components: {
        Nav,
        List,
    },
    data() {
        return {
        }
    },
    mounted() {
        // this.query()
        // this.init()
    },
    methods: {
        query () {
            this.$refs.list.pageQuery({})
        },
        add () {
            window.localStorage.removeItem('map')
            this.$router.push({
                name: 'map',
            })
        },
        view (row) {
            window.localStorage.setItem('map', row.gridSetting)
            this.$router.push({
                name: 'mapPreview',
                query: {
                    id: row.id,
                    name: row.name
                }
            })
        },
        edit (row) {
            window.localStorage.setItem('map', row.gridSetting)
            this.$router.push({
                name: 'map',
                query: {
                    id: row.id,
                    name: row.name
                }
            })
        },
        del(row) {
            this.$confirm('确定要永久删除此地图,关联的设备将重置?', '提示', {
                confirmButtonText: '确定',
                cancelButtonText: '取消',
                type: 'warning'
            }).then(res => {
                this.$http.postJson('/plant/delete', {
                    ids: [row.id]
                }).then(res => {
                    this.$message({
                        type: 'info',
                        message: '删除成功'
                    })
                    this.$emit('out')
                }).catch(() => {
                    this.$message({
                        type: 'info',
                        message: '删除失败'
                    })
                }).finally(() => {
                    this.query()
                })
            }, () => {
                this.$message({
                    type: 'info',
                    message: '取消删除'
                })
            })
        }
    },
}
</script>
<style lang="scss">
.maintenance {
    .item-value {
        .el-input__inner {
            background: transparent;
            border-radius: 2px;
            border: 1px solid #435F9E;
        }
    }
}
</style>
<style lang="scss" scoped>
.maintenance {
    width: 100%;
    height: 100%;
    overflow: hidden;
    color: #FFF;
    display: flex;
    flex-direction: column;
    .nav {
        padding: 10px 30px;
        font-size: 14px;
    }
    .item {
        margin-top: 20px;
        margin-left: 50px;
        display: flex;
        align-items: center;
        span {
            width: 120px;
            font-size: 16px;
            font-family: PingFangSC, PingFang SC;
            color: #C6DCE0;
            text-align: right;
            padding-right: 20px;
        }
        .item-value {
            width: 200px;
            border: 1px solid #435F9E;
        }
        .btn {
            line-height: 1.5;
            width: 100px;
            text-align: center;
            font-size: 16px;
            cursor: pointer;
        }
        .reset {
            background: #AAB6BA;
            color: #FFF;
        }
        .query {
            background: #5DD1FC;
            color: #FFF;
        }
    }
}
</style>
src/container/mapPreview/Map.vue
@@ -1,7 +1,7 @@
<!--
 * @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>
@@ -16,7 +16,7 @@
                                :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>
@@ -38,6 +38,7 @@
}
import mixins from '@/mixins/index'
import Device from '../workshop/device.vue'
import { getRequest, getUrl } from '@/api/Api'
export default {
    mixins: [mixins],
    components: {
@@ -70,7 +71,8 @@
            map: null, // åœ°å›¾æ•°æ®
            leftMax: 0,
            marginLeft: 0,
            direction: true
            direction: true,
            plantDeviceList: []
        }
    },
    watch: {
@@ -87,8 +89,7 @@
            this.height = (document.querySelector('.table').getBoundingClientRect().height - 30) / 20
        },
        id: {
            handler() {
            handler(val) {
                if (this.move) {
                    this.marginLeft = 0
                    this.$nextTick(() => {
@@ -104,7 +105,16 @@
                        }
                    })
                }
                if(val) {
                    getRequest('machineList',{plantId: val}).then(res => {
                        this.plantDeviceList = res.list.map(item => {
                            return {
                                machineId: item.id,
                                machineName: item.machineName
                            }
                        }) || []
                    })
                }
            },
            immediate: true
        }
@@ -116,6 +126,21 @@
        }
    },
    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) {
src/container/mapPreview/index.vue
@@ -1,7 +1,7 @@
<!--
 * @Date: 2024-01-05 22:26:22
 * @LastEditors: Sneed
 * @LastEditTime: 2024-01-31 21:41:12
 * @LastEditTime: 2024-02-02 22:56:40
 * @FilePath: /belleson-frontend/Users/mache/Documents/demo/mdc/src/container/mapPreview/index.vue
-->
<template>
@@ -23,7 +23,7 @@
                    </template>
                    <template slot="after">
                        <div class="work-list">
                            <span :title="item.name" :class="id===item.id ? 'active' : ''" v-for="item in mapList" @click="select(item)">{{item.name}}</span>
                            <!-- <span :title="item.name" :class="id===item.id ? 'active' : ''" v-for="item in mapList" @click="select(item)">{{item.name}}</span> -->
                        </div>
                    </template>
                </Status>
@@ -105,22 +105,30 @@
        select (v) {
            this.id = v.id
        },
        getMapList() {
            this.$store.dispatch('GetPlanList', {}).then(res => {
                try {
                    this.mapList = this.workshopList.filter(v => v.gridSetting && v.gridSetting != '{}')
                    if (this.mapList.length === 0) {
                        this.status = 0
                    }
                    this.id = this.mapList[0].id
                } catch (error) {
                    console.error(error)
                }
            })
        },
        // getMapList() {
        //     this.$store.dispatch('GetPlanList', {}).then(res => {
        //         try {
        //             this.mapList = this.workshopList.filter(v => v.gridSetting && v.gridSetting != '{}')
        //             if (this.mapList.length === 0) {
        //                 this.status = 0
        //             }
        //             this.id = this.mapList[0].id
        //         } catch (error) {
        //             console.error(error)
        //         }
        //     })
        // },
    },
    mounted() {
        this.getMapList()
        if (this.$route.query.id) {
            this.currentMap = JSON.parse(localStorage.getItem('map'))
            this.plantName = this.$route.query.name
            this.id = this.$route.query.id
            this.nav = '编辑地图'
        }  else {
            this.nav = '新增地图'
        }
        // this.getMapList()
    }
}
</script>
src/container/mapPreviewDetail/index.vue
@@ -1,7 +1,7 @@
<!--
 * @Date: 2024-01-05 22:26:22
 * @LastEditors: Sneed
 * @LastEditTime: 2024-01-31 21:54:36
 * @LastEditTime: 2024-02-02 23:46:50
 * @FilePath: /belleson-frontend/Users/mache/Documents/demo/mdc/src/container/mapPreviewDetail/index.vue
-->
<template>
@@ -235,7 +235,6 @@
            this.$router.go(-1)
        },
        init() {
            getFormRequest('getbyid', {
                machineId: this.$route.query.id
            }).then(res => {
src/container/preview/index.vue
@@ -1,7 +1,7 @@
<!--
 * @Date: 2024-01-05 22:26:22
 * @LastEditors: Sneed
 * @LastEditTime: 2024-01-31 21:47:40
 * @LastEditTime: 2024-02-02 23:32:35
 * @FilePath: /belleson-frontend/Users/mache/Documents/demo/mdc/src/container/preview/index.vue
-->
<template>
@@ -111,9 +111,6 @@
            getMapList() {
                try {
                    this.mapList = this.workshopList.filter (v => v.gridSetting && v.gridSetting!='{}')
                    if (this.mapList.length === 0) {
                        this.status = 2
                    }
                    this.id =this.mapList[0].id
                } catch (error) {
                    console.error(error)
@@ -121,7 +118,9 @@
            },
        },
        mounted () {
            this.getMapList()
            this.$store.dispatch('GetPlanList', {}).then(res => {
                this.getMapList()
            })
        }
    }
</script>
src/router/index.js
@@ -35,6 +35,11 @@
        component: () => import('@/container/home/Welcome')
      },
      {
        path: 'mapList',
        name: 'mapList',
        component: () => import('@/container/mapList/index')
      },
      {
        path: 'map',
        name: 'map',
        component: () => import('@/container/Map/index')
src/utils/ajax.js
@@ -1,7 +1,7 @@
/*
 * @Date: 2022-11-09 12:37:25
 * @LastEditors: Sneed
 * @LastEditTime: 2024-01-17 23:20:35
 * @LastEditTime: 2024-02-02 22:01:56
 * @FilePath: /belleson-frontend/Users/mache/Documents/demo/mdc/src/utils/ajax.js
 */
import axios from 'axios'
@@ -83,7 +83,7 @@
        Message({
          message: response.data.msg,
          type: 'error',
          duration: 3 * 1000
          duration: 600
        })
        return Promise.reject('error')
      }
@@ -94,7 +94,7 @@
    Message({
      message: '服务连接异常,请稍后重试或联系管理员',
      type: 'error',
      duration: 5 * 1000
      duration: 600
    })
    return Promise.reject(error)
  }