fanxiaoyu 6 месяцев назад
Родитель
Сommit
9b27b3d9f4

+ 8 - 0
cpp-admin/src/main/java/com/cpp/web/controller/overhaulPlan/OverhaulPlanRecordsController.java

@@ -8,6 +8,8 @@ import io.swagger.annotations.ApiOperation;
 import lombok.RequiredArgsConstructor;
 import org.springframework.web.bind.annotation.*;
 
+import java.util.Date;
+
 
 @RestController
 @RequiredArgsConstructor
@@ -24,4 +26,10 @@ public class OverhaulPlanRecordsController {
         return R.ok(overhaulPlanRecordsService.page(page,overhaulPlanRecordsService.getByStationCode(stationCode)));
     }
 
+    @ApiOperation(value = "通过场站编号查询记录(分页查询)", notes = "通过场站编号查询记录(分页查询)")
+    @GetMapping("/findByStationCodeAndTimeBetween")
+    public R findByStationCodeAndTimeBetween(String stationCode, Long startTime,Long endTime){
+        return R.ok(overhaulPlanRecordsService.findByStationCodeAndTimeBetween(stationCode,new Date(startTime),new Date(endTime)));
+    }
+
 }

+ 3 - 2
cpp-admin/src/main/java/com/cpp/web/controller/reportData/ReportDataController.java

@@ -117,13 +117,14 @@ public class ReportDataController {
     }
 
     /**
-     *  提取文件名中的时间
+     * 提取文件名中的时间
+     *
      * @param fileName
      * @return
      */
     private static String extractAndParseTimestamp(String fileName) {
         String[] fileNameParts = fileName.split("_");
-        String correctTimestampStr = fileNameParts[1]+fileNameParts[2];
+        String correctTimestampStr = fileNameParts[1] + fileNameParts[2];
         return correctTimestampStr;
     }
 }

+ 1 - 1
cpp-admin/src/main/java/com/cpp/web/domain/overhaulplan/OverhaulPlan.java

@@ -62,7 +62,7 @@ public class OverhaulPlan extends BaseCppEntity {
     private Integer maintenanceQuantity;
 
     /**
-     * 状态:0 待执行 1 执行中 2 已完成
+     *  1 执行中 2 已完成
      */
     @ApiModelProperty(value = "状态")
     private Integer status;

+ 14 - 3
cpp-admin/src/main/java/com/cpp/web/domain/overhaulplan/OverhaulPlanRecords.java

@@ -48,10 +48,21 @@ public class OverhaulPlanRecords extends BaseCppEntity {
     private BigDecimal overhaulCapacity;
 
     /**
-     * 使用数据类
+     * 预测模
      */
-    @ApiModelProperty(value = "使用数据类型")
-    private String dataType;
+    @ApiModelProperty(value = "预测模型")
+    private String forecastModel;
 
 
+    /**
+     * 使用次数
+     */
+    @ApiModelProperty(value = "使用次数")
+    private Integer useNum = 0;
+
+    /**
+     * 更新时间
+     */
+    @ApiModelProperty(value = "更新时间")
+    private Date updateTime;
 }

+ 5 - 0
cpp-admin/src/main/java/com/cpp/web/service/overhaulplan/OverhaulPlanRecordsService.java

@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
 import com.cpp.web.domain.overhaulplan.OverhaulPlan;
 import com.cpp.web.domain.overhaulplan.OverhaulPlanRecords;
 
+import java.util.Date;
 import java.util.List;
 
 /**
@@ -17,4 +18,8 @@ public interface OverhaulPlanRecordsService extends IService<OverhaulPlanRecords
 
     QueryWrapper<OverhaulPlanRecords> getByStationCode(String stationCode);
 
+    OverhaulPlanRecords findByStationCodeAndForecastModel(String stationCode, String forecastModel, Date startTime,Date endTime);
+
+    List<OverhaulPlanRecords> findByStationCodeAndTimeBetween(String stationCode,Date startTime,Date endTime);
+
 }

+ 7 - 0
cpp-admin/src/main/java/com/cpp/web/service/overhaulplan/OverhaulPlanService.java

@@ -3,7 +3,10 @@ package com.cpp.web.service.overhaulplan;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.cpp.web.domain.overhaulplan.OverhaulPlan;
+import org.apache.poi.ss.formula.functions.T;
 
+import javax.xml.crypto.Data;
+import java.util.Date;
 import java.util.List;
 
 /**
@@ -20,4 +23,8 @@ public interface OverhaulPlanService extends IService<OverhaulPlan> {
 
     List<OverhaulPlan> findByStationCode(String stationCode);
 
+    List<OverhaulPlan> findByStationCodeAndTimeBetween(Date date,String stationCode);
+
+    <T> List<T>  getCorrectionData(List<T> list);
+
 }

+ 39 - 1
cpp-admin/src/main/java/com/cpp/web/service/overhaulplan/impl/OverhaulPlanRecordsServiceImpl.java

@@ -8,6 +8,9 @@ import com.cpp.web.service.overhaulplan.OverhaulPlanRecordsService;
 import lombok.RequiredArgsConstructor;
 import org.springframework.stereotype.Service;
 
+import java.util.Date;
+import java.util.List;
+
 /**
  * cpp_overhaul_plan_records
  *
@@ -18,12 +21,47 @@ import org.springframework.stereotype.Service;
 @RequiredArgsConstructor
 public class OverhaulPlanRecordsServiceImpl extends ServiceImpl<OverhaulPlanRecordsMapper, OverhaulPlanRecords> implements OverhaulPlanRecordsService {
 
+    private final OverhaulPlanRecordsMapper overhaulPlanRecordsMapper;
     @Override
     public QueryWrapper<OverhaulPlanRecords> getByStationCode(String stationCode) {
         QueryWrapper<OverhaulPlanRecords> wrapper = new QueryWrapper<>();
-        if (!"".equals(stationCode)) {
+        if (null != stationCode && !"".equals(stationCode)) {
             wrapper.eq("station_code", stationCode);
         }
         return wrapper;
     }
+
+    @Override
+    public OverhaulPlanRecords findByStationCodeAndForecastModel(String stationCode, String forecastModel, Date startTime, Date endTime) {
+        QueryWrapper wrapper = new QueryWrapper<>();
+        if (null != stationCode && !"".equals(stationCode)){
+            wrapper.eq("station_code",stationCode);
+        }
+        if (null != forecastModel && !"".equals(forecastModel)){
+            wrapper.eq("forecast_model",forecastModel);
+        }
+        if (null != startTime){
+            wrapper.eq("start_time",startTime);
+        }
+        if (null != endTime){
+            wrapper.eq("end_time",endTime);
+        }
+        OverhaulPlanRecords overhaulPlanRecords = overhaulPlanRecordsMapper.selectOne(wrapper);
+        return overhaulPlanRecords;
+    }
+
+    @Override
+    public List<OverhaulPlanRecords> findByStationCodeAndTimeBetween(String stationCode, Date startTime, Date endTime) {
+        QueryWrapper<OverhaulPlanRecords> wrapper = new QueryWrapper<>();
+        if (null != stationCode && !"".equals(stationCode)){
+            wrapper.eq("station_code",stationCode);
+        }
+        if (null != startTime){
+            wrapper.eq("start_time",startTime);
+        }
+        if (null != endTime){
+            wrapper.eq("end_time",endTime);
+        }
+        return overhaulPlanRecordsMapper.selectList(wrapper);
+    }
 }

+ 121 - 10
cpp-admin/src/main/java/com/cpp/web/service/overhaulplan/impl/OverhaulPlanServiceImpl.java

@@ -3,13 +3,22 @@ package com.cpp.web.service.overhaulplan.impl;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.cpp.web.domain.overhaulplan.OverhaulPlan;
+import com.cpp.web.domain.overhaulplan.OverhaulPlanRecords;
 import com.cpp.web.domain.station.ElectricField;
 import com.cpp.web.mapper.overhaulplan.OverhaulPlanMapper;
+import com.cpp.web.service.overhaulplan.OverhaulPlanRecordsService;
 import com.cpp.web.service.overhaulplan.OverhaulPlanService;
-import io.swagger.models.auth.In;
+import com.cpp.web.service.station.ElectricFieldService;
 import lombok.RequiredArgsConstructor;
+import org.apache.poi.ss.formula.functions.T;
+import org.springframework.security.core.parameters.P;
 import org.springframework.stereotype.Service;
 
+import java.lang.reflect.Field;
+import java.math.BigDecimal;
+import java.math.RoundingMode;
+import java.util.ArrayList;
+import java.util.Date;
 import java.util.List;
 
 /**
@@ -23,8 +32,14 @@ import java.util.List;
 public class OverhaulPlanServiceImpl extends ServiceImpl<OverhaulPlanMapper, OverhaulPlan> implements OverhaulPlanService {
 
     private final OverhaulPlanMapper overhaulPlanMapper;
+
+    private final ElectricFieldService electricFieldService;
+
+    private final OverhaulPlanRecordsService overhaulPlanRecordsService;
+
     /**
-     *  查询所有检修计划
+     * 查询所有检修计划
+     *
      * @return
      */
     @Override
@@ -34,21 +49,22 @@ public class OverhaulPlanServiceImpl extends ServiceImpl<OverhaulPlanMapper, Ove
     }
 
     /**
-     *  根据场站编号查询检修计划信息
+     * 根据场站编号查询检修计划信息
+     *
      * @param stationCode
      * @return
      */
     @Override
     public QueryWrapper<OverhaulPlan> getByStationCode(String stationCode, Integer status) {
         QueryWrapper<OverhaulPlan> wrapper = new QueryWrapper<>();
-        if (null != status){
-            if (!"".equals(stationCode)){
-                wrapper.eq("station_code",stationCode);
-                wrapper.eq("status",status);
+        if (null != status) {
+            if (!"".equals(stationCode)) {
+                wrapper.eq("station_code", stationCode);
+                wrapper.eq("status", status);
             }
-        }else {
-            if (!"".equals(stationCode)){
-                wrapper.eq("station_code",stationCode);
+        } else {
+            if (!"".equals(stationCode)) {
+                wrapper.eq("station_code", stationCode);
             }
         }
         return wrapper;
@@ -59,4 +75,99 @@ public class OverhaulPlanServiceImpl extends ServiceImpl<OverhaulPlanMapper, Ove
         List<OverhaulPlan> overhaulPlanList = overhaulPlanMapper.findBysStationCode(stationCode);
         return overhaulPlanList;
     }
+
+    @Override
+    public List<OverhaulPlan> findByStationCodeAndTimeBetween(Date date, String stationCode) {
+        QueryWrapper<OverhaulPlan> wrapper = new QueryWrapper<>();
+        if (null != date) {
+            wrapper.ge("start_time", date);
+            wrapper.le("end_time", date);
+        }
+        if (null != stationCode && !"".equals(stationCode)) {
+            wrapper.eq("station_code", stationCode);
+        }
+        wrapper.eq("status", 1);
+        return overhaulPlanMapper.selectList(wrapper);
+    }
+
+    /**
+     *  返回修正后数据
+     * @param list
+     * @return
+     * @param <T>
+     */
+    @Override
+    public <T> List<T> getCorrectionData(List<T> list) {
+        List<T> resultList = new ArrayList<>();
+        BigDecimal electricFieldCapacity = BigDecimal.ZERO;
+        for (T tList : list) {
+            try {
+                Class<?> childClass = tList.getClass();
+                Class<?> superClass = childClass.getSuperclass();
+                // 时间
+                Field startTimeField = childClass.getDeclaredField("time");
+                startTimeField.setAccessible(true);
+                Date startTime = (Date) startTimeField.get(tList);
+                // 场站编号
+                Field stationCodeField = superClass.getDeclaredField("stationCode");
+                stationCodeField.setAccessible(true);
+                String stationCode = (String) stationCodeField.get(tList);
+                // 获取场站装机
+                ElectricField electricField = electricFieldService.findByStationCode(stationCode);
+                if (null != electricField) {
+                    electricFieldCapacity = electricField.getCapacity();
+                }
+                // 装机
+                Field capacityField = childClass.getDeclaredField("capacity");
+                capacityField.setAccessible(true);
+                capacityField.set(tList, electricFieldCapacity);
+                // 开机
+                Field openCapcityField = childClass.getDeclaredField("openCapacity");
+                openCapcityField.setAccessible(true);
+                // 预测模型
+                Field forecastModelField = childClass.getDeclaredField("forecastModel");
+                forecastModelField.setAccessible(true);
+                String forecastModel = (String)forecastModelField.get(tList);
+                // 根据时间查询检修计划
+                List<OverhaulPlan> overhaulPlanList = this.findByStationCodeAndTimeBetween(startTime, stationCode);
+                if (overhaulPlanList.size() > 0) {
+                    BigDecimal overCapacity = overhaulPlanList.get(0).getOverhaulCapacity();
+                    openCapcityField.set(tList, electricFieldCapacity.subtract(overCapacity));
+                    // 预测数据
+                    Field fpValueFiled = childClass.getDeclaredField("fpValue");
+                    fpValueFiled.setAccessible(true);
+                    BigDecimal fpValue = (BigDecimal) fpValueFiled.get(tList);
+                    // 开机/装机
+                    BigDecimal ratio = (electricFieldCapacity.subtract(overCapacity)).divide(electricFieldCapacity, 2, RoundingMode.HALF_UP);
+                    fpValueFiled.set(tList, fpValue.multiply(ratio));
+                    // 查询检修记录
+                    OverhaulPlanRecords overhaulPlanRecord = overhaulPlanRecordsService.findByStationCodeAndForecastModel(stationCode,forecastModel,overhaulPlanList.get(0).getStartTime(),overhaulPlanList.get(0).getEndTime());
+                    if (null != overhaulPlanRecord) {
+                        overhaulPlanRecord.setUseNum(overhaulPlanRecord.getUseNum() + 1);
+                        overhaulPlanRecord.setUpdateTime(new Date());
+                        overhaulPlanRecordsService.saveOrUpdate(overhaulPlanRecord);
+                        // 使用次数 +1
+                    }else {
+                        OverhaulPlanRecords overhaulPlanRecords = new OverhaulPlanRecords();
+                        overhaulPlanRecords.setOverhaulCapacity(overhaulPlanList.get(0).getOverhaulCapacity());
+                        overhaulPlanRecords.setStartTime(overhaulPlanList.get(0).getStartTime());
+                        overhaulPlanRecords.setEndTime(overhaulPlanList.get(0).getEndTime());
+                        overhaulPlanRecords.setUseNum(overhaulPlanRecords.getUseNum() + 1);
+                        overhaulPlanRecords.setStationCode(stationCode);
+                        overhaulPlanRecords.setForecastModel(forecastModel);
+                        overhaulPlanRecords.setCreateTime(new Date());
+                        overhaulPlanRecordsService.saveOrUpdate(overhaulPlanRecords);
+                    }
+
+                }else {
+                    // 设置开机为装机
+                    openCapcityField.set(tList,electricFieldCapacity);
+                }
+                resultList.add(tList);
+            } catch (NoSuchFieldException | IllegalAccessException e) {
+                throw new RuntimeException(e);
+            }
+        }
+        return resultList;
+    }
 }

+ 106 - 146
cpp-ui/src/views/maintenancerelated/overhaulplan/index.vue

@@ -39,16 +39,6 @@
         >新增
         </el-button>
       </el-col>
-      <!--      <el-col :span="1.5">-->
-      <!--        <el-button-->
-      <!--          type="success"-->
-      <!--          plain-->
-      <!--          icon="el-icon-edit"-->
-      <!--          size="mini"-->
-      <!--          @click="handleUpdate"-->
-      <!--        >修改-->
-      <!--        </el-button>-->
-      <!--      </el-col>-->
     </el-row>
 
     <div style="padding-top: 10px">
@@ -74,14 +64,26 @@
         <vxe-table-column field="status" title="状态" :formatter="statusFormatter"></vxe-table-column>
         <vxe-table-column field="isUse" title="是否使用" :formatter="useFormatter"></vxe-table-column>
         <vxe-table-column field="mcTime" title="手动停止时间" :formatter="formatDateTime"></vxe-table-column>
+        <vxe-table-column field="" title="使用详情">
+          <template v-slot="{ row }">
+            <el-button
+              type="text"
+              size="mini"
+              icon="el-icon-chat-dot-round"
+              title="使用详情"
+              @click="showRecords(row)">使用详情
+            </el-button>
+          </template>
+        </vxe-table-column>
         <vxe-table-column field="" title="操作">
           <template v-slot="{ row }">
             <el-button
               v-if="row.status === 1"
-              style="padding: 3px 4px 3px 4px;margin: 2px; color: red; background-color: whitesmoke;"
+              style="padding: 3px 4px 3px 4px;margin: 2px; color: red"
               size="mini"
               icon="el-icon-error"
               title="手动停止"
+              type="text"
               @click="stopOverhaulPlan(row)">废弃
             </el-button>
           </template>
@@ -194,6 +196,41 @@
         </div>
       </div>
     </el-dialog>
+
+    <el-dialog :title="title" :visible.sync="showDetails" :close-on-click-modal="false" width="1000px" height="600px">
+      <div class="dark-el-input dark-el-button">
+        <vxe-table
+          ref="xTable"
+          align="center"
+          class="mytable-style"
+          auto-resize
+          border
+          resizable
+          export-config
+          highlight-current-row
+          show-overflow
+          max-height="700"
+          :data="tableDataDetails.slice((currentPage-1)*pageSize,currentPage*pageSize)">
+          <vxe-table-column field="stationCode" title="场站名称" :formatter="codeChangeName"></vxe-table-column>
+          <vxe-table-column field="startTime" :formatter="formatDateTime" title="检修开始时间"></vxe-table-column>
+          <vxe-table-column field="endTime" :formatter="formatDateTime" title="检修结束时间"></vxe-table-column>
+          <vxe-table-column field="overhaulCapacity" title="检修容量(MW)"></vxe-table-column>
+          <vxe-table-column field="forecastModel" title="预测模型"></vxe-table-column>
+          <vxe-table-column field="useNum" title="使用次数"></vxe-table-column>
+          <vxe-table-column field="updateTime" :formatter="formatDateTime" title="上一次使用时间"></vxe-table-column>
+        </vxe-table>
+        <vxe-pager
+          background
+          :loading="loading"
+          :current-page.sync="currentPage"
+          :page-size.sync="pageSize"
+          :total="totalDetails"
+          @page-change="handlePageChangeDetails"
+          :layouts="['PrevJump', 'PrevPage', 'JumpNumber', 'NextPage', 'NextJump', 'Sizes', 'FullJump', 'Total']">
+        </vxe-pager>
+      </div>
+    </el-dialog>
+
   </div>
 </template>
 
@@ -227,19 +264,17 @@ export default {
       title: "",
       // 是否显示弹出层
       open: false,
-      edit: false,
+      showDetails: false,
       total: 0,
-      sortOrder: 'asc',
+      totalDetails: 0,
       pageSize: 10,
       currentPage: 1,
       stationList: [],
       stationCode: '',
       stationName: undefined,
-      searchForm: {},
       tableData: [],
+      tableDataDetails: [],
       loading: false,
-      modId: '',
-      checkSign: '',
       capacity: null,
       // 表单校验
       rules: {
@@ -273,7 +308,6 @@ export default {
   methods: {
     // 表单重置
     reset() {
-      this.edit = false;
       this.form = {
         stationCode: '',
         name: '',
@@ -297,27 +331,10 @@ export default {
       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))
     },
     // 提交按钮
     async commitChannel() {
-      var checkData=[]
+      var checkData = []
       const param = {
         "stationCode": this.form.stationCode
       }
@@ -342,87 +359,37 @@ export default {
             return
           }
           var timeStartEnd = [this.form.startTime, this.form.endTime]
-          if (this.checkDate(timeStartEnd, checkData, this.edit, this.form)) {
+          if (this.checkDate(timeStartEnd, checkData, this.form)) {
             this.$message.warning('该时间段内已有检修计划!')
             return
           }
-          // if (this.form.id != undefined) {
-          //   // 更新操作
-          //   this.$axios.post('/overhaulplan/updateById', this.form).then((res) => {
-          //     this.$message.success('修改成功')
-          //     this.open = false;
-          //     this.overhualStatus = null
-          //     this.queryByStationCode()
-          //   }).catch((error) => {
-          //   })
-          // } else {
-            // 新增操作
-            this.$axios.post('/overhaulplan/save', this.form).then((res) => {
-              if (res == undefined) {
-                this.$message.success('新增失败')
-              } else {
-                this.$message.success('新增成功')
-                this.overhualStatus = null
-                this.queryByStationCode()
-                this.open = false;
-              }
-            }).catch((error) => {
-            })
-          }
-        // }
+          // 新增操作
+          this.$axios.post('/overhaulplan/save', this.form).then((res) => {
+            if (res == undefined) {
+              this.$message.success('新增失败')
+            } else {
+              this.$message.success('新增成功')
+              this.overhualStatus = null
+              this.queryByStationCode()
+              this.open = false;
+            }
+          }).catch((error) => {
+          })
+        }
       });
     },
-    // /** 删除按钮操作 */
-    // handleDelete() {
-    //   const _selectData = this.$refs.xTable.getRadioRecord(true)
-    //   if (_selectData == null) {
-    //     this.$message({
-    //       type: 'warning',
-    //       message: '请选择记录!'
-    //     });
-    //     return
-    //   }
-    //
-    //   this.$confirm('是否确认删除?', '提示', {
-    //     confirmButtonText: '确定',
-    //     cancelButtonText: '取消',
-    //     type: 'warning'
-    //   }).then(() => {
-    //     this.doDelete(_selectData)
-    //   }).catch(() => {
-    //   });
-    // },
-    /**
-     * 删除提交
-     */
-    // doDelete(row) {
-    //   this.$axios.post('/overhaulplan/remove', row).then((res) => {
-    //     this.$message.success('删除成功!')
-    //     this.dataQuery()
-    //   }).catch((error) => {
-    //   })
-    //   this.loading = false
-    // },
     handlePageChange({currentPage, pageSize}) {
       this.currentPage = currentPage
       this.pageSize = pageSize
       this.queryByStationCode();
     },
-    // dataQuery() {
-    //   this.loading = true
-    //   const param = {
-    //     "currentPage": this.currentPage,
-    //     "pageSize": this.pageSize,
-    //   }
-    //   this.$axios.get('/overhaulplan/getList', {params: param}).then(response => {
-    //     this.tableData = response.data.records
-    //     this.total = response.data.total
-    //     this.loading = false
-    //   }).catch(() => {
-    //     this.loading = false
-    //   })
-    // },
-
+    handlePageChangeDetails({currentPage, pageSize}) {
+      this.currentPage = currentPage
+      if (this.pageSize != pageSize) {
+        this.changePageSize(pageSize)
+      }
+      this.pageSize = pageSize
+    },
     //日期转换器
     formatDateTime(cellValue) {
       if (cellValue.cellValue == null) {
@@ -469,7 +436,7 @@ export default {
         this.loading = false
       })
     },
-    checkDate(v1, v2, v3, v4) {
+    checkDate(v1, v2, v4) {
       let result = false
       const item = ''
       // 修改时所需便利集合
@@ -481,46 +448,26 @@ export default {
         }
         v5.push(v2[i])
       }
-      // 编辑修改
-      if (v3) {
-        for (let i = 0; i < v5.length; i++) {
-          if (v1[0] >= v5[i].startTime && v1[0] <= v5[i].endTime) {
-            result = true
-            break
-          }
-          if (v1[1] >= v5[i].startTime && v1[1] <= v5[i].endTime) {
-            result = true
-            break
-          }
-          if (v1[0] <= v5[i].startTime && v1[1] >= v5[i].endTime) {
-            result = true
-            break
-          }
-          if (v1[0] >= v5[i].startTime && v1[1] <= v5[i].endTime) {
-            result = true
-            break
-          }
+
+      for (let i = 0; i < v2.length; i++) {
+        if (v1[0] >= new Date(v2[i].startTime).getTime() && v1[0] <= new Date(v2[i].endTime).getTime()) {
+          result = true
+          break
         }
-      } else {
-        for (let i = 0; i < v2.length; i++) {
-          if (v1[0] >= new Date(v2[i].startTime).getTime() && v1[0] <= new Date(v2[i].endTime).getTime()) {
-            result = true
-            break
-          }
-          if (v1[1] >= new Date(v2[i].startTime).getTime() && v1[1] <= new Date(v2[i].endTime).getTime()) {
-            result = true
-            break
-          }
-          if (v1[0] <= new Date(v2[i].startTime).getTime() && v1[1] >= new Date(v2[i].endTime).getTime()) {
-            result = true
-            break
-          }
-          if (v1[0] >= new Date(v2[i].startTime).getTime() && v1[1] <= new Date(v2[i].endTime).getTime()) {
-            result = true
-            break
-          }
+        if (v1[1] >= new Date(v2[i].startTime).getTime() && v1[1] <= new Date(v2[i].endTime).getTime()) {
+          result = true
+          break
+        }
+        if (v1[0] <= new Date(v2[i].startTime).getTime() && v1[1] >= new Date(v2[i].endTime).getTime()) {
+          result = true
+          break
+        }
+        if (v1[0] >= new Date(v2[i].startTime).getTime() && v1[1] <= new Date(v2[i].endTime).getTime()) {
+          result = true
+          break
         }
       }
+
       return result
     },
     stopOverhaulPlan(row) {
@@ -532,12 +479,25 @@ export default {
     codeChangeName(row) {
       var codeList = this.stationList
       for (let i = 0; i < codeList.length; i++) {
-        console.log("a" + row.cellValue)
-        console.log("b" + codeList[i].value)
         if (row.cellValue == codeList[i].value) {
           return codeList[i].label
         }
       }
+    },
+    showRecords(row) {
+      this.showDetails = true
+      this.title = '使用记录详情'
+      this.loading = true
+      const param = {
+        "stationCode": this.stationCode,
+        "startTime": Date.parse(row.startTime),
+        "endTime": Date.parse(row.endTime)
+      }
+      this.$axios.get('/overhaulPlanRecords/findByStationCodeAndTimeBetween', {params: param}).then(response => {
+        this.tableDataDetails = response.data
+        this.totalDetails  = response.data.length()
+        this.loading = false
+      })
     }
   }
 }

+ 3 - 37
cpp-ui/src/views/maintenancerelated/overhaulplanrecords/index.vue

@@ -11,44 +11,12 @@
           </el-option>
         </el-select>
       </el-form-item>
-<!--      <el-form-item label="使用状态">-->
-<!--        <el-select v-model="overhualStatus" placeholder="请选择" style="width: 255px" popper-class="cpp-popper" clearable>-->
-<!--          <el-option-->
-<!--            v-for="item in options"-->
-<!--            :key="item.value"-->
-<!--            :label="item.label"-->
-<!--            :value="item.value">-->
-<!--          </el-option>-->
-<!--        </el-select>-->
-<!--      </el-form-item>-->
       <el-form-item>
         <el-button type="primary" size="mini" style="margin-left: 5px" icon="el-icon-search"
                    @click="queryByStationCode">查询
         </el-button>
       </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"-->
-<!--        >新增-->
-<!--        </el-button>-->
-<!--      </el-col>-->
-<!--      &lt;!&ndash;      <el-col :span="1.5">&ndash;&gt;-->
-<!--      &lt;!&ndash;        <el-button&ndash;&gt;-->
-<!--      &lt;!&ndash;          type="success"&ndash;&gt;-->
-<!--      &lt;!&ndash;          plain&ndash;&gt;-->
-<!--      &lt;!&ndash;          icon="el-icon-edit"&ndash;&gt;-->
-<!--      &lt;!&ndash;          size="mini"&ndash;&gt;-->
-<!--      &lt;!&ndash;          @click="handleUpdate"&ndash;&gt;-->
-<!--      &lt;!&ndash;        >修改&ndash;&gt;-->
-<!--      &lt;!&ndash;        </el-button>&ndash;&gt;-->
-<!--      &lt;!&ndash;      </el-col>&ndash;&gt;-->
-<!--    </el-row>-->
 
     <div style="padding-top: 10px">
       <vxe-table
@@ -67,7 +35,9 @@
         <vxe-table-column field="startTime" :formatter="formatDateTime" title="检修开始时间"></vxe-table-column>
         <vxe-table-column field="endTime" :formatter="formatDateTime" title="检修结束时间"></vxe-table-column>
         <vxe-table-column field="overhaulCapacity" title="检修容量(MW)"></vxe-table-column>
-        <vxe-table-column field="dataType" title="使用数据类型"></vxe-table-column>
+        <vxe-table-column field="forecastModel" title="预测模型"></vxe-table-column>
+        <vxe-table-column field="useNum" title="使用次数"></vxe-table-column>
+        <vxe-table-column field="updateTime" :formatter="formatDateTime" title="最近一次使用时间"></vxe-table-column>
       </vxe-table>
       <vxe-pager
         background
@@ -84,8 +54,6 @@
 
 
 <script>
-import form from "vxe-table/packages/form";
-
 export default {
   name: 'overhaulPlanRecords',
   data() {
@@ -163,8 +131,6 @@ export default {
     codeChangeName(row){
       var codeList = this.stationList
       for (let i = 0; i < codeList.length; i++) {
-        console.log("a"+ row.cellValue)
-        console.log("b" + codeList[i].value)
         if (row.cellValue == codeList[i].value){
           return codeList[i].label
         }