|
@@ -1,279 +1,232 @@
|
|
|
<template>
|
|
|
- <div class="knowledge-2">
|
|
|
- <div class="query mg-b-8">
|
|
|
- <div class="query-items">
|
|
|
- <div class="query-item">
|
|
|
- <div class="lable">场站:</div>
|
|
|
- <div class="search-input">
|
|
|
- <el-select v-model="wpId" clearable placeholder="请选择" popper-class="select" @change="(wpId) => { getWt(wpId, true); }">
|
|
|
- <el-option v-for="item in wpArray" :key="item.id" :value="item.id" :label="item.name" />
|
|
|
- </el-select>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- <div class="query-item">
|
|
|
- <div class="lable">风机:</div>
|
|
|
- <div class="search-input">
|
|
|
- <el-select v-model="wtId" clearable placeholder="请选择" popper-class="select">
|
|
|
- <el-option v-for="item in wtArray" :key="item.id" :value="item.id" :label="item.name" />
|
|
|
- </el-select>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- <div class="query-item">
|
|
|
- <div class="lable">类型:</div>
|
|
|
- <div class="search-input">
|
|
|
- <el-select v-model="type" clearable placeholder="请选择" popper-class="select">
|
|
|
- <el-option v-for="item in typeArray" :key="item.id" :value="item.id" :label="item.name" />
|
|
|
- </el-select>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- <div class="query-item">
|
|
|
- <div class="query-item">
|
|
|
- <div class="lable">开始日期:</div>
|
|
|
- <div class="search-input">
|
|
|
- <el-date-picker v-model="value1" @change="BeginChange(value1)" type="date" value-format="YYYY-MM-DD"
|
|
|
- placeholder="选择日期" popper-class="date-select">
|
|
|
- </el-date-picker>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- <div class="query-item">
|
|
|
- <div class="lable">结束日期:</div>
|
|
|
- <div class="search-input">
|
|
|
- <el-date-picker v-model="value2" @change="EndChange(value2)" type="date" value-format="YYYY-MM-DD"
|
|
|
- placeholder="选择日期" popper-class="date-select">
|
|
|
- </el-date-picker>
|
|
|
- <div class="unit svg-icon svg-icon-gray">
|
|
|
- <svg-icon :svgid="''" />
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- <div class="query-actions" style="margin-right: 1500px">
|
|
|
- <button class="btn green" @click="onClickSearch">查询的</button>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- <div>
|
|
|
- <ComTable :data="tableData" height="85vh"></ComTable>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
+ <div class="knowledge-2">
|
|
|
+ <div class="query mg-b-8">
|
|
|
+ <div class="query-items">
|
|
|
+ <div class="query-item">
|
|
|
+ <div class="lable">场站:</div>
|
|
|
+ <div class="search-input">
|
|
|
+ <el-select v-model="wpId" clearable placeholder="请选择" popper-class="select"
|
|
|
+ @change="(wpId) => { getWt(wpId, true); }">
|
|
|
+ <el-option v-for="item in wpArray" :key="item.id" :value="item.id" :label="item.name" />
|
|
|
+ </el-select>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="query-item">
|
|
|
+ <div class="lable">风机:</div>
|
|
|
+ <div class="search-input">
|
|
|
+ <el-select v-model="wtId" clearable placeholder="请选择" popper-class="select">
|
|
|
+ <el-option v-for="item in wtArray" :key="item.id" :value="item.id" :label="item.name" />
|
|
|
+ </el-select>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="query-item">
|
|
|
+ <div class="query-item">
|
|
|
+ <div class="lable">开始日期:</div>
|
|
|
+ <div class="search-input">
|
|
|
+ <el-date-picker v-model="value1" type="datetimerange" range-separator="至"
|
|
|
+ start-placeholder="开始日期" end-placeholder="结束日期">
|
|
|
+ </el-date-picker>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="query-actions" style="margin-right: 1500px">
|
|
|
+ <button class="btn green" @click="requestSafeList">查询</button>
|
|
|
+ <button class="btn green" @click="exportCsv">导出</button>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <el-row :type="'flex'" class="content">
|
|
|
+ <el-col :span="24">
|
|
|
+ <ComTable :data="tableData" height="85vh"></ComTable>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+ </div>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-import ComTable from "@com/coms/table/table.vue";
|
|
|
+ import ComTable from "@com/coms/table/table.vue";
|
|
|
+ import Papa from 'papaparse';
|
|
|
+ export default {
|
|
|
+ components: {
|
|
|
+ ComTable,
|
|
|
+ Papa
|
|
|
+ },
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ value1: [],
|
|
|
+ wpId: "",
|
|
|
+ wpArray: [],
|
|
|
+ wpName: "",
|
|
|
+ wtId: "",
|
|
|
+ wtIdWait:1,
|
|
|
+ tableData: {
|
|
|
+ column: [{
|
|
|
+ name: "编号",
|
|
|
+ field: "index",
|
|
|
+ is_num: false,
|
|
|
+ is_light: false,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ name: "转换时间",
|
|
|
+ field: "zhsj",
|
|
|
+ is_num: false,
|
|
|
+ is_light: false,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ name: "操作类型",
|
|
|
+ field: "ConversionName",
|
|
|
+ is_num: false,
|
|
|
+ is_light: false,
|
|
|
+ }
|
|
|
+ ],
|
|
|
+ data: [],
|
|
|
+ },
|
|
|
+ };
|
|
|
+ },
|
|
|
+ created() {
|
|
|
+ this.getWp();
|
|
|
+ this.value1 = [new Date((new Date() - 3600 * 1000 * 24 * 30)).formatDate("yyyy-MM-dd"),new Date().formatDate("yyyy-MM-dd")];
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ exportCsv() {
|
|
|
+ let data = this.tableData;
|
|
|
+ let arrName = [];
|
|
|
+ let dataArr = [];
|
|
|
+ data.column.forEach(item =>{
|
|
|
+ arrName.push(item.name)
|
|
|
+ })
|
|
|
+ data.data.forEach(ele=>{
|
|
|
+ let i = 0;
|
|
|
+ let obj = {};
|
|
|
+ for(var j in ele){
|
|
|
+ obj[arrName[i++]] = ele[j]
|
|
|
+ }
|
|
|
+ dataArr.push(obj)
|
|
|
+ })
|
|
|
+ var csv = Papa.unparse(dataArr);
|
|
|
+ //定义文件内容,类型必须为Blob 否则createObjectURL会报错
|
|
|
+ let content = new Blob([csv]);
|
|
|
+ //生成url对象
|
|
|
+ let urlObject = window.URL || window.webkitURL || window;
|
|
|
+ let url = urlObject.createObjectURL(content);
|
|
|
+ //生成<a></a>DOM元素
|
|
|
+ let el = document.createElement("a");
|
|
|
+ //链接赋值
|
|
|
+ el.href = url;
|
|
|
+ el.download = "操作类型.cvs";
|
|
|
+ //必须点击否则不会下载
|
|
|
+ el.click();
|
|
|
+ //移除链接释放资源
|
|
|
+ urlObject.revokeObjectURL(url);
|
|
|
+ },
|
|
|
+ formatDate(date) {
|
|
|
+ var date = new Date(date);
|
|
|
+ var YY = date.getFullYear() + '-';
|
|
|
+ var MM = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1) + '-';
|
|
|
+ var DD = (date.getDate() < 10 ? '0' + (date.getDate()) : date.getDate());
|
|
|
+ var hh = (date.getHours() < 10 ? '0' + date.getHours() : date.getHours()) + ':';
|
|
|
+ var mm = (date.getMinutes() < 10 ? '0' + date.getMinutes() : date.getMinutes()) + ':';
|
|
|
+ var ss = (date.getSeconds() < 10 ? '0' + date.getSeconds() : date.getSeconds());
|
|
|
+ return YY + MM + DD +" "+hh + mm + ss;
|
|
|
+ },
|
|
|
+ // 获取风场
|
|
|
+ getWp() {
|
|
|
+ let that = this;
|
|
|
+ that.API.requestData({
|
|
|
+ baseURL: "http://10.155.32.4:9001",
|
|
|
+ subUrl: "benchmarking/wplist",
|
|
|
+ success(res) {
|
|
|
+ that.wpArray = res.data;
|
|
|
+ that.wpId = res.data[0].id;
|
|
|
+ that.wpName = res.data[0].wpName;
|
|
|
+ that.getWt(that.wpId);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
+ // 获取风机
|
|
|
+ getWt(wpid) {
|
|
|
+ let that = this;
|
|
|
+ if (that.wpId) {
|
|
|
+ that.API.requestData({
|
|
|
+ method: "GET",
|
|
|
+ baseURL: "http://10.155.32.4:9001",
|
|
|
+ subUrl: "benchmarking/wtList",
|
|
|
+ data: {
|
|
|
+ wpid
|
|
|
+ },
|
|
|
+ success(res) {
|
|
|
+ that.wtArray = res.data;
|
|
|
+ that.wtId = res.data[0].id;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 获取停机事件
|
|
|
+ requestSafeList(wpId,wtid) {
|
|
|
+ let that = this;
|
|
|
+ if(wpId && wtid){
|
|
|
+ that.wpId = wpId;
|
|
|
+ that.wtid = wtid;
|
|
|
+ }
|
|
|
+ if(typeof that.value1[0].valueOf() != 'string'){
|
|
|
+ that.value1[0] = that.formatDate(that.value1[0].valueOf())
|
|
|
+ }
|
|
|
+ if(typeof that.value1[1].valueOf() != 'string'){
|
|
|
+ that.value1[1] = that.formatDate(that.value1[1].valueOf())
|
|
|
+ }
|
|
|
+ let data = {
|
|
|
+ WindPowerStation: that.wpId,
|
|
|
+ wtid:that.wtid,
|
|
|
+ beginDate: that.value1[0].valueOf(),
|
|
|
+ endDate: that.value1[1].valueOf(),
|
|
|
+ };
|
|
|
+ that.API.requestData({
|
|
|
+ showLoading:true,
|
|
|
+ subUrl: "/operationrecord/czlb",
|
|
|
+ data,
|
|
|
+ success(res) {
|
|
|
+ if (res.code == 200) {
|
|
|
+ that.tableData.data = [];
|
|
|
+ if (res.data.length) {
|
|
|
+ let data = res.data;
|
|
|
+ for (var i = 0; i < data.length; i++) {
|
|
|
+ let obj = {
|
|
|
+ index: i+1,
|
|
|
+ zhsj: data[i].zhsj,
|
|
|
+ ConversionName: data[i].ConversionName,
|
|
|
+ };
|
|
|
+ that.tableData.data.push(obj);
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
-export default {
|
|
|
- components: { ComTable },
|
|
|
- data () {
|
|
|
- return {
|
|
|
- value1: "",
|
|
|
- value2: "",
|
|
|
- wpId: "",
|
|
|
- wpArray: [],
|
|
|
- wpName: "",
|
|
|
- wtId: "",
|
|
|
- type: "",
|
|
|
- typeArray: [
|
|
|
-
|
|
|
- {
|
|
|
- id: 4,
|
|
|
- name: '维护'
|
|
|
- },
|
|
|
- {
|
|
|
- id: 2,
|
|
|
- name: '故障'
|
|
|
- }],
|
|
|
- tableData: {
|
|
|
- column: [
|
|
|
- {
|
|
|
- name: "场站",
|
|
|
- field: "wpName",
|
|
|
- is_num: true,
|
|
|
- is_light: false,
|
|
|
- },
|
|
|
- {
|
|
|
- name: "机组",
|
|
|
- field: "wtName",
|
|
|
- is_num: false,
|
|
|
- is_light: false,
|
|
|
- },
|
|
|
- {
|
|
|
- name: "开始时刻",
|
|
|
- field: "stopTime",
|
|
|
- is_num: false,
|
|
|
- is_light: false,
|
|
|
- },
|
|
|
- {
|
|
|
- name: "结束时刻",
|
|
|
- field: "startTime",
|
|
|
- is_num: false,
|
|
|
- is_light: false,
|
|
|
- },
|
|
|
- {
|
|
|
- name: "停机小时数(h)",
|
|
|
- field: "stopHours",
|
|
|
- is_num: false,
|
|
|
- is_light: false,
|
|
|
- },
|
|
|
- {
|
|
|
- name: "状态",
|
|
|
- field: "statusName",
|
|
|
- is_num: false,
|
|
|
- is_light: false,
|
|
|
- },
|
|
|
- {
|
|
|
- name: "停机类型",
|
|
|
- field: "warnDesc",
|
|
|
- is_num: false,
|
|
|
- is_light: false,
|
|
|
- },
|
|
|
- {
|
|
|
- name: "损失电量(kWh)",
|
|
|
- field: "lossPower",
|
|
|
- is_num: false,
|
|
|
- is_light: false,
|
|
|
- },
|
|
|
- {
|
|
|
- name: "报警信息",
|
|
|
- field: "handleWay",
|
|
|
- is_num: false,
|
|
|
- is_light: false,
|
|
|
- },
|
|
|
- ],
|
|
|
- data: [],
|
|
|
- },
|
|
|
- };
|
|
|
- },
|
|
|
- created () {
|
|
|
- // this.requestSafeList();
|
|
|
- this.value1 = new Date((new Date().getTime() - 3600 * 1000 * 24)).formatDate("yyyy-MM-dd");
|
|
|
- this.value2 = this.getTime(2);
|
|
|
- this.getWp();
|
|
|
- this.requestSafeList();
|
|
|
- },
|
|
|
- methods: {
|
|
|
- getTime (val) { //时间戳处理,val=1是默认开始时间(当前月第一天),val=2是默认结束时间(今天)
|
|
|
- var date = new Date();
|
|
|
- var year = date.getFullYear(),
|
|
|
- month = date.getMonth() + 1,
|
|
|
- day = date.getDate();
|
|
|
- month >= 1 && month <= 9 ? (month = '0' + month) : '';
|
|
|
- day >= 0 && day <= 9 ? (day = '0' + day) : '';
|
|
|
- var begin = year + '-' + month + '-01';
|
|
|
- var end = year + '-' + month + '-' + day;
|
|
|
- if (val == 1) {
|
|
|
- return begin;
|
|
|
- } else if (val == 2) {
|
|
|
- return end;
|
|
|
- }
|
|
|
- },
|
|
|
- // 获取风场
|
|
|
- getWp (reGetWp) {
|
|
|
- let that = this;
|
|
|
- that.API.requestData({
|
|
|
- baseURL: "http://10.155.32.4:9001",
|
|
|
- subUrl: "benchmarking/wplist",
|
|
|
- success (res) {
|
|
|
- that.wpArray = res.data;
|
|
|
- that.wpId = res.data[0].id;
|
|
|
- that.wpName = res.data[0].wpName;
|
|
|
- that.getWt(that.wpId, reGetWp);
|
|
|
- }
|
|
|
- });
|
|
|
- },
|
|
|
-
|
|
|
- // 获取风机
|
|
|
- getWt (wpid, reGetWp) {
|
|
|
- let that = this;
|
|
|
- if (that.wpId) {
|
|
|
- that.API.requestData({
|
|
|
- method: "GET",
|
|
|
- baseURL: "http://10.155.32.4:9001",
|
|
|
- subUrl: "benchmarking/wtList",
|
|
|
- data: {
|
|
|
- wpid
|
|
|
- },
|
|
|
- success (res) {
|
|
|
- that.wtArray = res.data;
|
|
|
- // that.wtId = res.data[0].id;
|
|
|
- }
|
|
|
- });
|
|
|
- }
|
|
|
- },
|
|
|
- BeginChange (vl) {
|
|
|
- this.value1 = vl;
|
|
|
- },
|
|
|
- EndChange (vl) {
|
|
|
- this.value2 = vl;
|
|
|
- },
|
|
|
- typeChange (vl) {
|
|
|
- this.type = vl;
|
|
|
- },
|
|
|
- // 搜索按钮
|
|
|
- onClickSearch () {
|
|
|
- this.requestSafeList();
|
|
|
- },
|
|
|
- // 获取停机事件
|
|
|
- requestSafeList () {
|
|
|
- let that = this;
|
|
|
-
|
|
|
- let data = {
|
|
|
- tablepar: {
|
|
|
- pageNum: 1,
|
|
|
- pageSize: 1000,
|
|
|
- },
|
|
|
- beginDate: that.value1,
|
|
|
- endDate: that.value2,
|
|
|
- wpId: that.wpId,
|
|
|
- };
|
|
|
-
|
|
|
- if (that.wtId != '') data.wtId = that.wtId;
|
|
|
- if (that.type != '') data.type = that.type;
|
|
|
-
|
|
|
- this.API.requestData({
|
|
|
- method: "POST",
|
|
|
- subUrl: "/event/getShutdownevent",
|
|
|
- data,
|
|
|
- success (res) {
|
|
|
- if (res.code == 200) {
|
|
|
- that.tableData.data = [];
|
|
|
- if (res.data.list.length) {
|
|
|
- let data = res.data.list;
|
|
|
- for (var i = 0; i < data.length; i++) {
|
|
|
- let obj = {
|
|
|
- wpName: data[i].wpName,
|
|
|
- wtName: data[i].wtName,
|
|
|
- stopTime: new Date(data[i].stopTime).formatDate("yyyy-MM-dd hh:mm:ss"),
|
|
|
-
|
|
|
- stopHours: data[i].stopHours,
|
|
|
- statusName: data[i].statusName,
|
|
|
- warnDesc: data[i].warnDesc,
|
|
|
- lossPower: data[i].lossPower,
|
|
|
- handleWay: data[i].handleWay,
|
|
|
-
|
|
|
- };
|
|
|
- if (data[i].startTime) obj.startTime = new Date(data[i].startTime).formatDate("yyyy-MM-dd hh:mm:ss");
|
|
|
- that.tableData.data.push(obj);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
- },
|
|
|
- });
|
|
|
- },
|
|
|
- },
|
|
|
-};
|
|
|
+ }
|
|
|
+ },
|
|
|
+ });
|
|
|
+ },
|
|
|
+ },
|
|
|
+ watch:{
|
|
|
+ wtId(e){
|
|
|
+ if(this.wtIdWait == 1){//这里只让执行一次
|
|
|
+ this.requestSafeList(this.wpId,e);
|
|
|
+ this.wtIdWait = 2;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ };
|
|
|
</script>
|
|
|
|
|
|
<style lang="less" scope>
|
|
|
-@titleGray: #9ca5a8;
|
|
|
-@rowGray: #606769;
|
|
|
-@darkBack: #536268;
|
|
|
-.knowledge-2 {
|
|
|
- .el-select {
|
|
|
- width: 200px;
|
|
|
- }
|
|
|
- .el-input {
|
|
|
- width: 200px;
|
|
|
- }
|
|
|
-}
|
|
|
+ @titleGray: #9ca5a8;
|
|
|
+ @rowGray: #606769;
|
|
|
+ @darkBack: #536268;
|
|
|
+
|
|
|
+ .knowledge-2 {
|
|
|
+ .el-select {
|
|
|
+ width: 200px;
|
|
|
+ }
|
|
|
+
|
|
|
+ .el-input {
|
|
|
+ width: 200px;
|
|
|
+ }
|
|
|
+ }
|
|
|
</style>
|