|
@@ -10,7 +10,11 @@
|
|
|
clearable
|
|
|
placeholder="请选择"
|
|
|
popper-class="select"
|
|
|
- @change="(stationId) => { Windturbines() }"
|
|
|
+ @change="
|
|
|
+ (stationId) => {
|
|
|
+ Windturbines();
|
|
|
+ }
|
|
|
+ "
|
|
|
>
|
|
|
<el-option
|
|
|
v-for="item in ChangZhan"
|
|
@@ -53,9 +57,14 @@
|
|
|
<div class="table-box">
|
|
|
<div class="title">自定义报警统计</div>
|
|
|
<div class="custom-report-items">
|
|
|
- <div class="title" v-for="item in tableData" :key="item" @click="alertDetail(item)">
|
|
|
- <div class="alarmName">{{item.alarmtext}}</div>
|
|
|
- <div class="alarmCount">{{item.sum}}</div>
|
|
|
+ <div
|
|
|
+ class="title"
|
|
|
+ v-for="item in tableData"
|
|
|
+ :key="item"
|
|
|
+ @click="alertDetail(item)"
|
|
|
+ >
|
|
|
+ <div class="alarmName">{{ item.alarmtext }}</div>
|
|
|
+ <div class="alarmCount">{{ item.sum }}</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
@@ -78,8 +87,8 @@
|
|
|
<el-scrollbar>
|
|
|
<tbody>
|
|
|
<tr v-for="item in dGridData" :key="item">
|
|
|
- <td>{{item.name}}</td>
|
|
|
- <td>{{item.sum}}</td>
|
|
|
+ <td>{{ item.name }}</td>
|
|
|
+ <td>{{ item.sum }}</td>
|
|
|
</tr>
|
|
|
</tbody>
|
|
|
</el-scrollbar>
|
|
@@ -87,16 +96,25 @@
|
|
|
</div>
|
|
|
<div class="dChart" height="100%" id="dChart">
|
|
|
<div class="title">报警统计柱状图</div>
|
|
|
- <!-- <multiple-hover-bar-chart height="80%" width="90%"></multiple-hover-bar-chart> -->
|
|
|
- <!-- <multiple-hover-bar-chart height="100%" :list="dChartData"></multiple-hover-bar-chart> -->
|
|
|
+ <div id="chartDom" style="style: 100%; height: 90%"></div>
|
|
|
+ <!-- <multiple-hover-bar-chart
|
|
|
+ height="90%"
|
|
|
+ widht="100%"
|
|
|
+ :list="dChartData"
|
|
|
+ :units="['次数']"
|
|
|
+ :showLegend="false"
|
|
|
+ /> -->
|
|
|
+ <!-- <Te /> -->
|
|
|
</div>
|
|
|
</el-dialog>
|
|
|
</div>
|
|
|
</template>
|
|
|
<script>
|
|
|
// import ComTable from "@/components/coms/table/table.vue";
|
|
|
-import MultipleHoverBarChart from "../../components/chart/bar/multiple-bar-chart.vue";
|
|
|
+import MultipleHoverBarChart from "./chart.vue";
|
|
|
import * as echarts from "echarts";
|
|
|
+import util from "@/helper/util.js";
|
|
|
+import partten from "@/helper/partten.js";
|
|
|
export default {
|
|
|
name: "customStatistics",
|
|
|
components: { MultipleHoverBarChart },
|
|
@@ -110,7 +128,7 @@ export default {
|
|
|
tableData: [],
|
|
|
dialogShow: false,
|
|
|
dGridData: [],
|
|
|
- dChartData: []
|
|
|
+ dChartData: [],
|
|
|
// tableLoading: true
|
|
|
};
|
|
|
},
|
|
@@ -133,7 +151,7 @@ export default {
|
|
|
success(res) {
|
|
|
that.ChangZhan = res.data;
|
|
|
that.stationId = res.data[0].id;
|
|
|
- }
|
|
|
+ },
|
|
|
});
|
|
|
},
|
|
|
getTable() {
|
|
@@ -147,7 +165,7 @@ export default {
|
|
|
data: {
|
|
|
stationid: this.stationId,
|
|
|
datebegin: this.startDate,
|
|
|
- dateend: this.endDate
|
|
|
+ dateend: this.endDate,
|
|
|
},
|
|
|
success(res) {
|
|
|
let tmpArr = [];
|
|
@@ -156,11 +174,11 @@ export default {
|
|
|
item["key"] = key;
|
|
|
tmpArr.push(item);
|
|
|
}
|
|
|
- tmpArr.sort(function(a, b) {
|
|
|
+ tmpArr.sort(function (a, b) {
|
|
|
return b["sum"] - a["sum"];
|
|
|
});
|
|
|
that.tableData = tmpArr;
|
|
|
- }
|
|
|
+ },
|
|
|
});
|
|
|
},
|
|
|
async alertDetail(item) {
|
|
@@ -174,22 +192,22 @@ export default {
|
|
|
stationid: this.stationId,
|
|
|
datebegin: this.startDate,
|
|
|
dateend: this.endDate,
|
|
|
- snapid: item["key"]
|
|
|
- }
|
|
|
+ snapid: item["key"],
|
|
|
+ },
|
|
|
});
|
|
|
let keyValue = resData.data.data;
|
|
|
const dGridData = [];
|
|
|
for (let key in keyValue) {
|
|
|
dGridData.push({ sum: keyValue[key], name: key });
|
|
|
}
|
|
|
- dGridData.sort(function(a, b) {
|
|
|
+ dGridData.sort(function (a, b) {
|
|
|
return b.sum - a.sum;
|
|
|
});
|
|
|
this.dGridData = dGridData;
|
|
|
this.alertDetailChart(item);
|
|
|
},
|
|
|
async alertDetailChart(item) {
|
|
|
- let resData = await this.API.requestData({
|
|
|
+ let { data } = await this.API.requestData({
|
|
|
timeout: 30000,
|
|
|
method: "GET",
|
|
|
baseURL: "http://192.168.1.14:8075/",
|
|
@@ -198,68 +216,96 @@ export default {
|
|
|
stationid: this.stationId,
|
|
|
datebegin: this.startDate,
|
|
|
dateend: this.endDate,
|
|
|
- snapid: item["key"]
|
|
|
- }
|
|
|
+ snapid: item["key"],
|
|
|
+ },
|
|
|
});
|
|
|
- let dataX = [],
|
|
|
- data1 = [],
|
|
|
- data2 = [];
|
|
|
- for (let item of resData.data.data) {
|
|
|
- dataX.push(item["linenum"]);
|
|
|
- data1.push(item["happendsum"]);
|
|
|
- data2.push(item["sum"]);
|
|
|
- }
|
|
|
|
|
|
- let option = {
|
|
|
- color: ["#05bb4c", "#4b55ae", "#fa8c16"],
|
|
|
- title: {
|
|
|
- text: "报警统计柱状图",
|
|
|
- left: "5%"
|
|
|
- },
|
|
|
- tooltip: {
|
|
|
- trigger: "axis",
|
|
|
- axisPointer: {
|
|
|
- type: "shadow"
|
|
|
- }
|
|
|
- },
|
|
|
- legend: {
|
|
|
- data: ["总数", "发生数量"],
|
|
|
- textStyle: {
|
|
|
- color: "#fff"
|
|
|
- }
|
|
|
+ let chartDom = document.getElementById("chartDom");
|
|
|
+ let myChart = echarts.init(chartDom);
|
|
|
+ let option;
|
|
|
+
|
|
|
+ let xAxisData = [];
|
|
|
+ let seriesData = [];
|
|
|
+ let legendData = [];
|
|
|
+ const color = [
|
|
|
+ "#05bb4c",
|
|
|
+ "#4b55ae",
|
|
|
+ "#fa8c16",
|
|
|
+ "#f8de5b",
|
|
|
+ "#1a93cf",
|
|
|
+ "#c531c7",
|
|
|
+ "#bd3338",
|
|
|
+ ];
|
|
|
+
|
|
|
+ data.forEach((ele, index) => {
|
|
|
+ xAxisData.push(ele.linenum);
|
|
|
+ seriesData.push({
|
|
|
+ name: ele.linenum,
|
|
|
+ value: ele.sum,
|
|
|
+ itemStyle: {
|
|
|
+ color: color[index],
|
|
|
+ },
|
|
|
+ });
|
|
|
+ legendData.push(ele.linenum);
|
|
|
+ });
|
|
|
+
|
|
|
+ option = {
|
|
|
+ xAxis: {
|
|
|
+ type: "category",
|
|
|
+ data: xAxisData,
|
|
|
+ axisLine: {
|
|
|
+ show: true, //隐藏y轴
|
|
|
+ },
|
|
|
},
|
|
|
- grid: {
|
|
|
- left: "5%",
|
|
|
- right: "6%",
|
|
|
- bottom: "3%",
|
|
|
- containLabel: true
|
|
|
+ yAxis: {
|
|
|
+ type: "value",
|
|
|
+ splitLine: {
|
|
|
+ show: false,
|
|
|
+ lineStyle: {
|
|
|
+ type: "dotted",
|
|
|
+ color: "#ccc",
|
|
|
+ },
|
|
|
+ },
|
|
|
+ axisLine: {
|
|
|
+ show: true, //隐藏y轴
|
|
|
+ },
|
|
|
},
|
|
|
- xAxis: { name: "线路", type: "category", data: dataX },
|
|
|
- yAxis: { name: "数量", type: "value" },
|
|
|
+
|
|
|
series: [
|
|
|
{
|
|
|
- name: "总数",
|
|
|
+ data: seriesData,
|
|
|
type: "bar",
|
|
|
- barWidth: 40,
|
|
|
- barGap: "-100%",
|
|
|
- label: { normal: { show: true, position: "top" } },
|
|
|
- data: data2
|
|
|
+ barMaxWidth: 80,
|
|
|
+ barGap: 3,
|
|
|
},
|
|
|
- {
|
|
|
- name: "发生数量",
|
|
|
- type: "bar",
|
|
|
- barGap: "-100%",
|
|
|
- barWidth: 40,
|
|
|
- label: { normal: { show: true, position: "inside" } },
|
|
|
- data: data1
|
|
|
- }
|
|
|
- ]
|
|
|
+ ],
|
|
|
+ grid: {
|
|
|
+ top: 32,
|
|
|
+ left: 8,
|
|
|
+ right: 8,
|
|
|
+ bottom: 0,
|
|
|
+ containLabel: true,
|
|
|
+ },
|
|
|
+ tooltip: {
|
|
|
+ trigger: "axis",
|
|
|
+ backgroundColor:
|
|
|
+ this.$store.state.themeName === "dark"
|
|
|
+ ? "rgba(0,0,0,0.4)"
|
|
|
+ : "rgba(255,255,255,0.5)",
|
|
|
+ borderColor:
|
|
|
+ this.$store.state.themeName === "dark"
|
|
|
+ ? partten.getColor("gray")
|
|
|
+ : "#000",
|
|
|
+ textStyle: {
|
|
|
+ color: this.$store.state.themeName === "dark" ? "#fff" : "#000",
|
|
|
+ fontSize: 12,
|
|
|
+ },
|
|
|
+ },
|
|
|
};
|
|
|
- let chart = echarts.init(document.getElementById("dChart"));
|
|
|
- chart.clear();
|
|
|
- chart.setOption(option);
|
|
|
- }
|
|
|
- }
|
|
|
+
|
|
|
+ option && myChart.setOption(option);
|
|
|
+ },
|
|
|
+ },
|
|
|
};
|
|
|
</script>
|
|
|
<style lang="less">
|
|
@@ -292,7 +338,7 @@ export default {
|
|
|
display: flex;
|
|
|
flex-wrap: wrap;
|
|
|
height: 80vh;
|
|
|
- overflow-y:auto;
|
|
|
+ overflow-y: auto;
|
|
|
.title {
|
|
|
height: 80px;
|
|
|
width: 18.8vw;
|