123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236 |
- <template>
- <div>
- <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="stationId"
- clearable
- placeholder="请选择"
- popper-class="select"
- @change="(stationId) => { Windturbines() }"
- >
- <el-option
- v-for="item in ChangZhan"
- :key="item.id"
- :value="item.id"
- :label="item.name"
- ></el-option>
- </el-select>
- </div>
- </div>
- <div class="query-item">
- <div class="lable">机组:</div>
- <div class="search-input">
- <el-select v-model="wtId" placeholder="请选择" popper-class="select">
- <el-option
- v-for="item in windturbines"
- :key="item.id"
- :label="item.name"
- :value="item.id"
- ></el-option>
- </el-select>
- </div>
- </div>
- <div class="query-item">
- <div class="lable">开始日期:</div>
- <div class="search-input">
- <el-date-picker
- v-model="startDate"
- type="datetime"
- placeholder="开始日期"
- popper-class="date-select"
- value-format="YYYY-MM-DD HH:mm:ss"
- ></el-date-picker>
- </div>
- </div>
- <div class="query-item">
- <div class="lable">结束日期:</div>
- <div class="search-input">
- <el-date-picker
- v-model="endDate"
- type="datetime"
- placeholder="开始日期"
- popper-class="date-select"
- value-format="YYYY-MM-DD HH:mm:ss"
- ></el-date-picker>
- </div>
- </div>
- <div class="query-actions">
- <button class="btn green" @click="getTable()">查询</button>
- <button class="btn green" @click="exportExcel()">导出</button>
- </div>
- </div>
- </div>
- <div class="table-box">
- <div class="title">自定义报警</div>
- <ComTable
- ref="curRef"
- :data="tableData"
- :pageSize="20"
- @onPagging="onChangePage"
- height="73vh"
- v-loading="tableLoading"
- element-loading-text="拼命加载中.."
- element-loading-background="rgba(0, 0, 0, 0.8)"
- ></ComTable>
- </div>
- </div>
- </template>
- <script>
- import ComTable from "@/components/coms/table/table.vue";
- export default {
- name: "customAlarm",
- components: { ComTable },
- data() {
- let that = this;
- return {
- ChangZhan: [],
- stationId: "MHS_FDC",
- windturbines: [],
- wtId: "",
- startDate: "",
- endDate: "",
- tableLoading: true,
- pageIndex: 1,
- pageSize: 20,
- tableData: {
- column: [
- {
- name: "场站",
- field: "stationName",
- is_num: false,
- is_light: false,
- sortable: true,
- id: "id"
- },
- {
- name: "机组",
- field: "windturbineName",
- is_num: false,
- is_light: false,
- sortable: true,
- id: "id"
- },
- {
- name: "报警时间",
- field: "alertTime",
- is_num: false,
- is_light: false,
- sortable: true,
- id: "id"
- },
- {
- name: "型号",
- field: "modelId",
- is_num: false,
- is_light: false,
- sortable: true,
- id: "id"
- },
- {
- name: "报警描述",
- field: "alertText",
- is_num: false,
- is_light: false,
- sortable: true,
- id: "id"
- }
- ],
- data: [],
- currentPageTotal: 0
- }
- };
- },
- created() {
- this.ChangZhanVal();
- this.Windturbines();
- let end = new Date();
- let start = new Date(end.getTime() - 1 * 24 * 60 * 60 * 1000);
- this.endDate = end.formatDate("yyyy-MM-dd hh:mm:ss");
- this.startDate = start.formatDate("yyyy-MM-dd hh:mm:ss");
- this.getTable();
- },
- methods: {
- // 场站
- ChangZhanVal() {
- var that = this;
- that.API.requestData({
- method: "GET",
- baseURL: "http://10.155.32.4:9001/",
- subUrl: "benchmarking/wplist",
- success(res) {
- that.ChangZhan = res.data;
- that.stationId = res.data[0].id;
- }
- });
- },
- Windturbines() {
- let that = this;
- that.API.requestData({
- method: "GET",
- subUrl: "powercompare/windturbineAjax",
- data: { wpId: that.stationId },
- success(res) {
- that.windturbines = res.data;
- // that.wtId = res.data[0].id;
- that.windturbines.unshift({ id: "", name: "请选择" });
- that.wtId = "";
- }
- });
- },
- getTable() {
- let that = this;
- this.tableLoading = true;
- this.API.requestData({
- timeout: 30000,
- method: "GET",
- baseURL: "http://192.168.1.18:8075/",
- subUrl: "alarm/history/page2",
- data: {
- category1: "custom",
- stationid: this.stationId,
- starttime: this.startDate,
- endtime: this.endDate,
- windturbineid: this.wtId,
- pagenum: this.pageIndex,
- pagesize: this.pageSize
- },
- success(res) {
- if (res.data) {
- that.tableData.data = res.data.records;
- that.tableData.total = res.data.total;
- } else {
- that.tableData.data = [];
- that.tableData.total = 0;
- }
- that.tableLoading = false;
- }
- });
- },
- onChangePage(params) {
- this.pageIndex = params.pageIndex;
- this.pageSize = params.pageSize;
- this.getTable();
- },
- exportExcel() {
- // let excelData = this.BASE.deepCopy(this.tableData);
- // excelData.data.forEach(ele => {
- // ele["category2"] = this.partsMap[ele["category2"]];
- // });
- this.BASE.exportExcel(this.tableData, "自定义报警");
- }
- }
- };
- </script>
- <style lang="less">
- .title {
- background: rgba(255, 255, 255, 0.1);
- margin-bottom: 8px;
- padding: 1vh;
- }
- </style>
|