Files

223 lines
4.8 KiB
Vue
Raw Permalink Normal View History

2022-01-22 15:11:07 +08:00
<template>
<div class="AppGridManagement">
2022-05-06 18:01:26 +08:00
<div class="pad-t32" v-if="component != 'Map' && isGridMember"></div>
<div class="select-gird" v-if="component != 'Map' && isGridMember" flex>
2022-05-05 00:11:51 +08:00
<AiPagePicker type="custom" class="fill" @select="handleSelectGird"
2022-05-04 19:50:50 +08:00
:ops="{url:'./SelectGird',label: 'girdName'}">
2022-05-04 19:32:49 +08:00
<div flex>
<img src="./components/img/gird-icon.png" alt="" class="gird-icon">
<AiMore v-model="params.girdName" icon="arrow-down"/>
</div>
2022-02-11 11:20:57 +08:00
</AiPagePicker>
<span @click="linkTo('./SetGird')" v-if="isGridAdmin">网格配置</span>
2022-01-22 15:11:07 +08:00
</div>
2022-05-09 10:13:53 +08:00
<component v-if="refresh && isGridMember" :is="component" @change="onChange" :params="params"/>
2022-08-15 09:01:16 +08:00
<!-- <div class="tabs" v-if="isTab && isGridMember">
2022-01-22 15:11:07 +08:00
<div class="item" @click="tabClick(index, item.component)" v-for="(item, index) in tabs" :key="index">
2022-02-09 09:37:29 +08:00
<img :src="tabIndex == index ? item.activeImg : item.img" alt=""/>
2022-01-22 15:11:07 +08:00
<p :class="tabIndex == index ? 'color-3267F0' : ''">{{ item.text }}</p>
</div>
2022-08-15 09:01:16 +08:00
</div> -->
2022-05-06 18:01:26 +08:00
<div v-if="!isGridMember" class="empty">
2022-01-22 15:11:07 +08:00
<img src="./components/img/no-admin.png" alt="">
2022-02-09 09:37:29 +08:00
<p>没有网格员权限<br/>无法查看网格信息哦~</p>
2022-01-22 15:11:07 +08:00
</div>
</div>
</template>
<script>
import Statistics from './Statistics.vue'
import Organization from './Organization.vue'
import Map from './Map.vue'
import {mapState} from "vuex";
2022-01-22 15:11:07 +08:00
export default {
name: 'AppGridManagement',
appName: '网格管理',
computed: {
...mapState(['user']),
2022-05-06 18:01:26 +08:00
isGridMember() {
return this.user.girdCheckType > 0
},
isGridAdmin() {
return this.user.girdCheckType == 2
}
},
2022-01-22 15:11:07 +08:00
data() {
return {
2022-08-15 09:01:16 +08:00
component: 'Organization',
2022-01-22 15:11:07 +08:00
params: {},
refresh: true,
tabIndex: 0,
tabs: [
{
img: require('./components/img/statistics-icon.png'),
activeImg: require('./components/img/statistics-icon-active.png'),
text: '统计',
component: 'Statistics',
},
{
img: require('./components/img/org-icon.png'),
activeImg: require('./components/img/org-icon-active.png'),
text: '组织',
component: 'Organization',
},
{
img: require('./components/img/map-icon.png'),
activeImg: require('./components/img/map-icon-active.png'),
text: '地图',
component: 'Map'
}
],
isTab: true,
}
},
components: {
Organization,
Statistics,
Map,
},
methods: {
onChange(e) {
this.params = e.params
this.component = e.type
},
2022-02-11 11:20:57 +08:00
refreshHome() {
2022-01-22 15:11:07 +08:00
this.refresh = false
this.$nextTick(() => {
this.refresh = true
})
2022-02-11 11:20:57 +08:00
}, tabClick(index, component) {
this.tabIndex = index
this.component = component
this.refreshHome();
2022-01-22 15:11:07 +08:00
},
linkTo(url) {
2022-02-09 09:37:29 +08:00
uni.navigateTo({url})
2022-01-22 15:11:07 +08:00
},
2022-02-11 11:20:57 +08:00
handleSelectGird(v) {
2022-05-05 00:11:51 +08:00
this.params = v || {}
2022-02-11 11:20:57 +08:00
this.refreshHome()
}
2022-01-22 15:11:07 +08:00
},
2022-02-10 13:49:05 +08:00
onLoad() {
2022-05-09 10:13:53 +08:00
this.handleSelectGird(this.user.gridInfo)
2022-01-22 15:11:07 +08:00
uni.$on('hideTab', () => {
this.isTab = false
})
uni.$on('showTab', () => {
this.isTab = true
})
},
2022-02-10 13:49:05 +08:00
onShow() {
document.title = '网格管理'
},
2022-01-22 15:11:07 +08:00
onReachBottom() {
2022-02-09 09:37:29 +08:00
if (!this.tabIndex) {
2022-01-22 15:11:07 +08:00
uni.$emit('nextList')
}
},
}
</script>
<style lang="scss" scoped>
.AppGridManagement {
height: 100vh;
}
2022-02-09 09:37:29 +08:00
.pad-t32 {
2022-01-22 15:11:07 +08:00
padding-top: 32px;
}
2022-02-09 09:37:29 +08:00
2022-05-04 19:32:49 +08:00
.gird-icon {
margin-right: 8px;
}
2022-02-09 09:37:29 +08:00
.select-gird {
2022-01-22 15:11:07 +08:00
width: calc(100% - 60px);
padding: 24px 32px;
background: #FFFFFF;
border-radius: 16px;
margin: 0 30px 32px;
box-sizing: border-box;
.gird-name {
2022-02-11 14:26:59 +08:00
display: inline-block;
max-width: calc(100% - 108px);
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
vertical-align: middle;
margin: 0 16px;
}
2022-02-09 09:37:29 +08:00
img {
2022-01-22 15:11:07 +08:00
width: 32px;
height: 32px;
vertical-align: middle;
}
2022-02-09 09:37:29 +08:00
span {
2022-01-22 15:11:07 +08:00
display: inline-block;
width: 112px;
height: 48px;
font-size: 28px;
font-family: PingFangSC-Medium, PingFang SC;
font-weight: 500;
color: #3F8DF5;
line-height: 48px;
}
}
2022-02-09 09:37:29 +08:00
2022-01-22 15:11:07 +08:00
.tabs {
width: 100%;
height: 98px;
background: #fff;
border-top: 1px solid #ddd;
position: fixed;
bottom: 0;
left: 0;
display: flex;
2022-02-09 09:37:29 +08:00
2022-01-22 15:11:07 +08:00
.item {
flex: 1;
text-align: center;
2022-02-09 09:37:29 +08:00
2022-01-22 15:11:07 +08:00
img {
width: 56px;
height: 56px;
margin-top: 8px;
}
2022-02-09 09:37:29 +08:00
2022-01-22 15:11:07 +08:00
p {
font-size: 22px;
font-family: PingFangSC-Medium, PingFang SC;
font-weight: 500;
color: #c4cad4;
line-height: 8px;
}
2022-02-09 09:37:29 +08:00
2022-01-22 15:11:07 +08:00
.color-3267F0 {
color: #3267f0;
}
}
}
2022-02-09 09:37:29 +08:00
.empty {
2022-01-22 15:11:07 +08:00
text-align: center;
2022-02-09 09:37:29 +08:00
img {
2022-01-22 15:11:07 +08:00
width: 282px;
height: 306px;
margin: 136px auto 0;
}
2022-02-09 09:37:29 +08:00
p {
2022-01-22 15:11:07 +08:00
font-size: 28px;
font-family: PingFangSC-Regular, PingFang SC;
color: #999;
line-height: 40px;
}
}
</style>