<!--
|
* @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>
|