Browse Source

feat:fix bugs

master
zhaobing’ 1 year ago
parent
commit
d469229a6f
  1. 8
      api/app/lib/controllers/patrolManage/patrolRecord.js
  2. 3
      weapp/app.json
  3. BIN
      weapp/images/device5.png
  4. BIN
      weapp/images/deviceStatus.png
  5. BIN
      weapp/images/rectangle.png
  6. BIN
      weapp/images/shield.png
  7. 6
      weapp/package/deviceBigdataGraph/deviceBigdataGraph.js
  8. 3
      weapp/package/deviceBigdataGraph/deviceBigdataGraph.wxml
  9. 123
      weapp/package/deviceBigdataGraph/lifeWarning/lifeWarning.js
  10. 10
      weapp/package/deviceBigdataGraph/lifeWarning/lifeWarning.json
  11. 91
      weapp/package/deviceBigdataGraph/lifeWarning/lifeWarning.wxml
  12. 170
      weapp/package/deviceBigdataGraph/lifeWarning/lifeWarning.wxss
  13. 43
      weapp/package/deviceBigdataGraph/statusDetail/statusDetail.js
  14. 58
      weapp/package/deviceBigdataGraph/statusDetail/statusDetail.wxml
  15. 41
      weapp/package/deviceBigdataGraph/statusDetail/statusDetail.wxss
  16. 58
      weapp/package/report/report.js
  17. 8
      weapp/utils/getApiUrl.js

8
api/app/lib/controllers/patrolManage/patrolRecord.js

@ -587,8 +587,8 @@ function getPointInfo(opts) {
try{
let rslt=[]
const models = ctx.fs.dc.models;
const {keywords}=ctx.query
let generalInclude = [{model:models.Project,where:{subType :{$like: `%${keywords}%`}}},{model:models.Device}]
const {projectId}=ctx.query
let generalInclude = [{model:models.Project,where:{id :projectId}},{model:models.Device}]
rslt=await models.Point.findAll({
include:generalInclude
})
@ -617,11 +617,11 @@ function getTemplate(opts){
try{
let rslt=[]
const models = ctx.fs.dc.models;
const {keywords}=ctx.query
const {projectId}=ctx.query
rslt=await models.PatrolPlan.findAll({
include:[
{model:models.Project,
where:{subType:{$like: `%${keywords}%`}}},
where:{id:projectId}},
{model:models.PatrolTemplate}]
})
let userInfo = ctx.fs.api.userInfo;

3
weapp/app.json

@ -27,7 +27,8 @@
"riskManagement/riskCalendar/riskCalendar",
"deviceBigdataGraph/deviceBigdataGraph",
"deviceBigdataGraph/statusDetail/statusDetail",
"report/report"
"report/report",
"deviceBigdataGraph/lifeWarning/lifeWarning"
]
}
],

BIN
weapp/images/device5.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 943 B

BIN
weapp/images/deviceStatus.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

BIN
weapp/images/rectangle.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

BIN
weapp/images/shield.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

6
weapp/package/deviceBigdataGraph/deviceBigdataGraph.js

@ -36,7 +36,11 @@ Page({
wx.navigateTo({
url: '/package/deviceBigdataGraph/statusDetail/statusDetail',
})
console.log('xxxxxx',e)
},
navigatorToLifeWarning(e) {
wx.navigateTo({
url: '/package/deviceBigdataGraph/lifeWarning/lifeWarning',
})
},
/**
* 生命周期函数--监听页面加载

3
weapp/package/deviceBigdataGraph/deviceBigdataGraph.wxml

@ -9,8 +9,9 @@
<text class="fontStyle">质保图谱</text>
</view>
<view class="detailStyle">
<van-button type="info" round size="small">查看详情</van-button>
<van-button type="info" round size="small" bindtap="navigatorToLifeWarning">查看详情</van-button>
</view>
</view>
<view class="progress-container">
<text class="label">过保比率:</text>

123
weapp/package/deviceBigdataGraph/lifeWarning/lifeWarning.js

@ -0,0 +1,123 @@
// package/deviceBigdataGraph/lifeWarning/lifeWarning.js
import * as echarts from '../../components/ec-canvas/echarts';
function setOption(chart, data) {
const option = {
grid: {
top: '5%',
left: '3%',
right: '4%',
bottom: '3%',
containLabel: true
},
xAxis: {
type: 'category',
data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
},
yAxis: {
type: 'value',
},
series: [
{
data: data,
type: 'line'
},
]
};
chart.setOption(option);
}
Page({
/**
* 页面的初始数据
*/
data: {
ec: {
// onInit: initChart,
lazyLoad: true, // 将 lazyLoad 设为 true 后,需要手动初始化图表
},
isLoaded: false,
list: [1,2,3]
},
initChart: function (data) {
this.ecComponent = this.selectComponent('#device-status-chart');
this.ecComponent.init((canvas, width, height, dpr) => {
const chart = echarts.init(canvas, null, {
width: width,
height: height,
devicePixelRatio: dpr // new
});
setOption(chart, data);
// 将图表实例绑定到 this 上,可以在其他成员函数中访问
this.chart = chart;
this.setData({
isLoaded: true,
});
// 注意这里一定要返回 chart 实例,否则会影响事件处理等
return chart;
});
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
const {windowHeight}=wx.getSystemInfoSync()
const pageHeight=windowHeight - 48
setTimeout(() => {
this.initChart([1,2,3,4,5,6])
}, 1000)
const that = this
that.setData({pageHeight:pageHeight+'px'})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
}
})

10
weapp/package/deviceBigdataGraph/lifeWarning/lifeWarning.json

@ -0,0 +1,10 @@
{
"navigationBarBackgroundColor": "#1979ff",
"navigationBarTextStyle": "white",
"navigationBarTitleText": "寿命预警",
"enablePullDownRefresh": false,
"usingComponents": {
"ec-canvas": "../../components/ec-canvas/ec-canvas",
"van-divider": "@vant/weapp/divider/index"
}
}

91
weapp/package/deviceBigdataGraph/lifeWarning/lifeWarning.wxml

@ -0,0 +1,91 @@
<!--package/deviceBigdataGraph/lifeWarning/lifeWarning.wxml-->
<view class="status-detail" style="height:{{pageHeight}}">
<!--顶部-->
<view>
<view class="firstRow">
<view>
<view class="icon">
<image src='/images/rectangle.png' class="backStyle"></image>
<view class="icon-text">设备总数</view>
</view>
<view class="fontStyle">300个</view>
</view>
<image src="/images/shield.png" class="deviceImgStyle"></image>
</view>
<view class="secondRow">
<view class="title-item flex flex-col">
<view>过保个数</view>
<view><text class="title-num">{{86}}</text></view>
</view>
<view class="title-item flex flex-col">
<view>质保个数</view>
<view><text class="title-num">{{300}}</text></view>
</view>
</view>
</view>
<!--折线图-->
<view class="card">
<view class="flex flex-between">
<view class="flex flex-start">
<image src="" class="card-img" src="/images/fault_icon.png" />
<view class="card-title">寿命预警</view>
</view>
</view>
<view class="chart">
<!-- <view>aaa</view> -->
<ec-canvas id="device-status-chart" canvas-id="device-status-chart" ec="{{ ec }}"></ec-canvas>
</view>
</view>
<!--数据概览-->
<view class="card">
<view class="flex flex-between">
<view class="flex flex-start">
<image src="" class="card-img" src="/images/fault_icon.png" />
<view class="card-title">数据概览</view>
</view>
</view>
<view class="describeStyle">
<view class="center-content">
<text class="font">30天内你有1000个设备即将过保,请及时更换设备</text>
</view>
</view>
<!--设备列表-->
<view>
<view class="detail">
<view style="position: relative; top: 8px;"> <text class="deviceStyle">设备A</text></view>
<van-divider class="van-divider-custom" />
<view class="flex flex-between" style="margin-top: -10px;">
<view style="margin: 5px 5px;"><text class="chineseStyle">所属结构物</text></view>
<view style="margin: 5px 5px;"><text class="chineseStyle">管廊A</text></view>
</view>
<view class="flex flex-between">
<view style="margin: 5px 5px;"><text class="chineseStyle">安装时间</text></view>
<view style="margin: 5px 5px;"> <text class="chineseStyle">2022-02-11</text></view>
</view>
<view class="flex flex-between">
<view style="margin: 5px 5px;"><text class="chineseStyle">质保期</text></view>
<view style="margin: 5px 5px;"><text class="chineseStyle">2022-02-11</text></view>
</view>
</view>
</view>
<view>
<view class="detail">
<view style="position: relative; top: 8px;"> <text class="deviceStyle">设备A</text></view>
<van-divider class="van-divider-custom" />
<view class="flex flex-between" style="margin-top: -10px;">
<view style="margin: 5px 5px;"><text class="chineseStyle">所属结构物</text></view>
<view style="margin: 5px 5px;"><text class="chineseStyle">管廊A</text></view>
</view>
<view class="flex flex-between">
<view style="margin: 5px 5px;"><text class="chineseStyle">安装时间</text></view>
<view style="margin: 5px 5px;"> <text class="chineseStyle">2022-02-11</text></view>
</view>
<view class="flex flex-between">
<view style="margin: 5px 5px;"><text class="chineseStyle">质保期</text></view>
<view style="margin: 5px 5px;"><text class="chineseStyle">2022-02-11</text></view>
</view>
</view>
</view>
</view>
</view>

170
weapp/package/deviceBigdataGraph/lifeWarning/lifeWarning.wxss

@ -0,0 +1,170 @@
/* package/deviceBigdataGraph/lifeWarning/lifeWarning.wxss */
.status-detail {
height: 100vh;
background-image: linear-gradient(179deg, #006BE3 0%, #4E87FF 16%, #4e87ff00 93%);
padding: 0 15px;
}
.icon {
width: 61px;
height: 31.86px;
position: relative;
padding: 0 10px;
}
.icon-text {
width: 100%;
/* height: 17px; */
font-family: PingFangSC-Medium;
font-weight: 500;
font-size: 12px;
color: #FFFFFF;
position: absolute;
top: 0;
left: 0;
text-align: center;
}
.fontStyle {
width: 100%;
height: 33px;
font-family: PingFangSC-Medium;
font-weight: 500;
font-size: 24px;
color: #FFFFFF;
padding: 0 10px;
}
.title-item {
color: #ffffffd9;
}
.title-num {
font-size: 20px;
color: #FFFFFF;
}
.title-unit {
font-size: 10px;
color: #FFFFFE;
margin-left: 10px;
}
.card {
background: #FFFFFF;
box-shadow: 2px 2px 11px 0 #00000008, 0 0 4px 0 #00000012;
border-radius: 4px;
padding: 12px;
margin-top: 12px;
/* height: 100vh; */
/* height: 300px; */
}
.card-img {
width: 18px;
height: 18px;
margin-right: 13px;
}
.card-title {
font-weight: 500;
font-size: 16px;
color: #383A3B;
}
.card-link {
font-weight: 500;
font-size: 14px;
color: #1684FF;
}
.chart {
width: 100%;
height: 250px;
margin-top: 20px;
}
.list {
margin-top: 10px;
padding: 10px 7px;
background-color: #F1F7FF;
}
.backStyle {
width: 61px;
height: 31.86px;
}
.firstRow {
display: flex;
justify-content: space-between;
position: relative;
height: 120px;
}
.deviceImgStyle {
width: 161.05px;
height: 166.86px;
position: absolute;
right: 15px;
}
.secondRow {
display: flex;
justify-content: space-between;
align-items: center;
padding: 0 10px;
}
.describeStyle {
margin: 5px 2px;
width: 100%;
height: 25px;
opacity: 0.33;
background-image: linear-gradient(269deg, #FFD9AD 0%, #FF9416 98%);
border-radius: 13px;
}
.font{
/* width: 255px; */
height: 17px;
font-family: PingFangSC-Medium;
font-weight: 500;
font-size: 12px;
color: #000000;
text-align: center;
font-weight: bold;
}
.center-content {
display: flex;
justify-content: center; /* 水平居中 */
align-items: center; /* 垂直居中 */
height: 100%; /* 或者根据实际需求设置高度 */
}
.detail{
/* height: 124px; */
background: #F1F7FF;
border-radius: 4px;
margin-bottom: 10px;
/* position: relative; */
}
.deviceStyle{
width: 41px;
height: 21px;
font-family: PingFangSC-Medium;
font-weight: 500;
font-size: 15px;
color: #1684FF;
margin: 10px 10px;
}
.chineseStyle{
width: 60px;
height: 17px;
font-family: PingFangSC-Regular;
font-weight: 400;
font-size: 12px;
color: #31373ed9;
}
.custom-class van-divider {
margin: 0px!important; /* 设置分割线的高度为2px */
}

43
weapp/package/deviceBigdataGraph/statusDetail/statusDetail.js

@ -1,7 +1,19 @@
// package/deviceBigdataGraph/detail/detail.js
import * as echarts from '../../components/ec-canvas/echarts';
function setOption(chart, data) {
function setOption(chart, data1,data2) {
const option = {
legend: {
data: ['设备故障率', '设备完好率'],
top:'-5px'
},
title:{
text:'单位%',
top:'-5px',
textStyle:{
fontSize:'10px',
fontWeight:'normal'
}
},
grid: {
top: '5%',
left: '3%',
@ -14,11 +26,17 @@ function setOption(chart, data) {
data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
},
yAxis: {
type: 'value'
type: 'value',
},
series: [
{
data: data,
name:'设备完好率',
data: data1,
type: 'line'
},
{
name:'设备故障率',
data: data2,
type: 'line'
}
]
@ -26,6 +44,8 @@ function setOption(chart, data) {
chart.setOption(option);
}
Page({
/**
@ -43,19 +63,16 @@ Page({
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
setTimeout(() => {
this.initChart([250, 300, 100, 147, 260, 123, 311])
}, 1000)
},
initChart: function (data) {
initChart: function (data1,data2) {
this.ecComponent = this.selectComponent('#device-status-chart');
this.ecComponent.init((canvas, width, height, dpr) => {
const chart = echarts.init(canvas, null, {
width: width,
height: height,
devicePixelRatio: dpr // new
});
setOption(chart, data);
setOption(chart, data1,data2);
// 将图表实例绑定到 this 上,可以在其他成员函数中访问
this.chart = chart;
@ -68,6 +85,12 @@ Page({
return chart;
});
},
onLoad(options) {
setTimeout(() => {
this.initChart([1,2,3,4,5,6],[1,2,3,10,1])
}, 1000)
},
/**
* 生命周期函数--监听页面初次渲染完成
*/

58
weapp/package/deviceBigdataGraph/statusDetail/statusDetail.wxml

@ -1,26 +1,40 @@
<!--package/deviceBigdataGraph/detail/detail.wxml-->
<view class="status-detail">
<view class="icon"><text class="icon-text">设备总数</text></view>
<view>300</view>
<view class="flex flex-around">
<view class="title-item flex flex-col">
<view>设备故障率</view>
<view><text class="title-num">{{86}}%</text></view>
<!--顶部-->
<view>
<view style="display: flex;justify-content: space-between;position: relative;height: 120px;">
<view>
<view class="icon">
<image src='/images/rectangle.png' style="width: 61px;height:31.86px;"></image>
<view class="icon-text">设备总数</view>
</view>
<view class="fontStyle">300个</view>
</view>
<image src="/images/deviceStatus.png" style="width:161.05px;height:166.86px;position: absolute;right: 15px;"></image>
</view>
<view style="display: flex; justify-content: space-between;align-items: center;padding: 0 10px;">
<view class="title-item flex flex-col">
<view>设备故障率</view>
<view><text class="title-num">{{86}}%</text></view>
</view>
<view class="title-item flex flex-col">
<view>完好率</view>
<view><text class="title-num">{{300}}%</text></view>
</view>
</view>
</view>
<view class="title-item flex flex-col">
<view>完好率</view>
<view><text class="title-num">{{300}}%</text></view>
<!--折线图-->
<view class="card">
<view class="flex flex-between">
<view class="flex flex-start">
<image src="" class="card-img" src="/images/device5.png" />
<view class="card-title">设备状态</view>
</view>
<view>近七天</view>
</view>
<view class="chart">
<!-- <view>aaa</view> -->
<ec-canvas id="device-status-chart" canvas-id="device-status-chart" ec="{{ ec }}"></ec-canvas>
</view>
</view>
</view>
<view class="card">
<view class="flex flex-start">
<!-- <image src="" class="card-img" /> -->
<view class="card-img" style="background: blue;"></view>
<view class="card-title">历史风险趋势</view>
</view>
<view class="chart">
<ec-canvas id="device-status-chart" canvas-id="device-status-chart" ec="{{ ec }}"></ec-canvas>
</view>
</view>
</view>
</view>

41
weapp/package/deviceBigdataGraph/statusDetail/statusDetail.wxss

@ -3,26 +3,37 @@
height: 100vh;
background-image: linear-gradient(179deg, #006BE3 0%, #4E87FF 16%, #4e87ff00 93%);
padding: 0 15px;
}
.icon {
}
.icon {
width: 61px;
height: 31.86px;
background-image: linear-gradient(0deg, #EAF2FF 5%, #2578F0 100%);
box-shadow: 0 3px 4px 1px #bfdbfa4f;
}
.icon-text {
width: 48px;
height: 17px;
position: relative;
padding: 0 10px;
}
.icon-text {
width: 100%;
/* height: 17px; */
font-family: PingFangSC-Medium;
font-weight: 500;
font-size: 12px;
color: #FFFFFF;
position: absolute;
top: 0;
left: 0;
text-align: center;
}
.fontStyle{
width: 100%;
height: 33px;
font-family: PingFangSC-Medium;
font-weight: 500;
font-size: 24px;
color: #FFFFFF;
padding: 0 10px;
}
.title-item {
width: 150px;
color: #ffffffd9;
}
@ -43,6 +54,8 @@
border-radius: 4px;
padding: 12px;
margin-top: 12px;
/* height: 100vh; */
/* height: 300px; */
}
.card-img {
@ -62,10 +75,10 @@
font-size: 14px;
color: #1684FF;
}
.chart {
width: 100%;
height: 195px;
height: 250px;
margin-top: 20px;
}

58
weapp/package/report/report.js

@ -1,47 +1,13 @@
// package/report/report.js
import { getPointList,getPatrolTemplate,getTemplates,reportQuest,getPatrolPlan } from "../../utils/getApiUrl";
import { getPointList,getPatrolTemplate,getTemplates,reportQuest,getPatrolPlan,getStructuresList } from "../../utils/getApiUrl";
import {Request} from "../../common";
const moment = require("../../utils/moment");
Page({
data: {
isPlanState: false,
structList: [{
id: 0,
name: '指挥中心'
}, {
id: 1,
name: '管廊'
},
{
id: 2,
name: '电梯系统'
}, {
id: 3,
name: '供配电系统'
}, {
id: 4,
name: '燃气仓'
},
{
id: 5,
name: '给水仓'
}, {
id: 6,
name: '防雷与接地系统'
}, {
id: 7,
name: '电气仓'
},
{
id: 8,
name: '高压电力仓'
}, {
id: 9,
name: '安防系统'
}
],
structList: [],//结构物列表
data:[],//巡检计划的数据(包括点位,设备等等)
structListIndex: undefined,//结构物id
pointList:[],//点位列表
@ -120,8 +86,8 @@ Page({
pointList:[],//选择结构物后先置空先前的点位列表
})
const keywords=that.data?.structList[event.detail.value]?.name
const query={keywords}
const projectId=that.data?.structList[event.detail.value]?.id
const query={projectId}
Request.get(getTemplates(query)).then(res=>{
if(res){
@ -463,7 +429,23 @@ Page({
wx.setNavigationBarTitle({
title: options.key,
});
Request.get(getStructuresList()).then(res=>{
if(res){
const list=res.rows
if(list&&list.length){
const res= list.filter(item=>item.type=='管廊')
that.setData({structList:res.map(item=>{
return {
name:item.name,
id:item.id
}
})})
}
}else{
wx.hideLoading();
}
})
},
onStructListPicker() {
this.setData({

8
weapp/utils/getApiUrl.js

@ -52,8 +52,8 @@ exports.getSubSystemPatrolAbout = (query) => {
// 获取点位信息
exports.getPointList = (query) => {
const {keywords } = query;
return `/patrolRecord/pointInfo?keywords=${keywords}`
const {projectId } = query;
return `/patrolRecord/pointInfo?projectId=${projectId}`
}
// 获取点位最新一条巡检记录
@ -67,8 +67,8 @@ exports.getPatrolTemplate = (id) => {
}
//根据结构物获取巡检模板
exports.getTemplates = (query) => {
const {keywords } = query;
return `/patrolRecord/getTemplate?keywords=${keywords}`
const {projectId } = query;
return `/patrolRecord/getTemplate?projectId=${projectId}`
}
exports.getPatrolRecordIssueHandle = () => {

Loading…
Cancel
Save