接口对接
This commit is contained in:
@@ -3,23 +3,15 @@
|
||||
<view slot="body">
|
||||
<view class="index">
|
||||
<!-- 运维 -->
|
||||
<YunWei v-if="userInfo.role == 1" :store="store" :projectList="projectList" :projectType="projectType" />
|
||||
<YunWei v-if="userInfo.authorities === 'operation_manager'" />
|
||||
<!-- 专职 -->
|
||||
<ZhuanZhi v-if="userInfo.role == 2" :store="store" :projectList="projectList" :projectType="projectType" />
|
||||
<ZhuanZhi v-if="userInfo.authorities === 'market_user'" />
|
||||
<!-- 工程 -->
|
||||
<GongCheng
|
||||
v-if="userInfo.role == 3"
|
||||
:store="store"
|
||||
:gcList="gcList"
|
||||
:projectList="projectList"
|
||||
:projectType="projectType"
|
||||
/>
|
||||
<GongCheng v-if="userInfo.authorities === 'engineering_user'" />
|
||||
<!-- 主用户 -->
|
||||
<ZhuYongHu v-if="userInfo.role == 4" :store="store" :projectList="projectList" :projectType="projectType" />
|
||||
<!-- 子用户 -->
|
||||
<ZiYongHu v-if="userInfo.role == 5" :store="store" :projectList="projectList" :projectType="projectType" />
|
||||
<YouKe v-if="userInfo.role == 6"> </YouKe>
|
||||
<uni-fab ref="fab" direction="vertical" horizontal="right" vertical="bottom" :content="content" @trigger="trigger" />
|
||||
<ZhuYongHu v-if="userInfo.authorities === 'app_vip_user'" />
|
||||
<YouKe v-if="userInfo.authorities === 'tourist'"> </YouKe>
|
||||
<Device ref="device" :store="store" />
|
||||
</view>
|
||||
</view>
|
||||
</Cn-page>
|
||||
@@ -28,13 +20,10 @@
|
||||
import YunWei from './comp/indexYunWei.vue'
|
||||
import GongCheng from './comp/indexGongCheng.vue'
|
||||
import ZhuYongHu from './comp/indexZhuYongHu.vue'
|
||||
import ZiYongHu from './comp/indexZiYongHu.vue'
|
||||
import ZhuanZhi from './comp/indexZhuanZhi.vue'
|
||||
import YouKe from './comp/indexYouKe.vue'
|
||||
import Device from './comp/device.vue'
|
||||
import list from '../../common/js/list'
|
||||
import { getProjectList } from '../../common/api/project'
|
||||
import { queryDictData } from '../../common/api/dictionary'
|
||||
import { queryEngineering } from '@/common/api/gc.js'
|
||||
|
||||
export default {
|
||||
mixins: [list],
|
||||
@@ -42,78 +31,16 @@ export default {
|
||||
YunWei,
|
||||
GongCheng,
|
||||
ZhuYongHu,
|
||||
ZiYongHu,
|
||||
ZhuanZhi,
|
||||
YouKe,
|
||||
Device,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
loading: true,
|
||||
userInfo: {
|
||||
role: 4,
|
||||
},
|
||||
projectList: [],
|
||||
gcList: [],
|
||||
projectType: [
|
||||
{
|
||||
text: '全部类型',
|
||||
value: 0,
|
||||
},
|
||||
{
|
||||
text: '监测',
|
||||
value: 1,
|
||||
},
|
||||
{
|
||||
text: '用能',
|
||||
value: 2,
|
||||
},
|
||||
{
|
||||
text: '环境',
|
||||
value: 3,
|
||||
},
|
||||
{
|
||||
text: '安防',
|
||||
value: 4,
|
||||
},
|
||||
{
|
||||
text: '其他',
|
||||
value: 5,
|
||||
},
|
||||
],
|
||||
loading: false,
|
||||
userInfo: {},
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
content() {
|
||||
let arr = [1, 3, 4]
|
||||
let content = [
|
||||
{
|
||||
iconPath: '/static/mine3.png',
|
||||
text: '运维管理',
|
||||
},
|
||||
{
|
||||
iconPath: '/static/mine3.png',
|
||||
text: '专职管理',
|
||||
},
|
||||
{
|
||||
iconPath: '/static/mine3.png',
|
||||
text: '工程',
|
||||
},
|
||||
{
|
||||
iconPath: '/static/mine3.png',
|
||||
text: '主用户',
|
||||
},
|
||||
{
|
||||
iconPath: '/static/mine3.png',
|
||||
text: '子用户',
|
||||
},
|
||||
{
|
||||
iconPath: '/static/mine3.png',
|
||||
text: '游客',
|
||||
},
|
||||
]
|
||||
return content
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
send() {
|
||||
uni.createPushMessage({
|
||||
@@ -127,145 +54,26 @@ export default {
|
||||
},
|
||||
})
|
||||
},
|
||||
|
||||
trigger(e) {
|
||||
if (e.index === 500) {
|
||||
uni.navigateTo({
|
||||
url: '/pages/device/new',
|
||||
})
|
||||
} else {
|
||||
this.userInfo.role = e.index + 1
|
||||
uni.setStorageSync('userInfo', {
|
||||
role: e.index + 1,
|
||||
id: 1,
|
||||
})
|
||||
let roleName = ''
|
||||
switch (e.index + 1) {
|
||||
case 1:
|
||||
roleName = '运维管理'
|
||||
uni.removeTabBarBadge({
|
||||
index: 1,
|
||||
})
|
||||
break
|
||||
case 2:
|
||||
roleName = '专职管理'
|
||||
uni.removeTabBarBadge({
|
||||
index: 1,
|
||||
})
|
||||
break
|
||||
case 3:
|
||||
roleName = '工程'
|
||||
uni.removeTabBarBadge({
|
||||
index: 1,
|
||||
})
|
||||
break
|
||||
case 4:
|
||||
roleName = '主用户'
|
||||
uni.setTabBarBadge({
|
||||
index: 1,
|
||||
text: '6',
|
||||
})
|
||||
break
|
||||
case 5:
|
||||
roleName = '子用户'
|
||||
uni.setTabBarBadge({
|
||||
index: 1,
|
||||
text: '6',
|
||||
})
|
||||
break
|
||||
case 6:
|
||||
roleName = '游客'
|
||||
uni.setTabBarBadge({
|
||||
index: 1,
|
||||
text: '6',
|
||||
})
|
||||
break
|
||||
}
|
||||
this.$util.toast(roleName + '角色切换成功')
|
||||
}
|
||||
this.$refs.fab.close()
|
||||
},
|
||||
init() {
|
||||
this.store = this.DataSource('/EquipmentDelivery/queryEquipmentByProject')
|
||||
this.store.reload()
|
||||
this.store.firstCallBack = () => {
|
||||
this.loading = false
|
||||
console.log(this.store)
|
||||
}
|
||||
},
|
||||
getProjectList() {
|
||||
getProjectList({
|
||||
pageNum: 1,
|
||||
pageSize: 9999,
|
||||
}).then((res) => {
|
||||
console.log(res)
|
||||
let arr = [
|
||||
{
|
||||
text: '全部项目',
|
||||
value: '-1',
|
||||
},
|
||||
...res.data.records.map((item) => {
|
||||
return {
|
||||
text: item.name,
|
||||
value: item.id,
|
||||
...item,
|
||||
}
|
||||
}),
|
||||
]
|
||||
arr.forEach((item) => {
|
||||
if (this.projectList.findIndex((item2) => item2.value == item.value) === -1) {
|
||||
this.projectList.push(item)
|
||||
}
|
||||
})
|
||||
})
|
||||
},
|
||||
getGcList() {
|
||||
queryEngineering().then((res) => {
|
||||
this.gcList = res.data
|
||||
})
|
||||
},
|
||||
queryDictData() {
|
||||
queryDictData('项目类型').then((res) => {
|
||||
this.projectType = [
|
||||
{
|
||||
text: '全部类型',
|
||||
value: '',
|
||||
},
|
||||
...res.data.map((item) => {
|
||||
return {
|
||||
text: item.anotherName,
|
||||
value: item.id,
|
||||
}
|
||||
}),
|
||||
]
|
||||
})
|
||||
loadingChange(e) {
|
||||
this.loading = e
|
||||
},
|
||||
},
|
||||
onLoad() {
|
||||
this.init()
|
||||
this.store = this.DataSource('/cs-device-boot/EquipmentDelivery/queryEquipmentByProject')
|
||||
},
|
||||
onShow() {
|
||||
this.userInfo = uni.getStorageSync(this.$cacheKey.userInfo)
|
||||
if (!this.userInfo) {
|
||||
this.userInfo = {
|
||||
role: 4,
|
||||
id: 1,
|
||||
}
|
||||
uni.setStorageSync('userInfo', {
|
||||
role: 4,
|
||||
id: 1,
|
||||
})
|
||||
}
|
||||
if (this.userInfo.role == 4 || this.userInfo.role == 5 || this.userInfo.role == 6) {
|
||||
if (
|
||||
this.userInfo.authorities === 'app_vip_user' ||
|
||||
this.userInfo.authorities == 5 ||
|
||||
this.userInfo.authorities === 'tourist'
|
||||
) {
|
||||
uni.setTabBarBadge({
|
||||
index: 1,
|
||||
text: '6',
|
||||
})
|
||||
}
|
||||
this.getProjectList()
|
||||
if (this.userInfo.role == 3) {
|
||||
this.getGcList()
|
||||
}
|
||||
this.$refs.device && this.$refs.device.init()
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user