反馈修改
This commit is contained in:
@@ -21,16 +21,18 @@
|
||||
</uni-nav-bar> -->
|
||||
<view class="index">
|
||||
<!-- 运维 -->
|
||||
<YunWei :devCount="devCount" v-if="userInfo.authorities === 'operation_manager'" />
|
||||
<YunWei :devCount="devCount" v-if="userInfo.authorities === 'operation_manager'"/>
|
||||
<!-- 专职 -->
|
||||
<ZhuanZhi :devCount="devCount" v-if="userInfo.authorities === 'market_user'" />
|
||||
<ZhuanZhi :devCount="devCount" v-if="userInfo.authorities === 'market_user'"/>
|
||||
<!-- 工程 -->
|
||||
<GongCheng :devCount="devCount" v-if="userInfo.authorities === 'engineering_user'" />
|
||||
<GongCheng :devCount="devCount" v-if="userInfo.authorities === 'engineering_user'"/>
|
||||
<!-- 主用户 -->
|
||||
<ZhuYongHu :devCount="devCount" v-if="userInfo.authorities === 'app_vip_user'" />
|
||||
<YouKe :devCount="devCount" v-if="userInfo.authorities === 'tourist'"> </YouKe>
|
||||
<view class="canneng-index-title mt20">设备列表</view>
|
||||
<Device ref="device" :store="store" />
|
||||
<ZhuYongHu :devCount="devCount" v-if="userInfo.authorities === 'app_vip_user'"/>
|
||||
<YouKe :devCount="devCount" v-if="userInfo.authorities === 'tourist'"></YouKe>
|
||||
<template v-if="engineeringList.length">
|
||||
<view class="canneng-index-title mt20">设备列表</view>
|
||||
<Device ref="device" :store="store"/>
|
||||
</template>
|
||||
</view>
|
||||
<uni-drawer ref="showRight" mode="right" :mask-click="false">
|
||||
<view>
|
||||
@@ -52,9 +54,9 @@ 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 { getDevCount } from '../../common/api/device.js'
|
||||
import { queryEngineering } from '@/common/api/engineering.js'
|
||||
import { pinyin } from 'pinyin-pro'
|
||||
import {getDevCount} from '../../common/api/device.js'
|
||||
import {queryEngineering} from '@/common/api/engineering.js'
|
||||
import {pinyin} from 'pinyin-pro'
|
||||
|
||||
export default {
|
||||
mixins: [list],
|
||||
@@ -83,7 +85,7 @@ export default {
|
||||
engineeringListFilter() {
|
||||
let result = []
|
||||
this.engineeringList.forEach((item) => {
|
||||
let arr = pinyin(item.name[0], { toneType: 'none', type: 'array' })
|
||||
let arr = pinyin(item.name[0], {toneType: 'none', type: 'array'})
|
||||
let letter = arr[0][0].toUpperCase()
|
||||
console.log(letter)
|
||||
let index = result.findIndex((item) => item.letter === letter)
|
||||
@@ -105,14 +107,6 @@ export default {
|
||||
// e的返回格式为json对象:{"text":"测试","index":0}
|
||||
this.drawer = !this.drawer
|
||||
if (this.drawer) {
|
||||
// #ifdef APP-PLUS
|
||||
var webView = this.$mp.page.$getAppWebview()
|
||||
// 修改buttons
|
||||
webView.setTitleNViewButtonStyle(0, {
|
||||
text: '取消',
|
||||
select: false,
|
||||
})
|
||||
// #endif
|
||||
this.openDrawer()
|
||||
} else {
|
||||
this.closeDrawer()
|
||||
@@ -123,32 +117,47 @@ export default {
|
||||
let res = await queryEngineering()
|
||||
this.engineeringList = res.data
|
||||
if (this.engineeringList.length === 0) {
|
||||
console.log('没有工程')
|
||||
uni.removeStorageSync(this.$cacheKey.engineering)
|
||||
return
|
||||
}
|
||||
if (!engineering) {
|
||||
uni.setStorageSync('engineering', res.data[0])
|
||||
this.select.engineeringName = res.data[0].name
|
||||
this.select.engineeringId = res.data[0].id
|
||||
this.projectList = []
|
||||
// 修改buttons
|
||||
// #ifdef APP-PLUS
|
||||
var webView = this.$mp.page.$getAppWebview()
|
||||
// 修改buttons
|
||||
webView.setTitleNViewButtonStyle(0, {
|
||||
text: '请先创建工程',
|
||||
})
|
||||
// #endif
|
||||
} else {
|
||||
if (this.engineeringList.findIndex((item) => item.id === engineering.id) === -1) {
|
||||
if (!engineering) {
|
||||
uni.setStorageSync('engineering', res.data[0])
|
||||
this.select.engineeringName = res.data[0].name
|
||||
this.select.engineeringId = res.data[0].id
|
||||
} else {
|
||||
this.select.engineeringName = engineering.name
|
||||
this.select.engineeringId = engineering.id
|
||||
if (this.engineeringList.findIndex((item) => item.id === engineering.id) === -1) {
|
||||
uni.setStorageSync('engineering', res.data[0])
|
||||
this.select.engineeringName = res.data[0].name
|
||||
this.select.engineeringId = res.data[0].id
|
||||
} else {
|
||||
this.select.engineeringName = engineering.name
|
||||
this.select.engineeringId = engineering.id
|
||||
}
|
||||
}
|
||||
this.store.params.engineerId = this.select.engineeringId
|
||||
// #ifdef APP-PLUS
|
||||
var webView = this.$mp.page.$getAppWebview()
|
||||
// 修改buttons
|
||||
webView.setTitleNViewButtonStyle(0, {
|
||||
text: this.select.engineeringName,
|
||||
})
|
||||
// #endif
|
||||
this.getDevCount()
|
||||
this.$refs.device && this.$refs.device.init()
|
||||
}
|
||||
this.store.params.engineerId = this.select.engineeringId
|
||||
// #ifdef APP-PLUS
|
||||
var webView = this.$mp.page.$getAppWebview()
|
||||
// 修改buttons
|
||||
webView.setTitleNViewButtonStyle(0, {
|
||||
text: this.select.engineeringName,
|
||||
})
|
||||
// #endif
|
||||
},
|
||||
getDevCount() {
|
||||
getDevCount(this.select.engineeringId).then((res) => {
|
||||
// Object.assign(this.devCount, res.data)
|
||||
this.devCount = res.data
|
||||
this.devCount.currentOffLineDevs.forEach((item) => {
|
||||
item.runStatus = 1
|
||||
@@ -159,7 +168,6 @@ export default {
|
||||
this.devCount.engineeringListLength = this.engineeringList.length
|
||||
console.log(this.devCount);
|
||||
})
|
||||
this.$refs.device && this.$refs.device.init()
|
||||
},
|
||||
closeDrawer(e) {
|
||||
if (!e) {
|
||||
@@ -200,9 +208,7 @@ export default {
|
||||
})
|
||||
this.$refs.device.select.projectName = ''
|
||||
this.$refs.device.select.projectNameIndex = 0
|
||||
getDevCount(this.select.engineeringId).then((res) => {
|
||||
this.devCount = res.data
|
||||
})
|
||||
this.getDevCount()
|
||||
this.$refs.device.init()
|
||||
this.$refs.showRight.close()
|
||||
},
|
||||
@@ -223,9 +229,8 @@ export default {
|
||||
},
|
||||
openDrawer(item) {
|
||||
if (this.engineeringList.length === 0) {
|
||||
uni.showToast({
|
||||
title: '暂无工程',
|
||||
icon: 'none',
|
||||
uni.navigateTo({
|
||||
url: '/pages/engineering/new',
|
||||
})
|
||||
return
|
||||
} else if (this.engineeringList.length === 1) {
|
||||
@@ -235,6 +240,14 @@ export default {
|
||||
})
|
||||
return
|
||||
}
|
||||
// #ifdef APP-PLUS
|
||||
var webView = this.$mp.page.$getAppWebview()
|
||||
// 修改buttons
|
||||
webView.setTitleNViewButtonStyle(0, {
|
||||
text: '取消',
|
||||
select: false,
|
||||
})
|
||||
// #endif
|
||||
this.$refs.showRight.open()
|
||||
},
|
||||
},
|
||||
@@ -261,11 +274,13 @@ export default {
|
||||
.index {
|
||||
padding: 20rpx 0 0;
|
||||
}
|
||||
|
||||
.canneng-index-title {
|
||||
padding: 0 20rpx;
|
||||
font-size: 28rpx;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
/deep/ .uni-card {
|
||||
background: $uni-theme-white;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user