|
@@ -109,7 +109,7 @@
|
|
|
<view class="fixed-column">
|
|
<view class="fixed-column">
|
|
|
<view class="table-cell header">上报时间</view>
|
|
<view class="table-cell header">上报时间</view>
|
|
|
<view class="table-cell" v-for="(item, idx) in tableList" :key="idx">
|
|
<view class="table-cell" v-for="(item, idx) in tableList" :key="idx">
|
|
|
- {{ item.uptime }}
|
|
|
|
|
|
|
+ {{ item.time }}
|
|
|
</view>
|
|
</view>
|
|
|
</view>
|
|
</view>
|
|
|
<view class="table-bg"></view>
|
|
<view class="table-bg"></view>
|
|
@@ -121,7 +121,7 @@
|
|
|
}}</view>
|
|
}}</view>
|
|
|
</view>
|
|
</view>
|
|
|
<view class="table-row" v-for="(item, idx) in tableList" :key="idx">
|
|
<view class="table-row" v-for="(item, idx) in tableList" :key="idx">
|
|
|
- <view class="table-cell">{{ item[activeChartInfo.title] }}</view>
|
|
|
|
|
|
|
+ <view class="table-cell">{{ item[activeChartInfo.key] }}</view>
|
|
|
</view>
|
|
</view>
|
|
|
</view>
|
|
</view>
|
|
|
</scroll-view>
|
|
</scroll-view>
|
|
@@ -177,6 +177,7 @@ export default {
|
|
|
eleActive: 0,
|
|
eleActive: 0,
|
|
|
hasData: true,
|
|
hasData: true,
|
|
|
tableList: [],
|
|
tableList: [],
|
|
|
|
|
+ titles: [],
|
|
|
currentPage: 1,
|
|
currentPage: 1,
|
|
|
pageSize: 9,
|
|
pageSize: 9,
|
|
|
total: 0,
|
|
total: 0,
|
|
@@ -219,15 +220,20 @@ export default {
|
|
|
const ctx = uni.createCanvasContext("temperatureChart", this);
|
|
const ctx = uni.createCanvasContext("temperatureChart", this);
|
|
|
const currentEle = this.eleTabs[this.eleActive];
|
|
const currentEle = this.eleTabs[this.eleActive];
|
|
|
console.log(currentEle, "currentEle");
|
|
console.log(currentEle, "currentEle");
|
|
|
- currentEle.data.forEach((item) => {
|
|
|
|
|
- if (item.value === "/" || item.value === "NA") {
|
|
|
|
|
- item.value = "0";
|
|
|
|
|
|
|
+ // u-charts 的 series.data 必须是数字数组;原数据 value 为字符串(含 "/"、"NA"),
|
|
|
|
|
+ // 直接传对象数组会导致 Y 轴 min/max 计算异常,刻度全部相同
|
|
|
|
|
+ const seriesData = currentEle.data.map((item) => {
|
|
|
|
|
+ const val = item.value;
|
|
|
|
|
+ if (val === "/" || val === "NA" || val === null || val === undefined || val === "") {
|
|
|
|
|
+ return 0;
|
|
|
}
|
|
}
|
|
|
|
|
+ const num = Number(val);
|
|
|
|
|
+ return isNaN(num) ? 0 : num;
|
|
|
});
|
|
});
|
|
|
const series = [
|
|
const series = [
|
|
|
{
|
|
{
|
|
|
name: currentEle.name,
|
|
name: currentEle.name,
|
|
|
- data: currentEle.data,
|
|
|
|
|
|
|
+ data: seriesData,
|
|
|
lineWidth: 3,
|
|
lineWidth: 3,
|
|
|
pointShape: "circle",
|
|
pointShape: "circle",
|
|
|
pointSize: 12,
|
|
pointSize: 12,
|
|
@@ -271,7 +277,7 @@ export default {
|
|
|
scrollShow: true,
|
|
scrollShow: true,
|
|
|
},
|
|
},
|
|
|
yAxis: {
|
|
yAxis: {
|
|
|
- splitNumber: 4,
|
|
|
|
|
|
|
+ tofix: 2,
|
|
|
axisLineColor: "#E4E7ED",
|
|
axisLineColor: "#E4E7ED",
|
|
|
fontColor: "#656565",
|
|
fontColor: "#656565",
|
|
|
gridColor: "#E4E7ED",
|
|
gridColor: "#E4E7ED",
|
|
@@ -380,12 +386,24 @@ export default {
|
|
|
if (this.eleTabs.length === 0) return;
|
|
if (this.eleTabs.length === 0) return;
|
|
|
this.eleActive = index;
|
|
this.eleActive = index;
|
|
|
this.activeChartInfo = this.eleTabs[index];
|
|
this.activeChartInfo = this.eleTabs[index];
|
|
|
|
|
+ const key = this.activeChartInfo.unit ? this.activeChartInfo.name + '(' + this.activeChartInfo.unit + ')' : this.activeChartInfo.name
|
|
|
|
|
+ const keyValue = this.getKeyByName(key)
|
|
|
|
|
+ this.activeChartInfo.key = keyValue
|
|
|
this.isFolded = true; // 关闭展开面板
|
|
this.isFolded = true; // 关闭展开面板
|
|
|
this.$nextTick(() => {
|
|
this.$nextTick(() => {
|
|
|
this.initChart();
|
|
this.initChart();
|
|
|
});
|
|
});
|
|
|
},
|
|
},
|
|
|
-
|
|
|
|
|
|
|
+ getKeyByName(key){
|
|
|
|
|
+ const titles = [...this.titles]
|
|
|
|
|
+ let k
|
|
|
|
|
+ titles.forEach(title => {
|
|
|
|
|
+ if(title.name === key){
|
|
|
|
|
+ k = title.key
|
|
|
|
|
+ }
|
|
|
|
|
+ })
|
|
|
|
|
+ return k
|
|
|
|
|
+ },
|
|
|
// 切换要素展开/收起状态
|
|
// 切换要素展开/收起状态
|
|
|
toggleFold() {
|
|
toggleFold() {
|
|
|
this.isFolded = !this.isFolded;
|
|
this.isFolded = !this.isFolded;
|
|
@@ -428,7 +446,9 @@ export default {
|
|
|
this.eleTabs.find((item) => item.name === this.eleKey) ||
|
|
this.eleTabs.find((item) => item.name === this.eleKey) ||
|
|
|
this.eleTabs[0];
|
|
this.eleTabs[0];
|
|
|
this.eleActive = this.eleTabs.indexOf(this.activeChartInfo);
|
|
this.eleActive = this.eleTabs.indexOf(this.activeChartInfo);
|
|
|
- console.log(this.activeChartInfo, "activeChartInfo");
|
|
|
|
|
|
|
+ const key = this.activeChartInfo.unit ? this.activeChartInfo.name + '(' + this.activeChartInfo.unit + ')' : this.activeChartInfo.name
|
|
|
|
|
+ const keyValue = this.getKeyByName(key)
|
|
|
|
|
+ this.activeChartInfo.key = keyValue
|
|
|
this.$nextTick(() => {
|
|
this.$nextTick(() => {
|
|
|
this.initChart();
|
|
this.initChart();
|
|
|
});
|
|
});
|
|
@@ -464,6 +484,7 @@ export default {
|
|
|
Array.isArray(val) ? `${val[1]}${val[3] || ""}` : val,
|
|
Array.isArray(val) ? `${val[1]}${val[3] || ""}` : val,
|
|
|
);
|
|
);
|
|
|
this.columns = resCol;
|
|
this.columns = resCol;
|
|
|
|
|
+ this.titles = res?.title || [];
|
|
|
this.tableList = newData;
|
|
this.tableList = newData;
|
|
|
this.total = res.total;
|
|
this.total = res.total;
|
|
|
console.log("tableList:", this.columns);
|
|
console.log("tableList:", this.columns);
|