gaosp
2024-03-09 95603bea1ab27824c2b4155d9d079a6c66d661b6
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
<!--
 * @Date: 2024-01-05 22:26:22
 * @LastEditors: Sneed
 * @LastEditTime: 2024-03-09 12:59:55
 * @FilePath: /belleson-frontend/Users/mache/Documents/demo/mdc/src/container/Map/index.vue
-->
<template>
    <div class="workshop">
        <Nav :name="nav">
            <template>
                <el-button size="mini" type="" class="back" @click="back">
                    返回
                </el-button>
            </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="请选择">
                        <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> -->
                </div>
            </template>
        </Map>
    </div>
</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'])
    },
    data() {
        return {
            nav: '',
            id: '',
            currentMap: [],
            plantName: '',
            mapList: [],
            status: 1, // 0 新增 1编辑 2查看
        }
    },
    methods: {
        back () {
            this.$router.push({
                name: 'mapList'
            })
        },
        getMapList() {
            this.$store.dispatch('GetPlanList', {}).then(res => {
                try {
                    this.mapList = this.workshopList.filter(v => v.gridSetting && v.gridSetting != '{}')
                    this.id = this.mapList[0].id
                } catch (error) {
                    console.error(error)
                }
            })
        },
        addMap() {
            this.id = ''
        },
        out() {
            this.back()
        },
    },
    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>
<style lang="scss">
.left-select {
    .el-input__inner {
        background: #435F9E;
        color: #C6DCE0;
        border: none;
    }
}
</style>
<style lang="scss" scoped>
.workshop {
    width: 100%;
    height: 100%;
    .workshop-tool {
        // width: 200px;
        display: flex;
        align-items: center;
        span {
            font-size: 12px;
            color: #fff;
            width: 100px;
        }
        .wkshoplist {
            width: 200px;
            margin-right: 20px;
        }
    }
    .back {
        margin-left: auto;
        cursor: pointer;
    }
}
</style>