添加导出

wp1.0
fanluyan 2 years ago
parent c15a9d9aaa
commit e0ad6d1b3a

@ -8,17 +8,17 @@
> --> > -->
<div class="bottomM"> <div class="bottomM">
<div class="infoBox"> <div class="infoBox">
<p @click="handleLook"> <p @click="handleLook(-1)">
<span>装置总数</span> <span>装置总数</span>
<span>{{ termDataNum.totalNum ? termDataNum.totalNum : 0 }}</span> <span>{{ termDataNum.totalNum ? termDataNum.totalNum : 0 }}</span>
</p> </p>
<p> <p @click="handleLook(1)">
<span>在线数量</span> <span>在线数量</span>
<span>{{ <span>{{
termDataNum.onlineNum ? termDataNum.onlineNum : 0 termDataNum.onlineNum ? termDataNum.onlineNum : 0
}}</span> }}</span>
</p> </p>
<p> <p @click="handleLook(0)">
<span>离线率</span> <span>离线率</span>
<span <span
>{{ >{{
@ -29,7 +29,7 @@
> >
</p> </p>
<p> <p>
<span>在线</span> <span @click="handleLook(1)">线</span>
<span <span
>{{ >{{
termDataNum.onlinePercent termDataNum.onlinePercent
@ -86,7 +86,10 @@
:visible.sync="dialogTableVisible" :visible.sync="dialogTableVisible"
> >
<div class="exportList" v-loading="exportLoading"> <div class="exportList" v-loading="exportLoading">
<el-button class="exportbtn" type="primary" @click="handleExport()" <el-button
class="exportbtn"
type="primary"
@click="handleExport(paramsLineVal)"
>导出</el-button >导出</el-button
> >
<el-table <el-table
@ -107,6 +110,8 @@
label="最新图片拍照时间" label="最新图片拍照时间"
></el-table-column> ></el-table-column>
<el-table-column prop="isonline" label="是否在线"></el-table-column> <el-table-column prop="isonline" label="是否在线"></el-table-column>
<el-table-column prop="longitude" label="经度"></el-table-column>
<el-table-column prop="latitude" label="纬度"></el-table-column>
</el-table> </el-table>
</div> </div>
</el-dialog> </el-dialog>
@ -145,6 +150,7 @@ export default {
dialogTableVisible: false, dialogTableVisible: false,
onLineData: [], onLineData: [],
exportLoading: false, exportLoading: false,
paramsLineVal: "",
}; };
}, },
created() { created() {
@ -170,12 +176,18 @@ export default {
}, },
methods: { methods: {
//线 //线
handleLook() { handleLook(val) {
console.log(val);
this.paramsLineVal = val;
this.dialogTableVisible = true; this.dialogTableVisible = true;
this.exportLoading = true; this.exportLoading = true;
getOnlineTerminalList() this.onLineData = [];
getOnlineTerminalList({
type: val,
})
.then((res) => { .then((res) => {
console.log(res); console.log(res);
this.onLineData = res.data; this.onLineData = res.data;
this.exportLoading = false; this.exportLoading = false;
console.log(this.onLineData); console.log(this.onLineData);
@ -183,8 +195,9 @@ export default {
.catch((err) => {}); .catch((err) => {});
}, },
// //
handleExport() { handleExport(val) {
window.location.href = "/api/api/getOnlineTerminalListExcel"; console.log(val);
window.location.href = "/api/api/getOnlineTerminalListExcel?type=" + val;
}, },
// //
changedate() { changedate() {
@ -248,8 +261,9 @@ export default {
getEchart2() { getEchart2() {
this.$nextTick(() => { this.$nextTick(() => {
console.log(this.termDataNum); console.log(this.termDataNum);
this.$echarts.init(document.getElementById("echart2")).dispose(); let that = this;
this.myChart2 = this.$echarts.init(document.getElementById("echart2")); that.$echarts.init(document.getElementById("echart2")).dispose();
that.myChart2 = this.$echarts.init(document.getElementById("echart2"));
let option = { let option = {
// title: { // title: {
// text: "线", // text: "线",
@ -265,14 +279,12 @@ export default {
top: 20, top: 20,
bottom: 20, bottom: 20,
}, },
series: [ series: [
{ {
type: "pie", type: "pie",
// minAngle: 45, //
// startAngle: 180, //
radius: ["40%", "70%"], radius: ["40%", "70%"],
avoidLabelOverlap: false, avoidLabelOverlap: false,
itemStyle: { itemStyle: {
borderRadius: 10, borderRadius: 10,
borderColor: "#fff", borderColor: "#fff",
@ -280,14 +292,14 @@ export default {
}, },
label: { label: {
show: true, show: true,
fontSize: 12, fontSize: 16,
fontWeight: "normal", fontWeight: "bold",
formatter: "{b}\n{d}%", formatter: "{b}\n{d}%",
}, },
emphasis: { emphasis: {
label: { label: {
show: true, show: true,
fontSize: 12, fontSize: 26,
fontWeight: "bold", fontWeight: "bold",
formatter: "{b}\n{d}%", formatter: "{b}\n{d}%",
}, },
@ -296,15 +308,23 @@ export default {
show: true, show: true,
}, },
data: [ data: [
{ value: this.termDataNum.onlineNum, name: "在线" }, { value: that.termDataNum.onlineNum, name: "在线" },
{ value: this.termDataNum.offlineNum, name: "离线" }, { value: that.termDataNum.offlineNum, name: "离线" },
], ],
}, },
], ],
}; };
this.myChart2.setOption(option); that.myChart2.setOption(option);
window.addEventListener("resize", () => { window.addEventListener("resize", () => {
this.myChart2.resize(); that.myChart2.resize();
});
that.myChart2.on("click", function (params) {
console.log(params);
if (params.name == "在线") {
that.handleLook(1);
} else {
that.handleLook(0);
}
}); });
}); });
}, },
@ -329,7 +349,7 @@ export default {
top: "10%", top: "10%",
left: "10%", left: "10%",
right: "10%", right: "10%",
bottom: "13%", bottom: "10%",
}, },
xAxis: { xAxis: {
type: "category", type: "category",
@ -429,15 +449,15 @@ export default {
}, },
label: { label: {
show: true, show: true,
fontSize: 14, fontSize: 16,
fontWeight: "normal", fontWeight: "bold",
formatter: "{b}\n{d}%", formatter: "{b}\n{d}%",
}, },
emphasis: { emphasis: {
label: { label: {
show: true, show: true,
fontSize: 14, fontSize: 26,
fontWeight: "normal", fontWeight: "bold",
formatter: "{b}\n{d}%", formatter: "{b}\n{d}%",
}, },
}, },
@ -507,6 +527,9 @@ export default {
flex-direction: column; flex-direction: column;
justify-content: space-around; justify-content: space-around;
box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1); box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
&:hover {
cursor: pointer;
}
&:first-child { &:first-child {
&:hover { &:hover {
cursor: pointer; cursor: pointer;

Loading…
Cancel
Save