设备编辑

This commit is contained in:
仲么了
2023-08-02 09:10:45 +08:00
parent 77b4ff6f88
commit f798c64930
15 changed files with 817 additions and 95 deletions

View File

@@ -72,7 +72,7 @@ export const queryByTopoId = (id) => {
url: '/cs-device-boot/lineTemplate/queryByTopoId', url: '/cs-device-boot/lineTemplate/queryByTopoId',
method: 'POST', method: 'POST',
data: { data: {
topoId:id, topoId: id,
}, },
}) })
} }
@@ -94,7 +94,7 @@ export const transferDevice = (id) => {
url: '/cs-device-boot/deviceUser/transfer', url: '/cs-device-boot/deviceUser/transfer',
method: 'POST', method: 'POST',
data: { data: {
eid:id, eid: id,
}, },
}) })
} }
@@ -106,7 +106,43 @@ export const deleteDevice = (id) => {
url: '/cs-device-boot/deviceUser/delete', url: '/cs-device-boot/deviceUser/delete',
method: 'POST', method: 'POST',
data: { data: {
eid:id, eid: id,
},
})
}
// 设备查询通过id获取
export const queryDeivceById = (id) => {
return request({
url: '/cs-device-boot/EquipmentDelivery/queryEquipmentById',
method: 'POST',
data: {
ids: id,
},
})
}
// 字典树接口通过id
export const queryByid = (id) => {
return request({
url: '/system-boot/dictTree/queryByid',
method: 'post',
data: {
id,
},
})
}
//设备修改监测点信息
export const updateDevice = (params) => {
return request({
url: '/cs-device-boot/lineTopologyDiagram/auditList',
method: 'POST',
header: {
'Content-Type': 'application/json',
},
data: {
pointList: params,
}, },
}) })
} }

View File

@@ -1,5 +1,5 @@
import request from '../js/request'; import request from '../js/request'
import config from '../js/config'; import config from '../js/config'
export function queryDictData(dictTypeName) { export function queryDictData(dictTypeName) {
return request({ return request({
@@ -8,12 +8,64 @@ export function queryDictData(dictTypeName) {
data: { data: {
dictTypeName, dictTypeName,
}, },
}); })
} }
export function queryDictDataCache(dictTypeName) { export function queryDictDataCache(dictTypeName) {
return request({ return request({
url: '/system-boot/dictType/dictDataCache', url: '/system-boot/dictType/dictDataCache',
method: 'get', method: 'get',
}); })
}
// 字典树接口通过code
export const queryByCode = (code) => {
return request({
url: '/system-boot/dictTree/queryByCode',
method: 'post',
data: {
code,
},
})
}
// 字典树接口
export const queryCsDictTree = (pid) => {
return request({
url: '/system-boot/dictTree/query',
method: 'post',
data: {
pid,
},
})
}
// 字典树接口通过id
export const queryByid = (id) => {
return request({
url: '/system-boot/dictTree/queryByid',
method: 'post',
data: {
id,
},
})
}
// 程序版本
export const queryEdDataPage = () => {
return request({
url: '/cs-device-boot/edData/queryEdDataPage',
method: 'post',
header: {
'Content-Type': 'application/json;charset=UTF-8',
},
data: {
pageNum: 1,
devName: '',
devType: '',
pageSize: 999,
versionStartDate: '',
versionendDate: '',
},
})
} }

View File

@@ -7,7 +7,7 @@
<view class="loading" v-if="loading"> <view class="loading" v-if="loading">
<zero-loading v-if="loading"></zero-loading> <zero-loading v-if="loading"></zero-loading>
</view> </view>
<slot name="body"></slot> <slot name="body" v-if="!loading"></slot>
</template> </template>
</view> </view>
</template> </template>

View File

@@ -393,6 +393,12 @@
"style": { "style": {
"navigationBarTitleText": "操作成功" "navigationBarTitleText": "操作成功"
} }
},
{
"path": "pages/device/edit",
"style": {
"navigationBarTitleText": "编辑设备"
}
} }
], ],
"tabBar": { "tabBar": {

View File

@@ -1,33 +1,56 @@
<template> <template>
<Cn-page :loading='loading'> <Cn-page :loading="loading">
<view slot='body'> <view slot="body">
<view class='about'> <view class="about">
<view class='about-title'>灿能APF</view> <view class="about-title">{{ deviceInfo.name }}</view>
<view class='about-text'>杋器码0000000</view> <view class="about-text">装置类型{{ deviceInfo.devTypeName }}</view>
<view class='about-text'>软件版本1.0.0</view> <view class="about-text">装置型号{{ deviceInfo.devModelName }}</view>
<view class='about-text'>使用期限永久使用</view> <view class="about-text"
<view class='about-text'>软件版本380-250/250-4-0-1</view> >装置接入方式{{ deviceInfo.devAccessMethod === 'cloud' ? '云直连' : 'mqtt' }}</view
>
<!-- <view class="about-text">装置注册时间永久使用</view> -->
<view class="about-text">程序版本{{ deviceInfo.programVersionName }}</view>
<view class="about-text">网络设备ID{{ deviceInfo.ndid }}</view>
</view> </view>
</view> </view>
</Cn-page> </Cn-page>
</template> </template>
<script> <script>
import { queryDeivceById } from '@/common/api/device'
import { queryByCode, queryCsDictTree, queryByid, queryEdDataPage } from '@/common/api/dictionary'
export default { export default {
data () { data() {
return { return {
loading: false, loading: true,
deviceInfo: {},
} }
}, },
methods: { methods: {},
onLoad(options) {
} queryDeivceById(options.id).then((res) => {
console.log(res)
this.deviceInfo = res.data[0]
queryByCode('Device_Type').then((res) => {
Promise.all([queryCsDictTree(res.data.id), queryByid(res.data.id), queryEdDataPage()]).then((resp) => {
console.log(resp)
this.deviceInfo.devTypeName = resp[0].data.find((item) => item.id === this.deviceInfo.devType)?.name
this.deviceInfo.devModelName = resp[1].data.find(
(item) => item.id === this.deviceInfo.devModel,
)?.name
console.log(resp[2])
this.deviceInfo.programVersionName = resp[2].data.records.find(
(item) => item.id === this.deviceInfo.programVersion,
)?.versionNo
this.loading = false
})
})
})
},
} }
</script> </script>
<style lang='scss'> <style lang="scss">
.about { .about {
padding: 34rpx; padding: 34rpx;
.about-title { .about-title {
font-size: 34rpx; font-size: 34rpx;
font-weight: bold; font-weight: bold;
@@ -40,5 +63,4 @@ export default {
margin-bottom: 34rpx; margin-bottom: 34rpx;
} }
} }
</style> </style>

View File

@@ -4,7 +4,6 @@
<uni-data-checkbox multiple v-model="checkbox" :localdata="hobby"></uni-data-checkbox> <uni-data-checkbox multiple v-model="checkbox" :localdata="hobby"></uni-data-checkbox>
<view class="charts-box"> <view class="charts-box">
<qiun-data-charts ontouch onzoom type="line" :opts="opts" :chartData="chartData" /> <qiun-data-charts ontouch onzoom type="line" :opts="opts" :chartData="chartData" />
<qiun-data-charts ontouch onzoom type="line" :opts="opts" :chartData="chartData" />
</view> </view>
</view> </view>
</template> </template>

View File

@@ -68,7 +68,7 @@
</view> </view>
</view> </view>
</view> </view>
<view class="content"> <view class="content" v-if="deviceInfo">
<view v-if="navMenuActive == 0"> <view v-if="navMenuActive == 0">
<basic :deviceInfo="deviceInfo"></basic> <basic :deviceInfo="deviceInfo"></basic>
</view> </view>
@@ -95,8 +95,8 @@
@trigger="trigger" @trigger="trigger"
/> />
<uni-popup ref="share" type="share" :safe-area="false"> <uni-popup ref="share" type="share" :safe-area="false">
<uni-popup-share title="分享到" ></uni-popup-share> <uni-popup-share title="分享到"></uni-popup-share>
<view style="height: 40rpx;background: #fff;"></view> <view style="height: 40rpx; background: #fff"></view>
</uni-popup> </uni-popup>
</view> </view>
</view> </view>
@@ -213,7 +213,7 @@ export default {
} else if (e.item.text === '告警') { } else if (e.item.text === '告警') {
uni.navigateTo({ url: '/pages/device/APF/report' }) uni.navigateTo({ url: '/pages/device/APF/report' })
} else if (e.item.text === '关于') { } else if (e.item.text === '关于') {
uni.navigateTo({ url: '/pages/device/APF/about' }) uni.navigateTo({ url: '/pages/device/APF/about?id=' + this.devId })
} else if (e.item.text === '移交') { } else if (e.item.text === '移交') {
uni.navigateTo({ url: '/pages/device/transfer?id=' + this.devId }) uni.navigateTo({ url: '/pages/device/transfer?id=' + this.devId })
} else if (e.item.text === '反馈') { } else if (e.item.text === '反馈') {
@@ -226,6 +226,10 @@ export default {
this.$util.toast('功能暂未开放') this.$util.toast('功能暂未开放')
} else if (e.item.text === '模版') { } else if (e.item.text === '模版') {
this.$util.toast('效果是功能暂未开放直接打开报表') this.$util.toast('效果是功能暂未开放直接打开报表')
} else if (e.item.text === '编辑') {
uni.navigateTo({
url: '/pages/device/edit?deviceInfo=' + encodeURIComponent(JSON.stringify(this.deviceInfo)),
})
} }
this.$refs.fab.close() this.$refs.fab.close()
}, },
@@ -388,6 +392,10 @@ export default {
iconPath: '/static/delate.png', iconPath: '/static/delate.png',
text: '删除', text: '删除',
}) })
this.content.splice(0, 0, {
iconPath: '/static/feedback.png',
text: '编辑',
})
this.content.splice(0, 0, { this.content.splice(0, 0, {
iconPath: '/static/transfer.png', iconPath: '/static/transfer.png',
text: '移交', text: '移交',

487
pages/device/edit.vue Normal file
View File

@@ -0,0 +1,487 @@
<template>
<view class="new">
<template v-if="type == 1">
<view class="content">
<uni-forms>
<uni-forms-item label="设备识别码">
<view style="display: flex">
<uni-easyinput type="text" v-model="formData.nDid" placeholder="请输入设备识别码" />
<uni-icons
type="camera"
color="#007aff"
size="26"
class="ml20"
@click="scanCode"
></uni-icons>
</view>
</uni-forms-item>
</uni-forms>
</view>
<view class="btn-wrap">
<view class="btn-wrap-item" @click="register"> 发起注册 </view>
</view>
</template>
<template v-else>
<view class="content">
<uni-forms>
<uni-forms-item label="项目">
<uni-data-select
v-model="formData.projectId"
:localdata="projectRange"
@change="queryTopologyDiagramPage"
disabled
></uni-data-select>
</uni-forms-item>
<!-- <uni-forms-item label="型号">
<uni-data-select v-model="formData.type" :localdata="typeRange"
@change="typeChange(item)"></uni-data-select>
</uni-forms-item> -->
<uni-forms-item label="位置">
<view style="display: flex">
<uni-easyinput
:clearable="false"
type="textarea"
autoHeight
v-model="formData.area"
placeholder="请输入位置信息"
disabled
/>
<!-- <uni-icons
type="location"
color="#007aff"
size="26"
class="ml20"
@click="chooseLocation"
></uni-icons> -->
</view>
</uni-forms-item>
<uni-forms-item label="拓扑图" v-if="formData.projectId">
<view style="display: flex">
<view style="flex: 1">
<view v-if="formData.topologyDiagramUrl">
<image :src="formData.topologyDiagramUrl" style="width: 100%" mode="widthFix" />
</view>
<view v-else class="gplot gplot-empty center" @click="chooseGplot"> 选择拓扑图 </view>
</view>
<!-- <uni-icons
type="image"
color="#007aff"
size="26"
class="ml20"
@click="chooseGplot"
></uni-icons> -->
</view>
</uni-forms-item>
<uni-forms-item label="监测点" v-if="pointList.length && formData.topologyDiagramUrl">
<view
class="point-item"
v-for="(item2, index2) in pointList"
:key="index2"
@click="editPoint(item2, index2)"
>
<view style="flex: 1" v-if="item2.name">{{ item2.name }}</view>
<view style="flex: 1; color: #999" v-else>请选择监测点</view>
<uni-icons type="compose" color="#007aff" size="26" class="ml20"></uni-icons>
</view>
</uni-forms-item>
</uni-forms>
</view>
<image class="gplot-image" ref="gplot-image" :src="formData.topologyDiagramUrl" mode="widthFix" />
<view class="btn-wrap">
<!-- <view class="btn-wrap-item" @click="add"> 添加监测点 </view> -->
<view class="btn-wrap-item" @click="submit"> 提交 </view>
</view>
<uni-drawer ref="gplot" mode="right" :mask-click="false">
<scroll-view style="height: 100%" scroll-y="true">
<view class="content">
<image
class="gplot gplot-box"
mode="aspectFill"
:class="{ 'gplot-active': key == activeGplot }"
:src="item.filePath"
@click="activeGplot = key"
v-for="(item, key) in imageList"
:key="key"
/>
<view class="btn-wrap">
<view class="btn-wrap-item" @click="closeDrawer"> 取消 </view>
<view class="btn-wrap-item ml20" @click="confirmGplot"> 确定 </view>
</view>
</view>
</scroll-view>
</uni-drawer>
<uni-drawer ref="point" mode="right" :mask-click="false">
<scroll-view style="height: 100%" scroll-y="true">
<view style="background: #fff">
<view class="map-pin-box">
<image class="gplot" mode="widthFix" :src="formData.topologyDiagramUrl" />
<movable-area class="map-pin-box-area">
<movable-view :x="point.lat" :y="point.lng" direction="all" @change="dragPoint">
<view class="point center">
{{ point.alias || point.name }}
</view>
</movable-view>
</movable-area>
</view>
</view>
<view class="content">
<view class="content-des">请拖动图中的蓝色定位图标选择监测点位置(左上角)</view>
<uni-forms>
<uni-data-select
v-model="point.position"
:localdata="positionList"
@change="positionChange"
></uni-data-select>
<uni-easyinput
:clearable="false"
class="mt20"
type="text"
v-model="point.alias"
@change="aliasChange"
placeholder="别名(非必填)"
/>
</uni-forms>
<view class="btn-wrap">
<view class="btn-wrap-item" @click="closeDrawer"> 取消 </view>
<view class="btn-wrap-item ml20" @click="addPoint"> 确定 </view>
</view>
</view>
</scroll-view>
</uni-drawer>
</template>
</view>
</template>
<script>
import { registerDevice, getModel, addDevice, queryByTopoId, updateDevice } from '@/common/api/device.js'
import { getProjectList, queryTopologyDiagramPage } from '@/common/api/project.js'
export default {
data() {
return {
loading: false,
type: 2,
formData: {
nDid: '',
area: '',
projectId: '',
topologyDiagramUrl: '',
topologyDiagram: '',
},
projectRange: [],
point: {},
pointList: [],
activeGplot: 0,
positionList: [],
imageList: [],
isAdaptive: false, // 是否适应当前项目
deviceInfo: {},
}
},
onLoad(options) {
this.deviceInfo = JSON.parse(decodeURIComponent(options.deviceInfo))
console.log(this.deviceInfo)
this.formData.projectId = this.deviceInfo.projectId
this.formData.topologyDiagramUrl = this.deviceInfo.filePath
this.pointList = this.deviceInfo.appsLineTopologyDiagramPO.map((item) => {
return {
...item,
name: item.label,
position: item.linePostion,
}
})
},
created() {
let engineering = uni.getStorageSync(this.$cacheKey.engineering)
getProjectList({
pageNum: 1,
pageSize: 9999,
engineeringId: engineering.id,
}).then((res) => {
console.log(res)
let arr = [
...res.data.records.map((item) => {
return {
...item,
text: item.name,
value: item.id,
}
}),
]
this.projectRange = arr
})
let dictData = uni.getStorageSync(this.$cacheKey.dictData)
dictData.forEach((item) => {
if (item.code == 'Line_Position') {
this.positionList = item.children.map((item) => {
return {
...item,
text: item.name,
value: item.id,
}
})
}
})
},
methods: {
resize() {
console.log(this.$refs['gplot-image'])
},
confirmGplot() {
this.formData.topologyDiagramUrl = this.imageList[this.activeGplot].filePath
this.formData.topologyDiagram = this.imageList[this.activeGplot].id
this.pointList.forEach((item) => {
console.log(item.position)
this.imageList[this.activeGplot].csLineTopologyTemplateVOList.forEach((item3) => {
console.log(item3.linePostion)
if (item3.linePostion === item.position) {
item.lat = item3.lat
item.lng = item3.lng
}
})
})
console.log(this.pointList)
this.$forceUpdate()
this.closeDrawer()
this.$nextTick(() => {
this.resize()
})
},
queryTopologyDiagramPage() {
setTimeout(() => {
if (!this.formData.projectId) {
return
}
queryTopologyDiagramPage({
projectId: this.formData.projectId,
}).then((res) => {
this.imageList = res.data.records
this.activeGplot = 0
this.confirmGplot()
})
}, 100)
},
aliasChange(e) {
this.$forceUpdate()
},
positionChange(e) {
this.point.name = this.positionList.find((item) => item.id == e).name
},
projectChange(e) {},
scanCode() {
uni.scanCode({
success: function (res) {
console.log('条码类型:' + res.scanType)
console.log('条码内容:' + res.result)
},
})
},
register() {
if (!this.formData.nDid) {
return this.$util.toast('请输入设备识别码')
}
registerDevice(this.formData.nDid).then((res) => {
getModel(this.formData.nDid).then((res) => {
console.log(res)
this.pointList = res.data.map((item) => {
return {
lat: 0,
lng: 0,
...item,
}
})
this.type = 2
})
})
},
chooseLocation() {
uni.chooseLocation({
success: function (res) {
this.address = res.name
console.log('位置名称:' + res.name)
console.log('详细地址:' + res.address)
console.log('纬度:' + res.latitude)
console.log('经度:' + res.longitude)
},
})
},
chooseGplot() {
this.$refs.gplot.open()
},
closeDrawer() {
this.$refs.gplot.close()
this.$refs.point.close()
},
add() {
this.$refs.point.open()
},
addPoint() {
if (!this.point.position) {
this.$util.toast('请选择监测点')
return
}
if (this.point.alias) {
this.point.name = this.point.alias
} else {
this.positionList.forEach((item) => {
if (item.id == this.point.position) {
this.point.name = item.name
}
})
}
this.pointList[this.editIndex] = this.point
console.log(this.pointList)
this.closeDrawer()
},
deletePoint(index) {
this.pointList.splice(index, 1)
},
editPoint(item, index) {
this.point = item
console.log(this.point)
this.editIndex = index
if (!this.point.alias) {
let every = this.positionList.every((item) => item.name != this.point.name)
console.log(every)
if (every) {
this.point.alias = this.point.name
} else {
this.point.alias = ''
}
}
this.$refs.point.open()
this.$forceUpdate()
},
dragPoint(e) {
console.log(e)
this.point.lat = e.detail.x
this.point.lng = e.detail.y
},
submit() {
updateDevice(this.pointList).then((res) => {
console.log(res)
this.$util.toast('提交成功')
setTimeout(() => {
uni.navigateBack({ delta: 1 })
}, 1500)
})
},
},
}
</script>
<style lang="scss">
.new {
padding: 34rpx;
.new-btn {
display: flex;
align-items: center;
justify-content: center;
margin: 80rpx auto 0;
width: 320rpx;
background: $uni-theme-blue;
color: #fff;
height: 80rpx;
border-radius: 12rpx;
}
.content {
.content-des {
font-size: 28rpx;
color: #666;
margin-bottom: 20rpx;
}
margin-bottom: 20rpx;
padding: 34rpx;
background: $uni-theme-white;
border-radius: 12rpx;
}
.gplot {
position: relative;
width: 100%;
height: 188rpx;
}
.gplot-empty {
margin: 0 auto;
border: 1px dashed #dcdfe6;
color: #999;
height: 188rpx;
}
.gplot-box {
height: 280rpx;
margin: 0 auto;
}
.gplot-active::after {
content: '';
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
box-sizing: border-box;
border: 8rpx solid $uni-theme-blue;
// background: rgba(3, 3, 3, .5);
}
.btn-wrap {
margin-top: 40rpx;
display: flex;
align-items: center;
justify-content: space-between;
.btn-wrap-item {
display: flex;
align-items: center;
justify-content: center;
flex: 1;
background: $uni-theme-blue;
color: #fff;
height: 80rpx;
border-radius: 12rpx;
}
}
}
.map-pin-box {
position: relative;
width: 375px;
margin: 0 auto;
.map-pin-box-area {
position: absolute;
width: 100%;
height: 100%;
top: 0;
left: 0;
}
.point {
white-space: nowrap;
}
}
/deep/ .uni-drawer__content {
width: 100vw !important;
}
.point-item {
height: 72rpx;
display: flex;
align-items: center;
justify-content: center;
border-top: 2rpx solid #e5e5e5;
border-color: rgb(229, 229, 229);
}
.point-item:first-of-type {
border-top: none;
}
.gplot-image {
position: absolute;
left: -9999px;
width: 375px;
}
</style>

View File

@@ -1,51 +1,80 @@
<template> <template>
<Cn-page :loading='loading'> <Cn-page :loading="loading">
<view slot='body'> <view slot="body">
<view class='device-list device'> <view class="device-list device">
<uni-card title="基础设备" sub-title="副标题" extra="APF" v-for="item in 10" :key="item" @click="jump" padding="0" <Cn-empty v-if="projectList.length == 0"></Cn-empty>
thumbnail="/static/real_time_data.png"> <template v-else>
</uni-card> <uni-card
<uni-load-more status="nomore"></uni-load-more> :title="item.equipmentName"
:sub-title="item.projectName"
:extra="item.projectType"
padding="0"
v-for="(item, index) in projectList"
:key="index"
@click="jump(item)"
thumbnail="/static/device.png"
>
</uni-card>
<uni-load-more status="nomore"></uni-load-more>
</template>
</view> </view>
</view> </view>
</Cn-page> </Cn-page>
</template> </template>
<script> <script>
export default { export default {
data () { data() {
return { return {
loading: false, loading: false,
current: 0, current: 0,
items: ['正常', '报警', '离线'], items: ['正常', '报警', '离线'],
styleType: 'text', styleType: 'text',
activeColor: '#007aff', activeColor: '#007aff',
content: [{ content: [
iconPath: '/static/add.png', {
text: '添加 ', iconPath: '/static/add.png',
}, text: '添加 ',
] },
],
projectList: [],
} }
}, },
methods: { methods: {
onClickItem (e) { onClickItem(e) {
this.current = e.currentIndex this.current = e.currentIndex
}, },
jump () { jump(item) {
uni.navigateTo({ uni.navigateTo({
url: '/pages/device/APF/detail?id=' + item.id url: '/pages/device/APF/detail?id=' + item.equipmentId + '&isPrimaryUser=' + item.isPrimaryUser,
}) })
}, },
trigger (e) { trigger(e) {
if (e.index === 0) { if (e.index === 0) {
uni.navigateTo({ uni.navigateTo({
url: '/pages/device/new' url: '/pages/device/new',
}) })
} }
},
},
onLoad(options) {
this.projectList = JSON.parse(decodeURIComponent(options.projectList))
console.log(this.projectList);
switch (options.type) {
case 'alarmLineDevs':
uni.setNavigationBarTitle({
title: '报警设备',
})
break
case 'offLineDevs':
uni.setNavigationBarTitle({
title: '离线设备',
})
break
} }
} },
} }
</script> </script>
<style lang='scss'> <style lang="scss">
.device-list { .device-list {
.header { .header {
position: sticky; position: sticky;

View File

@@ -5,11 +5,11 @@
<div class="header-item-value">{{ devCount.onLineCount || 0 }}</div> <div class="header-item-value">{{ devCount.onLineCount || 0 }}</div>
<div class="header-item-label">正常设备</div> <div class="header-item-label">正常设备</div>
</div> </div>
<div class="header-item"> <div class="header-item" @click="jump('alarmLineDevs')">
<div class="header-item-value" @click="jump('alarmLineDevs')">{{ devCount.alarmLineCount || 0 }}</div> <div class="header-item-value">{{ devCount.alarmLineCount || 0 }}</div>
<div class="header-item-label">报警设备</div> <div class="header-item-label">报警设备</div>
</div> </div>
<div class="header-item"> <div class="header-item" @click="jump('offLineDevs')">
<div class="header-item-value">{{ devCount.offLineCount || 0 }}</div> <div class="header-item-value">{{ devCount.offLineCount || 0 }}</div>
<div class="header-item-label">离线设备</div> <div class="header-item-label">离线设备</div>
</div> </div>
@@ -17,7 +17,7 @@
<view style="padding: 20rpx 20rpx 0"> <view style="padding: 20rpx 20rpx 0">
<Cn-grid title="常用功能"> <Cn-grid title="常用功能">
<Cn-grid-item src="/static/device2.png" text="设备注册" @click="registerDevice"></Cn-grid-item> <Cn-grid-item src="/static/device2.png" text="设备注册" @click="registerDevice"></Cn-grid-item>
<Cn-grid-item src="/static/gateway2.png" text="网关注册" @click="registerGateway"></Cn-grid-item> <!-- <Cn-grid-item src="/static/gateway2.png" text="网关注册" @click="registerGateway"></Cn-grid-item> -->
<Cn-grid-item src="/static/feedback2.png" text="提交反馈" @click="submitFeedBack"></Cn-grid-item> <Cn-grid-item src="/static/feedback2.png" text="提交反馈" @click="submitFeedBack"></Cn-grid-item>
</Cn-grid> </Cn-grid>
</view> </view>
@@ -66,14 +66,25 @@ export default {
}) })
}, },
jump(type) { jump(type) {
switch (key) { switch (type) {
case value: case 'alarmLineDevs':
uni.navigateTo({
url:
'/pages/device/list?type=alarmLineDevs&projectList=' +
encodeURIComponent(JSON.stringify(this.devCount.alarmLineDevs)),
})
break
case 'offLineDevs':
uni.navigateTo({
url:
'/pages/device/list?type=offLineDevs&projectList=' +
encodeURIComponent(JSON.stringify(this.devCount.offLineDevs)),
})
break
break; default:
break
default: }
break;
}
}, },
}, },
} }

View File

@@ -5,11 +5,11 @@
<div class="header-item-value">{{ devCount.onLineCount || 0 }}</div> <div class="header-item-value">{{ devCount.onLineCount || 0 }}</div>
<div class="header-item-label">正常设备</div> <div class="header-item-label">正常设备</div>
</div> </div>
<div class="header-item"> <div class="header-item" @click="jump('alarmLineDevs')">
<div class="header-item-value">{{ devCount.alarmLineCount || 0 }}</div> <div class="header-item-value">{{ devCount.alarmLineCount || 0 }}</div>
<div class="header-item-label">报警设备</div> <div class="header-item-label">报警设备</div>
</div> </div>
<div class="header-item"> <div class="header-item" @click="jump('offLineDevs')">
<div class="header-item-value">{{ devCount.offLineCount || 0 }}</div> <div class="header-item-value">{{ devCount.offLineCount || 0 }}</div>
<div class="header-item-label">离线设备</div> <div class="header-item-label">离线设备</div>
</div> </div>
@@ -24,6 +24,29 @@ export default {
default: {}, default: {},
}, },
}, },
methods:{
jump(type) {
switch (type) {
case 'alarmLineDevs':
uni.navigateTo({
url:
'/pages/device/list?type=alarmLineDevs&projectList=' +
encodeURIComponent(JSON.stringify(this.devCount.alarmLineDevs)),
})
break
case 'offLineDevs':
uni.navigateTo({
url:
'/pages/device/list?type=offLineDevs&projectList=' +
encodeURIComponent(JSON.stringify(this.devCount.offLineDevs)),
})
break
default:
break
}
},
}
} }
</script> </script>
<style lang="scss"></style> <style lang="scss"></style>

View File

@@ -5,11 +5,11 @@
<div class="header-item-value">{{ devCount.onLineCount || 0 }}</div> <div class="header-item-value">{{ devCount.onLineCount || 0 }}</div>
<div class="header-item-label">正常设备</div> <div class="header-item-label">正常设备</div>
</div> </div>
<div class="header-item"> <div class="header-item" @click="jump('alarmLineDevs')">
<div class="header-item-value">{{ devCount.alarmLineCount || 0 }}</div> <div class="header-item-value">{{ devCount.alarmLineCount || 0 }}</div>
<div class="header-item-label">报警设备</div> <div class="header-item-label">报警设备</div>
</div> </div>
<div class="header-item"> <div class="header-item" @click="jump('offLineDevs')">
<div class="header-item-value">{{ devCount.offLineCount || 0 }}</div> <div class="header-item-value">{{ devCount.offLineCount || 0 }}</div>
<div class="header-item-label">离线设备</div> <div class="header-item-label">离线设备</div>
</div> </div>
@@ -24,6 +24,29 @@ export default {
default: {}, default: {},
}, },
}, },
methods: {
jump(type) {
switch (type) {
case 'alarmLineDevs':
uni.navigateTo({
url:
'/pages/device/list?type=alarmLineDevs&projectList=' +
encodeURIComponent(JSON.stringify(this.devCount.alarmLineDevs)),
})
break
case 'offLineDevs':
uni.navigateTo({
url:
'/pages/device/list?type=offLineDevs&projectList=' +
encodeURIComponent(JSON.stringify(this.devCount.offLineDevs)),
})
break
default:
break
}
},
},
} }
</script> </script>
<style lang="scss"></style> <style lang="scss"></style>

View File

@@ -5,11 +5,11 @@
<div class="header-item-value">{{ devCount.onLineCount || 0 }}</div> <div class="header-item-value">{{ devCount.onLineCount || 0 }}</div>
<div class="header-item-label">正常设备</div> <div class="header-item-label">正常设备</div>
</div> </div>
<div class="header-item"> <div class="header-item" @click="jump('alarmLineDevs')">
<div class="header-item-value">{{ devCount.alarmLineCount || 0 }}</div> <div class="header-item-value">{{ devCount.alarmLineCount || 0 }}</div>
<div class="header-item-label">报警设备</div> <div class="header-item-label">报警设备</div>
</div> </div>
<div class="header-item"> <div class="header-item" @click="jump('offLineDevs')">
<div class="header-item-value">{{ devCount.offLineCount || 0 }}</div> <div class="header-item-value">{{ devCount.offLineCount || 0 }}</div>
<div class="header-item-label">离线设备</div> <div class="header-item-label">离线设备</div>
</div> </div>
@@ -17,7 +17,7 @@
<view style="padding: 20rpx 20rpx 0"> <view style="padding: 20rpx 20rpx 0">
<Cn-grid title="常用功能"> <Cn-grid title="常用功能">
<Cn-grid-item src="/static/device2.png" text="设备注册" @click="registerDevice"></Cn-grid-item> <Cn-grid-item src="/static/device2.png" text="设备注册" @click="registerDevice"></Cn-grid-item>
<Cn-grid-item src="/static/gateway2.png" text="网关注册" @click="registerGateway"></Cn-grid-item> <!-- <Cn-grid-item src="/static/gateway2.png" text="网关注册" @click="registerGateway"></Cn-grid-item> -->
<Cn-grid-item src="/static/feedback2.png" text="提交反馈" @click="submitFeedBack"></Cn-grid-item> <Cn-grid-item src="/static/feedback2.png" text="提交反馈" @click="submitFeedBack"></Cn-grid-item>
</Cn-grid> </Cn-grid>
</view> </view>
@@ -65,10 +65,26 @@ export default {
url: '/pages/gateway/new', url: '/pages/gateway/new',
}) })
}, },
jump(item) { jump(type) {
uni.navigateTo({ switch (type) {
url: '/pages/device/APF/detail', case 'alarmLineDevs':
}) uni.navigateTo({
url:
'/pages/device/list?type=alarmLineDevs&projectList=' +
encodeURIComponent(JSON.stringify(this.devCount.alarmLineDevs)),
})
break
case 'offLineDevs':
uni.navigateTo({
url:
'/pages/device/list?type=offLineDevs&projectList=' +
encodeURIComponent(JSON.stringify(this.devCount.offLineDevs)),
})
break
default:
break
}
}, },
}, },
} }

View File

@@ -2,31 +2,31 @@
<view class="index-zhuanzhi"> <view class="index-zhuanzhi">
<div class="header"> <div class="header">
<div class="header-item"> <div class="header-item">
<div class="header-item-value">8</div> <div class="header-item-value">{{ devCount.allDevCount || 0 }}</div>
<div class="header-item-label">设备总数</div> <div class="header-item-label">设备总数</div>
</div> </div>
<div class="header-item"> <div class="header-item">
<div class="header-item-value">{{ devCount.onLineCount || 0 }}</div> <div class="header-item-value">{{ devCount.onLineCount || 0 }}</div>
<div class="header-item-label">正常设备</div> <div class="header-item-label">正常设备</div>
</div> </div>
<div class="header-item" @click="projectWarning"> <div class="header-item" @click="jump('alarmLineDevs')">
<div class="header-item-value">{{ devCount.alarmLineCount || 0 }}</div> <div class="header-item-value">{{ devCount.alarmLineCount || 0 }}</div>
<div class="header-item-label">报警设备</div> <div class="header-item-label">报警设备</div>
</div> </div>
<div class="header-item"> <div class="header-item" @click="jump('offLineDevs')">
<div class="header-item-value">{{ devCount.offLineCount || 0 }}</div> <div class="header-item-value">{{ devCount.offLineCount || 0 }}</div>
<div class="header-item-label">离线设备</div> <div class="header-item-label">离线设备</div>
</div> </div>
<div class="header-item"> <div class="header-item">
<div class="header-item-value">4</div> <div class="header-item-value">{{ devCount.alarmEventCount || 0 }}</div>
<div class="header-item-label">告警数量</div> <div class="header-item-label">告警数量</div>
</div> </div>
<div class="header-item"> <div class="header-item">
<div class="header-item-value">0</div> <div class="header-item-value">{{ devCount.eventCount || 0 }}</div>
<div class="header-item-label">事件数量</div> <div class="header-item-label">事件数量</div>
</div> </div>
<div class="header-item" @click="projectNum"> <div class="header-item" @click="projectNum">
<div class="header-item-value">3</div> <div class="header-item-value">{{ devCount.projectCount || 0 }}</div>
<div class="header-item-label">项目个数</div> <div class="header-item-label">项目个数</div>
</div> </div>
</div> </div>
@@ -56,15 +56,25 @@ export default {
url: '/pages/project/list', url: '/pages/project/list',
}) })
}, },
jump(item) { jump(type) {
if (item.name.indexOf('APF') > -1) { switch (type) {
uni.navigateTo({ case 'alarmLineDevs':
url: '/pages/device/APF/detail', uni.navigateTo({
}) url:
} else if (item.name.indexOf('DVR') > -1) { '/pages/device/list?type=alarmLineDevs&projectList=' +
uni.navigateTo({ encodeURIComponent(JSON.stringify(this.devCount.alarmLineDevs)),
url: '/pages/device/DVR/detail', })
}) break
case 'offLineDevs':
uni.navigateTo({
url:
'/pages/device/list?type=offLineDevs&projectList=' +
encodeURIComponent(JSON.stringify(this.devCount.offLineDevs)),
})
break
default:
break
} }
}, },
}, },

View File

@@ -46,7 +46,7 @@
<view class="mine-nav-label">项目管理</view> <view class="mine-nav-label">项目管理</view>
<uni-icons type="forward" color="#aaa" size="20"></uni-icons> <uni-icons type="forward" color="#aaa" size="20"></uni-icons>
</view> </view>
<view <!-- <view
class="mine-nav" class="mine-nav"
@click="jump('gateway')" @click="jump('gateway')"
style="border-bottom: none; box-shadow: 0 4rpx 8rpx #e7e7e74c" style="border-bottom: none; box-shadow: 0 4rpx 8rpx #e7e7e74c"
@@ -54,7 +54,7 @@
<image mode="aspectFill" class="mine-nav-icon" src="/static/gateway.png" /> <image mode="aspectFill" class="mine-nav-icon" src="/static/gateway.png" />
<view class="mine-nav-label">网关列表</view> <view class="mine-nav-label">网关列表</view>
<uni-icons type="forward" color="#aaa" size="20"></uni-icons> <uni-icons type="forward" color="#aaa" size="20"></uni-icons>
</view> </view> -->
<view class="mine-nav" @click="jump('setupMessage')"> <view class="mine-nav" @click="jump('setupMessage')">
<image mode="aspectFill" class="mine-nav-icon" src="/static/message4.png" /> <image mode="aspectFill" class="mine-nav-icon" src="/static/message4.png" />
<view class="mine-nav-label">消息配置</view> <view class="mine-nav-label">消息配置</view>