首页修改
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<view class="device">
|
||||
<view class="nav" :style="{ top: navHeight + 'px' }">
|
||||
<view class="nav" :style="{ top: navTabHeight + 'px' }">
|
||||
<!-- <view class="nav-menu" :class="{ 'nav-menu-active': select.engineeringName }" @click="openDrawer"
|
||||
>{{ select.engineeringName || '工程' }}
|
||||
</view> -->
|
||||
@@ -37,20 +37,21 @@
|
||||
<view style="flex: 1"></view>
|
||||
<template v-if="deviceListFilter.length">
|
||||
<template v-if="transfer || share">
|
||||
<view class="nav-menu nav-menu-btn" @click="submit">确定 </view>
|
||||
<view class="nav-menu nav-menu-btn" @click="cancel">取消</view>
|
||||
<view class="nav-menu nav-menu-btn" @click="submit">确定</view>
|
||||
</template>
|
||||
<template v-else>
|
||||
<view
|
||||
class="nav-menu nav-menu-btn"
|
||||
@click="transfer = true"
|
||||
@click="selectDevice('transfer')"
|
||||
v-if="userInfo.authorities === 'app_vip_user' || userInfo.authorities === 'engineering_user'"
|
||||
>移交
|
||||
>移交
|
||||
</view>
|
||||
<view
|
||||
class="nav-menu nav-menu-btn"
|
||||
@click="share = true"
|
||||
@click="selectDevice('share')"
|
||||
v-if="userInfo.authorities === 'app_vip_user'"
|
||||
>分享
|
||||
>分享
|
||||
</view>
|
||||
</template>
|
||||
</template>
|
||||
@@ -92,8 +93,9 @@
|
||||
</view>
|
||||
</template>
|
||||
<script>
|
||||
import { getProjectList } from '@/common/api/project'
|
||||
import { queryDictData } from '@/common/api/dictionary'
|
||||
import {getProjectList} from '@/common/api/project'
|
||||
import {queryDictData} from '@/common/api/dictionary'
|
||||
|
||||
export default {
|
||||
props: {
|
||||
store: {
|
||||
@@ -113,18 +115,18 @@ export default {
|
||||
projectType: '',
|
||||
projectTypeIndex: 0,
|
||||
},
|
||||
minHeight: '',
|
||||
minHeight: 0,
|
||||
navTabHeight: 0,
|
||||
engineeringList: [],
|
||||
projectList: [],
|
||||
projectType: [],
|
||||
navHeight: 0,
|
||||
userInfo: {},
|
||||
selectProject: false,
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
deviceListFilter() {
|
||||
return this.store.data.filter((item) => {
|
||||
let arr = this.store.data.filter((item) => {
|
||||
if (this.select.projectName && this.select.projectType) {
|
||||
return item.project === this.select.projectName && item.type === this.select.projectType
|
||||
} else if (this.select.projectName) {
|
||||
@@ -135,12 +137,30 @@ export default {
|
||||
return true
|
||||
}
|
||||
})
|
||||
if (this.transfer || this.share) {
|
||||
return arr.filter((item) => {
|
||||
return item.isPrimaryUser === '1'
|
||||
})
|
||||
} else {
|
||||
return arr
|
||||
}
|
||||
},
|
||||
},
|
||||
created() {
|
||||
this.userInfo = uni.getStorageSync(this.$cacheKey.userInfo)
|
||||
},
|
||||
mounted() {
|
||||
|
||||
|
||||
},
|
||||
methods: {
|
||||
selectDevice(type) {
|
||||
if (this.deviceListFilter.findIndex(item => item.isPrimaryUser === '1') === -1) {
|
||||
this.$util.toast('没有可操作的设备')
|
||||
} else {
|
||||
this[type] = true
|
||||
}
|
||||
},
|
||||
deviceIcon(e) {
|
||||
let str = ''
|
||||
switch (e) {
|
||||
@@ -165,35 +185,50 @@ export default {
|
||||
this.checkList.push(e.equipmentId)
|
||||
}
|
||||
},
|
||||
submit() {
|
||||
console.log(this.checkList)
|
||||
if (this.transfer) {
|
||||
this.transfer = false
|
||||
uni.navigateTo({ url: '/pages/device/transfer?id=' + this.checkList.join(',') })
|
||||
} else if (this.share) {
|
||||
this.share = false
|
||||
this.$emit('share', this.shareList)
|
||||
}
|
||||
cancel() {
|
||||
this.transfer = false
|
||||
this.share = false
|
||||
this.checkList = []
|
||||
},
|
||||
submit() {
|
||||
console.log(this.checkList)
|
||||
if (this.checkList.length === 0) {
|
||||
this.$util.toast('请选择设备')
|
||||
return
|
||||
}
|
||||
if (this.transfer) {
|
||||
uni.navigateTo({url: '/pages/device/transfer?id=' + this.checkList.join(',')})
|
||||
} else if (this.share) {
|
||||
uni.navigateTo({url: '/pages/device/share?id=' + this.checkList.join(',')})
|
||||
}
|
||||
this.cancel()
|
||||
},
|
||||
async init() {
|
||||
console.warn('init')
|
||||
this.getProjectList()
|
||||
this.getDeviceList()
|
||||
},
|
||||
getDeviceList() {
|
||||
this.store.params.pageSize = 999
|
||||
this.store.firstCallBack = () => {
|
||||
// 获取nav高度
|
||||
this.store.params.pageSize = 50
|
||||
this.store.firstCallBack = (res) => {
|
||||
uni.createSelectorQuery()
|
||||
.select('.nav')
|
||||
.boundingClientRect((rect2) => {
|
||||
if (!rect2) return
|
||||
// #ifdef H5
|
||||
this.minHeight = 'calc(100vh - env(safe-area-inset-bottom) - ' + (50 + rect2.height) + 'px)'
|
||||
// #endif
|
||||
// #ifdef APP-PLUS
|
||||
this.minHeight = 'calc(100vh - ' + rect2.height + 'px)'
|
||||
// #endif
|
||||
.select('.uni-navbar')
|
||||
.boundingClientRect((rect1) => {
|
||||
if (!rect1) return
|
||||
this.navTabHeight = rect1.height
|
||||
uni.createSelectorQuery()
|
||||
.select('.nav')
|
||||
.boundingClientRect((rect2) => {
|
||||
if (!rect2) return
|
||||
// #ifdef H5
|
||||
this.minHeight = 'calc(100vh - ' + (this.navTabHeight + rect2.height + 50) + 'px)'
|
||||
// #endif
|
||||
// #ifdef APP-PLUS
|
||||
this.minHeight = 'calc(100vh - ' + (this.navTabHeight + rect2.height) + 'px)'
|
||||
console.log(this.minHeight)
|
||||
// #endif
|
||||
})
|
||||
.exec()
|
||||
})
|
||||
.exec()
|
||||
}
|
||||
@@ -239,7 +274,7 @@ export default {
|
||||
})
|
||||
},
|
||||
submitFeedBack() {
|
||||
uni.navigateTo({ url: '/pages/home/feedback' })
|
||||
uni.navigateTo({url: '/pages/home/feedback'})
|
||||
},
|
||||
projectTypeChange(e) {
|
||||
this.select.projectTypeIndex = e.detail.value
|
||||
@@ -266,7 +301,7 @@ export default {
|
||||
confirmText: '直连装置',
|
||||
cancelText: '网关接入',
|
||||
cancelColor: '#007aff',
|
||||
success: ({ confirm, cancel }) => {
|
||||
success: ({confirm, cancel}) => {
|
||||
if (confirm) {
|
||||
uni.navigateTo({
|
||||
url: '/pages/device/new',
|
||||
@@ -300,6 +335,7 @@ export default {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 20rpx 0;
|
||||
|
||||
&-left {
|
||||
flex: 1;
|
||||
margin-right: 10px;
|
||||
|
||||
Reference in New Issue
Block a user