|
@@ -3,20 +3,21 @@
|
|
|
<div class="optionDiv">
|
|
|
<div>
|
|
|
场站:
|
|
|
- <el-select v-model="staionId" placeholder="请选择">
|
|
|
+ <el-select v-model="staionId" placeholder="请选择" clearable>
|
|
|
<el-option
|
|
|
- v-for="item in staionInfo"
|
|
|
+ v-for="item in stationInfo"
|
|
|
:key="item.id"
|
|
|
:label="item.name"
|
|
|
- :value="item.name">
|
|
|
+ :value="item.id">
|
|
|
</el-option>
|
|
|
</el-select>
|
|
|
</div>
|
|
|
- <el-button class="option" @click="search">查询</el-button>
|
|
|
- <el-button class="option" @click="dialogVisible = true">补录</el-button>
|
|
|
+ <el-button class="option" @click="search(staionId)">查询</el-button>
|
|
|
+ <el-button class="option" @click="insertInfo">新增</el-button>
|
|
|
</div>
|
|
|
<div style="margin-top: .5%">
|
|
|
<el-table
|
|
|
+ v-loading="loading"
|
|
|
:data="tableData.slice((page.currentPage-1)*page.pageSize,page.currentPage*page.pageSize)"
|
|
|
border
|
|
|
style="width: 100%">
|
|
@@ -26,6 +27,12 @@
|
|
|
<el-table-column prop="wdSum" align="center" label="主风向"></el-table-column>
|
|
|
<el-table-column prop="generatingCapacity" align="center" label="年平均发电量(MWh)"></el-table-column>
|
|
|
<el-table-column prop="realTimeTotal" align="center" label="年平均有效小时数"></el-table-column>
|
|
|
+ <el-table-column label="操作" align="center">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-button icon="el-icon-edit" @click="handleClick(scope.row)" type="text" size="small">编辑</el-button>
|
|
|
+ <el-button icon="el-icon-delete" @click="deleteClick(scope.row)" type="text" size="small">删除</el-button>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
</el-table>
|
|
|
<div class="block">
|
|
|
<el-pagination
|
|
@@ -39,23 +46,14 @@
|
|
|
</el-pagination>
|
|
|
</div>
|
|
|
</div>
|
|
|
- <el-dialog title="编辑" :visible.sync="dialogVisible">
|
|
|
- <el-form :model="form" :rules="rules">
|
|
|
+ <el-dialog :title="title" :visible.sync="dialogVisible">
|
|
|
+ <el-form ref="form" :model="form" :rules="rules" label-width="120px">
|
|
|
<el-row class="row-bg el-row-two" justify="space-between">
|
|
|
<el-col :span="12">
|
|
|
- <el-form-item label="日期" style="width: 100%">
|
|
|
- <el-date-picker
|
|
|
- v-model="form.date"
|
|
|
- type="date"
|
|
|
- placeholder="选择日期" :picker-options="pickerOptions">
|
|
|
- </el-date-picker>
|
|
|
- </el-form-item>
|
|
|
- </el-col>
|
|
|
- <el-col :span="12">
|
|
|
- <el-form-item label="场站" style="width: 100%">
|
|
|
- <el-select v-model="form.staionId" placeholder="请选择" >
|
|
|
+ <el-form-item label="场站:" prop="stationName">
|
|
|
+ <el-select v-model="form.stationName" placeholder="请选择" style="width: 100%">
|
|
|
<el-option
|
|
|
- v-for="item in staionInfo"
|
|
|
+ v-for="item in stationInfo"
|
|
|
:key="item.id"
|
|
|
:label="item.name"
|
|
|
:value="item.name">
|
|
@@ -63,54 +61,192 @@
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
+ <el-col :span="12">
|
|
|
+ <el-form-item label="风机型号:" prop="modelName">
|
|
|
+ <el-input v-model="form.modelName" placeholder="请输入内容" style="width: 100%"></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+
|
|
|
+ <el-row class="row-bg el-row-two" justify="space-between">
|
|
|
+ <el-col :span="12">
|
|
|
+ <el-form-item label="平均风速:" prop="wsAve">
|
|
|
+ <el-input v-model="form.wsAve" placeholder="请输入内容" style="width: 100%"></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="12">
|
|
|
+ <el-form-item label="主风向:" prop="wdSum">
|
|
|
+ <el-input v-model="form.wdSum" placeholder="请输入内容" style="width: 100%"></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+ <el-row class="row-bg el-row-two" justify="space-between">
|
|
|
+ <el-col :span="12">
|
|
|
+ <el-form-item label="年平均发电量:" prop="generatingCapacity">
|
|
|
+ <el-input v-model="form.generatingCapacity" placeholder="请输入内容" style="width: 100%"></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="12">
|
|
|
+ <el-form-item label="年平均等效小时数:" prop="realTimeTotal" label-width="150px">
|
|
|
+ <el-input v-model="form.realTimeTotal" placeholder="请输入内容" style="width: 100%"></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
</el-row>
|
|
|
+
|
|
|
</el-form>
|
|
|
<div slot="footer" class="dialog-footer">
|
|
|
<el-button @click="dialogVisible = false">取 消</el-button>
|
|
|
- <el-button type="primary" @click="dialogVisible = false">确 定</el-button>
|
|
|
+ <el-button type="primary" @click="saveInfo">确 定</el-button>
|
|
|
</div>
|
|
|
</el-dialog>
|
|
|
</el-card>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-import {getStationInfo} from "@/api/biz/manualEntry/stationDataInfoEntry";
|
|
|
+import {
|
|
|
+ getStationInfo,
|
|
|
+ getFanModelDataList,
|
|
|
+ saveFanModelData,
|
|
|
+ deleteFanModelData
|
|
|
+} from "@/api/biz/manualEntry/stationDataInfoEntry";
|
|
|
|
|
|
export default {
|
|
|
// 杨总数据信息补录
|
|
|
name: "index",
|
|
|
data() {
|
|
|
+ const reg = /^\d+(\.\d{1,6})?$/
|
|
|
+ const checkFnum = (rule, value, callback) => {
|
|
|
+ if (!value) {
|
|
|
+ callback(new Error('不能为空'))
|
|
|
+ }
|
|
|
+ if (reg.test(value) == false) {
|
|
|
+ callback(new Error('只能输入正数数字或带小数点6位以内的数字'));
|
|
|
+ }
|
|
|
+ callback()
|
|
|
+
|
|
|
+ }
|
|
|
return {
|
|
|
+ saveFlag: 'add',
|
|
|
dialogVisible: false,
|
|
|
date: new Date(new Date() - 86400000),
|
|
|
staionId: '',
|
|
|
- staionInfo: [],
|
|
|
+ stationInfo: [],
|
|
|
pickerOptions: {
|
|
|
disabledDate(time) {
|
|
|
return time.getTime() > Date.now() - 86400000
|
|
|
}
|
|
|
},
|
|
|
tableData: [],
|
|
|
+ loading: false,
|
|
|
page: {
|
|
|
total: 0, // 总页数
|
|
|
currentPage: 1, // 当前页数
|
|
|
pageSize: 10 // 每页显示多少条
|
|
|
},
|
|
|
+ title: '新增&保存',
|
|
|
form: {},
|
|
|
- rules: {},
|
|
|
+ rules: {
|
|
|
+ wsAve: [{required: true, validator: checkFnum, trigger: 'change'}],
|
|
|
+ wdSum: [{required: true, message: '请填写主风向', trigger: 'change'}],
|
|
|
+ generatingCapacity: [{required: true, validator: checkFnum, trigger: 'change'}],
|
|
|
+ realTimeTotal: [{required: true, validator: checkFnum, trigger: 'change'}],
|
|
|
+ stationName: [{required: true, message: '请选择场站', trigger: 'change'}],
|
|
|
+ modelName: [{required: true, message: '请填写风机型号', trigger: 'change'}],
|
|
|
+ },
|
|
|
+ id: '',
|
|
|
}
|
|
|
},
|
|
|
mounted() {
|
|
|
this.getStationInfo()
|
|
|
},
|
|
|
methods: {
|
|
|
- search() {
|
|
|
+ search(id) {
|
|
|
+ this.loading = true
|
|
|
+ if (id === undefined || id === null) id = ''
|
|
|
+ getFanModelDataList({id: id}).then(res => {
|
|
|
+ this.tableData = res.data
|
|
|
+ this.page.total = this.tableData.length
|
|
|
+ this.loading = false
|
|
|
+ }).catch(err => {
|
|
|
+ console.log('获取场站统计数据异常:' + err)
|
|
|
+ this.loading = false
|
|
|
+ })
|
|
|
+ },
|
|
|
+ insertInfo() {
|
|
|
+ this.saveFlag = 'add'
|
|
|
+ this.title = '新增&保存'
|
|
|
+ this.resetForm()
|
|
|
+ this.dialogVisible = true
|
|
|
+ },
|
|
|
+ // 编辑
|
|
|
+ handleClick(row) {
|
|
|
+ this.saveFlag = 'edit'
|
|
|
+ this.title = '编辑&保存'
|
|
|
+ this.form = {
|
|
|
+ id: row.id,
|
|
|
+ stationId: row.stationId,
|
|
|
+ stationName: row.stationName,
|
|
|
+ modelName: row.modelName,
|
|
|
+ stationNameEasy: row.stationNameEasy,
|
|
|
+ wsAve: row.wsAve,
|
|
|
+ wdSum: row.wdSum,
|
|
|
+ generatingCapacity: row.generatingCapacity,
|
|
|
+ realTimeTotal: row.realTimeTotal
|
|
|
+ }
|
|
|
+ this.dialogVisible = true
|
|
|
+ },
|
|
|
+ cancel() {
|
|
|
+ this.resetForm()
|
|
|
+ this.dialogVisible = false
|
|
|
+ },
|
|
|
+ saveInfo() {
|
|
|
+ this.$refs["form"].validate(valid => {
|
|
|
+ if (valid) {
|
|
|
+ if (this.saveFlag === 'add') {
|
|
|
+ let staion = this.stationInfo.find(w => w.name === this.form.stationName)
|
|
|
+ this.form.stationId = staion.id
|
|
|
+ this.form.stationNameEasy = staion.easyName
|
|
|
+ }
|
|
|
+ saveFanModelData(this.form).then(res => {
|
|
|
+ this.$message.success('保存成功')
|
|
|
+ this.dialogVisible = false
|
|
|
+ this.search('')
|
|
|
+ }).catch(err => {
|
|
|
+ console.log('保存信息异常:' + err)
|
|
|
+ this.dialogVisible = false
|
|
|
+ })
|
|
|
+ }else{
|
|
|
+ this.$message.warning('校验不通过')
|
|
|
+ }
|
|
|
+ })
|
|
|
|
|
|
},
|
|
|
+ // 删除
|
|
|
+ deleteClick(row) {
|
|
|
+ deleteFanModelData(row.id).then(res => {
|
|
|
+ this.$message.success('删除成功')
|
|
|
+ this.search('')
|
|
|
+ }).catch(err => {
|
|
|
+
|
|
|
+ })
|
|
|
+ },
|
|
|
+ resetForm() {
|
|
|
+ this.form = {
|
|
|
+ id: '',
|
|
|
+ stationId: null,
|
|
|
+ stationName: null,
|
|
|
+ modelName: null,
|
|
|
+ stationNameEasy: null,
|
|
|
+ wsAve: null,
|
|
|
+ wdSum: null,
|
|
|
+ generatingCapacity: null,
|
|
|
+ realTimeTotal: null
|
|
|
+ }
|
|
|
+ },
|
|
|
getStationInfo() {
|
|
|
getStationInfo().then(res => {
|
|
|
- console.log(res.data)
|
|
|
- this.staionInfo = res.data
|
|
|
+ this.stationInfo = res.data
|
|
|
+ this.search('')
|
|
|
}).catch(err => {
|
|
|
console.log('获取场站列表异常:' + err)
|
|
|
})
|