-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #22 from XiaofengZeng/dev
feat(module): 推进二维地图Map2d组件功能开发
- Loading branch information
Showing
9 changed files
with
250 additions
and
57 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
27 changes: 27 additions & 0 deletions
27
src/components/SideMenu/ModuleController/ModuleDirectory/index.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<template> | ||
<div class="directory"> | ||
<div class="directory-title"> | ||
{{ item.title }} | ||
</div> | ||
<div class="directory-item"> | ||
<ModuleItem :list="item.list"></ModuleItem> | ||
</div> | ||
</div> | ||
</template> | ||
|
||
<script> | ||
import ModuleItem from '../ModuleItem'; | ||
export default { | ||
name: 'ModuleDirectory', | ||
components: { | ||
ModuleItem, | ||
}, | ||
props: { | ||
item: Object, // 当前所在场景 | ||
}, | ||
}; | ||
</script> | ||
|
||
<style> | ||
</style> |
63 changes: 63 additions & 0 deletions
63
src/components/SideMenu/ModuleController/ModuleItem/index.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
<template> | ||
<ul> | ||
<li v-for="i in list" :key="i.id"> | ||
<el-button | ||
type="primary" | ||
plain | ||
:class="isActivated(i.enName)" | ||
@click="toggleModule(i.enName)" | ||
> | ||
{{ i.cnName }} | ||
</el-button> | ||
</li> | ||
</ul> | ||
</template> | ||
|
||
<script> | ||
export default { | ||
name: 'ModuleItem', | ||
props: { | ||
list: Array, | ||
}, | ||
data() { | ||
return { | ||
activatedModule: '', | ||
}; | ||
}, | ||
methods: { | ||
isActivated(value) { | ||
return this.activatedModule === value ? 'active' : null; | ||
}, | ||
// TODO: 触发功能,执行相关方法 | ||
toggleModule(value) { | ||
if (this.activatedModule !== value) { | ||
this.activatedModule = value; | ||
// this.$store.commit('map2d/addToActivatedModules', value); | ||
this.$store.commit('map2d/setActivatedModule', value); | ||
} else { | ||
this.activatedModule = ''; | ||
// this.$store.commit('map2d/romoveFromActivatedModules', value); | ||
} | ||
}, | ||
}, | ||
}; | ||
</script> | ||
|
||
<style lang="less" scoped> | ||
ul { | ||
width: inherit; | ||
list-style: none; | ||
display: flex; | ||
justify-content: space-around; | ||
align-items: center; | ||
li { | ||
display: inline; | ||
margin: 5px; | ||
} | ||
.active { | ||
background: #f38031; | ||
border-color: #f38031; | ||
color: #fff; | ||
} | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,88 @@ | ||
<template> | ||
<div class="kn-module-cotroller"></div> | ||
<div class="kn-module-cotroller"> | ||
<div class="module-title"> | ||
<span>功能模块</span> | ||
</div> | ||
<div class="module-directories"> | ||
<ModuleDirectory | ||
v-for="d in directorise" | ||
:key="d.key" | ||
:item="d" | ||
></ModuleDirectory> | ||
</div> | ||
</div> | ||
</template> | ||
|
||
<script> | ||
import { mapState } from 'vuex'; | ||
import ModuleDirectory from './ModuleDirectory'; | ||
export default { | ||
name: 'ModuleController', | ||
components: { | ||
ModuleDirectory, | ||
}, | ||
data() { | ||
return { | ||
directorise: [], | ||
}; | ||
}, | ||
methods: { | ||
getDirectorise() { | ||
switch (this.currentScene.toLowerCase()) { | ||
case 'dashboard': | ||
this.directorise = []; | ||
break; | ||
case 'warehouse': | ||
this.directorise = []; | ||
break; | ||
case 'map': | ||
this.directorise = this.$store.state.map2d.moduleDrectories; | ||
break; | ||
default: | ||
break; | ||
} | ||
}, | ||
}, | ||
mounted() { | ||
this.getDirectorise(); | ||
}, | ||
computed: { | ||
...mapState(['currentScene']), | ||
}, | ||
watch: { | ||
currentScene(_, newVal) { | ||
this.getDirectorise(newVal); | ||
}, | ||
}, | ||
}; | ||
</script> | ||
|
||
<style lang="less" scoped> | ||
.kn-module-cotroller { | ||
width: inherit; | ||
display: flex; | ||
flex: 1; | ||
flex-direction: row; | ||
background-color: rgb(255, 255, 255); | ||
.module-title { | ||
width: 30px; | ||
height: 100%; | ||
display: flex; | ||
align-items: center; | ||
color: #fff; | ||
background-color: #f4a031; | ||
} | ||
.module-directories { | ||
width: 320px; | ||
display: flex; | ||
flex-direction: column; | ||
} | ||
.active { | ||
background: #f38031; | ||
border-color: #f38031; | ||
color: #fff; | ||
} | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters