瀏覽代碼

-新增设备和密封点的导入导出功能
-修改删除逻辑
-修改新增重复问题

jiangbiao 2 年之前
父節點
當前提交
960a54ce70
共有 31 個文件被更改,包括 1265 次插入234 次删除
  1. 308 0
      master/src/main/java/com/ruoyi/common/utils/file/ExcelUtils.java
  2. 4 3
      master/src/main/java/com/ruoyi/framework/config/SecurityConfig.java
  3. 122 9
      master/src/main/java/com/ruoyi/project/base/controller/TBaseDeviceController.java
  4. 1 0
      master/src/main/java/com/ruoyi/project/base/controller/TBasePlantController.java
  5. 246 28
      master/src/main/java/com/ruoyi/project/base/controller/TBasePointController.java
  6. 1 0
      master/src/main/java/com/ruoyi/project/base/controller/TBaseRegionController.java
  7. 12 1
      master/src/main/java/com/ruoyi/project/base/domain/TBaseDevice.java
  8. 50 53
      master/src/main/java/com/ruoyi/project/base/domain/TBasePoint.java
  9. 1 0
      master/src/main/java/com/ruoyi/project/base/mapper/TBaseDeviceMapper.java
  10. 1 0
      master/src/main/java/com/ruoyi/project/base/mapper/TBasePlantMapper.java
  11. 10 8
      master/src/main/java/com/ruoyi/project/base/mapper/TBasePointMapper.java
  12. 2 0
      master/src/main/java/com/ruoyi/project/base/mapper/TBaseRegionMapper.java
  13. 1 0
      master/src/main/java/com/ruoyi/project/base/service/ITBaseDeviceService.java
  14. 1 0
      master/src/main/java/com/ruoyi/project/base/service/ITBasePlantService.java
  15. 14 9
      master/src/main/java/com/ruoyi/project/base/service/ITBasePointService.java
  16. 1 0
      master/src/main/java/com/ruoyi/project/base/service/ITBaseRegionService.java
  17. 5 0
      master/src/main/java/com/ruoyi/project/base/service/impl/TBaseDeviceServiceImpl.java
  18. 6 0
      master/src/main/java/com/ruoyi/project/base/service/impl/TBasePlantServiceImpl.java
  19. 20 21
      master/src/main/java/com/ruoyi/project/base/service/impl/TBasePointServiceImpl.java
  20. 5 0
      master/src/main/java/com/ruoyi/project/base/service/impl/TBaseRegionServiceImpl.java
  21. 74 6
      master/src/main/java/com/ruoyi/web/controller/common/CommonController.java
  22. 10 6
      master/src/main/resources/mybatis/base/TBaseDeviceMapper.xml
  23. 5 0
      master/src/main/resources/mybatis/base/TBasePlantMapper.xml
  24. 20 7
      master/src/main/resources/mybatis/base/TBasePointMapper.xml
  25. 5 0
      master/src/main/resources/mybatis/base/TBaseRegionMapper.xml
  26. 二進制
      master/src/main/resources/static/template/base/baseDevice.xlsx
  27. 二進制
      master/src/main/resources/static/template/base/basePoint.xlsx
  28. 128 21
      ui/src/views/base/device/index.vue
  29. 14 10
      ui/src/views/base/plant/index.vue
  30. 184 42
      ui/src/views/base/point/index.vue
  31. 14 10
      ui/src/views/base/region/index.vue

+ 308 - 0
master/src/main/java/com/ruoyi/common/utils/file/ExcelUtils.java

@@ -0,0 +1,308 @@
+package com.ruoyi.common.utils.file;
+
+import org.apache.poi.hssf.usermodel.HSSFDataFormat;
+import org.apache.poi.hssf.usermodel.HSSFDateUtil;
+import org.apache.poi.hssf.usermodel.HSSFWorkbook;
+import org.apache.poi.ss.usermodel.*;
+import org.apache.poi.ss.util.CellRangeAddress;
+import org.apache.poi.xssf.usermodel.XSSFWorkbook;
+import org.springframework.web.multipart.MultipartFile;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.math.BigDecimal;
+import java.text.DecimalFormat;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+
+/**
+ * Created by Administrator on 2018/7/26 0026.
+ */
+public class ExcelUtils {
+
+    public static Workbook getWorkBook(MultipartFile file) {
+        //获得文件名
+        String fileName = file.getOriginalFilename();
+        //创建Workbook工作薄对象,表示整个excel
+        Workbook workbook = null;
+        try {
+            //获取excel文件的io流
+            InputStream is = file.getInputStream();
+            //根据文件后缀名不同(xls和xlsx)获得不同的Workbook实现类对象
+            if (fileName.endsWith("xls")) {
+                //2003
+                workbook = new HSSFWorkbook(is);
+            } else if (fileName.endsWith("xlsx")) {
+                //2007 及2007以上
+                workbook = new XSSFWorkbook(is);
+            }
+        } catch (IOException e) {
+//            log.error(e.getMessage());
+        }
+        return workbook;
+    }
+
+    public static Workbook getWorkBook(File file) {
+        //获得文件名
+        String fileName = file.getName();
+        //创建Workbook工作薄对象,表示整个excel
+        Workbook workbook = null;
+        try {
+            //获取excel文件的io流
+            InputStream is =new FileInputStream(file);
+            //根据文件后缀名不同(xls和xlsx)获得不同的Workbook实现类对象
+            if (fileName.endsWith("xls")) {
+                //2003
+                workbook = new HSSFWorkbook(is);
+            } else if (fileName.endsWith("xlsx")) {
+                //2007 及2007以上
+                workbook = new XSSFWorkbook(is);
+            }
+        } catch (IOException e) {
+//            log.error(e.getMessage());
+        }
+        return workbook;
+    }
+
+    public static String getCellValue(Cell cell) {
+        String cellValue = "";
+        if (cell == null) {
+            return cellValue;
+        }
+        System.out.println("Excel格式:"+ cell.getCellType().name());
+
+        switch (cell.getCellType().name()) {
+            case "STRING":
+                cellValue = cell.getRichStringCellValue().getString();
+                break;
+            case "NUMERIC":
+                System.out.println("Excel数据样式:"+ cell.getCellStyle().getDataFormatString());
+                if("General".equals(cell.getCellStyle().getDataFormatString())){
+                    cellValue = new BigDecimal(cell.getNumericCellValue()).toPlainString();
+                }else if("m/d/yyyy;@".equals(cell.getCellStyle().getDataFormatString())){
+                    cellValue =  new SimpleDateFormat("yyyy-MM-dd").format(cell.getDateCellValue());
+                }else if("@".equals(cell.getCellStyle().getDataFormatString())){
+                    cellValue = cell.getNumericCellValue() + "";
+                }else if(cell.getCellStyle().getDataFormatString().indexOf("0_") > -1){
+                    //数字非日期
+                    System.out.println("Excel值:"+ cell.getNumericCellValue());
+                    cellValue = cell.getNumericCellValue() + "";
+                }else{
+                    try {
+                        cellValue =  new SimpleDateFormat("yyyy-MM-dd").format(cell.getDateCellValue());
+                    }catch (Exception e){
+                        cellValue = cell.getNumericCellValue() + "";
+                    }
+                }
+                break;
+            case "BLANK":
+                cellValue = "";
+                break;
+            default:
+                cellValue = cell.toString();
+                break;
+        }
+        //判断数据的类型
+//        switch (cell.getCellType()) {
+//            case Cell.CELL_TYPE_NUMERIC: //数字
+//                cellValue = stringDateProcess(cell);
+//                break;
+//            case Cell.CELL_TYPE_STRING: //字符串
+//                cellValue = String.valueOf(cell.getStringCellValue());
+//                break;
+//            case Cell.CELL_TYPE_BOOLEAN: //Boolean
+//                cellValue = String.valueOf(cell.getBooleanCellValue());
+//                break;
+//            case Cell.CELL_TYPE_FORMULA: //公式
+//                cellValue = String.valueOf(cell.getCellFormula());
+//                break;
+//            case Cell.CELL_TYPE_BLANK: //空值
+//                cellValue = "";
+//                break;
+//            case Cell.CELL_TYPE_ERROR: //故障
+//                cellValue = "非法字符";
+//                break;
+//            default:
+//                cellValue = "未知类型";
+//                break;
+//        }
+//        cellValue = String.valueOf(cell.getStringCellValue());
+        return cellValue;
+    }
+
+    /**
+     * 时间格式处理
+     *
+     * @return
+     * @author Liu Xin Nan
+     * @data 2017年11月27日
+     */
+    public static String stringDateProcess(Cell cell) {
+        String result = new String();
+        if (HSSFDateUtil.isCellDateFormatted(cell)) {// 处理日期格式、时间格式
+            SimpleDateFormat sdf = null;
+            if (cell.getCellStyle().getDataFormat() == HSSFDataFormat.getBuiltinFormat("h:mm")) {
+                sdf = new SimpleDateFormat("HH:mm");
+            } else {// 日期
+                sdf = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
+            }
+            Date date = cell.getDateCellValue();
+            result = sdf.format(date);
+        } else if (cell.getCellStyle().getDataFormat() == 58) {
+            // 处理自定义日期格式:m月d日(通过判断单元格的格式id解决,id的值是58)
+            SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
+            double value = cell.getNumericCellValue();
+            Date date = DateUtil
+                    .getJavaDate(value);
+            result = sdf.format(date);
+        } else {
+            double value = cell.getNumericCellValue();
+            CellStyle style = cell.getCellStyle();
+            DecimalFormat format = new DecimalFormat();
+            String temp = style.getDataFormatString();
+            // 单元格设置成常规
+            if (temp.equals("General")) {
+                format.applyPattern("#");
+            }
+            result = format.format(value);
+        }
+
+        return result;
+    }
+
+    /**
+     * 合并单元格处理,获取合并行
+     *
+     * @param sheet
+     * @return List<CellRangeAddress>
+     */
+    public static List<CellRangeAddress> getCombineCell(Sheet sheet) {
+        List<CellRangeAddress> list = new ArrayList<CellRangeAddress>();
+        //获得一个 sheet 中合并单元格的数量
+        int sheetmergerCount = sheet.getNumMergedRegions();
+        //遍历所有的合并单元格
+        for (int i = 0; i < sheetmergerCount; i++) {
+            //获得合并单元格保存进list中
+            CellRangeAddress ca = sheet.getMergedRegion(i);
+            list.add(ca);
+        }
+        return list;
+    }
+
+    public static int getRowNum(List<CellRangeAddress> listCombineCell, Cell cell, Sheet sheet) {
+        int xr = 0;
+        int firstC = 0;
+        int lastC = 0;
+        int firstR = 0;
+        int lastR = 0;
+        for (CellRangeAddress ca : listCombineCell) {
+            //获得合并单元格的起始行, 结束行, 起始列, 结束列
+            firstC = ca.getFirstColumn();
+            lastC = ca.getLastColumn();
+            firstR = ca.getFirstRow();
+            lastR = ca.getLastRow();
+            if (cell.getRowIndex() >= firstR && cell.getRowIndex() <= lastR) {
+                if (cell.getColumnIndex() >= firstC && cell.getColumnIndex() <= lastC) {
+                    xr = lastR;
+                }
+            }
+        }
+        return xr;
+
+    }
+
+    /**
+     * 判断单元格是否为合并单元格,是的话则将单元格的值返回
+     *
+     * @param listCombineCell 存放合并单元格的list
+     * @param cell            需要判断的单元格
+     * @param sheet           sheet
+     * @return
+     */
+    public static String isCombineCell(List<CellRangeAddress> listCombineCell, Cell cell, Sheet sheet)
+            throws Exception {
+        int firstC = 0;
+        int lastC = 0;
+        int firstR = 0;
+        int lastR = 0;
+        String cellValue = null;
+        for (CellRangeAddress ca : listCombineCell) {
+            //获得合并单元格的起始行, 结束行, 起始列, 结束列
+            firstC = ca.getFirstColumn();
+            lastC = ca.getLastColumn();
+            firstR = ca.getFirstRow();
+            lastR = ca.getLastRow();
+            if (cell.getRowIndex() >= firstR && cell.getRowIndex() <= lastR) {
+                if (cell.getColumnIndex() >= firstC && cell.getColumnIndex() <= lastC) {
+                    Row fRow = sheet.getRow(firstR);
+                    Cell fCell = fRow.getCell(firstC);
+                    cellValue = getCellValue(fCell);
+                    break;
+                }
+            } else {
+                cellValue = "";
+            }
+        }
+        return cellValue;
+    }
+
+    /**
+     * 获取合并单元格的值
+     *
+     * @param sheet
+     * @param row
+     * @param column
+     * @return
+     */
+    public static String getMergedRegionValue(Sheet sheet, int row, int column) {
+        int sheetMergeCount = sheet.getNumMergedRegions();
+
+        for (int i = 0; i < sheetMergeCount; i++) {
+            CellRangeAddress ca = sheet.getMergedRegion(i);
+            int firstColumn = ca.getFirstColumn();
+            int lastColumn = ca.getLastColumn();
+            int firstRow = ca.getFirstRow();
+            int lastRow = ca.getLastRow();
+
+            if (row >= firstRow && row <= lastRow) {
+                if (column >= firstColumn && column <= lastColumn) {
+                    Row fRow = sheet.getRow(firstRow);
+                    Cell fCell = fRow.getCell(firstColumn);
+                    return getCellValue(fCell);
+                }
+            }
+        }
+
+        return null;
+    }
+
+    /**
+     * 判断指定的单元格是否是合并单元格
+     *
+     * @param sheet
+     * @param row    行下标
+     * @param column 列下标
+     * @return
+     */
+    public static boolean isMergedRegion(Sheet sheet, int row, int column) {
+        int sheetMergeCount = sheet.getNumMergedRegions();
+        for (int i = 0; i < sheetMergeCount; i++) {
+            CellRangeAddress range = sheet.getMergedRegion(i);
+            int firstColumn = range.getFirstColumn();
+            int lastColumn = range.getLastColumn();
+            int firstRow = range.getFirstRow();
+            int lastRow = range.getLastRow();
+            if (row >= firstRow && row <= lastRow) {
+                if (column >= firstColumn && column <= lastColumn) {
+                    return true;
+                }
+            }
+        }
+        return false;
+    }
+
+}

+ 4 - 3
master/src/main/java/com/ruoyi/framework/config/SecurityConfig.java

@@ -22,7 +22,7 @@ import com.ruoyi.framework.security.handle.LogoutSuccessHandlerImpl;
 
 /**
  * spring security配置
- * 
+ *
  * @author ruoyi
  */
 @EnableGlobalMethodSecurity(prePostEnabled = true, securedEnabled = true)
@@ -33,7 +33,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter
      */
     @Autowired
     private UserDetailsService userDetailsService;
-    
+
     /**
      * 认证失败处理类
      */
@@ -51,7 +51,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter
      */
     @Autowired
     private JwtAuthenticationTokenFilter authenticationTokenFilter;
-    
+
     /**
      * 跨域过滤器
      */
@@ -113,6 +113,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter
                 // 静态资源,可匿名访问
                 .antMatchers(HttpMethod.GET, "/", "/*.html", "/**/*.html", "/**/*.css", "/**/*.js", "/profile/**").permitAll()
                 .antMatchers("/swagger-ui.html", "/swagger-resources/**", "/webjars/**", "/*/api-docs", "/druid/**").permitAll()
+                .antMatchers("/common/template").anonymous()
                 // 除上面外的所有请求全部需要鉴权认证
                 .anyRequest().authenticated()
                 .and()

+ 122 - 9
master/src/main/java/com/ruoyi/project/base/controller/TBaseDeviceController.java

@@ -1,18 +1,27 @@
 package com.ruoyi.project.base.controller;
 
+import java.io.IOException;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
 import java.util.Date;
 import java.util.List;
 import javax.servlet.http.HttpServletResponse;
+
+import com.alibaba.fastjson2.JSON;
+import com.ruoyi.common.core.domain.entity.SysDictData;
+import com.ruoyi.common.utils.file.ExcelUtils;
+import com.ruoyi.project.base.domain.TBasePlant;
+import com.ruoyi.project.base.domain.TBaseRegion;
+import com.ruoyi.project.base.service.ITBasePlantService;
+import com.ruoyi.project.base.service.ITBaseRegionService;
+import com.ruoyi.system.service.ISysDictTypeService;
+import org.apache.poi.ss.usermodel.Cell;
+import org.apache.poi.ss.usermodel.Row;
+import org.apache.poi.ss.usermodel.Sheet;
+import org.apache.poi.ss.usermodel.Workbook;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.PutMapping;
-import org.springframework.web.bind.annotation.DeleteMapping;
-import org.springframework.web.bind.annotation.PathVariable;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
 import com.ruoyi.common.annotation.Log;
 import com.ruoyi.common.core.controller.BaseController;
 import com.ruoyi.common.core.domain.AjaxResult;
@@ -21,6 +30,7 @@ import com.ruoyi.project.base.domain.TBaseDevice;
 import com.ruoyi.project.base.service.ITBaseDeviceService;
 import com.ruoyi.common.utils.poi.ExcelUtil;
 import com.ruoyi.common.core.page.TableDataInfo;
+import org.springframework.web.multipart.MultipartFile;
 
 /**
  * 设备/管线Controller
@@ -35,6 +45,12 @@ public class TBaseDeviceController extends BaseController
     @Autowired
     private ITBaseDeviceService tBaseDeviceService;
 
+    @Autowired
+    private ITBasePlantService tBasePlantService;
+
+    @Autowired
+    private ITBaseRegionService tBaseRegionService;
+
     /**
      * 查询设备/管线列表
      */
@@ -62,7 +78,7 @@ public class TBaseDeviceController extends BaseController
     {
         List<TBaseDevice> list = tBaseDeviceService.selectTBaseDeviceList(tBaseDevice);
         ExcelUtil<TBaseDevice> util = new ExcelUtil<TBaseDevice>(TBaseDevice.class);
-        util.exportExcel(response, list, "设备/管线数据");
+        util.exportExcel(response, list, "受控设备清单");
     }
 
     /**
@@ -84,6 +100,7 @@ public class TBaseDeviceController extends BaseController
     public AjaxResult add(@RequestBody TBaseDevice tBaseDevice)
     {
         tBaseDevice.setUpdaterCode(getUserId());
+        tBaseDevice.setCreaterCode(getUserId());
         tBaseDevice.setUpdatedate(new Date());
         return toAjax(tBaseDeviceService.insertTBaseDevice(tBaseDevice));
     }
@@ -111,4 +128,100 @@ public class TBaseDeviceController extends BaseController
     {
         return toAjax(tBaseDeviceService.deleteTBaseDeviceByIds(ids));
     }
+
+    @Log(title = "受控设备台账导入", businessType = BusinessType.INSERT)
+    @PostMapping("/importData")
+    public AjaxResult importData(@RequestParam("file") MultipartFile file) throws IOException {
+        //获取操作人员ID
+        Long userId = getUserId();
+        //报错行数统计
+        List<Integer> failRow = new ArrayList<>();
+        Workbook workbook = ExcelUtils.getWorkBook(file);
+        Sheet sheet = workbook.getSheetAt(0);
+        List<TBaseDevice> list = new ArrayList<>();
+        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
+        int rowNum = sheet.getPhysicalNumberOfRows();
+        int failNumber = 0;
+        for (int i = 1; i < rowNum; i++) {
+            try {
+                logger.info("读取行数:" + i);
+                Row row = sheet.getRow(i);
+                int cellNum = row.getLastCellNum();
+                TBaseDevice entity = new TBaseDevice();
+                Long plantId =0L;
+                for (int j = 0; j < cellNum; j++) {
+                    Cell cell = row.getCell(j);
+                    if (cell == null) {
+                        continue;
+                    }
+                    String cellValue = ExcelUtils.getCellValue(cell);
+                    logger.info("cellValue:" + cellValue);
+                    if (j == 0) {
+                        //装置名称
+                        TBasePlant tBasePlant = tBasePlantService.selectTBasePlantByName(cellValue);
+                        if (tBasePlant == null) {return AjaxResult.success("未找到对应装置!请检查装置名称无误后重新提交!",0);}
+                        plantId = tBasePlant.getId();
+                        entity.setPlantId(plantId);
+                    } else if (j == 1) {
+                        //  区域名称
+                        TBaseRegion tBaseRegion = tBaseRegionService.selectTBaseRegionByName(cellValue, plantId);
+                        if (tBaseRegion == null) {return AjaxResult.success("未找到对应区域!请检查装置名称与区域名称无误后重新提交!",0);}
+                        entity.setRegionId(tBaseRegion.getId());
+                    } else if (j == 2) {
+                        // 设备描述
+                        entity.setDescribe(cellValue);
+                    } else if (j == 3) {
+                        //设备编号
+                        entity.setCode(cellValue);
+                    } else if (j == 4) {
+                        // 主要物料
+                        entity.setMaterial(cellValue);
+                    } else if (j == 5) {
+                        // 物料状态
+                        entity.setMaterialStatus(cellValue);
+                    } else if (j == 6) {
+                        // 合成响应因子
+                        entity.setResponseFactor(cellValue);
+                    } else if (j == 7) {
+                        // 响应因子来源
+                        entity.setResponseFactorFrom(cellValue);
+                    } else if (j == 8) {
+                        // 维护日期
+                        entity.setUpdatedate(sdf.parse(cellValue));
+                    } else if (j == 9) {
+                        // 备注
+                        entity.setRemarks(cellValue);
+                    }
+                }
+                entity.setCreaterCode(userId);
+                entity.setApproveStatus(0L);
+                logger.info("entity:" + entity);
+                list.add(entity);
+            } catch (Exception e) {
+                failNumber++;
+                logger.info("e:" + JSON.toJSONString(e));
+                failRow.add(i + 1);
+            }
+        }
+        int successNumber = 0;
+        int failNum = 0;
+        for (TBaseDevice t : list
+        ) {
+            failNum++;
+            try {
+                //根据使用证、注册编号、位号,进行数据更新
+                add(t);
+                successNumber++;
+            } catch (Exception e) {
+                failNumber++;
+                logger.info("e:" + e);
+                failRow.add(failNum + 1);
+            }
+        }
+        logger.info("list:" + JSON.toJSONString(list));
+        logger.info("successNumber:" + String.valueOf(successNumber));
+        logger.info("failNumber:" + String.valueOf(failNumber));
+        logger.info("failRow:" + String.valueOf(failRow));
+        return AjaxResult.success(String.valueOf(successNumber), failRow);
+    }
 }

+ 1 - 0
master/src/main/java/com/ruoyi/project/base/controller/TBasePlantController.java

@@ -86,6 +86,7 @@ public class TBasePlantController extends BaseController
     {
         tBasePlant.setUpdatedate(new Date());
         tBasePlant.setUpdaterCode(getUserId());
+        tBasePlant.setCreaterCode(getUserId());
         return toAjax(tBasePlantService.insertTBasePlant(tBasePlant));
     }
 

+ 246 - 28
master/src/main/java/com/ruoyi/project/base/controller/TBasePointController.java

@@ -1,18 +1,30 @@
 package com.ruoyi.project.base.controller;
 
+import java.io.IOException;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
 import java.util.Date;
 import java.util.List;
 import javax.servlet.http.HttpServletResponse;
+
+import com.alibaba.fastjson2.JSON;
+import com.ruoyi.common.core.domain.entity.SysDictData;
+import com.ruoyi.common.utils.StringUtils;
+import com.ruoyi.common.utils.file.ExcelUtils;
+import com.ruoyi.project.base.domain.TBaseDevice;
+import com.ruoyi.project.base.domain.TBasePlant;
+import com.ruoyi.project.base.domain.TBaseRegion;
+import com.ruoyi.project.base.service.ITBaseDeviceService;
+import com.ruoyi.project.base.service.ITBasePlantService;
+import com.ruoyi.project.base.service.ITBaseRegionService;
+import com.ruoyi.system.service.ISysDictTypeService;
+import org.apache.poi.ss.usermodel.Cell;
+import org.apache.poi.ss.usermodel.Row;
+import org.apache.poi.ss.usermodel.Sheet;
+import org.apache.poi.ss.usermodel.Workbook;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.PutMapping;
-import org.springframework.web.bind.annotation.DeleteMapping;
-import org.springframework.web.bind.annotation.PathVariable;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
 import com.ruoyi.common.annotation.Log;
 import com.ruoyi.common.core.controller.BaseController;
 import com.ruoyi.common.core.domain.AjaxResult;
@@ -21,6 +33,7 @@ import com.ruoyi.project.base.domain.TBasePoint;
 import com.ruoyi.project.base.service.ITBasePointService;
 import com.ruoyi.common.utils.poi.ExcelUtil;
 import com.ruoyi.common.core.page.TableDataInfo;
+import org.springframework.web.multipart.MultipartFile;
 
 /**
  * 密封点Controller
@@ -30,18 +43,29 @@ import com.ruoyi.common.core.page.TableDataInfo;
  */
 @RestController
 @RequestMapping("/base/point")
-public class TBasePointController extends BaseController
-{
+public class TBasePointController extends BaseController {
     @Autowired
     private ITBasePointService tBasePointService;
 
+    @Autowired
+    private ITBaseDeviceService tBaseDeviceService;
+
+    @Autowired
+    private ITBasePlantService tBasePlantService;
+
+    @Autowired
+    private ITBaseRegionService tBaseRegionService;
+
+    @Autowired
+    private ISysDictTypeService isysDictTypeService;
+
+
     /**
      * 查询密封点列表
      */
     @PreAuthorize("@ss.hasPermi('base:point:list')")
     @GetMapping("/list")
-    public TableDataInfo list(TBasePoint tBasePoint)
-    {
+    public TableDataInfo list(TBasePoint tBasePoint) {
         startPage();
         List<TBasePoint> list = tBasePointService.selectTBasePointList(tBasePoint);
         return getDataTable(list);
@@ -53,8 +77,7 @@ public class TBasePointController extends BaseController
     @PreAuthorize("@ss.hasPermi('base:point:export')")
     @Log(title = "密封点", businessType = BusinessType.EXPORT)
     @PostMapping("/export")
-    public void export(HttpServletResponse response, TBasePoint tBasePoint)
-    {
+    public void export(HttpServletResponse response, TBasePoint tBasePoint) {
         List<TBasePoint> list = tBasePointService.selectTBasePointList(tBasePoint);
         ExcelUtil<TBasePoint> util = new ExcelUtil<TBasePoint>(TBasePoint.class);
         util.exportExcel(response, list, "密封点数据");
@@ -65,8 +88,7 @@ public class TBasePointController extends BaseController
      */
     @PreAuthorize("@ss.hasPermi('base:point:query')")
     @GetMapping(value = "/{id}")
-    public AjaxResult getInfo(@PathVariable("id") Long id)
-    {
+    public AjaxResult getInfo(@PathVariable("id") Long id) {
         return AjaxResult.success(tBasePointService.selectTBasePointById(id));
     }
 
@@ -76,11 +98,17 @@ public class TBasePointController extends BaseController
     @PreAuthorize("@ss.hasPermi('base:point:add')")
     @Log(title = "密封点", businessType = BusinessType.INSERT)
     @PostMapping
-    public AjaxResult add(@RequestBody TBasePoint tBasePoint)
-    {
-        tBasePoint.setUpdatedate(new Date());
-        tBasePoint.setUpdaterCode(getUserId());
+    public AjaxResult add(@RequestBody TBasePoint tBasePoint) {
+        TBasePoint point = tBasePointService.selectTBasePointByGroupCodeAndExtendCode(tBasePoint);
+        if (point == null) {
+            tBasePoint.setUpdatedate(new Date());
+            tBasePoint.setUpdaterCode(getUserId());
+            tBasePoint.setCreaterCode(getUserId());
         return toAjax(tBasePointService.insertTBasePoint(tBasePoint));
+        }else{
+            return AjaxResult.error("当前数据已存在!");
+        }
+
     }
 
     /**
@@ -89,11 +117,15 @@ public class TBasePointController extends BaseController
     @PreAuthorize("@ss.hasPermi('base:point:edit')")
     @Log(title = "密封点", businessType = BusinessType.UPDATE)
     @PutMapping
-    public AjaxResult edit(@RequestBody TBasePoint tBasePoint)
-    {
-        tBasePoint.setUpdatedate(new Date());
-        tBasePoint.setUpdaterCode(getUserId());
-        return toAjax(tBasePointService.updateTBasePoint(tBasePoint));
+    public AjaxResult edit(@RequestBody TBasePoint tBasePoint) {
+        TBasePoint point = tBasePointService.selectTBasePointByGroupCodeAndExtendCode(tBasePoint);
+        if (point == null) {
+            tBasePoint.setUpdatedate(new Date());
+            tBasePoint.setUpdaterCode(getUserId());
+            return toAjax(tBasePointService.updateTBasePoint(tBasePoint));
+        }else{
+            return AjaxResult.error("当前数据已存在!");
+        }
     }
 
     /**
@@ -101,9 +133,195 @@ public class TBasePointController extends BaseController
      */
     @PreAuthorize("@ss.hasPermi('base:point:remove')")
     @Log(title = "密封点", businessType = BusinessType.DELETE)
-	@DeleteMapping("/{ids}")
-    public AjaxResult remove(@PathVariable Long[] ids)
-    {
+    @DeleteMapping("/{ids}")
+    public AjaxResult remove(@PathVariable Long[] ids) {
         return toAjax(tBasePointService.deleteTBasePointByIds(ids));
     }
+
+
+    @Log(title = "受控设备台账导入", businessType = BusinessType.INSERT)
+    @PostMapping("/importData")
+    public AjaxResult importData(@RequestParam("file") MultipartFile file) throws IOException {
+        //获取操作人员ID
+        Long userId = getUserId();
+        //报错行数统计
+        List<Integer> failRow = new ArrayList<>();
+        Workbook workbook = ExcelUtils.getWorkBook(file);
+        Sheet sheet = workbook.getSheetAt(0);
+        List<TBasePoint> list = new ArrayList<>();
+        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
+        int rowNum = sheet.getPhysicalNumberOfRows();
+        int failNumber = 0;
+        for (int i = 1; i < rowNum; i++) {
+            try {
+                logger.info("读取行数:" + i);
+                Row row = sheet.getRow(i);
+                int cellNum = row.getLastCellNum();
+                TBasePoint entity = new TBasePoint();
+                Long plantId = 0L;
+                Long regionId = 0L;
+                String devCode = "";
+                String devName = "";
+                for (int j = 0; j < cellNum; j++) {
+                    Cell cell = row.getCell(j);
+                    if (cell == null) {
+                        continue;
+                    }
+                    String cellValue = ExcelUtils.getCellValue(cell);
+                    logger.info("cellValue:" + cellValue);
+                    if (j == 0) {
+                        //装置名称
+                        TBasePlant tBasePlant = tBasePlantService.selectTBasePlantByName(cellValue);
+                        if (tBasePlant == null) {
+                            return AjaxResult.success("未找到对应装置!请检查装置无误后重新提交!", 0);
+                        }
+                        plantId = tBasePlant.getId();
+                        entity.setPlantId(plantId);
+                    } else if (j == 1 || j == 2) {
+                        if (StringUtils.isEmpty(cellValue))
+                            return AjaxResult.success("未找到对应装置!请检查装置名称无误后重新提交!", 0);
+                    } else if (j == 3) {
+                        //  区域名称
+                        TBaseRegion tBaseRegion = tBaseRegionService.selectTBaseRegionByName(cellValue, plantId);
+                        if (tBaseRegion == null) {
+                            return AjaxResult.success("未找到对应区域!请检查装置与区域无误后重新提交!", 0);
+                        }
+                        regionId = tBaseRegion.getId();
+                        entity.setRegionId(regionId);
+                    } else if (j == 4) {
+                        if (StringUtils.isEmpty(cellValue))
+                            return AjaxResult.success("未找到对应区域!请检查装置与区域无误后重新提交!", 0);
+                    } else if (j == 5) {
+                        // 平台
+                        entity.setLayer(cellValue);
+                    } else if (j == 6) {
+                        //PID
+                        entity.setPidNo(cellValue);
+                    } else if (j == 7) {
+                        // 设备名称
+                        devName = cellValue;
+                    } else if (j == 8) {
+                        // 设备编号
+                        devCode = cellValue;
+                        TBaseDevice tBaseDevice = new TBaseDevice();
+                        tBaseDevice.setPlantId(plantId);
+                        tBaseDevice.setRegionId(regionId);
+                        tBaseDevice.setCode(devCode);
+                        tBaseDevice.setDescribe(devName);
+                        TBaseDevice device = tBaseDeviceService.selectDeviceByPlantRegionAndDevice(tBaseDevice);
+                        if (device == null) {
+                            return AjaxResult.success("未找到对应设备!请检查装置、区域、设备无误后重新提交!", 0);
+                        }
+                        entity.setDevId(device.getId());// 设备id
+                    } else if (j == 9) {
+                        // 群组位置
+                        entity.setGroupPosition(cellValue);
+                    } else if (j == 10) {
+                        // 密封点位置
+                        entity.setPointPosition(cellValue);
+                    } else if (j == 11) {
+                        // 群组编码
+                        entity.setGroupCode(cellValue);
+                    } else if (j == 12) {
+                        // 密封点扩展号编码
+                        entity.setExtendCode(cellValue);
+                    } else if (j == 13) {
+                        for (SysDictData dictData : isysDictTypeService.selectDictDataByType("point_type")) {
+                            if (dictData.getDictLabel().equals(cellValue)) {
+                                // 密封点类型
+                                entity.setPointType(dictData.getDictValue());
+                                break;
+                            }
+                        }
+                    } else if (j == 14) {
+                        // 密封点子类型
+                        entity.setSubPointType(cellValue);
+                    } else if (j == 15) {
+                        // 公称直径
+                        entity.setDia(cellValue);
+                    } else if (j == 16) {
+                        // 是否不可达点
+                        entity.setUnarrive(cellValue.equals("是")?"1":"0");
+                    } else if (j == 17) {
+                        // 不可达原因
+                        entity.setUnarriveReason(cellValue);
+                    } else if (j == 18) {
+                        // 是否保温
+                        entity.setKeepWarm(cellValue.equals("是")?"1":"0");
+                    } else if (j == 19) {
+                        // 介质
+                        entity.setMedium(cellValue);
+                    } else if (j == 20) {
+                        for (SysDictData dictData : isysDictTypeService.selectDictDataByType("medium_type")) {
+                            if (dictData.getDictLabel().equals(cellValue)) {
+                                // 介质状态
+                                entity.setMediumType(dictData.getDictValue());
+                                break;
+                            }
+                        }
+                    } else if (j == 21) {
+                        // toc分数
+                        entity.setTocMark(cellValue);
+                    } else if (j == 22) {
+                        // 甲烷质量分数
+                        entity.setMethaneMark(cellValue);
+                    } else if (j == 23) {
+                        // vocs分数
+                        entity.setVocsMark(cellValue);
+                    } else if (j == 24) {
+                        // 工艺温度
+                        entity.setTemperature(cellValue);
+                    } else if (j == 25) {
+                        // 工艺压力
+                        entity.setPressure(cellValue);
+                    } else if (j == 26) {
+                        // pic图号
+                        entity.setPicNo(cellValue);
+                    } else if (j == 27) {
+                        // 运行时间
+                        entity.setRunTime(sdf.parse(cellValue));
+                    } else if (j == 28) {
+                        // 备注
+                        entity.setRemarks(cellValue);
+                    }
+                }
+                entity.setCreaterCode(userId);
+                entity.setApproveStatus(0L);
+                logger.info("entity:" + entity);
+                list.add(entity);
+            } catch (Exception e) {
+                failNumber++;
+                logger.info("e:" + JSON.toJSONString(e));
+                failRow.add(i + 1);
+            }
+        }
+        int successNumber = 0;
+        int failNum = 0;
+        for (TBasePoint t : list
+        ) {
+            failNum++;
+            try {
+                //进行数据更新
+                TBasePoint tBasePoint = tBasePointService.selectTBasePointByGroupCodeAndExtendCode(t);
+                if (tBasePoint == null) {
+                    t.setUpdatedate(new Date());
+                    t.setUpdaterCode(getUserId());
+                    tBasePointService.insertTBasePoint(t);
+                    successNumber++;
+                }else {
+                    failNumber++;
+                    failRow.add(failNum + 1);
+                }
+            } catch (Exception e) {
+                failNumber++;
+                logger.info("e:" + e);
+                failRow.add(failNum + 1);
+            }
+        }
+        logger.info("list:" + JSON.toJSONString(list));
+        logger.info("successNumber:" + successNumber);
+        logger.info("failNumber:" + failNumber);
+        logger.info("failRow:" + failRow);
+        return AjaxResult.success(String.valueOf(successNumber), failRow);
+    }
 }

+ 1 - 0
master/src/main/java/com/ruoyi/project/base/controller/TBaseRegionController.java

@@ -78,6 +78,7 @@ public class TBaseRegionController extends BaseController
     @PostMapping
     public AjaxResult add(@RequestBody TBaseRegion tBaseRegion)
     {
+        tBaseRegion.setCreaterCode(getUserId());
         tBaseRegion.setUpdaterCode(getUserId());
         tBaseRegion.setUpdatedate(new Date());
         return toAjax(tBaseRegionService.insertTBaseRegion(tBaseRegion));

+ 12 - 1
master/src/main/java/com/ruoyi/project/base/domain/TBaseDevice.java

@@ -36,7 +36,7 @@ public class TBaseDevice extends BaseEntity {
     /**
      * 审核状态
      */
-    @Excel(name = "审核状态")
+    @Excel(name = "审核状态",dictType = "base_approve_status")
     private Long approveStatus;
 
     @Excel(name = "装置名称")
@@ -135,6 +135,17 @@ public class TBaseDevice extends BaseEntity {
     @Excel(name = "维护时间", width = 30, dateFormat = "yyyy-MM-dd")
     private Date updatedate;
 
+    @Excel(name = "备注")
+    private String remarks;
+
+    public String getRemarks() {
+        return remarks;
+    }
+
+    public void setRemarks(String remarks) {
+        this.remarks = remarks;
+    }
+
     public String getMaterial() {
         return material;
     }

+ 50 - 53
master/src/main/java/com/ruoyi/project/base/domain/TBasePoint.java

@@ -32,25 +32,52 @@ public class TBasePoint extends BaseEntity {
     /**
      * 泄漏程度
      */
-    @Excel(name = "泄漏程度")
+    @Excel(name = "泄漏程度", dictType = "leakage_degree")
     private String leakageDegree;
 
+
+    @Excel(name = "装置名称")
+    @TableField(exist = false)
+    private String plantName;
+
+    @Excel(name = "装置编码")
+    @TableField(exist = false)
+    private String plantCode;
+
+    @Excel(name = "装置类别" ,dictType = "plant_type")
+    @TableField(exist = false)
+    private String plantType;
+
+    @Excel(name = "区域编码")
+    @TableField(exist = false)
+    private String regionCode;
+
+    @Excel(name = "区域名称")
+    @TableField(exist = false)
+    private String regionName;
+
+    @Excel(name = "设备编码")
+    @TableField(exist = false)
+    private String devCode;
+
+
+    @Excel(name = "设备名称")
+    @TableField(exist = false)
+    private String devName;
+
     /**
      * 装置ID
      */
-    @Excel(name = "装置ID")
     private Long plantId;
 
     /**
      * 区域ID
      */
-    @Excel(name = "区域ID")
     private Long regionId;
 
     /**
      * 设备id
      */
-    @Excel(name = "设备id")
     private Long devId;
 
     /**
@@ -62,13 +89,13 @@ public class TBasePoint extends BaseEntity {
     /**
      * 介质状态
      */
-    @Excel(name = "介质状态")
+    @Excel(name = "介质状态",dictType= "medium_type")
     private String mediumType;
 
     /**
      * 密封点类型
      */
-    @Excel(name = "密封点类型")
+    @Excel(name = "密封点类型",dictType = "point_type")
     private String pointType;
 
     /**
@@ -99,7 +126,7 @@ public class TBasePoint extends BaseEntity {
      * 扩展编码
      */
     @Excel(name = "扩展编码")
-    private String extendCoude;
+    private String extendCode;
 
     /**
      * 密封点子类型
@@ -116,7 +143,7 @@ public class TBasePoint extends BaseEntity {
     /**
      * 是否不可达点
      */
-    @Excel(name = "是否不可达点")
+    @Excel(name = "是否不可达点",dictType = "yes_no")
     private String unarrive;
 
     /**
@@ -128,7 +155,7 @@ public class TBasePoint extends BaseEntity {
     /**
      * 是否保温/保冷
      */
-    @Excel(name = "是否保温/保冷")
+    @Excel(name = "是否保温/保冷",dictType = "yes_no")
     private String keepWarm;
 
     /**
@@ -192,29 +219,22 @@ public class TBasePoint extends BaseEntity {
     @Excel(name = "VOCs质量分数")
     private String vocsMark;
 
-    /**
-     * 描述
-     */
-    @Excel(name = "描述")
-    private String remarks;
 
     /**
      * 审核状态
      */
-    @Excel(name = "审核状态")
+    @Excel(name = "审核状态" ,dictType = "base_approve_status")
     private Long approveStatus;
 
     /**
      * 最新申请时间
      */
     @JsonFormat(pattern = "yyyy-MM-dd")
-    @Excel(name = "最新申请时间", width = 30, dateFormat = "yyyy-MM-dd")
     private Date approveTime;
 
     /**
      * 部门编号
      */
-    @Excel(name = "部门编号")
     private Long deptId;
 
     /**
@@ -225,14 +245,12 @@ public class TBasePoint extends BaseEntity {
     /**
      * 创建人
      */
-    @Excel(name = "创建人")
     private Long createrCode;
 
     /**
      * 创建时间
      */
     @JsonFormat(pattern = "yyyy-MM-dd")
-    @Excel(name = "创建时间", width = 30, dateFormat = "yyyy-MM-dd")
     private Date createdate;
 
     /**
@@ -240,45 +258,24 @@ public class TBasePoint extends BaseEntity {
      */
 
     private Long updaterCode;
-    @Excel(name = "修改人")
+    @Excel(name = "维护人")
     @TableField(exist = false)
     private String updater;
 
-    @Excel(name = "装置名称")
-    @TableField(exist = false)
-    private String plantName;
-
-    @Excel(name = "装置编码")
-    @TableField(exist = false)
-    private String plantCode;
-
-    @Excel(name = "装置类别")
-    @TableField(exist = false)
-    private String plantType;
-
-    @Excel(name = "区域编码")
-    @TableField(exist = false)
-    private String regionCode;
-
-    @Excel(name = "区域名称")
-    @TableField(exist = false)
-    private String regionName;
-
-    @Excel(name = "设备名称")
-    @TableField(exist = false)
-    private String devName;
-
-    @Excel(name = "设备编码")
-    @TableField(exist = false)
-    private String devCode;
 
     /**
      * 修改时间
      */
     @JsonFormat(pattern = "yyyy-MM-dd")
-    @Excel(name = "修改时间", width = 30, dateFormat = "yyyy-MM-dd")
+    @Excel(name = "维护时间", width = 30, dateFormat = "yyyy-MM-dd")
     private Date updatedate;
 
+    /**
+     * 描述
+     */
+    @Excel(name = "描述")
+    private String remarks;
+
     public String getRegionCode() {
         return regionCode;
     }
@@ -447,12 +444,12 @@ public class TBasePoint extends BaseEntity {
         return groupCode;
     }
 
-    public void setExtendCoude(String extendCoude) {
-        this.extendCoude = extendCoude;
+    public void setExtendCode(String extendCode) {
+        this.extendCode = extendCode;
     }
 
-    public String getExtendCoude() {
-        return extendCoude;
+    public String getExtendCode() {
+        return extendCode;
     }
 
     public void setSubPointType(String subPointType) {
@@ -663,7 +660,7 @@ public class TBasePoint extends BaseEntity {
                 .append("groupPosition", getGroupPosition())
                 .append("pointPosition", getPointPosition())
                 .append("groupCode", getGroupCode())
-                .append("extendCoude", getExtendCoude())
+                .append("extendCode", getExtendCode())
                 .append("subPointType", getSubPointType())
                 .append("dia", getDia())
                 .append("unarrive", getUnarrive())

+ 1 - 0
master/src/main/java/com/ruoyi/project/base/mapper/TBaseDeviceMapper.java

@@ -18,6 +18,7 @@ public interface TBaseDeviceMapper
      * @return 设备/管线
      */
     public TBaseDevice selectTBaseDeviceById(Long id);
+    public TBaseDevice selectDeviceByPlantRegionAndDevice(TBaseDevice tBaseDevice);
 
     /**
      * 查询设备/管线列表

+ 1 - 0
master/src/main/java/com/ruoyi/project/base/mapper/TBasePlantMapper.java

@@ -18,6 +18,7 @@ public interface TBasePlantMapper
      * @return 装置
      */
     public TBasePlant selectTBasePlantById(Long id);
+    public TBasePlant selectTBasePlantByName(String name);
 
     /**
      * 查询装置列表

+ 10 - 8
master/src/main/java/com/ruoyi/project/base/mapper/TBasePointMapper.java

@@ -2,26 +2,28 @@ package com.ruoyi.project.base.mapper;
 
 import java.util.List;
 import com.ruoyi.project.base.domain.TBasePoint;
+import org.apache.ibatis.annotations.Param;
 
 /**
  * 密封点Mapper接口
- * 
+ *
  * @author ruoyi
  * @date 2022-11-11
  */
-public interface TBasePointMapper 
+public interface TBasePointMapper
 {
     /**
      * 查询密封点
-     * 
+     *
      * @param id 密封点主键
      * @return 密封点
      */
     public TBasePoint selectTBasePointById(Long id);
+    public TBasePoint selectTBasePointByGroupCodeAndExtendCode(TBasePoint tBasePoint);
 
     /**
      * 查询密封点列表
-     * 
+     *
      * @param tBasePoint 密封点
      * @return 密封点集合
      */
@@ -29,7 +31,7 @@ public interface TBasePointMapper
 
     /**
      * 新增密封点
-     * 
+     *
      * @param tBasePoint 密封点
      * @return 结果
      */
@@ -37,7 +39,7 @@ public interface TBasePointMapper
 
     /**
      * 修改密封点
-     * 
+     *
      * @param tBasePoint 密封点
      * @return 结果
      */
@@ -45,7 +47,7 @@ public interface TBasePointMapper
 
     /**
      * 删除密封点
-     * 
+     *
      * @param id 密封点主键
      * @return 结果
      */
@@ -53,7 +55,7 @@ public interface TBasePointMapper
 
     /**
      * 批量删除密封点
-     * 
+     *
      * @param ids 需要删除的数据主键集合
      * @return 结果
      */

+ 2 - 0
master/src/main/java/com/ruoyi/project/base/mapper/TBaseRegionMapper.java

@@ -2,6 +2,7 @@ package com.ruoyi.project.base.mapper;
 
 import java.util.List;
 import com.ruoyi.project.base.domain.TBaseRegion;
+import org.apache.ibatis.annotations.Param;
 
 /**
  * 区域Mapper接口
@@ -18,6 +19,7 @@ public interface TBaseRegionMapper
      * @return 区域
      */
     public TBaseRegion selectTBaseRegionById(Long id);
+    public TBaseRegion selectTBaseRegionByName(@Param("name") String name,@Param("plantId") Long plantId);
 
     /**
      * 查询区域列表

+ 1 - 0
master/src/main/java/com/ruoyi/project/base/service/ITBaseDeviceService.java

@@ -27,6 +27,7 @@ public interface ITBaseDeviceService
      */
     public List<TBaseDevice> selectTBaseDeviceList(TBaseDevice tBaseDevice);
     public List<TBaseDevice> selectAllDeviceByRegionId(Long regionId);
+    public TBaseDevice selectDeviceByPlantRegionAndDevice(TBaseDevice tBaseDevice);
 
     /**
      * 新增设备/管线

+ 1 - 0
master/src/main/java/com/ruoyi/project/base/service/ITBasePlantService.java

@@ -18,6 +18,7 @@ public interface ITBasePlantService
      * @return 装置
      */
     public TBasePlant selectTBasePlantById(Long id);
+    public TBasePlant selectTBasePlantByName(String name);
 
     /**
      * 查询装置列表

+ 14 - 9
master/src/main/java/com/ruoyi/project/base/service/ITBasePointService.java

@@ -1,27 +1,32 @@
 package com.ruoyi.project.base.service;
 
 import java.util.List;
+
 import com.ruoyi.project.base.domain.TBasePoint;
 
 /**
  * 密封点Service接口
- * 
+ *
  * @author ruoyi
  * @date 2022-11-11
  */
-public interface ITBasePointService 
-{
+public interface ITBasePointService {
     /**
      * 查询密封点
-     * 
+     *
      * @param id 密封点主键
      * @return 密封点
      */
     public TBasePoint selectTBasePointById(Long id);
 
+    /**
+     * 根据群组编码、扩展编码查询密封点
+     */
+    public TBasePoint selectTBasePointByGroupCodeAndExtendCode(TBasePoint tBasePoint);
+
     /**
      * 查询密封点列表
-     * 
+     *
      * @param tBasePoint 密封点
      * @return 密封点集合
      */
@@ -29,7 +34,7 @@ public interface ITBasePointService
 
     /**
      * 新增密封点
-     * 
+     *
      * @param tBasePoint 密封点
      * @return 结果
      */
@@ -37,7 +42,7 @@ public interface ITBasePointService
 
     /**
      * 修改密封点
-     * 
+     *
      * @param tBasePoint 密封点
      * @return 结果
      */
@@ -45,7 +50,7 @@ public interface ITBasePointService
 
     /**
      * 批量删除密封点
-     * 
+     *
      * @param ids 需要删除的密封点主键集合
      * @return 结果
      */
@@ -53,7 +58,7 @@ public interface ITBasePointService
 
     /**
      * 删除密封点信息
-     * 
+     *
      * @param id 密封点主键
      * @return 结果
      */

+ 1 - 0
master/src/main/java/com/ruoyi/project/base/service/ITBaseRegionService.java

@@ -18,6 +18,7 @@ public interface ITBaseRegionService
      * @return 区域
      */
     public TBaseRegion selectTBaseRegionById(Long id);
+    public TBaseRegion selectTBaseRegionByName(String name,Long plantId);
 
     /**
      * 查询区域列表

+ 5 - 0
master/src/main/java/com/ruoyi/project/base/service/impl/TBaseDeviceServiceImpl.java

@@ -47,6 +47,11 @@ public class TBaseDeviceServiceImpl implements ITBaseDeviceService
     {
         return tBaseDeviceMapper.selectAllDeviceByRegionId(regionId);
     }
+    @Override
+    public TBaseDevice selectDeviceByPlantRegionAndDevice(TBaseDevice tBaseDevice)
+    {
+        return tBaseDeviceMapper.selectDeviceByPlantRegionAndDevice(tBaseDevice);
+    }
 
     /**
      * 新增设备/管线

+ 6 - 0
master/src/main/java/com/ruoyi/project/base/service/impl/TBasePlantServiceImpl.java

@@ -31,6 +31,12 @@ public class TBasePlantServiceImpl implements ITBasePlantService
         return tBasePlantMapper.selectTBasePlantById(id);
     }
 
+    @Override
+    public TBasePlant selectTBasePlantByName(String name)
+    {
+        return tBasePlantMapper.selectTBasePlantByName(name);
+    }
+
     /**
      * 查询装置列表
      *

+ 20 - 21
master/src/main/java/com/ruoyi/project/base/service/impl/TBasePointServiceImpl.java

@@ -1,6 +1,7 @@
 package com.ruoyi.project.base.service.impl;
 
 import java.util.List;
+
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import com.ruoyi.project.base.mapper.TBasePointMapper;
@@ -9,85 +10,83 @@ import com.ruoyi.project.base.service.ITBasePointService;
 
 /**
  * 密封点Service业务层处理
- * 
+ *
  * @author ruoyi
  * @date 2022-11-11
  */
 @Service
-public class TBasePointServiceImpl implements ITBasePointService 
-{
+public class TBasePointServiceImpl implements ITBasePointService {
     @Autowired
     private TBasePointMapper tBasePointMapper;
 
     /**
      * 查询密封点
-     * 
+     *
      * @param id 密封点主键
      * @return 密封点
      */
     @Override
-    public TBasePoint selectTBasePointById(Long id)
-    {
+    public TBasePoint selectTBasePointById(Long id) {
         return tBasePointMapper.selectTBasePointById(id);
     }
 
+    @Override
+    public TBasePoint selectTBasePointByGroupCodeAndExtendCode(TBasePoint tBasePoint) {
+        return tBasePointMapper.selectTBasePointByGroupCodeAndExtendCode(tBasePoint);
+    }
+
     /**
      * 查询密封点列表
-     * 
+     *
      * @param tBasePoint 密封点
      * @return 密封点
      */
     @Override
-    public List<TBasePoint> selectTBasePointList(TBasePoint tBasePoint)
-    {
+    public List<TBasePoint> selectTBasePointList(TBasePoint tBasePoint) {
         return tBasePointMapper.selectTBasePointList(tBasePoint);
     }
 
     /**
      * 新增密封点
-     * 
+     *
      * @param tBasePoint 密封点
      * @return 结果
      */
     @Override
-    public int insertTBasePoint(TBasePoint tBasePoint)
-    {
+    public int insertTBasePoint(TBasePoint tBasePoint) {
         return tBasePointMapper.insertTBasePoint(tBasePoint);
     }
 
     /**
      * 修改密封点
-     * 
+     *
      * @param tBasePoint 密封点
      * @return 结果
      */
     @Override
-    public int updateTBasePoint(TBasePoint tBasePoint)
-    {
+    public int updateTBasePoint(TBasePoint tBasePoint) {
         return tBasePointMapper.updateTBasePoint(tBasePoint);
     }
 
     /**
      * 批量删除密封点
-     * 
+     *
      * @param ids 需要删除的密封点主键
      * @return 结果
      */
     @Override
-    public int deleteTBasePointByIds(Long[] ids)
-    {
+    public int deleteTBasePointByIds(Long[] ids) {
         return tBasePointMapper.deleteTBasePointByIds(ids);
     }
 
     /**
      * 删除密封点信息
-     * 
+     *
      * @param id 密封点主键
      * @return 结果
      */
     @Override
-    public int deleteTBasePointById(Long id)
-    {
+    public int deleteTBasePointById(Long id) {
         return tBasePointMapper.deleteTBasePointById(id);
     }
 }

+ 5 - 0
master/src/main/java/com/ruoyi/project/base/service/impl/TBaseRegionServiceImpl.java

@@ -31,6 +31,11 @@ public class TBaseRegionServiceImpl implements ITBaseRegionService
         return tBaseRegionMapper.selectTBaseRegionById(id);
     }
 
+    @Override
+    public TBaseRegion selectTBaseRegionByName(String name,Long plantId) {
+        return tBaseRegionMapper.selectTBaseRegionByName(name,plantId);
+    }
+
     /**
      * 查询区域列表
      *

+ 74 - 6
master/src/main/java/com/ruoyi/web/controller/common/CommonController.java

@@ -1,17 +1,19 @@
 package com.ruoyi.web.controller.common;
 
+import java.io.BufferedInputStream;
+import java.io.BufferedOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
 import java.util.ArrayList;
 import java.util.List;
+import javax.servlet.ServletOutputStream;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.http.MediaType;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
 import org.springframework.web.multipart.MultipartFile;
 import com.ruoyi.common.config.RuoYiConfig;
 import com.ruoyi.common.constant.Constants;
@@ -23,7 +25,7 @@ import com.ruoyi.framework.config.ServerConfig;
 
 /**
  * 通用请求处理
- * 
+ *
  * @author ruoyi
  */
 @RestController
@@ -37,9 +39,32 @@ public class CommonController
 
     private static final String FILE_DELIMETER = ",";
 
+
+    /**
+     * 导入下载模板
+     */
+    @RequestMapping("/template")
+    @ResponseBody
+    public void template(String type,HttpServletRequest request, HttpServletResponse response) throws IOException
+    {
+        String downloadname = "";
+        String url = "";
+        if ( type.equals("baseDevice") ) {
+            downloadname = "受控设备导入模板.xlsx";
+            url = "static/template/base/baseDevice.xlsx";
+        }else if ( type.equals("basePoint") ) {
+            downloadname = "密封点导入模板.xlsx";
+            url = "static/template/base/basePoint.xlsx";
+        }
+        InputStream is = Thread.currentThread().getContextClassLoader().getResourceAsStream(url);
+
+        downloadFile(downloadname, is, request, response);
+    }
+
+
     /**
      * 通用下载请求
-     * 
+     *
      * @param fileName 文件名称
      * @param delete 是否删除
      */
@@ -160,4 +185,47 @@ public class CommonController
             log.error("下载文件失败", e);
         }
     }
+    public static void downloadFile(String filename, InputStream is, HttpServletRequest request, HttpServletResponse response) throws IOException {
+        response.reset();
+        if (filename.endsWith(".doc") || filename.endsWith(".docx")) {
+            response.setContentType("application/msword;charset=utf-8");
+        } else if (filename.endsWith(".xls") || filename.endsWith(".xlsx")) {
+            response.setContentType("application/vnd.ms-excel;charset=utf-8");
+        } else {
+            response.setHeader("content-type", "application/octet-stream");
+        }
+        //下载文件的名称
+        response.setHeader("Content-Disposition", "attachment;filename=" + new String(filename.getBytes("UTF-8"), "iso-8859-1"));
+        request.setCharacterEncoding("UTF-8");
+
+        ServletOutputStream out = null;
+        BufferedInputStream bis = null;
+        BufferedOutputStream bos = null;
+        try {
+            out = response.getOutputStream();
+            bis = new BufferedInputStream(is);
+            bos = new BufferedOutputStream(out);
+            byte[] buff = new byte[2048];
+            int bytesRead;
+            while (-1 != (bytesRead = bis.read(buff, 0, buff.length))) {
+                bos.write(buff, 0, bytesRead);
+            }
+        } catch (IOException e) {
+            e.printStackTrace();
+        } finally {
+            try {
+                if (bis != null) {
+                    bis.close();
+                }
+                if (bos != null) {
+                    bos.close();
+                }
+                if (is != null) {
+                    is.close();
+                }
+            } catch (IOException e) {
+                e.printStackTrace();
+            }
+        }
+    }
 }

+ 10 - 6
master/src/main/resources/mybatis/base/TBaseDeviceMapper.xml

@@ -14,7 +14,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="regionCode"    column="region_code"    />
         <result property="code"    column="code"    />
         <result property="describe"    column="describe"    />
-        <result property="remark"    column="remark"    />
+        <result property="remarks"    column="remarks"    />
         <result property="approveStatus"    column="approve_status"    />
         <result property="approveTime"    column="approve_time"    />
         <result property="deptId"    column="dept_id"    />
@@ -31,11 +31,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </resultMap>
 
     <sql id="selectTBaseDeviceVo">
-        select id, plant_id, region_id, `code`, `describe`, remark, approve_status, approve_time, dept_id, del_flag, creater_code, createdate, updater_code, updatedate,material,material_status,response_factor,response_factor_from from t_base_device
+        select id, plant_id, region_id, `code`, `describe`, remarks, approve_status, approve_time, dept_id, del_flag, creater_code, createdate, updater_code, updatedate,material,material_status,response_factor,response_factor_from from t_base_device
     </sql>
 
     <select id="selectTBaseDeviceList" parameterType="TBaseDevice" resultMap="TBaseDeviceResult">
-        select d.id, d.plant_id,bp.plant_name,bp.plant_type,bp.plant_code, d.region_id,br.region_code,br.region_name, d.code, d.describe, d.remark, d.approve_status, d.approve_time, d.dept_id, d.del_flag, d.creater_code, d.createdate, d.updater_code,su.user_name updater, d.updatedate,d.material,d.material_status,d.response_factor,d.response_factor_from from t_base_device d
+        select d.id, d.plant_id,bp.plant_name,bp.plant_type,bp.plant_code, d.region_id,br.region_code,br.region_name, d.code, d.describe, d.remarks, d.approve_status, d.approve_time, d.dept_id, d.del_flag, d.creater_code, d.createdate, d.updater_code,su.user_name updater, d.updatedate,d.material,d.material_status,d.response_factor,d.response_factor_from from t_base_device d
         left join sys_user su on su.user_id = d.updater_code
         left join t_base_plant bp on bp.id = d.plant_id
         left join t_base_region br on br.id = d.region_id
@@ -63,6 +63,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <include refid="selectTBaseDeviceVo"/>
         where id = #{id}
     </select>
+    <select id="selectDeviceByPlantRegionAndDevice" parameterType="TBaseDevice" resultMap="TBaseDeviceResult">
+        <include refid="selectTBaseDeviceVo"/>
+        where plant_id=#{plantId} and region_id=#{regionId} and `code`=#{code} and `describe`=#{describe} and del_flag=0
+    </select>
 
     <insert id="insertTBaseDevice" parameterType="TBaseDevice" useGeneratedKeys="true" keyProperty="id">
         insert into t_base_device
@@ -71,7 +75,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="regionId != null">region_id,</if>
             <if test="code != null">`code`,</if>
             <if test="describe != null">`describe`,</if>
-            <if test="remark != null">remark,</if>
+            <if test="remarks != null">remarks,</if>
             <if test="approveStatus != null">approve_status,</if>
             <if test="approveTime != null">approve_time,</if>
             <if test="deptId != null">dept_id,</if>
@@ -90,7 +94,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="regionId != null">#{regionId},</if>
             <if test="code != null">#{code},</if>
             <if test="describe != null">#{describe},</if>
-            <if test="remark != null">#{remark},</if>
+            <if test="remarks != null">#{remarks},</if>
             <if test="approveStatus != null">#{approveStatus},</if>
             <if test="approveTime != null">#{approveTime},</if>
             <if test="deptId != null">#{deptId},</if>
@@ -113,7 +117,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="regionId != null">region_id = #{regionId},</if>
             <if test="code != null">`code` = #{code},</if>
             <if test="describe != null">`describe` = #{describe},</if>
-            <if test="remark != null">remark = #{remark},</if>
+            <if test="remarks != null">remarks = #{remarks},</if>
             <if test="approveStatus != null">approve_status = #{approveStatus},</if>
             <if test="approveTime != null">approve_time = #{approveTime},</if>
             <if test="deptId != null">dept_id = #{deptId},</if>

+ 5 - 0
master/src/main/resources/mybatis/base/TBasePlantMapper.xml

@@ -55,6 +55,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         where id = #{id}
     </select>
 
+    <select id="selectTBasePlantByName" parameterType="String" resultMap="TBasePlantResult">
+        <include refid="selectTBasePlantVo"/>
+        where plant_name = #{name} and del_flag=0
+    </select>
+
     <insert id="insertTBasePlant" parameterType="TBasePlant" useGeneratedKeys="true" keyProperty="id">
         insert into t_base_plant
         <trim prefix="(" suffix=")" suffixOverrides=",">

+ 20 - 7
master/src/main/resources/mybatis/base/TBasePointMapper.xml

@@ -25,7 +25,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="groupPosition"    column="group_position"    />
         <result property="pointPosition"    column="point_position"    />
         <result property="groupCode"    column="group_code"    />
-        <result property="extendCoude"    column="extend_coude"    />
+        <result property="extendCode"    column="extend_code"    />
         <result property="subPointType"    column="sub_point_type"    />
         <result property="dia"    column="dia"    />
         <result property="unarrive"    column="unarrive"    />
@@ -54,11 +54,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </resultMap>
 
     <sql id="selectTBasePointVo">
-        select id, ppm, leakage_degree, plant_id, region_id, dev_id, medium, medium_type, point_type, layer, group_position, point_position, group_code, extend_coude, sub_point_type, dia, unarrive, unarrive_reason, keep_warm, temperature, pressure, run_time, pid_no, pid_url, pic_no, pic_url, toc_mark, methane_mark, vocs_mark, remarks, approve_status, approve_time, dept_id, del_flag, creater_code, createdate, updater_code, updatedate from t_base_point
+        select id, ppm, leakage_degree, plant_id, region_id, dev_id, medium, medium_type, point_type, layer, group_position, point_position, group_code, extend_code, sub_point_type, dia, unarrive, unarrive_reason, keep_warm, temperature, pressure, run_time, pid_no, pid_url, pic_no, pic_url, toc_mark, methane_mark, vocs_mark, remarks, approve_status, approve_time, dept_id, del_flag, creater_code, createdate, updater_code, updatedate from t_base_point
     </sql>
 
     <select id="selectTBasePointList" parameterType="TBasePoint" resultMap="TBasePointResult">
-        select d.id, d.ppm, d.leakage_degree, d.plant_id,bp.plant_name,bp.plant_type,bp.plant_code, d.region_id,br.region_code,br.region_name, d.dev_id,bd.code dev_code,bd.`describe` dev_name,d.medium, d.medium_type, d.point_type, d.layer, d.group_position, d.point_position, d.group_code, d.extend_coude, d.sub_point_type, d.dia, d.unarrive, d.unarrive_reason, d.keep_warm, d.temperature, d.pressure, d.run_time, d.pid_no, d.pid_url, d.pic_no, d.pic_url, d.toc_mark, d.methane_mark, d.vocs_mark, d.remarks, d.approve_status, d.approve_time, d.dept_id, d.del_flag, d.creater_code, d.createdate, su.user_name updater, d.updatedate from t_base_point d
+        select d.id, d.ppm, d.leakage_degree, d.plant_id,bp.plant_name,bp.plant_type,bp.plant_code, d.region_id,br.region_code,br.region_name, d.dev_id,bd.code dev_code,bd.`describe` dev_name,d.medium, d.medium_type, d.point_type, d.layer, d.group_position, d.point_position, d.group_code, d.extend_code, d.sub_point_type, d.dia, d.unarrive, d.unarrive_reason, d.keep_warm, d.temperature, d.pressure, d.run_time, d.pid_no, d.pid_url, d.pic_no, d.pic_url, d.toc_mark, d.methane_mark, d.vocs_mark, d.remarks, d.approve_status, d.approve_time, d.dept_id, d.del_flag, d.creater_code, d.createdate, su.user_name updater, d.updatedate from t_base_point d
         left join sys_user su on su.user_id = d.updater_code
         left join t_base_plant bp on bp.id = d.plant_id
         left join t_base_region br on br.id = d.region_id
@@ -76,7 +76,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="groupPosition != null  and groupPosition != ''"> and d.group_position = #{groupPosition}</if>
             <if test="pointPosition != null  and pointPosition != ''"> and d.point_position = #{pointPosition}</if>
             <if test="groupCode != null  and groupCode != ''"> and d.group_code = #{groupCode}</if>
-            <if test="extendCoude != null  and extendCoude != ''"> and d.extend_coude = #{extendCoude}</if>
+            <if test="extendCode != null  and extendCode != ''"> and d.extend_code = #{extendCode}</if>
             <if test="subPointType != null  and subPointType != ''"> and d.sub_point_type = #{subPointType}</if>
             <if test="dia != null  and dia != ''"> and d.dia = #{dia}</if>
             <if test="unarrive != null  and unarrive != ''"> and d.unarrive = #{unarrive}</if>
@@ -109,6 +109,19 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         where id = #{id}
     </select>
 
+    <select id="selectTBasePointByGroupCodeAndExtendCode" parameterType="TBasePoint" resultMap="TBasePointResult">
+        <include refid="selectTBasePointVo"/>
+        <where>
+            <if test="id != null "> and id != #{id}</if>
+            <if test="plantId != null "> and plant_id = #{plantId}</if>
+            <if test="regionId != null "> and region_id = #{regionId}</if>
+            <if test="devId != null "> and dev_id = #{devId}</if>
+            <if test="groupCode != null  and groupCode != ''"> and group_code = #{groupCode}</if>
+            <if test="extendCode != null  and extendCode != ''"> and extend_code = #{extendCode}</if>
+            and del_flag=0
+        </where>
+    </select>
+
     <insert id="insertTBasePoint" parameterType="TBasePoint" useGeneratedKeys="true" keyProperty="id">
         insert into t_base_point
         <trim prefix="(" suffix=")" suffixOverrides=",">
@@ -124,7 +137,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="groupPosition != null">group_position,</if>
             <if test="pointPosition != null">point_position,</if>
             <if test="groupCode != null">group_code,</if>
-            <if test="extendCoude != null">extend_coude,</if>
+            <if test="extendCode != null">extend_code,</if>
             <if test="subPointType != null">sub_point_type,</if>
             <if test="dia != null">dia,</if>
             <if test="unarrive != null">unarrive,</if>
@@ -163,7 +176,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="groupPosition != null">#{groupPosition},</if>
             <if test="pointPosition != null">#{pointPosition},</if>
             <if test="groupCode != null">#{groupCode},</if>
-            <if test="extendCoude != null">#{extendCoude},</if>
+            <if test="extendCode != null">#{extendCode},</if>
             <if test="subPointType != null">#{subPointType},</if>
             <if test="dia != null">#{dia},</if>
             <if test="unarrive != null">#{unarrive},</if>
@@ -206,7 +219,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="groupPosition != null">group_position = #{groupPosition},</if>
             <if test="pointPosition != null">point_position = #{pointPosition},</if>
             <if test="groupCode != null">group_code = #{groupCode},</if>
-            <if test="extendCoude != null">extend_coude = #{extendCoude},</if>
+            <if test="extendCode != null">extend_code = #{extendCode},</if>
             <if test="subPointType != null">sub_point_type = #{subPointType},</if>
             <if test="dia != null">dia = #{dia},</if>
             <if test="unarrive != null">unarrive = #{unarrive},</if>

+ 5 - 0
master/src/main/resources/mybatis/base/TBaseRegionMapper.xml

@@ -58,6 +58,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         where id = #{id}
     </select>
 
+    <select id="selectTBaseRegionByName" resultMap="TBaseRegionResult">
+        <include refid="selectTBaseRegionVo"/>
+        where region_name = #{name} and plant_id=#{plantId} and del_flag=0
+    </select>
+
     <insert id="insertTBaseRegion" parameterType="TBaseRegion" useGeneratedKeys="true" keyProperty="id">
         insert into t_base_region
         <trim prefix="(" suffix=")" suffixOverrides=",">

二進制
master/src/main/resources/static/template/base/baseDevice.xlsx


二進制
master/src/main/resources/static/template/base/basePoint.xlsx


+ 128 - 21
ui/src/views/base/device/index.vue

@@ -70,6 +70,17 @@
         >删除
         </el-button>
       </el-col>
+      <el-col :span="1.5">
+        <el-button
+          type="warning"
+          plain
+          icon="el-icon-upload2"
+          size="mini"
+          @click="handleImport"
+          v-hasPermi="['base:device:add']"
+        >导入
+        </el-button>
+      </el-col>
       <el-col :span="1.5">
         <el-button
           type="warning"
@@ -106,22 +117,26 @@
 
     <el-table v-loading="loading" :data="deviceList" :cell-style="tableCellStyle"
               @selection-change="handleSelectionChange" :height="clientHeight" border>
-      <el-table-column type="selection" width="55" align="center"/>
-      <el-table-column label="审核状态" align="center" prop="approveStatus" :formatter="approveStatusFormat"/>
-      <el-table-column label="装置名称" align="center" prop="plantName"/>
-      <el-table-column label="装置编编码" align="center" prop="plantCode"/>
-      <el-table-column label="区域名称" align="center" prop="regionName"/>
-      <el-table-column label="区域编号" align="center" prop="regionCode"/>
-      <el-table-column label="设备/管线编号" align="center" prop="code"/>
-      <el-table-column label="设备/管线描述" align="center" prop="describe"/>
-      <el-table-column label="维护人" align="center" prop="updater"/>
+      <el-table-column type="selection" width="55" align="center" fixed="left"/>
+      <el-table-column label="审核状态" align="center" fixed="left" prop="approveStatus" :formatter="approveStatusFormat" :show-overflow-tooltip="true" width="80"/>
+      <el-table-column label="装置名称" align="center" prop="plantName" :show-overflow-tooltip="true" width="100"/>
+      <el-table-column label="装置编编码" align="center" prop="plantCode" :show-overflow-tooltip="true" width="100"/>
+      <el-table-column label="区域名称" align="center" prop="regionName" :show-overflow-tooltip="true" width="100"/>
+      <el-table-column label="区域编号" align="center" prop="regionCode" :show-overflow-tooltip="true" width="100"/>
+      <el-table-column label="设备/管线编号" align="center" prop="code" :show-overflow-tooltip="true" width="130"/>
+      <el-table-column label="设备/管线描述" align="center" prop="describe" :show-overflow-tooltip="true" width="230"/>
+      <el-table-column label="主要物料/产品" align="center" prop="material" :show-overflow-tooltip="true" width="130"/>
+      <el-table-column label="物料状态" align="center" prop="materialStatus" :show-overflow-tooltip="true" width="100"/>
+      <el-table-column label="合成相应因子" align="center" prop="responseFactor" :show-overflow-tooltip="true" width="100"/>
+      <el-table-column label="相应因子来源" align="center" prop="responseFactorFrom" :show-overflow-tooltip="true" width="100"/>
+      <el-table-column label="维护人" align="center" prop="updater" :show-overflow-tooltip="true" width="100"/>
       <el-table-column label="维护时间" align="center" prop="updatedate" width="180">
         <template slot-scope="scope">
           <span>{{ parseTime(scope.row.updatedate, '{y}-{m}-{d}') }}</span>
         </template>
       </el-table-column>
-      <el-table-column label="备注" align="center" prop="remark"/>
-      <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
+      <el-table-column label="备注" align="center" prop="remark"  :show-overflow-tooltip="true" width="230"/>
+      <el-table-column label="操作" align="center" fixed="right"  class-name="small-padding fixed-width"  width="120">
         <template slot-scope="scope">
           <el-button
             size="mini"
@@ -202,6 +217,40 @@
         <el-button @click="cancel">取 消</el-button>
       </div>
     </el-dialog>
+
+    <!-- 用户导入对话框 -->
+    <el-dialog v-dialogDrag :title="upload.title" :visible.sync="upload.open" width="400px" append-to-body>
+      <el-upload
+        ref="upload"
+        :limit="1"
+        accept=".xlsx, .xls"
+        :headers="upload.headers"
+        :action="upload.url"
+        :disabled="upload.isUploading"
+        :on-progress="handleFileUploadProgress"
+        :on-success="handleFileSuccess"
+        :auto-upload="false"
+        drag
+      >
+        <i class="el-icon-upload"></i>
+        <div class="el-upload__text">
+          {{ $t('将文件拖到此处,或') }}
+          <em>{{ $t('点击上传') }}</em>
+        </div>
+        <div class="el-upload__tip" slot="tip">
+          <!--<el-checkbox v-model="upload.updateSupport" />是否更新已经存在的用户数据-->
+          <el-link type="info" style="font-size:12px" @click="importTemplate">{{ $t('下载模板') }}</el-link>
+        </div>
+        <form ref="downloadFileForm" :action="upload.downloadAction" target="FORMSUBMIT">
+          <input name="type" :value="upload.type" hidden />
+        </form>
+        <div class="el-upload__tip" style="color:red" slot="tip">{{ $t('提示:仅允许导入“xls”或“xlsx”格式文件!') }}</div>
+      </el-upload>
+      <div slot="footer" class="dialog-footer">
+        <el-button type="primary" @click="submitFileForm"  v-loading.fullscreen.lock="fullscreenLoading">{{ $t('确 定') }}</el-button>
+        <el-button @click="upload.open = false">{{ $t('取 消') }}</el-button>
+      </div>
+    </el-dialog>
   </div>
 </template>
 
@@ -210,6 +259,7 @@ import {listDevice, getDevice, delDevice, addDevice, updateDevice} from "@/api/b
 import {getAllPlantName} from "@/api/base/plant";
 import {getAllRegion} from "@/api/base/region";
 import {MessageBox} from 'element-ui'
+import {getToken} from "@/utils/auth";
 
 export default {
   name: "Device",
@@ -238,6 +288,25 @@ export default {
       title: "",
       // 是否显示弹出层
       open: false,
+      fullscreenLoading: false,
+      // 用户导入参数
+      upload: {
+        downloadAction: process.env.VUE_APP_BASE_API + '/common/template',
+        //下载模板类型
+        type: "baseDevice",
+        // 是否显示弹出层(用户导入)
+        open: false,
+        // 弹出层标题(用户导入)
+        title: "",
+        // 是否禁用上传
+        isUploading: false,
+        // 是否更新已经存在的用户数据
+        updateSupport: 0,
+        // 设置上传的请求头部
+        headers: { Authorization: "Bearer " + getToken() },
+        // 上传的地址
+        url: process.env.VUE_APP_BASE_API + "/base/device/importData"
+      },
       // 查询参数
       queryParams: {
         pageNum: 1,
@@ -291,6 +360,40 @@ export default {
     });
   },
   methods: {
+    // 提交上传文件
+    submitFileForm() {
+      this.$refs.upload.submit();
+      this.fullscreenLoading = true;
+    },
+    /** 导入按钮操作 */
+    handleImport() {
+      this.upload.title = this.$t('用户导入');
+      this.upload.open = true;
+    },
+    /** 下载模板操作 */
+    importTemplate() {
+      this.$refs['downloadFileForm'].submit()
+    },
+    // 文件上传中处理
+    handleFileUploadProgress(event, file, fileList) {
+      this.upload.isUploading = true;
+    },
+    // 文件上传成功处理
+    handleFileSuccess(response, file, fileList) {
+      this.upload.open = false;
+      this.upload.isUploading = false;
+      this.$refs.upload.clearFiles();
+      this.fullscreenLoading = false;
+      console.log(response)
+      if (response.data ===0) {
+        this.$alert(this.$t('导入失败!')+ response.msg, this.$t('导入结果'), { dangerouslyUseHTMLString: true });
+      }else if (response.data[0] != null) {
+        this.$alert(this.$t('成功导入') + response.msg + this.$t('条数据') + "," + this.$t('第') + response.data + this.$t('行数据出现错误导入失败')+"。", this.$t('导入结果'), { dangerouslyUseHTMLString: true });
+      }else {
+        this.$alert(this.$t('成功导入') + response.msg + this.$t('条数据'), this.$t('导入结果'), { dangerouslyUseHTMLString: true });
+      }
+      this.getList();
+    },
     approveStatusFormat(row, column) {
       return this.selectDictLabel(this.approveStatusOperation, row.approveStatus);
     },
@@ -422,18 +525,22 @@ export default {
     /** 删除按钮操作 */
     handleDelete(row) {
       const ids = row.id || this.ids;
-      const status = (row.approveStatus==0?'0':row.approveStatus) || this.status;
-      let list=[];
-      list.push(status)
-      for (const s of list) {
-        if (s != 0) {
-          MessageBox.alert('已送审/已审核的数据不可删除!', '注意!', {
-            confirmButtonText: '确定',
-          })
-          return
+      if(row.approveStatus===undefined){
+        for (let i = 0; i < this.status.length; i++) {
+          if (this.status[i] != 0) {
+            MessageBox.alert('已送审/已审核的数据不可删除!', '注意!', {
+              confirmButtonText: '确定',
+            })
+            return
+          }
         }
+      }else if (row.approveStatus!=0){
+        MessageBox.alert('已送审/已审核的数据不可删除!', '注意!', {
+          confirmButtonText: '确定',
+        })
+        return
       }
-      this.$modal.confirm('是否确认删除设备/管线编号为"' + ids + '"的数据项?').then(function () {
+      this.$modal.confirm('是否确认删除数据项?').then(function () {
         return delDevice(ids);
       }).then(() => {
         this.getList();

+ 14 - 10
ui/src/views/base/plant/index.vue

@@ -397,18 +397,22 @@ export default {
     /** 删除按钮操作 */
     handleDelete(row) {
       const ids = row.id || this.ids;
-      const status = (row.approveStatus==0?'0':row.approveStatus) || this.status;
-      let list=[];
-      list.push(status)
-      for (const s of list) {
-        if (s != 0) {
-          MessageBox.alert('已送审/已审核的数据不可删除!', '注意!', {
-            confirmButtonText: '确定',
-          })
-          return
+      if(row.approveStatus===undefined){
+        for (let i = 0; i < this.status.length; i++) {
+          if (this.status[i] != 0) {
+            MessageBox.alert('已送审/已审核的数据不可删除!', '注意!', {
+              confirmButtonText: '确定',
+            })
+            return
+          }
         }
+      }else if (row.approveStatus!=0){
+        MessageBox.alert('已送审/已审核的数据不可删除!', '注意!', {
+          confirmButtonText: '确定',
+        })
+        return
       }
-      this.$modal.confirm('是否确认删除装置编号为"' + ids + '"的数据项?').then(function () {
+      this.$modal.confirm('是否确认删除数据项?').then(function () {
         return delPlant(ids);
       }).then(() => {
         this.getList();

+ 184 - 42
ui/src/views/base/point/index.vue

@@ -135,6 +135,17 @@
         >删除
         </el-button>
       </el-col>
+      <el-col :span="1.5">
+        <el-button
+          type="warning"
+          plain
+          icon="el-icon-upload2"
+          size="mini"
+          @click="handleImport"
+          v-hasPermi="['base:device:add']"
+        >导入
+        </el-button>
+      </el-col>
       <el-col :span="1.5">
         <el-button
           type="warning"
@@ -166,6 +177,26 @@
         >审核
         </el-button>
       </el-col>
+      <el-col :span="1.5">
+        <el-button
+          type="success"
+          plain
+          icon="el-icon-upload"
+          size="mini"
+          @click="handleToApprove"
+        >上传PID图
+        </el-button>
+      </el-col>
+      <el-col :span="1.5">
+        <el-button
+          type="success"
+          plain
+          icon="el-icon-upload"
+          size="mini"
+          @click="handleApprove"
+        >上传组件照片
+        </el-button>
+      </el-col>
       <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
     </el-row>
 
@@ -173,48 +204,57 @@
               @selection-change="handleSelectionChange" :height="clientHeight" border>
       <el-table-column type="selection" width="55" align="center"/>
       <el-table-column label="检测净值(ppm)" align="center" prop="ppm" width="110" :show-overflow-tooltip="true"/>
-      <el-table-column label="泄漏程度" align="center" prop="leakageDegree" :formatter="leakageFormat"/>
+      <el-table-column label="泄漏程度" align="center" prop="leakageDegree" :formatter="leakageFormat"
+                       :show-overflow-tooltip="true"/>
       <el-table-column label="装置名称" align="center" prop="plantName" :show-overflow-tooltip="true"/>
-      <el-table-column label="装置编码" align="center" prop="plantCode"/>
+      <el-table-column label="装置编码" align="center" prop="plantCode" :show-overflow-tooltip="true"/>
       <el-table-column label="装置类别" align="center" prop="plantType" :formatter="plantTypeFormat"/>
-      <el-table-column label="区域名称" align="center" prop="regionName"/>
-      <el-table-column label="区域编码" align="center" prop="regionCode"/>
+      <el-table-column label="区域名称" align="center" prop="regionName" :show-overflow-tooltip="true"/>
+      <el-table-column label="区域编码" align="center" prop="regionCode" :show-overflow-tooltip="true"/>
       <el-table-column label="设备/管线名称" align="center" prop="devName" width="150" :show-overflow-tooltip="true"/>
       <el-table-column label="设备/管线编码" align="center" prop="devCode" width="150" :show-overflow-tooltip="true"/>
-      <el-table-column label="介质" align="center" prop="medium"/>
-      <el-table-column label="介质状态" align="center" prop="mediumType" :formatter="mediumTypeFormat"/>
-      <el-table-column label="密封点类型" align="center" prop="pointType" width="100" :formatter="pointFormat"/>
-      <el-table-column label="平台(层)" align="center" prop="layer"/>
-      <el-table-column label="群组位置" align="center" prop="groupPosition"/>
-      <el-table-column label="密封点位置" align="center" prop="pointPosition" width="110"/>
-      <el-table-column label="群组编码" align="center" prop="groupCode"/>
-      <el-table-column label="扩展编码" align="center" prop="extendCoude"/>
-      <el-table-column label="密封点子类型" align="center" prop="subPointType" width="110"/>
-      <el-table-column label="公称直径(mm)" align="center" prop="dia" width="110"/>
-      <el-table-column label="是否不可达点" align="center" prop="unarrive" width="110" :formatter="unarriveFormat"/>
-      <el-table-column label="不可达原因" align="center" prop="unarriveReason" width="110"/>
-      <el-table-column label="是否保温/保冷" align="center" prop="keepWarm" width="110" :formatter="keepWarmFormat"/>
-      <el-table-column label="工艺温度(℃)" align="center" prop="temperature" width="110"/>
-      <el-table-column label="工艺压力(Mpa)" align="center" prop="pressure" width="110"/>
+      <el-table-column label="介质" align="center" prop="medium" :show-overflow-tooltip="true"/>
+      <el-table-column label="介质状态" align="center" prop="mediumType" :formatter="mediumTypeFormat"
+                       :show-overflow-tooltip="true"/>
+      <el-table-column label="密封点类型" align="center" prop="pointType" width="100" :formatter="pointFormat"
+                       :show-overflow-tooltip="true"/>
+      <el-table-column label="平台(层)" align="center" prop="layer" :show-overflow-tooltip="true"/>
+      <el-table-column label="群组位置" align="center" prop="groupPosition" :show-overflow-tooltip="true"/>
+      <el-table-column label="密封点位置" align="center" prop="pointPosition" width="110"
+                       :show-overflow-tooltip="true"/>
+      <el-table-column label="群组编码" align="center" prop="groupCode" :show-overflow-tooltip="true"/>
+      <el-table-column label="扩展编码" align="center" prop="extendCode" :show-overflow-tooltip="true"/>
+      <el-table-column label="密封点子类型" align="center" prop="subPointType" width="110"
+                       :show-overflow-tooltip="true"/>
+      <el-table-column label="公称直径(mm)" align="center" prop="dia" width="110" :show-overflow-tooltip="true"/>
+      <el-table-column label="是否不可达点" align="center" prop="unarrive" width="110" :formatter="unarriveFormat"
+                       :show-overflow-tooltip="true"/>
+      <el-table-column label="不可达原因" align="center" prop="unarriveReason" width="110"
+                       :show-overflow-tooltip="true"/>
+      <el-table-column label="是否保温/保冷" align="center" prop="keepWarm" width="110" :formatter="keepWarmFormat"
+                       :show-overflow-tooltip="true"/>
+      <el-table-column label="工艺温度(℃)" align="center" prop="temperature" width="110" :show-overflow-tooltip="true"/>
+      <el-table-column label="工艺压力(Mpa)" align="center" prop="pressure" width="110" :show-overflow-tooltip="true"/>
       <el-table-column label="运行时间" align="center" prop="runTime" width="180">
         <template slot-scope="scope">
           <span>{{ parseTime(scope.row.runTime, '{y}-{m}-{d}') }}</span>
         </template>
       </el-table-column>
-      <el-table-column label="PID图号" align="center" prop="pidNo"/>
-      <el-table-column label="群组照片号" align="center" prop="picNo" width="110"/>
-      <el-table-column label="TOC质量分数" align="center" prop="tocMark" width="110"/>
-      <el-table-column label="甲烷质量分数" align="center" prop="methaneMark" width="110"/>
-      <el-table-column label="VOCs质量分数" align="center" prop="vocsMark" width="110"/>
+      <el-table-column label="PID图号" align="center" prop="pidNo" :show-overflow-tooltip="true"/>
+      <el-table-column label="群组照片号" align="center" prop="picNo" width="110" :show-overflow-tooltip="true"/>
+      <el-table-column label="TOC质量分数" align="center" prop="tocMark" width="110" :show-overflow-tooltip="true"/>
+      <el-table-column label="甲烷质量分数" align="center" prop="methaneMark" width="110"
+                       :show-overflow-tooltip="true"/>
+      <el-table-column label="VOCs质量分数" align="center" prop="vocsMark" width="110" :show-overflow-tooltip="true"/>
       <el-table-column label="审核状态" align="center" fixed="left" prop="approveStatus"
-                       :formatter="approveStatusFormat"/>
-      <el-table-column label="最后维护人" align="center" prop="updater" width="110"/>
-      <el-table-column label="最后维护时间" align="center" prop="updatedate" width="180">
+                       :formatter="approveStatusFormat" :show-overflow-tooltip="true"/>
+      <el-table-column label="最后维护人" align="center" prop="updater" width="110" :show-overflow-tooltip="true"/>
+      <el-table-column label="最后维护时间" align="center" prop="updatedate" width="180" :show-overflow-tooltip="true">
         <template slot-scope="scope">
           <span>{{ parseTime(scope.row.updatedate, '{y}-{m}-{d}') }}</span>
         </template>
       </el-table-column>
-      <el-table-column label="描述" align="center" prop="remarks"/>
+      <el-table-column label="描述" align="center" prop="remarks" width="180" :show-overflow-tooltip="true"/>
       <el-table-column label="操作" align="center" width="140px" fixed="right" class-name="small-padding fixed-width">
         <template slot-scope="scope">
           <el-button
@@ -361,8 +401,8 @@
         </el-row>
         <el-row>
           <el-col :span="12">
-            <el-form-item label="扩展编码" prop="extendCoude">
-              <el-input v-model="form.extendCoude" placeholder="请输入扩展编码"/>
+            <el-form-item label="扩展编码" prop="extendCode">
+              <el-input v-model="form.extendCode" placeholder="请输入扩展编码"/>
             </el-form-item>
           </el-col>
           <el-col :span="12">
@@ -464,6 +504,44 @@
         <el-button @click="cancel">取 消</el-button>
       </div>
     </el-dialog>
+
+
+    <!-- 用户导入对话框 -->
+    <el-dialog v-dialogDrag :title="upload.title" :visible.sync="upload.open" width="400px" append-to-body>
+      <el-upload
+        ref="upload"
+        :limit="1"
+        accept=".xlsx, .xls"
+        :headers="upload.headers"
+        :action="upload.url"
+        :disabled="upload.isUploading"
+        :on-progress="handleFileUploadProgress"
+        :on-success="handleFileSuccess"
+        :auto-upload="false"
+        drag
+      >
+        <i class="el-icon-upload"></i>
+        <div class="el-upload__text">
+          {{ $t('将文件拖到此处,或') }}
+          <em>{{ $t('点击上传') }}</em>
+        </div>
+        <div class="el-upload__tip" slot="tip">
+          <!--<el-checkbox v-model="upload.updateSupport" />是否更新已经存在的用户数据-->
+          <el-link type="info" style="font-size:12px" @click="importTemplate">{{ $t('下载模板') }}</el-link>
+        </div>
+        <form ref="downloadFileForm" :action="upload.downloadAction" target="FORMSUBMIT">
+          <input name="type" :value="upload.type" hidden/>
+        </form>
+        <div class="el-upload__tip" style="color:red" slot="tip">{{ $t('提示:仅允许导入“xls”或“xlsx”格式文件!') }}</div>
+      </el-upload>
+      <div slot="footer" class="dialog-footer">
+        <el-button type="primary" @click="submitFileForm" v-loading.fullscreen.lock="fullscreenLoading">{{
+            $t('确 定')
+          }}
+        </el-button>
+        <el-button @click="upload.open = false">{{ $t('取 消') }}</el-button>
+      </div>
+    </el-dialog>
   </div>
 </template>
 
@@ -473,11 +551,31 @@ import {getAllPlantName} from "@/api/base/plant";
 import {getAllRegion} from "@/api/base/region";
 import {getAllDeviceByRegionId} from "@/api/base/device";
 import {MessageBox} from "element-ui";
+import {getToken} from "@/utils/auth";
 
 export default {
   name: "Point",
   data() {
     return {
+      fullscreenLoading: false,
+      // 用户导入参数
+      upload: {
+        downloadAction: process.env.VUE_APP_BASE_API + '/common/template',
+        //下载模板类型
+        type: "basePoint",
+        // 是否显示弹出层(用户导入)
+        open: false,
+        // 弹出层标题(用户导入)
+        title: "",
+        // 是否禁用上传
+        isUploading: false,
+        // 是否更新已经存在的用户数据
+        updateSupport: 0,
+        // 设置上传的请求头部
+        headers: {Authorization: "Bearer " + getToken()},
+        // 上传的地址
+        url: process.env.VUE_APP_BASE_API + "/base/point/importData"
+      },
       plantOperation: [],
       regionOperation: [],
       deviceOperation: [],
@@ -523,7 +621,7 @@ export default {
         groupPosition: null,
         pointPosition: null,
         groupCode: null,
-        extendCoude: null,
+        extendCode: null,
         subPointType: null,
         dia: null,
         unarrive: null,
@@ -561,6 +659,12 @@ export default {
         devId: [
           {required: true, message: this.$t('装置') + this.$t('不能为空'), trigger: "blur"}
         ],
+        groupCode: [
+          {required: true, message: this.$t('群组编码') + this.$t('不能为空'), trigger: "blur"}
+        ],
+        extendCode: [
+          {required: true, message: this.$t('扩展编码') + this.$t('不能为空'), trigger: "blur"}
+        ],
       }
     };
   },
@@ -593,6 +697,40 @@ export default {
     })
   },
   methods: {
+    // 提交上传文件
+    submitFileForm() {
+      this.$refs.upload.submit();
+      this.fullscreenLoading = true;
+    },
+    /** 导入按钮操作 */
+    handleImport() {
+      this.upload.title = this.$t('用户导入');
+      this.upload.open = true;
+    },
+    /** 下载模板操作 */
+    importTemplate() {
+      this.$refs['downloadFileForm'].submit()
+    },
+    // 文件上传中处理
+    handleFileUploadProgress(event, file, fileList) {
+      this.upload.isUploading = true;
+    },
+    // 文件上传成功处理
+    handleFileSuccess(response, file, fileList) {
+      this.upload.open = false;
+      this.upload.isUploading = false;
+      this.$refs.upload.clearFiles();
+      this.fullscreenLoading = false;
+      console.log(response)
+      if (response.data === 0) {
+        this.$alert(this.$t('导入失败!') + response.msg, this.$t('导入结果'), {dangerouslyUseHTMLString: true});
+      } else if (response.data[0] != null) {
+        this.$alert(this.$t('成功导入') + response.msg + this.$t('条数据') + "," + this.$t('第') + response.data + this.$t('行数据出现错误导入失败') + "。", this.$t('导入结果'), {dangerouslyUseHTMLString: true});
+      } else {
+        this.$alert(this.$t('成功导入') + response.msg + this.$t('条数据'), this.$t('导入结果'), {dangerouslyUseHTMLString: true});
+      }
+      this.getList();
+    },
     getAllRegion(val) {
       this.form.regionId = '';
       this.queryParams.regionId = '';
@@ -694,7 +832,7 @@ export default {
         groupPosition: null,
         pointPosition: null,
         groupCode: null,
-        extendCoude: null,
+        extendCode: null,
         subPointType: null,
         dia: null,
         unarrive: null,
@@ -796,18 +934,22 @@ export default {
     /** 删除按钮操作 */
     handleDelete(row) {
       const ids = row.id || this.ids;
-      const status = (row.approveStatus==0?'0':row.approveStatus) || this.status;
-      let list=[];
-      list.push(status)
-      for (const s of list) {
-        if (s != 0) {
-          MessageBox.alert('已送审/已审核的数据不可删除!', '注意!', {
-            confirmButtonText: '确定',
-          })
-          return
+      if (row.approveStatus === undefined) {
+        for (let i = 0; i < this.status.length; i++) {
+          if (this.status[i] != 0) {
+            MessageBox.alert('已送审/已审核的数据不可删除!', '注意!', {
+              confirmButtonText: '确定',
+            })
+            return
+          }
         }
+      } else if (row.approveStatus != 0) {
+        MessageBox.alert('已送审/已审核的数据不可删除!', '注意!', {
+          confirmButtonText: '确定',
+        })
+        return
       }
-      this.$modal.confirm('是否确认删除密封点编号为"' + ids + '"的数据项?').then(function () {
+      this.$modal.confirm('是否确认删除数据项?').then(function () {
         return delPoint(ids);
       }).then(() => {
         this.getList();

+ 14 - 10
ui/src/views/base/region/index.vue

@@ -359,18 +359,22 @@ export default {
     /** 删除按钮操作 */
     handleDelete(row) {
       const ids = row.id || this.ids;
-      const status = (row.approveStatus==0?'0':row.approveStatus) || this.status;
-      let list=[];
-      list.push(status)
-      for (const s of list) {
-        if (s != 0) {
-          MessageBox.alert('已送审/已审核的数据不可删除!', '注意!', {
-            confirmButtonText: '确定',
-          })
-          return
+      if(row.approveStatus===undefined){
+        for (let i = 0; i < this.status.length; i++) {
+          if (this.status[i] != 0) {
+            MessageBox.alert('已送审/已审核的数据不可删除!', '注意!', {
+              confirmButtonText: '确定',
+            })
+            return
+          }
         }
+      }else if (row.approveStatus!=0){
+        MessageBox.alert('已送审/已审核的数据不可删除!', '注意!', {
+          confirmButtonText: '确定',
+        })
+        return
       }
-      this.$modal.confirm('是否确认删除区域编号为"' + ids + '"的数据项?').then(function() {
+      this.$modal.confirm('是否确认删除数据项?').then(function() {
         return delRegion(ids);
       }).then(() => {
         this.getList();