|
@@ -62,7 +62,8 @@
|
|
</div>
|
|
</div>
|
|
<div class="query-actions">
|
|
<div class="query-actions">
|
|
<button class="btn green" @click="searchData">搜索</button>
|
|
<button class="btn green" @click="searchData">搜索</button>
|
|
- <button class="btn green" @click="searchTree">筛选</button>
|
|
|
|
|
|
+ <button class="btn" @click="searchTree">筛选</button>
|
|
|
|
+ <button class="btn" @click="exportExcel()">导出</button>
|
|
<!-- <button class="btn green" @click="fx">分析</button> -->
|
|
<!-- <button class="btn green" @click="fx">分析</button> -->
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
@@ -144,6 +145,7 @@ import Table3 from "../../components/coms/table/table3.vue";
|
|
import MultipleYLineChartNormal from "./multiple-y-line-chart-normal.vue";
|
|
import MultipleYLineChartNormal from "./multiple-y-line-chart-normal.vue";
|
|
import FX from "./alarm-center-yjfx.vue";
|
|
import FX from "./alarm-center-yjfx.vue";
|
|
import BASE from "@tools/basicTool.js";
|
|
import BASE from "@tools/basicTool.js";
|
|
|
|
+import XLSX from 'xlsx'
|
|
export default {
|
|
export default {
|
|
components: {
|
|
components: {
|
|
Panel3,
|
|
Panel3,
|
|
@@ -153,6 +155,7 @@ export default {
|
|
},
|
|
},
|
|
data() {
|
|
data() {
|
|
return {
|
|
return {
|
|
|
|
+ nb:[],
|
|
dialogTitleFX: "",
|
|
dialogTitleFX: "",
|
|
dialogVisibleFX: false,
|
|
dialogVisibleFX: false,
|
|
dialogTitle: "",
|
|
dialogTitle: "",
|
|
@@ -576,8 +579,8 @@ export default {
|
|
enddate: enddate,
|
|
enddate: enddate,
|
|
},
|
|
},
|
|
});
|
|
});
|
|
-
|
|
|
|
- ////////
|
|
|
|
|
|
+ console.log('123',data);
|
|
|
|
+ this.nb=data.data
|
|
this.tableData = [];
|
|
this.tableData = [];
|
|
const resData = data.data;
|
|
const resData = data.data;
|
|
// const resData =this.resdata;
|
|
// const resData =this.resdata;
|
|
@@ -610,8 +613,8 @@ export default {
|
|
|
|
|
|
this.tableData.column = column;
|
|
this.tableData.column = column;
|
|
this.tableData.data = dataAll;
|
|
this.tableData.data = dataAll;
|
|
-
|
|
|
|
- ///////////////////// 获取规则list
|
|
|
|
|
|
+ console.log('表头',this.tableData.column);
|
|
|
|
+ console.log('表格数据',this.tableData.data);
|
|
const map = {};
|
|
const map = {};
|
|
var windNum = [];
|
|
var windNum = [];
|
|
for (let i in resData) {
|
|
for (let i in resData) {
|
|
@@ -676,6 +679,44 @@ export default {
|
|
this.dialogTitleFX = "预警分析";
|
|
this.dialogTitleFX = "预警分析";
|
|
this.dialogVisibleFX = true;
|
|
this.dialogVisibleFX = true;
|
|
},
|
|
},
|
|
|
|
+ exportExcel() {
|
|
|
|
+ let that = this;
|
|
|
|
+ const headers = ['机组编号', '报警描述', '数量', '时间(m)']
|
|
|
|
+ var resultArray = [];
|
|
|
|
+ for (var i = 0; i < that.nb.length; i++) {
|
|
|
|
+ var obj = that.nb[i];
|
|
|
|
+ for (var key in obj) {
|
|
|
|
+ if (Array.isArray(obj[key])) {
|
|
|
|
+ var innerArray = obj[key];
|
|
|
|
+ for (var j = 0; j < innerArray.length; j++) {
|
|
|
|
+ var innerObj = innerArray[j];
|
|
|
|
+ // 在这里处理最里面的数据
|
|
|
|
+ var alertText = innerObj.alertText;
|
|
|
|
+ var count = innerObj.count;
|
|
|
|
+ var windturbineId = innerObj.windturbineId;
|
|
|
|
+ var time = innerObj.time;
|
|
|
|
+ // 其他属性的处理...
|
|
|
|
+ console.log(windturbineId,alertText, count,time);
|
|
|
|
+ resultArray.push({
|
|
|
|
+ windturbineId: windturbineId,
|
|
|
|
+ alertText: alertText,
|
|
|
|
+ count: count,
|
|
|
|
+ time: time
|
|
|
|
+ });
|
|
|
|
+ console.log('resultArray',resultArray);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+ const data = resultArray.map(item => [item.windturbineId, item.alertText, item.count, item.time])
|
|
|
|
+ const worksheet = XLSX.utils.aoa_to_sheet([headers, ...data])
|
|
|
|
+ const workbook = XLSX.utils.book_new()
|
|
|
|
+ XLSX.utils.book_append_sheet(workbook, worksheet, 'Sheet1')
|
|
|
|
+ XLSX.writeFile(workbook, '报警描述.xlsx')
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
},
|
|
},
|
|
};
|
|
};
|
|
</script>
|
|
</script>
|