123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190 |
- <!--
- - Copyright (c) 2018-2025, lengleng All rights reserved.
- -
- - Redistribution and use in source and binary forms, with or without
- - modification, are permitted provided that the following conditions are met:
- -
- - Redistributions of source code must retain the above copyright notice,
- - this list of conditions and the following disclaimer.
- - Redistributions in binary form must reproduce the above copyright
- - notice, this list of conditions and the following disclaimer in the
- - documentation and/or other materials provided with the distribution.
- - Neither the name of the pig4cloud.com developer nor the names of its
- - contributors may be used to endorse or promote products derived from
- - this software without specific prior written permission.
- - Author: lengleng (wangiegie@gmail.com)
- -->
- <template>
- <div class="execution">
- <div style="display: inline-block">
- <div class="startTime" style="display: inline-block">
- <span class="timeText" style="font-weight: bold;font-size: 14px"> 起始时间:</span>
- <el-date-picker
- v-model="startTime"
- :clearable="false"
- type="datetime"
- value-format="timestamp"
- placeholder="选择日期">
- </el-date-picker>
- </div>
- <div class="endTime" style="display: inline-block">
- <span class="timeText" style="font-weight: bold;font-size: 14px"> 截止时间:</span>
- <el-date-picker
- v-model="endTime"
- :clearable="false"
- type="datetime"
- value-format="timestamp"
- placeholder="选择日期">
- </el-date-picker>
- </div>
- <span style="font-weight: bold;font-size: 14px"> 场站名称:</span>
- <el-select style="width:250px" v-model="stationCode" @change="getAllWindturbineInfo" size="small">
- <el-option
- v-for="item in stationList"
- :key="item.value"
- :label="item.label"
- :value="item.value">
- <span style="float: left">{{ item.label }}</span>
- <span style="float: right; color: #8492a6;font-size: 13px">{{ item.value }}</span>
- </el-option>
- </el-select>
-
- <span style="font-weight: bold;font-size: 14px"> 所属设备:</span>
- <el-select style="width:250px" v-model="equipmentId" filterable size="small">
- <el-option
- v-for="item in windturbineInfoList"
- :key="item.value"
- :label="item.label"
- :value="item.value">
- <span style="float: left">{{ item.label }}</span>
- <span style="float: right; color: #8492a6;font-size: 13px">{{ item.value }}</span>
- </el-option>
- </el-select>
-
- <div class="timeQuery" style="display: inline-block">
- <el-button size="small" :loading="loading" @click="dateQuery">查询</el-button>
- </div>
- </div>
- <basic-container>
- <avue-crud ref="crud"
- :page.sync="page"
- :data="tableData"
- :table-loading="tableLoading"
- :option="tableOption"
- @search-change="searchChange"
- @refresh-change="refreshChange"
- @size-change="sizeChange"
- @current-change="currentChange">
- </avue-crud>
- </basic-container>
- </div>
- </template>
- <script>
- import {
- getStation,
- getAllWindturbineInfo,
- getByStationCodeAndEquipmentIdAndTimeBetween
- } from '@/api/windturbinestatusdata'
- import {tableOption} from '@/const/crud/windturbinestatusdata'
- import {mapGetters} from 'vuex'
- export default {
- name: 'windturbinestatusdata',
- data() {
- return {
- startTime: new Date(new Date().toLocaleDateString()).getTime(),
- endTime: new Date(new Date().toLocaleDateString()).getTime() + 60 * 60 * 24 * 1000 - 1,
- stationList: [],
- stationCode: [],
- loading: false,
- windturbineInfoList: [],
- equipmentId: '',
- searchForm: {},
- tableData: [],
- page: {
- total: 0, // 总页数
- currentPage: 1, // 当前页数
- pageSize: 20 // 每页显示多少条
- },
- tableLoading: false,
- tableOption: tableOption
- }
- },
- computed: {
- ...mapGetters(['permissions']),
- permissionList() {
- return {
- addBtn: this.vaildData(this.permissions.idp_windturbinestatusdata_add, false),
- delBtn: this.vaildData(this.permissions.idp_windturbinestatusdata_del, false),
- editBtn: this.vaildData(this.permissions.idp_windturbinestatusdata_edit, false)
- };
- }
- },
- mounted() {
- this.getStationCode()
- },
- methods: {
- dateQuery() {
- if (this.equipmentId === '' || this.equipmentId == null) {
- return alert("请选择所属设备")
- }
- this.tableLoading = true
- const param = new URLSearchParams()
- param.append('page', this.page)
- param.append('stationCode', this.stationCode)
- param.append("equipmentId", this.equipmentId)
- param.append('startTime', this.startTime)
- param.append('endTime', this.endTime)
- getByStationCodeAndEquipmentIdAndTimeBetween(param).then(response => {
- this.tableData = response.data.data.records
- this.page.total = response.data.data.total
- this.tableLoading = false
- }).catch(() => {
- this.tableLoading = false
- })
- },
- getStationCode() {
- this.tableLoading = true
- getStation().then(response => {
- this.stationList = response.data.data
- if (this.stationList.length > 0) {
- this.stationCode = this.stationList[0].value
- }
- this.getAllWindturbineInfo()
- this.tableLoading = false
- })
- },
- getAllWindturbineInfo() {
- this.windturbineInfoList = []
- this.equipmentId = ''
- this.tableLoading = true
- const param = new URLSearchParams()
- param.append('stationCode', this.stationCode)
- getAllWindturbineInfo(param).then(response => {
- this.windturbineInfoList = response.data.data
- if (this.windturbineInfoList.length > 0) {
- this.equipmentId = this.windturbineInfoList[0].value
- }
- this.tableLoading = false
- })
- },
- sizeChange(pageSize) {
- this.page.pageSize = pageSize
- },
- currentChange(current) {
- this.page.currentPage = current
- },
- searchChange(form, done) {
- this.searchForm = form
- this.page.currentPage = 1
- this.dateQuery(this.page, form)
- done()
- },
- refreshChange() {
- this.dateQuery()
- }
- }
- }
- </script>
|