Ver Fonte

逆变器页面

zy há 1 ano atrás
pai
commit
7cd059229e

+ 24 - 2
neim-biz/src/main/java/com/jiayue/biz/controller/InverterInfoController.java

@@ -1,8 +1,10 @@
 package com.jiayue.biz.controller;
 
 import com.jiayue.biz.domain.PvModuleModel;
+import com.jiayue.biz.domain.StationInfo;
 import com.jiayue.biz.domain.WeatherStationInfo;
 import com.jiayue.biz.service.PvModuleModelService;
+import com.jiayue.biz.service.StationInfoService;
 import com.jiayue.biz.service.WeatherStationInfoService;
 import com.jiayue.common.annotation.Log;
 import com.jiayue.common.core.controller.BaseController;
@@ -16,6 +18,8 @@ import org.springframework.web.bind.annotation.*;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
 
 /**
  * 逆变器信息Controller
@@ -28,9 +32,9 @@ import java.util.List;
 @RequestMapping("/dataQuery/inverterInfo")
 public class InverterInfoController extends BaseController {
     private final PvModuleModelService pvModuleModelService;
-
+    private final StationInfoService stationInfoService;
     @GetMapping("/getPvModuleModel")
-    public AjaxResult list() {
+    public AjaxResult getPvModuleModel() {
         List<PvModuleModel> pvModuleModels = pvModuleModelService.list();
         List list = new ArrayList();
         for(PvModuleModel pvModuleModel : pvModuleModels){
@@ -40,4 +44,22 @@ public class InverterInfoController extends BaseController {
         }
         return AjaxResult.success(list);
     }
+
+
+    /**
+     * 获取场站信息
+     */
+    @GetMapping("/getStationInfo")
+    public AjaxResult getStationInfo() {
+        List<Map<String, String>> list = new ArrayList<>();
+        List<StationInfo> stationInfoList = stationInfoService.selectStationInfo();
+        List<StationInfo> stationInfos = stationInfoList.stream().filter(w -> w.getStationBasicInfo().getStationType().equals("光")).collect(Collectors.toList());
+        for (StationInfo stationInfo : stationInfos) {
+            Map<String, String> map = new HashMap<>();
+            map.put("id", stationInfo.getId());
+            map.put("name", stationInfo.getStationBasicInfo().getStationName());
+            list.add(map);
+        }
+        return AjaxResult.success(list);
+    }
 }

+ 13 - 4
neim-biz/src/main/java/com/jiayue/biz/controller/WeatherStationInfoController.java

@@ -5,10 +5,7 @@ import cn.hutool.core.util.StrUtil;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import com.jiayue.biz.domain.Project;
-import com.jiayue.biz.domain.StatisticsSituation;
-import com.jiayue.biz.domain.WeatherStationInfo;
-import com.jiayue.biz.domain.WindTowerInfo;
+import com.jiayue.biz.domain.*;
 import com.jiayue.biz.service.ProjectService;
 import com.jiayue.biz.service.StatisticsSituationService;
 import com.jiayue.biz.service.WeatherStationInfoService;
@@ -41,6 +38,18 @@ import java.util.stream.Collectors;
 public class WeatherStationInfoController extends BaseController {
     private final WeatherStationInfoService weatherStationInfoService;
 
+    @GetMapping("/infoList")
+    public AjaxResult infoList() {
+        List<WeatherStationInfo> weatherStationInfos = weatherStationInfoService.list();
+        List list = new ArrayList();
+        for(WeatherStationInfo weatherStationInfo : weatherStationInfos){
+            HashMap map = new HashMap();
+            map.put("id",weatherStationInfo.getId());
+            map.put("model",weatherStationInfo.getName());
+        }
+        return AjaxResult.success(list);
+    }
+
     /**
      * 查询环境监测仪信息列表
      */

+ 21 - 0
neim-ui/src/api/biz/dataQuery/inverterInfo.js

@@ -0,0 +1,21 @@
+import request from '@/utils/request'
+
+
+// 查询光伏组件
+export function getPvModuleModel() {
+  return request({
+    url: '/dataQuery/inverterInfo/getPvModuleModel',
+    method: 'get'
+  })
+}
+// 查询场站信息
+export function getStationInfo() {
+  return request({
+    url: '/dataQuery/inverterInfo/getStationInfo',
+    method: 'get'
+  })
+}
+
+
+
+

+ 336 - 0
neim-ui/src/views/dataQuery/inverterInfo/index.vue

@@ -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>