Files
dvcp_v2_wxcp_app/src/saas/AppGridManagement/AppGridManagement.vue

236 lines
5.1 KiB
Vue
Raw Normal View History

2022-01-22 15:11:07 +08:00
<template>
<div class="AppGridManagement">
<div class="pad-t32" v-if="component != 'Map' && isAdmin"></div>
2022-02-11 11:20:57 +08:00
<div class="select-gird" v-if="component != 'Map' && isAdmin" flex>
<AiPagePicker type="gird" class="fill" :selected="[params]" @select="handleSelectGird">
<img src="./components/img/gird-icon.png" alt="" class="gird-icon">
<div v-text="params.girdName"/>
<u-icon name="arrow-down" color="#999" class="down-icon" size="20"/>
</AiPagePicker>
2022-01-22 15:11:07 +08:00
<span @click="linkTo('./SetGird')" v-if="checkType == 2">网格配置</span>
</div>
2022-02-09 09:37:29 +08:00
<component v-if="refresh && isAdmin" :is="component" @change="onChange" :params="params"></component>
2022-01-22 15:11:07 +08:00
<div class="tabs" v-if="isTab && isAdmin">
<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>
</div>
<div v-if="!isAdmin" class="empty">
<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'
export default {
name: 'AppGridManagement',
appName: '网格管理',
data() {
return {
component: 'Statistics',
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,
isAdmin: false,
checkType: ''
}
},
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
},
isGirdUser() {
this.isAdmin = false
this.$http.post('/app/appgirdmemberinfo/checkLogOnUser').then((res) => {
2022-02-11 11:20:57 +08:00
if (res?.data) {
2022-01-22 15:11:07 +08:00
if (res.data.checkType != '0') {
this.isAdmin = true
this.checkType = res.data.checkType
this.params = res.data.appGirdInfo
}
}
})
},
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) {
this.params = v?.[0] || {}
this.refreshHome()
}
2022-01-22 15:11:07 +08:00
},
2022-02-10 13:49:05 +08:00
onLoad() {
2022-02-09 09:37:29 +08:00
this.isGirdUser()
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
.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;
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
2022-02-11 10:05:02 +08:00
.gird-name-div {
2022-01-22 15:11:07 +08:00
display: inline-block;
2022-02-11 11:20:57 +08:00
padding: 0 20px;
2022-01-22 15:11:07 +08:00
box-sizing: border-box;
font-size: 32px;
font-family: PingFangSC-Medium, PingFang SC;
font-weight: 500;
color: #333;
line-height: 48px;
2022-02-09 09:37:29 +08:00
img {
2022-01-22 15:11:07 +08:00
margin-left: 8px;
}
2022-02-11 10:05:02 +08:00
.gird-name{
display: inline-block;
max-width: calc(100% - 50px);
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
vertical-align: middle;
}
2022-01-22 15:11:07 +08:00
}
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>