fix(fix): fix bugs
fix bugs Signed-off-by: liubaixun <liubaixun@yinxiang.com>mini-program
commit
d95c3d7bd3
|
@ -22,7 +22,7 @@
|
||||||
<text>{{ titleName+echartName }}</text>
|
<text>{{ titleName+echartName }}</text>
|
||||||
</view>
|
</view>
|
||||||
<view id="echart_p">
|
<view id="echart_p">
|
||||||
<qiun-data-charts type="line" :opts="opts" :chartData="chartData" :ontouch="true"
|
<qiun-data-charts type="area" :opts="opts" :chartData="chartData" :ontouch="true"
|
||||||
background="none" />
|
background="none" />
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
@ -39,25 +39,28 @@
|
||||||
backgroundColor: 'transparent',
|
backgroundColor: 'transparent',
|
||||||
},
|
},
|
||||||
|
|
||||||
equipmentId:'',
|
equipmentId: '',
|
||||||
|
|
||||||
chartData: {},
|
chartData: {},
|
||||||
opts: {
|
opts: {
|
||||||
color: ["#24B383"],
|
color: ["#24B383"],
|
||||||
padding: [15, 10, 0, 15],
|
padding: [15, 35, 0, 15],
|
||||||
dataLabel: false,
|
dataLabel: false,
|
||||||
dataPointShape: false,
|
dataPointShape: false,
|
||||||
enableScroll: true,
|
enableScroll: false,
|
||||||
legend: {},
|
legend: {},
|
||||||
|
tooltipShow: true,
|
||||||
xAxis: {
|
xAxis: {
|
||||||
disableGrid: true,
|
disableGrid: true,
|
||||||
scrollShow: true,
|
// scrollShow: true,
|
||||||
scrollAlign: 'left',
|
labelCount: 4,
|
||||||
scrollColor: '#24B383',
|
// scrollAlign: 'left',
|
||||||
scrollBackgroundColor: '#DFE5E4',
|
// scrollColor: '#24B383',
|
||||||
itemCount: 3,
|
// scrollBackgroundColor: '#DFE5E4',
|
||||||
|
// itemCount: '5',
|
||||||
boundaryGap: "justify",
|
boundaryGap: "justify",
|
||||||
format: "",
|
// format: "",
|
||||||
|
|
||||||
},
|
},
|
||||||
yAxis: {
|
yAxis: {
|
||||||
gridType: "dash",
|
gridType: "dash",
|
||||||
|
@ -66,14 +69,14 @@
|
||||||
data: [{
|
data: [{
|
||||||
title: '',
|
title: '',
|
||||||
min: 0,
|
min: 0,
|
||||||
// max: 14
|
// max: '',
|
||||||
titleOffsetY: -5,
|
titleOffsetY: -5,
|
||||||
}]
|
}]
|
||||||
},
|
},
|
||||||
extra: {
|
extra: {
|
||||||
area: {
|
area: {
|
||||||
type: "curve",
|
type: "curve",
|
||||||
opacity: 0.2,
|
opacity: 0.8,
|
||||||
addLine: true,
|
addLine: true,
|
||||||
width: 2,
|
width: 2,
|
||||||
gradient: true,
|
gradient: true,
|
||||||
|
@ -82,14 +85,14 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
categoriesList:[],
|
categoriesList: [],
|
||||||
valuePH:'',
|
valuePH: '',
|
||||||
valuePHList:[],
|
valuePHList: [],
|
||||||
newValuePHList:[],
|
newValuePHList: [],
|
||||||
unit:'',
|
unit: '',
|
||||||
|
|
||||||
titleName:'',
|
titleName: '',
|
||||||
echartName:''
|
echartName: ''
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
onReady() {
|
onReady() {
|
||||||
|
@ -98,22 +101,22 @@
|
||||||
|
|
||||||
},
|
},
|
||||||
onLoad(option) {
|
onLoad(option) {
|
||||||
console.log(option);
|
// console.log(option);
|
||||||
if(option.id){
|
if (option.id) {
|
||||||
this.equipmentId = option.id
|
this.equipmentId = option.id
|
||||||
}
|
}
|
||||||
if(option.data){
|
if (option.data) {
|
||||||
this.valuePH = option.data
|
this.valuePH = option.data
|
||||||
}
|
}
|
||||||
if(option.name){
|
if (option.name) {
|
||||||
this.echartName = option.name
|
this.echartName = option.name
|
||||||
}
|
}
|
||||||
if(option.unit){
|
if (option.unit) {
|
||||||
this.unit = option.unit
|
this.unit = option.unit
|
||||||
this.opts.yAxis.data[0].title = option.unit
|
this.opts.yAxis.data[0].title = option.unit
|
||||||
}
|
}
|
||||||
|
|
||||||
this.titleName = this.getStatus(option.equipmentNumber,option.targetValue)
|
this.titleName = this.getStatus(option.equipmentNumber, option.targetValue)
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
this.getEchartsData()
|
this.getEchartsData()
|
||||||
|
@ -127,7 +130,7 @@
|
||||||
let res = {
|
let res = {
|
||||||
categories: this.categoriesList,
|
categories: this.categoriesList,
|
||||||
series: [{
|
series: [{
|
||||||
name: this.titleName+this.echartName,
|
name: this.titleName + this.echartName,
|
||||||
data: this.newValuePHList
|
data: this.newValuePHList
|
||||||
}, ]
|
}, ]
|
||||||
};
|
};
|
||||||
|
@ -136,35 +139,41 @@
|
||||||
},
|
},
|
||||||
|
|
||||||
// 获取折线图数据
|
// 获取折线图数据
|
||||||
getEchartsData(){
|
getEchartsData() {
|
||||||
this.$http({
|
this.$http({
|
||||||
url:this.api.chart_fsdata + '?equipmentId=' + this.equipmentId,
|
url: this.api.chart_fsdata + '?equipmentId=' + this.equipmentId,
|
||||||
method:'POST'
|
method: 'POST'
|
||||||
}).then(res=>{
|
}).then(res => {
|
||||||
console.log(res,'获取折线图数据');
|
console.log(res, '获取折线图数据');
|
||||||
res.data.forEach((i,index)=>{
|
res.data.forEach((i, index) => {
|
||||||
this.categoriesList.push(i.time);
|
this.categoriesList.push(i.time);
|
||||||
this.valuePHList.push(i.value)
|
this.valuePHList.push(i.value)
|
||||||
})
|
})
|
||||||
this.getServerData();
|
this.getServerData();
|
||||||
|
|
||||||
|
this.categoriesList = this.categoriesList.map(item => {
|
||||||
|
return item.split(' ')[1]
|
||||||
|
})
|
||||||
|
// this.opts.xAxis.itemCount = this.categoriesList.length
|
||||||
// console.log(this.categoriesList,'this.categoriesList');
|
// console.log(this.categoriesList,'this.categoriesList');
|
||||||
// console.log(this.valuePHList,'this.valuePHList');
|
// console.log(this.valuePHList,'this.valuePHList');
|
||||||
this.newValuePHList = this.valuePHList.map((e,index)=>{
|
this.newValuePHList = this.valuePHList.map((e, index) => {
|
||||||
return e[this.titleName+this.echartName] == undefined ? '' : e[this.titleName+this.echartName]
|
return e[this.titleName + this.echartName] == undefined ? '' : e[this.titleName +
|
||||||
|
this.echartName]
|
||||||
})
|
})
|
||||||
console.log(this.newValuePHList,'121212212121211111111');
|
console.log(this.newValuePHList, '121212212121211111111');
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
// 判断是否是平均或者目标,或者是1#
|
// 判断是否是平均或者目标,或者是1#
|
||||||
getStatus(equipmentNumber,targetValue){
|
getStatus(equipmentNumber, targetValue) {
|
||||||
if(targetValue == 1){
|
if (targetValue == 1) {
|
||||||
return '目标'
|
return '目标'
|
||||||
}else if(targetValue == 0 && equipmentNumber == 0){
|
} else if (targetValue == 0 && equipmentNumber == 0) {
|
||||||
return '1#平均'
|
return '1#平均'
|
||||||
}else if(targetValue == 0 && equipmentNumber == 15){
|
} else if (targetValue == 0 && equipmentNumber == 15) {
|
||||||
return '2#平均'
|
return '2#平均'
|
||||||
}else if(targetValue == 0 && equipmentNumber != 0 && equipmentNumber != 15){
|
} else if (targetValue == 0 && equipmentNumber != 0 && equipmentNumber != 15) {
|
||||||
return equipmentNumber + '#'
|
return equipmentNumber + '#'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -266,7 +275,7 @@
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: calc(100% - 74rpx);
|
height: calc(100% - 74rpx);
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
padding: 0 20rpx;
|
padding: 0 0rpx;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -210,21 +210,24 @@ var _default = {
|
||||||
chartData: {},
|
chartData: {},
|
||||||
opts: {
|
opts: {
|
||||||
color: ["#24B383"],
|
color: ["#24B383"],
|
||||||
padding: [15, 10, 0, 15],
|
padding: [15, 35, 0, 15],
|
||||||
dataLabel: false,
|
dataLabel: false,
|
||||||
dataPointShape: false,
|
dataPointShape: false,
|
||||||
enableScroll: true,
|
enableScroll: false,
|
||||||
legend: {},
|
legend: {},
|
||||||
|
tooltipShow: true,
|
||||||
xAxis: {
|
xAxis: {
|
||||||
disableGrid: true,
|
disableGrid: true,
|
||||||
scrollShow: true,
|
// scrollShow: true,
|
||||||
scrollAlign: 'left',
|
labelCount: 4,
|
||||||
scrollColor: '#24B383',
|
// scrollAlign: 'left',
|
||||||
scrollBackgroundColor: '#DFE5E4',
|
// scrollColor: '#24B383',
|
||||||
itemCount: 3,
|
// scrollBackgroundColor: '#DFE5E4',
|
||||||
boundaryGap: "justify",
|
// itemCount: '5',
|
||||||
format: ""
|
boundaryGap: "justify"
|
||||||
|
// format: "",
|
||||||
},
|
},
|
||||||
|
|
||||||
yAxis: {
|
yAxis: {
|
||||||
gridType: "dash",
|
gridType: "dash",
|
||||||
dashLength: 2,
|
dashLength: 2,
|
||||||
|
@ -232,14 +235,14 @@ var _default = {
|
||||||
data: [{
|
data: [{
|
||||||
title: '',
|
title: '',
|
||||||
min: 0,
|
min: 0,
|
||||||
// max: 14
|
// max: '',
|
||||||
titleOffsetY: -5
|
titleOffsetY: -5
|
||||||
}]
|
}]
|
||||||
},
|
},
|
||||||
extra: {
|
extra: {
|
||||||
area: {
|
area: {
|
||||||
type: "curve",
|
type: "curve",
|
||||||
opacity: 0.2,
|
opacity: 0.8,
|
||||||
addLine: true,
|
addLine: true,
|
||||||
width: 2,
|
width: 2,
|
||||||
gradient: true,
|
gradient: true,
|
||||||
|
@ -261,7 +264,7 @@ var _default = {
|
||||||
// this.getServerData();
|
// this.getServerData();
|
||||||
},
|
},
|
||||||
onLoad: function onLoad(option) {
|
onLoad: function onLoad(option) {
|
||||||
console.log(option);
|
// console.log(option);
|
||||||
if (option.id) {
|
if (option.id) {
|
||||||
this.equipmentId = option.id;
|
this.equipmentId = option.id;
|
||||||
}
|
}
|
||||||
|
@ -309,6 +312,10 @@ var _default = {
|
||||||
_this2.valuePHList.push(i.value);
|
_this2.valuePHList.push(i.value);
|
||||||
});
|
});
|
||||||
_this2.getServerData();
|
_this2.getServerData();
|
||||||
|
_this2.categoriesList = _this2.categoriesList.map(function (item) {
|
||||||
|
return item.split(' ')[1];
|
||||||
|
});
|
||||||
|
// this.opts.xAxis.itemCount = this.categoriesList.length
|
||||||
// console.log(this.categoriesList,'this.categoriesList');
|
// console.log(this.categoriesList,'this.categoriesList');
|
||||||
// console.log(this.valuePHList,'this.valuePHList');
|
// console.log(this.valuePHList,'this.valuePHList');
|
||||||
_this2.newValuePHList = _this2.valuePHList.map(function (e, index) {
|
_this2.newValuePHList = _this2.valuePHList.map(function (e, index) {
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
<view class="target_water_fertilizer_PH data-v-3d983434"><u-navbar vue-id="454957e0-1" background="{{background}}" is-back="{{true}}" back-icon-color="#FFFFFF" border-bottom="{{false}}" title="{{titleName+echartName}}" title-color="#FFFFFF" title-bold="{{true}}" title-size="32" class="data-v-3d983434" bind:__l="__l"></u-navbar><view class="navbar data-v-3d983434"><image src="../../static/PH_bg.png" mode class="data-v-3d983434"></image></view><view class="content data-v-3d983434"><view class="number data-v-3d983434">{{''+(valuePH+unit)+''}}</view><view class="data_analysis data-v-3d983434"><image src="../../static/data_analysis.png" mode class="data-v-3d983434"></image><text class="data-v-3d983434">数据分析</text></view><view class="echart data-v-3d983434"><view class="title data-v-3d983434"><image src="../../static/icon_ph.png" mode class="data-v-3d983434"></image><text class="data-v-3d983434">{{titleName+echartName}}</text></view><view id="echart_p" class="data-v-3d983434"><qiun-data-charts vue-id="454957e0-2" type="line" opts="{{opts}}" chartData="{{chartData}}" ontouch="{{true}}" background="none" class="data-v-3d983434" bind:__l="__l"></qiun-data-charts></view></view></view></view>
|
<view class="target_water_fertilizer_PH data-v-3d983434"><u-navbar vue-id="454957e0-1" background="{{background}}" is-back="{{true}}" back-icon-color="#FFFFFF" border-bottom="{{false}}" title="{{titleName+echartName}}" title-color="#FFFFFF" title-bold="{{true}}" title-size="32" class="data-v-3d983434" bind:__l="__l"></u-navbar><view class="navbar data-v-3d983434"><image src="../../static/PH_bg.png" mode class="data-v-3d983434"></image></view><view class="content data-v-3d983434"><view class="number data-v-3d983434">{{''+(valuePH+unit)+''}}</view><view class="data_analysis data-v-3d983434"><image src="../../static/data_analysis.png" mode class="data-v-3d983434"></image><text class="data-v-3d983434">数据分析</text></view><view class="echart data-v-3d983434"><view class="title data-v-3d983434"><image src="../../static/icon_ph.png" mode class="data-v-3d983434"></image><text class="data-v-3d983434">{{titleName+echartName}}</text></view><view id="echart_p" class="data-v-3d983434"><qiun-data-charts vue-id="454957e0-2" type="area" opts="{{opts}}" chartData="{{chartData}}" ontouch="{{true}}" background="none" class="data-v-3d983434" bind:__l="__l"></qiun-data-charts></view></view></view></view>
|
|
@ -108,6 +108,6 @@
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: calc(100% - 74rpx);
|
height: calc(100% - 74rpx);
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
padding: 0 20rpx;
|
padding: 0 0rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue