添加谱图内容

newCac1.0
fanluyan 4 months ago
parent 15b52f9fed
commit 257ad35bbf

@ -63,6 +63,17 @@
<span>{{ scope.row.createTime }}</span> <span>{{ scope.row.createTime }}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="操作" width="200" class-name="editClass">
<template slot-scope="scope">
<el-link
type="primary"
@click="handleLookClick(scope.row)"
size="small"
icon="el-icon-document"
>查看图谱</el-link
>
</template>
</el-table-column>
</el-table> </el-table>
<div class="pageNation"> <div class="pageNation">
<el-pagination <el-pagination
@ -78,6 +89,21 @@
</div> </div>
</div> </div>
</div> </div>
<el-dialog
title="图谱"
:visible.sync="tpdialogVisible"
width="860px"
class="tpboxCharts"
@close="closeCharts"
v-if="tpdialogVisible"
>
<span v-if="tpRow.config">{{ tpRow.config.sensor.name }}</span>
<span v-else>{{ tpRow.configId }}</span>
<div id="tpEchartBox"></div>
<span slot="footer" class="dialog-footer">
<el-button @click="closeCharts"></el-button>
</span>
</el-dialog>
</div> </div>
</template> </template>
<script> <script>
@ -95,6 +121,16 @@ export default {
total: 0, // total: 0, //
serverOption: [{ id: -1, sensor: { name: "全部" } }], // serverOption: [{ id: -1, sensor: { name: "全部" } }], //
serverVal: "", serverVal: "",
tpdialogVisible: false,
tpRow: "", //
tpModleData: "", //
myChart: "",
xData4: [], //
lineData4: [], //
yMax4: "", //y
channelCrests4: [], //
dataPointer4: [], //
}; };
}, },
created() { created() {
@ -145,6 +181,145 @@ export default {
console.log(err); // console.log(err); //
}); });
}, },
handleLookClick(row) {
console.log(row);
// model
if (row.model) {
// model
// model
this.tpdialogVisible = true;
this.tpRow = row;
this.tpModleData = row.model;
this.lineData4 = this.tpModleData.channels[0].data; //
this.yMax4 = this.tpModleData.yMax; //y
this.channelCrests4 = this.tpModleData.channels[0].crests;
var timeSpan = 1; //
for (var i = 0; i < this.tpModleData.k * timeSpan; i = i + timeSpan) {
this.xData4.push(i);
}
console.log(this.lineData4);
for (var i = 0; i < this.channelCrests4.length; i++) {
this.dataPointer4.push({
name: this.channelCrests4[i].name,
label: this.channelCrests4[i].j + "",
xAxis: this.channelCrests4[i].time,
yAxis: this.lineData4[this.channelCrests4[i].time],
});
}
console.log(this.dataPointer4);
//
this.$nextTick(() => {
this.getEchart4();
});
} else {
// model
this.$message({
showClose: true,
message: "暂无图谱数据",
type: "warning",
});
}
},
getEchart4() {
this.$nextTick(() => {
let that = this;
that.myChart = this.$echarts.init(
document.getElementById("tpEchartBox")
);
let option = {
// title: {
// text: "4",
// left: "left",
// },
tooltip: {
trigger: "axis",
axisPointer: {
animation: false,
},
},
dataZoom: [
{
type: "inside",
start: 0,
end: 100,
},
{
start: 0,
end: 100,
},
],
xAxis: {
type: "category",
data: this.xData4, // x
boundaryGap: false,
axisLabel: {
//interval: 0, //
showMaxLabel: true, //
},
// showMaxLabel: true,
name: "单位:s", //
},
yAxis: {
type: "value",
scale: true,
show: true, // y
name: "单位:mV", //
nameTextStyle: {
//
color: "#000", //
fontSize: 10, //
padding: [0, 28, 4, 0], //
},
},
series: [
{
data: this.lineData4,
type: "line",
smooth: true,
symbol: "none",
sampling: "lttb",
itemStyle: {
color: "rgb(255, 70, 131)",
},
markPoint: {
data: this.dataPointer4,
symbol: "pin",
symbolSize: 18,
itemStyle: {
normal: {
label: {
show: true,
position: "top",
distance: 0,
formatter: function (params) {
console.log(params);
return params.data.label + ":" + params.name;
},
},
},
},
},
},
],
};
that.myChart.setOption(option);
window.addEventListener("resize", () => {
that.myChart.resize();
});
});
},
closeCharts() {
this.tpdialogVisible = false;
this.xData4 = []; //
this.lineData4 = []; //
this.yMax4 = ""; //y
this.channelCrests4 = []; //
this.dataPointer4 = []; //
},
// //
downFile(row) { downFile(row) {
// a // a
@ -211,4 +386,13 @@ export default {
} }
} }
} }
.tpboxCharts {
.el-dialog__body {
height: 400px;
#tpEchartBox {
height: 380px;
width: 820px;
}
}
}
</style> </style>

Loading…
Cancel
Save