Browse Source

逆变器信息新增、修改

xusl 9 tháng trước cách đây
mục cha
commit
ccc057d0fa

+ 2 - 2
cpp-admin/src/main/java/com/cpp/web/controller/configManager/InverterInfoController.java

@@ -78,7 +78,7 @@ public class InverterInfoController {
      * @return R
      */
     @ApiOperation(value = "新增idp_inverter_info", notes = "新增idp_inverter_info")
-    @PostMapping
+    @PostMapping("/save")
     public R save(@RequestBody InverterInfo inverterInfo) {
         return R.ok(inverterInfoService.save(inverterInfo));
     }
@@ -90,7 +90,7 @@ public class InverterInfoController {
      * @return R
      */
     @ApiOperation(value = "修改idp_inverter_info", notes = "修改idp_inverter_info")
-    @PutMapping
+    @PostMapping("/updateById")
     public R updateById(@RequestBody InverterInfo inverterInfo) {
         return R.ok(inverterInfoService.updateById(inverterInfo));
     }

+ 0 - 63
cpp-admin/src/main/java/com/cpp/web/domain/station/InverterInfo.java

@@ -28,91 +28,28 @@ import java.util.Date;
 @ApiModel(value = "cpp_inverter_info")
 public class InverterInfo extends BaseCppEntity {
 
-    public InverterInfo() {
-        this.setEquipmentType(EquipmentTypeEnum.INVERTER.getCode());
-    }
-
-
-    /**
-     * 设备类型
-     */
-    @ApiModelProperty(value = "设备类型")
-    private Integer equipmentType;
-
-
     /**
      * 名称
      */
     @ApiModelProperty(value = "名称")
     private String name;
 
-
     /**
      * 制造商
      */
     @ApiModelProperty(value = "制造商")
     private String manufacturer;
 
-
     /**
      * 型号
      */
     @ApiModelProperty(value = "型号")
     private String modelNumber;
 
-
-    /**
-     * 安装时间
-     */
-    @ApiModelProperty(value = "安装时间")
-    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
-    private Date installationTime;
-
-
-    /**
-     * 入库时间间隔  单位 s
-     */
-    @ApiModelProperty(value = "入库时间间隔  单位 s")
-    private Integer timeInterval;
-
-
-    /**
-     * 是否组串式 1:是 0:不是
-     */
-    @ApiModelProperty(value = "是否组串式 1:是 0:不是")
-    private String groupSeries;
-
-
-    /**
-     * 逆变器效率
-     */
-    @ApiModelProperty(value = "逆变器效率")
-    private BigDecimal efficiency = new BigDecimal(-99);
-
-
-    /**
-     * 额定功率
-     */
-    @ApiModelProperty(value = "额定功率")
-    private BigDecimal capacity = new BigDecimal(-99);
-
-
-    /**
-     * 集电线路
-     */
-    @ApiModelProperty(value = "集电线路")
-    private String collectorCircuit;
-
-
     /**
      * 逆变器是否样板机 1:是 0:不是
      */
     @ApiModelProperty(value = "逆变器是否样板机 1:是 0:不是")
     private String sample;
-    /**
-     * 绑定数据采集通道
-     */
-    @ApiModelProperty(value = "绑定数据采集通道")
-    private String bindTunnel;
 
 }

+ 252 - 33
cpp-ui/src/views/configManager/inverterinfo/index.vue

@@ -17,29 +17,87 @@
       </el-form-item>
     </el-form>
 
+    <el-row :gutter="10" class="mb8">
+      <el-col :span="1.5">
+        <el-button
+            type="primary"
+            plain
+            icon="el-icon-plus"
+            size="mini"
+            @click="handleAdd"
+            v-hasPermi="['system:user:add']"
+        >新增
+        </el-button>
+      </el-col>
+      <el-col :span="1.5">
+        <el-button
+            type="success"
+            plain
+            icon="el-icon-edit"
+            size="mini"
+            :disabled="single"
+            @click="handleUpdate"
+            v-hasPermi="['system:user:edit']"
+        >修改
+        </el-button>
+      </el-col>
+      <el-col :span="1.5">
+        <el-button
+            type="danger"
+            plain
+            icon="el-icon-delete"
+            size="mini"
+            :disabled="multiple"
+            @click="handleDelete"
+            v-hasPermi="['system:user:remove']"
+        >删除
+        </el-button>
+      </el-col>
+      <el-col :span="1.5">
+        <el-button
+            type="info"
+            plain
+            icon="el-icon-upload2"
+            size="mini"
+            @click="handleImport"
+            v-hasPermi="['system:user:import']"
+        >导入
+        </el-button>
+      </el-col>
+      <el-col :span="1.5">
+        <el-button
+            type="warning"
+            plain
+            icon="el-icon-download"
+            size="mini"
+            @click="handleExport"
+            v-hasPermi="['system:user:export']"
+        >导出
+        </el-button>
+      </el-col>
+      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList" :columns="columns"></right-toolbar>
+    </el-row>
+
     <div style="padding-top: 10px">
       <vxe-table
           ref="xTable"
-          border
-          export-config
-          keep-source
+          align="center"
+          class="mytable-style"
           auto-resize
+          border
           resizable
+          export-config
           highlight-current-row
-          :loading="loading"
+          show-overflow
+          max-height="700"
           :data="tableData"
-          :edit-config="{trigger: 'manual', mode: 'row',autoClear:false,showStatus: true,icon:'none'}">
-        <vxe-table-column field="equipmentNo" title="设备编号" ></vxe-table-column>
-        <vxe-table-column field="name" title="设备名称" ></vxe-table-column>
-        <vxe-table-column field="manufacturer" title="制造商" ></vxe-table-column>
-        <vxe-table-column field="modelNumber" title="型号" ></vxe-table-column>
-        <vxe-table-column field="installationTime" title="安装时间" ></vxe-table-column>
-        <vxe-table-column field="timeInterval" title="入库时间间隔" :formatter="timeIntervalFormat"></vxe-table-column>
-        <vxe-table-column field="groupSeries" title="是否组串式"  :formatter="yesNoFormat"></vxe-table-column>
-        <vxe-table-column field="efficiency" title="逆变器效率" ></vxe-table-column>
-        <vxe-table-column field="capacity" title="额定功率" ></vxe-table-column>
-        <vxe-table-column field="collectorCircuit" title="集电线路" ></vxe-table-column>
-        <vxe-table-column field="sample" title="逆变器是否样板机" :formatter="yesNoFormat"></vxe-table-column>
+          :radio-config="{trigger: 'row'}">
+        <vxe-column type="radio" width="60"/>
+        <vxe-table-column field="stationCode" title="所属场站" :formatter="stationCodeFormat"></vxe-table-column>
+        <vxe-table-column field="name" title="设备名称"></vxe-table-column>
+        <vxe-table-column field="manufacturer" title="制造商"></vxe-table-column>
+        <vxe-table-column field="modelNumber" title="型号"></vxe-table-column>
+        <vxe-table-column field="sample" title="是否样板机" :formatter="yesNoFormat"></vxe-table-column>
       </vxe-table>
       <vxe-pager
           background
@@ -52,6 +110,70 @@
       </vxe-pager>
     </div>
 
+    <el-dialog :title="title" :visible.sync="open" width="750px" height="600px">
+      <el-form ref="form" :model="form" :rules="rules" width="730px" label-width="130px">
+        <el-row class="mb4">
+          <el-col :span="12">
+            <el-form-item label="所属场站" prop="stationCode">
+              <el-select
+                  v-model="form.stationCode"
+                  placeholder="请选择"
+                  style="width: 100%"
+              >
+                <el-option
+                    v-for="item in this.stationList"
+                    :key="item.value"
+                    :label="item.label"
+                    :value="item.value"
+                />
+              </el-select>
+            </el-form-item>
+          </el-col>
+          <el-col :span="12">
+            <el-form-item label="设备名称" prop="name">
+              <el-input style="width: 100%" v-model="form.name" maxlength="50"/>
+            </el-form-item>
+          </el-col>
+        </el-row>
+        <el-row class="mb4">
+          <el-col :span="12">
+            <el-form-item label="制造商" prop="manufacturer">
+              <el-input  style="width: 100%" v-model="form.manufacturer" maxlength="50"/>
+            </el-form-item>
+          </el-col>
+          <el-col :span="12">
+            <el-form-item label="型号" prop="modelNumber">
+              <el-input style="width: 100%" v-model="form.modelNumber" maxlength="50"/>
+            </el-form-item>
+          </el-col>
+        </el-row>
+        <el-row class="mb4">
+          <el-col :span="12">
+            <el-form-item label="是否样板机" prop="sample">
+              <el-select
+                  v-model="form.sample"
+                  placeholder="请选择"
+                  style="width: 100%"
+              >
+                <el-option
+                    v-for="item in this.yesNoOptions"
+                    :key="item.value"
+                    :label="item.label"
+                    :value="item.value"
+                />
+              </el-select>
+            </el-form-item>
+          </el-col>
+          <el-col :span="12">
+
+          </el-col>
+        </el-row>
+      </el-form>
+      <div slot="footer" class="dialog-footer">
+        <el-button type="primary" @click="commitChannel">确 定</el-button>
+        <el-button @click="cancelChannel">取 消</el-button>
+      </div>
+    </el-dialog>
   </div>
 </template>
 
@@ -61,6 +183,17 @@ export default {
   name: 'inverterinfo',
   data() {
     return {
+      form: {
+        stationCode: undefined,
+        name: undefined,
+        manufacturer: undefined,
+        modelNumber: undefined,
+        sample: undefined,
+      },
+      title: "",
+      // 是否显示弹出层
+      open: false,
+      edit: false,
       total: 0,
       sortOrder: 'asc',
       pageSize: 10,
@@ -71,6 +204,28 @@ export default {
       tableData: [],
       loading: false,
       modId: '',//备用id
+      yesNoOptions: [
+        {value: '0', label: '不是'},
+        {value: '1', label: '是'}
+      ],
+      // 表单校验
+      rules: {
+        stationCode: [
+          {required: true, message: "所属场站不能为空", trigger: "blur"}
+        ],
+        name: [
+          {required: true, message: "设备名称不能为空", trigger: "blur"}
+        ],
+        manufacturer: [
+          {required: true, message: "制造商不能为空", trigger: "blur"}
+        ],
+        modelNumber: [
+          {required: true, message: "型号不能为空", trigger: "blur"}
+        ],
+        sample: [
+          {required: true, message: "是否样板不能为空", trigger: "blur"}
+        ],
+      },
     }
   },
   mounted() {
@@ -78,24 +233,88 @@ export default {
   },
   computed: {},
   methods: {
-    stationChange(){
+    // 表单重置
+    reset() {
+      this.edit = false;
+      this.form = {
+        stationCode: undefined,
+        name: undefined,
+        manufacturer: undefined,
+        modelNumber: undefined,
+        sample: undefined,
+      },
+      this.resetForm("form");
+    },
+    // 取消按钮
+    cancelChannel() {
+      this.open = false;
+      this.reset();
+    },
+    /** 新增按钮操作 */
+    handleAdd() {
+      this.reset();
+      this.open = true;
+      this.title = "新增逆变器信息";
+      this.edit = false;
+    },
+    /** 修改按钮操作 */
+    handleUpdate() {
+      this.title = "修改逆变器信息";
+      this.reset();
+      const _selectData = this.$refs.xTable.getRadioRecord(true)
+      if (_selectData == null) {
+        this.$message({
+          type: 'warning',
+          message: '请选择记录!'
+        });
+        return
+      }
+      this.open = true;
+      this.edit = true;
+      this.form = JSON.parse(JSON.stringify(_selectData))
+    },
+    // 提交按钮
+    commitChannel() {
+      this.$refs["form"].validate(async valid => {
+        if (valid) {
+          if (this.form.id != undefined) {
+            // 更新操作
+            this.$request.post('/inverterinfo/updateById', this.form).then((res) => {
+              this.$message.success('修改成功')
+              this.open = false;
+              this.stationChange()
+              this.dataQuery()
+            }).catch((error) => {
+            })
+          } else {
+            // 新增操作
+            this.$request.post('/inverterinfo/save', this.form).then((res) => {
+              if (res == undefined) {
+                this.$message.success('新增失败')
+              } else {
+                this.$message.success('新增成功')
+                this.stationChange()
+                this.dataQuery()
+                this.open = false;
+              }
+            }).catch((error) => {
+            })
+          }
+        }
+      });
+    },
+    stationChange() {
       this.currentPage = 1
       this.pageSize = 10
     },
-    timeIntervalFormat({ cellValue, row, column }) {
-      if (cellValue==1){
-        return '一分钟'
-      }
-      else if (cellValue==5){
-        return '五分钟'
-      }
-      return ''
+    stationCodeFormat({cellValue, row, column}) {
+      const item = this.stationList.find(item => item.value === cellValue)
+      return item ? item.label : ''
     },
-    yesNoFormat({ cellValue, row, column }) {
-      if (cellValue==0){
+    yesNoFormat({cellValue, row, column}) {
+      if (cellValue == 0) {
         return '不是'
-      }
-      else {
+      } else {
         return '是'
       }
     },
@@ -107,9 +326,9 @@ export default {
     dataQuery() {
       this.loading = true
       const param = {
-        "currentPage":this.currentPage,
-        "pageSize":this.pageSize,
-        "stationCode":this.stationCode
+        "currentPage": this.currentPage,
+        "pageSize": this.pageSize,
+        "stationCode": this.stationCode
       }
 
       this.$request.get('/inverterinfo/getByStationCode', {params: param}).then(response => {
@@ -123,7 +342,7 @@ export default {
     getStationCode() {
       this.$request({url: '/electricfield/all', method: 'get'}).then(response => {
         this.stationList = response.data
-        if (this.stationList.length>0){
+        if (this.stationList.length > 0) {
           this.stationCode = this.stationList[0].value
           this.dataQuery()
         }