|
@@ -0,0 +1,336 @@
|
|
|
+<template>
|
|
|
+ <div class="app-container">
|
|
|
+ <el-card class="box-card">
|
|
|
+ <div>
|
|
|
+ <span>场站:</span>
|
|
|
+ <div style="display: inline-block;margin-right: .5%">
|
|
|
+ <el-select v-model="stationId" clearable placeholder="请选择">
|
|
|
+ <el-option
|
|
|
+ v-for="item in stationOption"
|
|
|
+ :key="item.id"
|
|
|
+ :label="item.name"
|
|
|
+ :value="item.id">
|
|
|
+ </el-option>
|
|
|
+ </el-select>
|
|
|
+ </div>
|
|
|
+ <el-button
|
|
|
+ type="primary"
|
|
|
+ plain
|
|
|
+ icon="el-icon-plus"
|
|
|
+ size="mini"
|
|
|
+ @click="handleAdd"
|
|
|
+ >新增
|
|
|
+ </el-button>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <div style="margin-top: 1%">
|
|
|
+ <el-table v-loading="loading" border
|
|
|
+ :data="tableData.slice((page.currentPage-1)*page.pageSize,page.currentPage*page.pageSize)">
|
|
|
+ <el-table-column type="index" label="序号" width="55" align="center"/>
|
|
|
+ <el-table-column label="场站名称" align="center" prop="stationName"/>
|
|
|
+ <el-table-column label="逆变器名称" align="center" prop="name"/>
|
|
|
+ <el-table-column label="型号" align="center" prop="modelNumber"/>
|
|
|
+ <el-table-column label="经度" align="center" prop="longitude"/>
|
|
|
+ <el-table-column label="纬度" align="center" prop="latitude"/>
|
|
|
+ <el-table-column label="额定功率" align="center" prop="capacity"/>
|
|
|
+ <el-table-column label="光伏组件型号" align="center" prop="batteryModel"/>
|
|
|
+ <el-table-column label="光伏组件数量" align="center" prop="batteryNumber"/>
|
|
|
+ <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-button
|
|
|
+ size="mini"
|
|
|
+ type="text"
|
|
|
+ icon="el-icon-edit"
|
|
|
+ @click="handleUpdate(scope.row)"
|
|
|
+ v-hasPermi="['dataQuery:windTowerStatusInfo:edit']"
|
|
|
+ >修改
|
|
|
+ </el-button>
|
|
|
+ <el-button
|
|
|
+ size="mini"
|
|
|
+ type="text"
|
|
|
+ icon="el-icon-delete"
|
|
|
+ @click="handleDelete(scope.row)"
|
|
|
+ v-hasPermi="['dataQuery:windTowerStatusInfo:remove']"
|
|
|
+ >删除
|
|
|
+ </el-button>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ </el-table>
|
|
|
+ <div class="block" style="float: right">
|
|
|
+ <el-pagination
|
|
|
+ @size-change="handleSizeChange"
|
|
|
+ @current-change="handleCurrentChange"
|
|
|
+ :current-page=page.currentPage
|
|
|
+ :page-sizes="[10, 15, 30, 50]"
|
|
|
+ :page-size=page.pageSize
|
|
|
+ layout="total, sizes, prev, pager, next, jumper"
|
|
|
+ :total=page.total>
|
|
|
+ </el-pagination>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <!-- 添加或修改测风塔信息对话框 -->
|
|
|
+ <el-dialog :title="title" :visible.sync="open" width="50%" append-to-body>
|
|
|
+ <el-form ref="form" :model="form" :rules="rules" label-width="100px">
|
|
|
+ <el-row :gutter="20" class="mb8">
|
|
|
+ <el-col :span="12">
|
|
|
+ <el-form-item label="场站名称" prop="stationName">
|
|
|
+ <el-input v-model="form.stationName" placeholder="请输入名称"/>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="12">
|
|
|
+ <el-form-item label="逆变器名称" prop="name">
|
|
|
+ <el-input v-model="form.name" placeholder="请输入名称"/>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+
|
|
|
+ </el-row>
|
|
|
+ <el-row :gutter="20" class="mb8">
|
|
|
+ <el-col :span="12">
|
|
|
+ <el-form-item label="经度" prop="longitude">
|
|
|
+ <el-input v-model="form.longitude" placeholder="请输入经度"/>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="12">
|
|
|
+ <el-form-item label="纬度" prop="latitude">
|
|
|
+ <el-input v-model="form.latitude" placeholder="请输入纬度"/>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+ <el-row :gutter="20" class="mb8">
|
|
|
+ <el-col :span="12">
|
|
|
+ <el-form-item label="型号" prop="modelNumber">
|
|
|
+ <el-input v-model="form.modelNumber" placeholder="请输入型号"/>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="12">
|
|
|
+ <el-form-item label="额定功率" prop="capacity">
|
|
|
+ <el-input v-model="form.capacity" placeholder="请输入额定功率"/>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+ <el-row :gutter="20" class="mb8">
|
|
|
+ <el-col :span="12">
|
|
|
+ <el-form-item label="光伏组件型号" prop="batteryModel">
|
|
|
+ <el-select v-model="form.batteryModel" clearable placeholder="请选择光伏组件型号">
|
|
|
+ <el-option
|
|
|
+ v-for="item in pvModuleModelOption"
|
|
|
+ :key="item.id"
|
|
|
+ :label="item.model"
|
|
|
+ :value="item.model">
|
|
|
+ </el-option>
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="12">
|
|
|
+ <el-form-item label="光伏组件数量" prop="batteryNumber">
|
|
|
+ <el-input v-model="form.batteryNumber" placeholder="请输入光伏组件数量"/>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+
|
|
|
+ </el-form>
|
|
|
+ <div slot="footer" class="dialog-footer">
|
|
|
+ <el-button type="primary" @click="submitForm">确 定</el-button>
|
|
|
+ <el-button @click="cancel">取 消</el-button>
|
|
|
+ </div>
|
|
|
+ </el-dialog>
|
|
|
+ </el-card>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+import {getPvModuleModel,getStationInfo} from "@/api/biz/dataQuery/inverterInfo";
|
|
|
+export default {
|
|
|
+ name: "index",
|
|
|
+ data() {
|
|
|
+ const checkName = (rule, value, callback) => {
|
|
|
+ var s6 = this.tableData
|
|
|
+ if (value == null || value === '') {
|
|
|
+ callback(new Error('请填写逆变器名称'))
|
|
|
+ }
|
|
|
+ for (let i = 0; i < s6.length; i++) {
|
|
|
+ if (this.modId == '') {
|
|
|
+ // 新增
|
|
|
+ if ((value == s6[i].name)) {
|
|
|
+ callback(new Error('名称不能重复'))
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ // 修改
|
|
|
+ if (this.modId != s6[i].id) {
|
|
|
+ if ((value == s6[i].name)) {
|
|
|
+ callback(new Error('名称不能重复'))
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ callback()
|
|
|
+ }
|
|
|
+ const reg = /^[\-\+]?(0?\d{1,2}(\.\d{1,5})*|1[0-7]?\d{1}(\.\d{1,5})*|180(\.0{1,5})*)$/
|
|
|
+ const reg1 = /^[\-\+]?([0-8]?\d{1}(\.\d{1,5})*|90(\.0{1,5})*)$/
|
|
|
+ const checkLongitude = (rule, value, callback) => {
|
|
|
+ if (!value) {
|
|
|
+ callback(new Error('不许为空'))
|
|
|
+ }
|
|
|
+ if (reg.test(value) == false) {
|
|
|
+ callback(new Error('请输入正确经度'));
|
|
|
+ } else {
|
|
|
+ callback()
|
|
|
+ }
|
|
|
+ }
|
|
|
+ const checkLatitude = (rule, value, callback) => {
|
|
|
+ if (!value) {
|
|
|
+ callback(new Error('不许为空'))
|
|
|
+ }
|
|
|
+ if (reg1.test(value) == false) {
|
|
|
+ callback(new Error('请输入正确纬度'));
|
|
|
+ } else {
|
|
|
+ callback()
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return {
|
|
|
+ stationOption:[],
|
|
|
+ pvModuleModelOption:[],
|
|
|
+ stationId:'',
|
|
|
+ tableData: [],
|
|
|
+ loading: false,
|
|
|
+ open:false,
|
|
|
+ title:'新增&保存',
|
|
|
+ modId:'',
|
|
|
+ form: {},
|
|
|
+ // 表单校验
|
|
|
+ rules: {
|
|
|
+ name: [{required: true, validator: checkName, trigger: 'blur'}],
|
|
|
+ // modelNumber: [{required: true, message:'请输入型号', trigger: 'blur'}],
|
|
|
+ longitude: [{required: true, validator: checkLongitude, trigger: 'blur'}],
|
|
|
+ latitude: [{required: true, validator: checkLatitude, trigger: 'blur'}],
|
|
|
+ },
|
|
|
+ page: {
|
|
|
+ total: 0, // 总页数
|
|
|
+ currentPage: 1, // 当前页数
|
|
|
+ pageSize: 10 // 每页显示多少条
|
|
|
+ },
|
|
|
+ }
|
|
|
+ },
|
|
|
+ mounted() {
|
|
|
+ this.getStationInfo()
|
|
|
+ this.getPvModuleModel()
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ /*获取场站信息*/
|
|
|
+ getStationInfo(){
|
|
|
+ getStationInfo().then(res=>{
|
|
|
+ this.stationOption = res.data
|
|
|
+ }).catch(err=>{
|
|
|
+ console.log('获取场站信息异常:'+err)
|
|
|
+ })
|
|
|
+ },
|
|
|
+ /*获取光伏组件*/
|
|
|
+ getPvModuleModel(){
|
|
|
+ getPvModuleModel().then(res=>{
|
|
|
+ this.pvModuleModelOption = res.data
|
|
|
+ }).catch(err=>{
|
|
|
+ console.log('获取光伏组件的信息异常:'+err)
|
|
|
+ })
|
|
|
+ },
|
|
|
+ getList(){
|
|
|
+ this.loading = true
|
|
|
+ list().then(res=>{
|
|
|
+ this.tableData = res.rows
|
|
|
+ this.page.total = res.total
|
|
|
+ this.loading = false
|
|
|
+ }).catch(err=>{
|
|
|
+ this.loading = false
|
|
|
+ console.log('获取环境监测仪异常:'+err)
|
|
|
+ })
|
|
|
+ },
|
|
|
+ /*新增按钮*/
|
|
|
+ handleAdd() {
|
|
|
+ this.reset()
|
|
|
+ this.title = "新增&保存";
|
|
|
+ this.open = true;
|
|
|
+ },
|
|
|
+ /** 修改按钮操作 */
|
|
|
+ handleUpdate(row) {
|
|
|
+ this.reset();
|
|
|
+ this.modId = row.id
|
|
|
+ this.form = {
|
|
|
+ stationName:row.stationName,
|
|
|
+ id: row.id,
|
|
|
+ name: row.name,
|
|
|
+ modelNumber: row.modelNumber,
|
|
|
+ longitude: row.longitude,
|
|
|
+ latitude: row.latitude,
|
|
|
+ capacity: row.capacity,
|
|
|
+ batteryModel:row.batteryModel,
|
|
|
+ batteryNumber:row.batteryNumber
|
|
|
+ };
|
|
|
+ this.open = true;
|
|
|
+ this.title = "修改&保存";
|
|
|
+ },
|
|
|
+ /** 删除按钮操作 */
|
|
|
+ handleDelete(row) {
|
|
|
+ const ids = row.id;
|
|
|
+ this.$modal.confirm('是否确认删除环境监测仪信息名称为"' + row.name + '"信息及所有数据?').then(function () {
|
|
|
+ // return delWeatherStationInfo(ids);
|
|
|
+ }).then(() => {
|
|
|
+ this.getList();
|
|
|
+ this.$modal.msgSuccess("删除成功");
|
|
|
+ }).catch(() => {
|
|
|
+ });
|
|
|
+ },
|
|
|
+ /** 提交按钮 */
|
|
|
+ submitForm() {
|
|
|
+ // this.form.heights = this.form.heights.toString()
|
|
|
+ this.$refs["form"].validate(valid => {
|
|
|
+ if (valid) {
|
|
|
+ console.log(this.form)
|
|
|
+ // if (this.form.id != null) {
|
|
|
+ // updateWeatherStationInfo(this.form).then(response => {
|
|
|
+ // this.$modal.msgSuccess("修改成功");
|
|
|
+ // this.open = false;
|
|
|
+ // this.getList();
|
|
|
+ // });
|
|
|
+ // } else {
|
|
|
+ // addWeatherStationInfo(this.form).then(response => {
|
|
|
+ // this.$modal.msgSuccess("新增成功");
|
|
|
+ // this.open = false;
|
|
|
+ // this.getList();
|
|
|
+ // });
|
|
|
+ // }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
+ // 取消按钮
|
|
|
+ cancel() {
|
|
|
+ this.open = false;
|
|
|
+ this.reset();
|
|
|
+ },
|
|
|
+ reset(){
|
|
|
+ this.form = {
|
|
|
+ stationName:null,
|
|
|
+ id:null,
|
|
|
+ name:null,
|
|
|
+ modelNumber: null,
|
|
|
+ longitude: null,
|
|
|
+ latitude: null,
|
|
|
+ capacity: null,
|
|
|
+ batteryModel: null,
|
|
|
+ batteryNumber: null
|
|
|
+ }
|
|
|
+ },
|
|
|
+ /*pageSize改变*/
|
|
|
+ handleSizeChange(val) {
|
|
|
+ this.page.pageSize = val
|
|
|
+ this.page.currentPage = 1
|
|
|
+ },
|
|
|
+ /*currentPage改变*/
|
|
|
+ handleCurrentChange(val) {
|
|
|
+ this.page.currentPage = val
|
|
|
+ },
|
|
|
+ }
|
|
|
+}
|
|
|
+</script>
|
|
|
+
|
|
|
+<style scoped>
|
|
|
+
|
|
|
+</style>
|