Przeglądaj źródła

徐明浩
特种设备-压力容器年检报告同步数据失效处理
特种设备-压力容器年检报告-上传第三方数据、第三方数据列表
特种设备-压力管道年检报告-上传第三方数据、第三方数据列表

徐明浩 3 lat temu
rodzic
commit
c4b1814faf

+ 89 - 0
master/src/main/java/com/ruoyi/project/sems/controller/TReportThirdController.java

@@ -0,0 +1,89 @@
+package com.ruoyi.project.sems.controller;
+
+import com.ruoyi.common.utils.poi.ExcelUtil;
+import com.ruoyi.framework.aspectj.lang.annotation.Log;
+import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
+import com.ruoyi.framework.web.controller.BaseController;
+import com.ruoyi.framework.web.domain.AjaxResult;
+import com.ruoyi.project.sems.domain.TReportThird;
+import com.ruoyi.project.sems.service.ITReportThirdService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.List;
+
+/**
+ * 压力容器第三方数据文件Controller
+ *
+ * @author ruoyi
+ * @date 2021-11-16
+ */
+@RestController
+@RequestMapping("/third/tReportThird")
+public class TReportThirdController extends BaseController {
+
+    @Autowired
+    private ITReportThirdService tReportThirdService;
+
+    /**
+     * 查询压力容器第三方数据文件列表
+     */
+    //@PreAuthorize("@ss.hasPermi('third:tReportYlrqThird:list')")
+    @GetMapping("/list")
+    public AjaxResult list(TReportThird tReportYlrqThird) {
+        List<TReportThird> list = tReportThirdService.selectTReportThirdList(tReportYlrqThird);
+        return AjaxResult.success(list);
+    }
+
+    /**
+     * 导出压力容器第三方数据文件列表
+     */
+    @PreAuthorize("@ss.hasPermi('third:tReportYlrqThird:export')")
+    @Log(title = "压力容器第三方数据文件", businessType = BusinessType.EXPORT)
+    @GetMapping("/export")
+    public AjaxResult export(TReportThird tReportYlrqThird) {
+        List<TReportThird> list = tReportThirdService.selectTReportThirdList(tReportYlrqThird);
+        ExcelUtil<TReportThird> util = new ExcelUtil<TReportThird>(TReportThird.class);
+        return util.exportExcel(list, "tReportYlrqThird");
+    }
+
+    /**
+     * 获取压力容器第三方数据文件详细信息
+     */
+    @PreAuthorize("@ss.hasPermi('third:tReportYlrqThird:query')")
+    @GetMapping(value = "/{id}")
+    public AjaxResult getInfo(@PathVariable("id") Long id) {
+        return AjaxResult.success(tReportThirdService.selectTReportThirdById(id));
+    }
+
+    /**
+     * 新增压力容器第三方数据文件
+     */
+    @PreAuthorize("@ss.hasPermi('third:tReportYlrqThird:add')")
+    @Log(title = "压力容器第三方数据文件", businessType = BusinessType.INSERT)
+    @PostMapping
+    public AjaxResult add(@RequestBody TReportThird tReportYlrqThird) {
+        return toAjax(tReportThirdService.insertTReportThird(tReportYlrqThird));
+    }
+
+    /**
+     * 修改压力容器第三方数据文件
+     */
+    @PreAuthorize("@ss.hasPermi('third:tReportYlrqThird:edit')")
+    @Log(title = "压力容器第三方数据文件", businessType = BusinessType.UPDATE)
+    @PutMapping
+    public AjaxResult edit(@RequestBody TReportThird tReportYlrqThird) {
+        return toAjax(tReportThirdService.updateTReportThird(tReportYlrqThird));
+    }
+
+    /**
+     * 删除压力容器第三方数据文件
+     */
+    @PreAuthorize("@ss.hasPermi('third:tReportYlrqThird:remove')")
+    @Log(title = "压力容器第三方数据文件", businessType = BusinessType.DELETE)
+    @DeleteMapping("/{ids}")
+    public AjaxResult remove(@PathVariable Long[] ids) {
+        return toAjax(tReportThirdService.deleteTReportThirdByIds(ids));
+    }
+}

+ 40 - 0
master/src/main/java/com/ruoyi/project/sems/controller/TReportYlgdController.java

@@ -1,11 +1,17 @@
 package com.ruoyi.project.sems.controller;
 
 import java.io.IOException;
+import java.text.ParseException;
 import java.util.ArrayList;
+import java.util.Date;
 import java.util.List;
 
 import com.alibaba.fastjson.JSON;
 import com.ruoyi.common.utils.file.ExcelUtils;
+import com.ruoyi.common.utils.file.FileUploadUtils;
+import com.ruoyi.framework.config.RuoYiConfig;
+import com.ruoyi.project.sems.domain.TReportThird;
+import com.ruoyi.project.sems.service.ITReportThirdService;
 import org.apache.poi.ss.usermodel.Cell;
 import org.apache.poi.ss.usermodel.Row;
 import org.apache.poi.ss.usermodel.Sheet;
@@ -32,9 +38,13 @@ import org.springframework.web.multipart.MultipartFile;
 @RestController
 @RequestMapping("/sems/reportYlgd")
 public class TReportYlgdController extends BaseController {
+
     @Autowired
     private ITReportYlgdService tReportYlgdService;
 
+    @Autowired
+    private ITReportThirdService itReportYlrqThirdService;
+
 
     /**
      * 同步数据
@@ -47,6 +57,36 @@ public class TReportYlgdController extends BaseController {
         return AjaxResult.success();
     }
 
+    /**
+     * 第三方数据导入
+     *
+     * @param file 导入文件
+     * @return
+     * @throws IOException
+     */
+    @PostMapping("/importForThird")
+    public AjaxResult importForThird(@RequestParam("file") MultipartFile file, @RequestParam("plantCode") String plantCode,
+                                     @RequestParam("year") String year) throws IOException, ParseException {
+        //获取操作人员ID
+        Long userId = getUserId();
+        //文件保存至服务器下
+        String fileName = file.getOriginalFilename();
+        //文件存放路径
+        String filePath = RuoYiConfig.getProfile() + "/sems/reportYlrqThird";
+        String upload = FileUploadUtils.upload(filePath, file);
+        // 文件路径保存至数据库
+        TReportThird tReportThird = new TReportThird();
+        tReportThird.setPlantCode(plantCode);
+        tReportThird.setYear(year);
+        tReportThird.setFileName(fileName);
+        tReportThird.setFilePath(upload);
+        tReportThird.setCreateBy(userId + "");
+        tReportThird.setCreateTime(new Date());
+        tReportThird.setType("2");
+        int i = this.itReportYlrqThirdService.insertTReportThird(tReportThird);
+        return AjaxResult.success(i);
+    }
+
     /**
      * 查询压力管道年检报告列表
      */

+ 39 - 1
master/src/main/java/com/ruoyi/project/sems/controller/TReportYlrqController.java

@@ -1,12 +1,17 @@
 package com.ruoyi.project.sems.controller;
 
 import java.io.IOException;
-import java.text.SimpleDateFormat;
+import java.text.ParseException;
 import java.util.ArrayList;
+import java.util.Date;
 import java.util.List;
 
 import com.alibaba.fastjson.JSON;
 import com.ruoyi.common.utils.file.ExcelUtils;
+import com.ruoyi.common.utils.file.FileUploadUtils;
+import com.ruoyi.framework.config.RuoYiConfig;
+import com.ruoyi.project.sems.domain.TReportThird;
+import com.ruoyi.project.sems.service.ITReportThirdService;
 import org.apache.poi.ss.usermodel.Cell;
 import org.apache.poi.ss.usermodel.Row;
 import org.apache.poi.ss.usermodel.Sheet;
@@ -33,9 +38,12 @@ import org.springframework.web.multipart.MultipartFile;
 @RestController
 @RequestMapping("/sems/reportYlrq")
 public class TReportYlrqController extends BaseController {
+
     @Autowired
     private ITReportYlrqService tReportYlrqService;
 
+    @Autowired
+    private ITReportThirdService itReportYlrqThirdService;
 
     /**
      * 同步数据
@@ -71,6 +79,36 @@ public class TReportYlrqController extends BaseController {
         return util.exportExcel(list, "reportYlrq");
     }
 
+    /**
+     * 第三方数据导入
+     *
+     * @param file 导入文件
+     * @return
+     * @throws IOException
+     */
+    @PostMapping("/importForThird")
+    public AjaxResult importForThird(@RequestParam("file") MultipartFile file, @RequestParam("plantCode") String plantCode,
+                                     @RequestParam("year") String year) throws IOException, ParseException {
+        //获取操作人员ID
+        Long userId = getUserId();
+        //文件保存至服务器下
+        String fileName = file.getOriginalFilename();
+        //文件存放路径
+        String filePath = RuoYiConfig.getProfile() + "/sems/reportYlrqThird";
+        String upload = FileUploadUtils.upload(filePath, file);
+        // 文件路径保存至数据库
+        TReportThird tReportYlrqThird = new TReportThird();
+        tReportYlrqThird.setPlantCode(plantCode);
+        tReportYlrqThird.setYear(year);
+        tReportYlrqThird.setFileName(fileName);
+        tReportYlrqThird.setFilePath(upload);
+        tReportYlrqThird.setCreateBy(userId + "");
+        tReportYlrqThird.setCreateTime(new Date());
+        tReportYlrqThird.setType("1");
+        int i = this.itReportYlrqThirdService.insertTReportThird(tReportYlrqThird);
+        return AjaxResult.success(i);
+    }
+
     /**
      * 批量导入
      */

+ 110 - 0
master/src/main/java/com/ruoyi/project/sems/domain/TReportThird.java

@@ -0,0 +1,110 @@
+package com.ruoyi.project.sems.domain;
+
+import com.ruoyi.framework.aspectj.lang.annotation.Excel;
+import com.ruoyi.framework.web.domain.BaseEntity;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+
+/**
+ * 压力容器第三方数据文件对象 t_report_ylrq_third
+ *
+ * @author ruoyi
+ * @date 2021-11-16
+ */
+public class TReportThird extends BaseEntity {
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * seq_report_ylrq_third_id
+     */
+    private Long id;
+
+    private String type;
+
+    /**
+     * 装置名称
+     */
+    @Excel(name = "装置名称")
+    private String plantCode;
+
+    /**
+     * 年份
+     */
+    @Excel(name = "年份")
+    private String year;
+
+    /**
+     * 文件名称
+     */
+    @Excel(name = "文件名称")
+    private String fileName;
+
+    /**
+     * 文件路径
+     */
+    @Excel(name = "文件路径")
+    private String filePath;
+
+    public String getType() {
+        return type;
+    }
+
+    public void setType(String type) {
+        this.type = type;
+    }
+
+    public void setId(Long id) {
+        this.id = id;
+    }
+
+    public Long getId() {
+        return id;
+    }
+
+    public void setPlantCode(String plantCode) {
+        this.plantCode = plantCode;
+    }
+
+    public String getPlantCode() {
+        return plantCode;
+    }
+
+    public void setYear(String year) {
+        this.year = year;
+    }
+
+    public String getYear() {
+        return year;
+    }
+
+    public void setFileName(String fileName) {
+        this.fileName = fileName;
+    }
+
+    public String getFileName() {
+        return fileName;
+    }
+
+    public void setFilePath(String filePath) {
+        this.filePath = filePath;
+    }
+
+    public String getFilePath() {
+        return filePath;
+    }
+
+    @Override
+    public String toString() {
+        return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
+                .append("id", getId())
+                .append("plantCode", getPlantCode())
+                .append("year", getYear())
+                .append("fileName", getFileName())
+                .append("filePath", getFilePath())
+                .append("createBy", getCreateBy())
+                .append("createTime", getCreateTime())
+                .append("updateBy", getUpdateBy())
+                .append("updateTime", getUpdateTime())
+                .toString();
+    }
+}

+ 63 - 0
master/src/main/java/com/ruoyi/project/sems/mapper/TReportThirdMapper.java

@@ -0,0 +1,63 @@
+package com.ruoyi.project.sems.mapper;
+
+import com.ruoyi.framework.aspectj.lang.annotation.DataScope;
+import com.ruoyi.project.sems.domain.TReportThird;
+
+import java.util.List;
+
+/**
+ * 压力容器第三方数据文件Mapper接口
+ *
+ * @author ruoyi
+ * @date 2021-11-16
+ */
+public interface TReportThirdMapper {
+    /**
+     * 查询压力容器第三方数据文件
+     *
+     * @param id 压力容器第三方数据文件ID
+     * @return 压力容器第三方数据文件
+     */
+    public TReportThird selectTReportThirdById(Long id);
+
+    /**
+     * 查询压力容器第三方数据文件列表
+     *
+     * @param tReportYlrqThird 压力容器第三方数据文件
+     * @return 压力容器第三方数据文件集合
+     */
+    @DataScope(deptAlias = "d")
+    public List<TReportThird> selectTReportThirdList(TReportThird tReportYlrqThird);
+
+    /**
+     * 新增压力容器第三方数据文件
+     *
+     * @param tReportYlrqThird 压力容器第三方数据文件
+     * @return 结果
+     */
+    public int insertTReportThird(TReportThird tReportYlrqThird);
+
+    /**
+     * 修改压力容器第三方数据文件
+     *
+     * @param tReportYlrqThird 压力容器第三方数据文件
+     * @return 结果
+     */
+    public int updateTReportThird(TReportThird tReportYlrqThird);
+
+    /**
+     * 删除压力容器第三方数据文件
+     *
+     * @param id 压力容器第三方数据文件ID
+     * @return 结果
+     */
+    public int deleteTReportThirdById(Long id);
+
+    /**
+     * 批量删除压力容器第三方数据文件
+     *
+     * @param ids 需要删除的数据ID
+     * @return 结果
+     */
+    public int deleteTReportThirdByIds(Long[] ids);
+}

+ 91 - 0
master/src/main/java/com/ruoyi/project/sems/service/impl/TReportThirdServiceImpl.java

@@ -0,0 +1,91 @@
+package com.ruoyi.project.sems.service.impl;
+
+import com.ruoyi.common.utils.DateUtils;
+import com.ruoyi.project.sems.domain.TReportThird;
+import com.ruoyi.project.sems.mapper.TReportThirdMapper;
+import com.ruoyi.project.sems.service.ITReportThirdService;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import java.util.List;
+
+/**
+ * 压力容器第三方数据文件Service业务层处理
+ *
+ * @author ruoyi
+ * @date 2021-11-16
+ */
+@Service
+public class TReportThirdServiceImpl implements ITReportThirdService {
+
+    @Resource
+    private TReportThirdMapper tReportThirdMapper;
+
+    /**
+     * 查询压力容器第三方数据文件
+     *
+     * @param id 压力容器第三方数据文件ID
+     * @return 压力容器第三方数据文件
+     */
+    @Override
+    public TReportThird selectTReportThirdById(Long id) {
+        return tReportThirdMapper.selectTReportThirdById(id);
+    }
+
+    /**
+     * 查询压力容器第三方数据文件列表
+     *
+     * @param tReportThird 压力容器第三方数据文件
+     * @return 压力容器第三方数据文件
+     */
+    @Override
+    public List<TReportThird> selectTReportThirdList(TReportThird tReportThird) {
+        return tReportThirdMapper.selectTReportThirdList(tReportThird);
+    }
+
+    /**
+     * 新增压力容器第三方数据文件
+     *
+     * @param tReportThird 压力容器第三方数据文件
+     * @return 结果
+     */
+    @Override
+    public int insertTReportThird(TReportThird tReportThird) {
+        tReportThird.setCreateTime(DateUtils.getNowDate());
+        return tReportThirdMapper.insertTReportThird(tReportThird);
+    }
+
+    /**
+     * 修改压力容器第三方数据文件
+     *
+     * @param tReportThird 压力容器第三方数据文件
+     * @return 结果
+     */
+    @Override
+    public int updateTReportThird(TReportThird tReportThird) {
+        tReportThird.setUpdateTime(DateUtils.getNowDate());
+        return tReportThirdMapper.updateTReportThird(tReportThird);
+    }
+
+    /**
+     * 批量删除压力容器第三方数据文件
+     *
+     * @param ids 需要删除的压力容器第三方数据文件ID
+     * @return 结果
+     */
+    @Override
+    public int deleteTReportThirdByIds(Long[] ids) {
+        return tReportThirdMapper.deleteTReportThirdByIds(ids);
+    }
+
+    /**
+     * 删除压力容器第三方数据文件信息
+     *
+     * @param id 压力容器第三方数据文件ID
+     * @return 结果
+     */
+    @Override
+    public int deleteTReportThirdById(Long id) {
+        return tReportThirdMapper.deleteTReportThirdById(id);
+    }
+}

+ 6 - 8
master/src/main/java/com/ruoyi/project/sems/service/impl/TReportYlrqServiceImpl.java

@@ -1,18 +1,16 @@
 package com.ruoyi.project.sems.service.impl;
 
-import java.util.List;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-
+import com.ruoyi.project.sems.domain.TReportYlrq;
 import com.ruoyi.project.sems.domain.TSpecdevYlrq;
-import com.ruoyi.project.sems.mapper.TSpecdevYlrqMapper;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
 import com.ruoyi.project.sems.mapper.TReportYlrqMapper;
-import com.ruoyi.project.sems.domain.TReportYlrq;
+import com.ruoyi.project.sems.mapper.TSpecdevYlrqMapper;
 import com.ruoyi.project.sems.service.ITReportYlrqService;
+import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
+import java.util.List;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
 
 /**
  * 压力容器年检报告Service业务层处理

+ 108 - 0
master/src/main/resources/mybatis/sems/TReportThirdMapper.xml

@@ -0,0 +1,108 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper
+        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.ruoyi.project.sems.mapper.TReportThirdMapper">
+
+    <resultMap type="TReportThird" id="TReportThirdResult">
+        <result property="id" column="id"/>
+        <result property="plantCode" column="plant_code"/>
+        <result property="year" column="year"/>
+        <result property="fileName" column="file_name"/>
+        <result property="filePath" column="file_path"/>
+        <result property="createBy" column="create_by"/>
+        <result property="createTime" column="create_time"/>
+        <result property="updateBy" column="update_by"/>
+        <result property="updateTime" column="update_time"/>
+        <result property="type" column="type"/>
+        <result property="deptName" column="dept_name"/>
+    </resultMap>
+
+    <sql id="selectTReportThirdVo">
+        select d.id,
+               d.plant_code,
+               d.year,
+               d.file_name,
+               d.file_path,
+               d.create_by,
+               d.create_time,
+               d.update_by,
+               d.update_time,
+               d.type
+        from t_report_third d
+    </sql>
+
+    <select id="selectTReportThirdList" parameterType="TReportThird" resultMap="TReportThirdResult">
+        <include refid="selectTReportThirdVo"/>
+        <where>
+            <if test="type != null  and type != ''">and type = #{type}</if>
+        </where>
+        <!-- 数据范围过滤 -->
+        /*${params.dataScope}*/
+    </select>
+
+    <select id="selectTReportThirdById" parameterType="Long" resultMap="TReportThirdResult">
+        <include refid="selectTReportThirdVo"/>
+        where id = #{id}
+    </select>
+
+    <insert id="insertTReportThird" parameterType="TReportThird">
+        <selectKey keyProperty="id" resultType="long" order="BEFORE">
+            SELECT seq_t_report_third.NEXTVAL as id FROM DUAL
+        </selectKey>
+        insert into t_report_third
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="id != null">id,</if>
+            <if test="plantCode != null">plant_code,</if>
+            <if test="year != null">year,</if>
+            <if test="fileName != null">file_name,</if>
+            <if test="filePath != null">file_path,</if>
+            <if test="createBy != null">create_by,</if>
+            <if test="createTime != null">create_time,</if>
+            <if test="updateBy != null">update_by,</if>
+            <if test="updateTime != null">update_time,</if>
+            <if test="type != null">type,</if>
+        </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
+            <if test="id != null">#{id},</if>
+            <if test="plantCode != null">#{plantCode},</if>
+            <if test="year != null">#{year},</if>
+            <if test="fileName != null">#{fileName},</if>
+            <if test="filePath != null">#{filePath},</if>
+            <if test="createBy != null">#{createBy},</if>
+            <if test="createTime != null">#{createTime},</if>
+            <if test="updateBy != null">#{updateBy},</if>
+            <if test="updateTime != null">#{updateTime},</if>
+            <if test="type != null">#{type},</if>
+        </trim>
+    </insert>
+
+    <update id="updateTReportThird" parameterType="TReportThird">
+        update t_report_third
+        <trim prefix="SET" suffixOverrides=",">
+            <if test="plantCode != null">plant_code = #{plantCode},</if>
+            <if test="year != null">year = #{year},</if>
+            <if test="fileName != null">file_name = #{fileName},</if>
+            <if test="filePath != null">file_path = #{filePath},</if>
+            <if test="createBy != null">create_by = #{createBy},</if>
+            <if test="createTime != null">create_time = #{createTime},</if>
+            <if test="updateBy != null">update_by = #{updateBy},</if>
+            <if test="updateTime != null">update_time = #{updateTime},</if>
+        </trim>
+        where id = #{id}
+    </update>
+
+    <update id="deleteTReportThirdById" parameterType="Long">
+        update t_report_third
+        set del_flag = 2
+        where id = #{id}
+    </update>
+
+    <update id="deleteTReportThirdByIds" parameterType="String">
+        update t_report_third set del_flag = 2 where id in
+        <foreach item="id" collection="array" open="(" separator="," close=")">
+            #{id}
+        </foreach>
+    </update>
+
+</mapper>

+ 10 - 0
ui/src/api/sems/tReportThird.js

@@ -0,0 +1,10 @@
+import request from '@/utils/request'
+
+// 查询压力容器第三方数据文件列表
+export function listTReportThird(query) {
+  return request({
+    url: '/third/tReportThird/list',
+    method: 'get',
+    params: query
+  })
+}

+ 4 - 0
ui/src/lang/en.js

@@ -1661,6 +1661,10 @@ export default {
   同步数据:'Synchronous Data',
   压力管道年检报告:'Penstock Account Annual Inspection Report',
   压力容器年检报告:'Pressure Vessel Account Annual Inspection Report',
+  批量下载历史报告:'Batch Download History Report',
+  导入更新数据:'Import Update Data',
+  上传第三方数据:'Upload Third Party Data',
+  第三方数据列表:'Third Party Data List',
   特种设备分析:'Special Equipment Analysis',
   首次测厚日期:'Date of Frist Fixed Point Thickness',
   最近测厚日期:'Date of Lately Fixed Point Thickness',

+ 4 - 0
ui/src/lang/zh.js

@@ -1661,6 +1661,10 @@ export default {
   同步数据:'同步数据',
   压力管道年检报告:'压力管道年检报告',
   压力容器年检报告:'压力容器年检报告',
+  批量下载历史报告:'批量下载历史报告',
+  导入更新数据:'导入更新数据',
+  上传第三方数据:'上传第三方数据',
+  第三方数据列表:'第三方数据列表',
   特种设备分析:'特种设备分析',
   首次测厚日期:'首次测厚日期',
   最近测厚日期:'最近测厚日期',

+ 164 - 7
ui/src/views/sems/reportYlgd/index.vue

@@ -68,7 +68,7 @@
           size="mini"
           @click="handleImport"
           v-hasPermi="['sems:reportYlgd:edit']"
-        >导入更新数据
+        >{{ $t('导入更新数据') }}
         </el-button>
       </el-col>
       <el-col :span="1.5">
@@ -78,7 +78,24 @@
           size="mini"
           @click="handleExport"
           v-hasPermi="['sems:reportYlgd:export']"
-        >{{ $t('导出') }}</el-button>
+        >{{ $t('导出') }}
+        </el-button>
+      </el-col>
+      <el-col :span="1.5">
+        <el-button
+          type="success"
+          size="mini"
+          @click="importThirdParty"
+        >{{ $t('上传第三方数据') }}
+        </el-button>
+      </el-col>
+      <el-col :span="1.5">
+        <el-button
+          type="success"
+          size="mini"
+          @click="thirdPartyList"
+        >{{ $t('第三方数据列表') }}
+        </el-button>
       </el-col>
       <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
     </el-row>
@@ -585,18 +602,84 @@
         <input name="type" :value="upload.type" hidden/>
       </form>
     </el-dialog>
+    <!-- 第三方导入对话框 -->
+    <el-dialog :title="thirdUpload.title" :visible.sync="thirdUpload.open" width="400px" append-to-body>
+      <div>装置:
+        <el-select v-model="plantCodeThird" :placeholder="$t('请选择') + $t('导入装置')" clearable size="small">
+          <el-option
+            v-for="dict in plantOptions"
+            :key="dict.name"
+            :label="dict.name"
+            :value="dict.name"
+          />
+        </el-select>
+      </div>
+      <div>年份:
+        <el-date-picker
+          v-model="importThirdYear"
+          type="year"
+          placeholder="选择导入的第三方数据年份">
+        </el-date-picker>
+      </div>
+      <el-upload
+        ref="thirdUpload"
+        :limit="1"
+        accept=".xlsx, .xls"
+        :data="submitData"
+        :headers="thirdUpload.headers"
+        :action="thirdUpload.url + '?updateSupport=' + thirdUpload.updateSupport"
+        :disabled="thirdUpload.isUploading"
+        :on-progress="handleFileUploadProgressThird"
+        :on-success="handleFileSuccessThird"
+        :auto-upload="false"
+        drag
+      >
+        <i class="el-icon-upload"></i>
+        <div class="el-upload__text">
+          将文件拖到此处,或
+          <em>点击上传</em>
+        </div>
+        <!--        <div class="el-upload__tip" style="color:red" slot="tip">提示:仅允许导入“xls”或“xlsx”格式文件!</div>-->
+      </el-upload>
+      <div slot="footer" class="dialog-footer">
+        <el-button type="primary" @click="thirdSubmitFileForm">确 定</el-button>
+        <el-button @click="thirdUpload.open = false">取 消</el-button>
+      </div>
+    </el-dialog>
+    <!-- 第三方数据列表对话框 -->
+    <el-dialog :title="thirdList.title" :visible.sync="thirdList.open" width="540px" append-to-body>
+      <el-table
+        :data="reportThirdList"
+        style="width: 100%">
+        <el-table-column
+          prop="plantCode"
+          :label="$t('装置名称')"
+          width="100"
+          :show-overflow-tooltip="true"
+          align="center"/>
+        <el-table-column
+          prop="year"
+          :label="$t('年份')"
+          width="100"
+          :show-overflow-tooltip="true"
+          align="center"/>
+        <el-table-column
+          prop="fileName"
+          :label="$t('文件名称')"
+          width="300"
+          :show-overflow-tooltip="true"
+          align="center"/>
+      </el-table>
+    </el-dialog>
   </div>
 </template>
 
 <script>
 import {
   listReportYlgd,
-  getReportYlgd,
   delReportYlgd,
-  addReportYlgd,
   updateReportYlgd,
   exportReportYlgd,
-  importTemplate,
   syncReportYlgd
 } from "@/api/sems/reportYlgd";
 import {listHistoryYlgd} from "@/api/sems/historyYlgd";
@@ -605,13 +688,25 @@ import {getToken} from "@/utils/auth";
 import Treeselect from "@riophae/vue-treeselect";
 import "@riophae/vue-treeselect/dist/vue-treeselect.css";
 import YearApprove from './yearapprove'
-import {exportSpecGl} from "@/api/sems/specGl";
+import {listTReportThird} from "@/api/sems/tReportThird";
+import {mylistPlant} from "@/api/system/plant";
 
 export default {
   name: "ReportYlgd",
   components: {Treeselect, YearApprove},
   data() {
     return {
+      submitData: {
+        plantCode: null,
+        year: null,
+      },
+      thirdListQuery: {
+        type: 2,
+      },
+      reportThirdList: [],
+      plantCodeThird: null,
+      importThirdYear: null,
+      plantOptions: [],
       // 用户导入参数
       upload: {
         downloadAction: process.env.VUE_APP_BASE_API + '/common/template',
@@ -629,6 +724,28 @@ export default {
         // 上传的地址
         url: process.env.VUE_APP_BASE_API + "/sems/reportYlgd/importForUpdate"
       },
+      // 第三方导入参数
+      thirdUpload: {
+        // 是否显示弹出层
+        open: false,
+        // 弹出层标题
+        title: "",
+        // 是否禁用上传
+        isUploading: false,
+        // 是否更新已经存在的用户数据
+        updateSupport: 0,
+        // 设置上传的请求头部
+        headers: {Authorization: "Bearer " + getToken()},
+        // 上传的地址
+        url: process.env.VUE_APP_BASE_API + "/sems/reportYlgd/importForThird"
+      },
+      // 第三方数据列表
+      thirdList: {
+        // 是否显示弹出层
+        open: false,
+        // 弹出层标题
+        title: "",
+      },
       exportCheckYear: null,
       dialogVisible: false,
       // 遮罩层
@@ -796,6 +913,12 @@ export default {
     this.getDicts("REPORT_CON").then(response => {
       this.conOptions = response.data;
     });
+    let plantParams = {
+      pType: 1
+    }
+    mylistPlant(plantParams).then(response => {
+      this.plantOptions = response.data;
+    });
   },
   methods: {
     /** 查询压力管道年检报告列表 */
@@ -1155,12 +1278,46 @@ export default {
         confirmButtonText: this.$t('确定'),
         cancelButtonText: this.$t('取消'),
         type: "warning"
-      }).then(function() {
+      }).then(function () {
         return exportReportYlgd(queryParams);
       }).then(response => {
         this.download(response.msg);
       })
     },
+    //导入第三方数据
+    importThirdParty() {
+      this.thirdUpload.title = "第三方数据导入";
+      this.thirdUpload.open = true;
+    },
+    thirdSubmitFileForm() {
+      this.submitData.plantCode = this.plantCodeThird;
+      this.submitData.year = new Date(this.importThirdYear).getFullYear();
+      this.$refs.thirdUpload.submit();
+    },
+    //第三方数据列表
+    thirdPartyList() {
+      listTReportThird(this.thirdListQuery).then(response => {
+        this.reportThirdList = response.data;
+      });
+      this.thirdList.title = "第三方数据列表";
+      this.thirdList.open = true;
+    },
+    // 第三方文件上传中处理
+    handleFileUploadProgressThird(event, file, fileList) {
+      this.thirdUpload.isUploading = true;
+    },
+    // 第三方文件上传成功处理
+    handleFileSuccessThird(response, file, fileList) {
+      this.thirdUpload.open = false;
+      this.thirdUpload.isUploading = false;
+      this.$refs.thirdUpload.clearFiles();
+      if (response.data.length > 0) {
+        this.$alert(this.$t('导入成功'));
+      } else {
+        this.$alert(this.$t('导入成功'));
+      }
+      this.getList();
+    },
   }
 };
 </script>

+ 168 - 8
ui/src/views/sems/reportYlrq/index.vue

@@ -57,7 +57,7 @@
         <el-button
           type="danger"
           size="mini"
-          @click="exportData"
+          @click="syncData"
         >{{ $t('同步数据') }}
         </el-button>
       </el-col>
@@ -76,7 +76,7 @@
           size="mini"
           @click="handleImport"
           v-hasPermi="['sems:reportYlrq:edit']"
-        >导入更新数据
+        >{{ $t('导入更新数据') }}
         </el-button>
       </el-col>
       <el-col :span="1.5">
@@ -86,7 +86,24 @@
           size="mini"
           @click="handleExport"
           v-hasPermi="['sems:reportYlrq:export']"
-        >{{ $t('导出') }}</el-button>
+        >{{ $t('导出') }}
+        </el-button>
+      </el-col>
+      <el-col :span="1.5">
+        <el-button
+          type="success"
+          size="mini"
+          @click="importThirdParty"
+        >{{ $t('上传第三方数据') }}
+        </el-button>
+      </el-col>
+      <el-col :span="1.5">
+        <el-button
+          type="success"
+          size="mini"
+          @click="thirdPartyList"
+        >{{ $t('第三方数据列表') }}
+        </el-button>
       </el-col>
       <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
     </el-row>
@@ -799,6 +816,75 @@
         <el-button @click="upload.open = false">取 消</el-button>
       </div>
     </el-dialog>
+    <!-- 第三方导入对话框 -->
+    <el-dialog :title="thirdUpload.title" :visible.sync="thirdUpload.open" width="400px" append-to-body>
+      <div>{{ $t('装置') }}:
+        <el-select v-model="plantCodeThird" :placeholder="$t('请选择') + $t('导入装置')" clearable size="small">
+          <el-option
+            v-for="dict in plantOptions"
+            :key="dict.name"
+            :label="dict.name"
+            :value="dict.name"
+          />
+        </el-select>
+      </div>
+      <div>{{ $t('年份') }}:
+        <el-date-picker
+          v-model="importThirdYear"
+          type="year"
+          placeholder="选择导入的第三方数据年份">
+        </el-date-picker>
+      </div>
+      <el-upload
+        ref="thirdUpload"
+        :limit="1"
+        accept=".xlsx, .xls"
+        :data="submitData"
+        :headers="thirdUpload.headers"
+        :action="thirdUpload.url + '?updateSupport=' + thirdUpload.updateSupport"
+        :disabled="thirdUpload.isUploading"
+        :on-progress="handleFileUploadProgressThird"
+        :on-success="handleFileSuccessThird"
+        :auto-upload="false"
+        drag
+      >
+        <i class="el-icon-upload"></i>
+        <div class="el-upload__text">
+          将文件拖到此处,或
+          <em>点击上传</em>
+        </div>
+        <!--        <div class="el-upload__tip" style="color:red" slot="tip">提示:仅允许导入“xls”或“xlsx”格式文件!</div>-->
+      </el-upload>
+      <div slot="footer" class="dialog-footer">
+        <el-button type="primary" @click="thirdSubmitFileForm">确 定</el-button>
+        <el-button @click="thirdUpload.open = false">取 消</el-button>
+      </div>
+    </el-dialog>
+    <!-- 第三方数据列表对话框 -->
+    <el-dialog :title="thirdList.title" :visible.sync="thirdList.open" width="540px" append-to-body>
+      <el-table
+        :data="reportYlrqThirdList"
+        style="width: 100%">
+        <el-table-column
+          prop="plantCode"
+          :label="$t('装置名称')"
+          width="100"
+          :show-overflow-tooltip="true"
+          align="center"/>
+        <el-table-column
+          prop="year"
+          :label="$t('年份')"
+          width="100"
+          :show-overflow-tooltip="true"
+          align="center"/>
+        <el-table-column
+          prop="fileName"
+          :label="$t('文件名称')"
+          width="300"
+          :show-overflow-tooltip="true"
+          align="center"/>
+      </el-table>
+    </el-dialog>
     <form ref="downloadFileForm" :action="upload.downloadAction" target="FORMSUBMIT">
       <input name="type" :value="upload.type" hidden/>
     </form>
@@ -808,12 +894,9 @@
 <script>
 import {
   listReportYlrq,
-  getReportYlrq,
   delReportYlrq,
-  addReportYlrq,
   updateReportYlrq,
   exportReportYlrq,
-  importTemplate,
   syncReportYlrq
 } from "@/api/sems/reportYlrq";
 import {listHistoryYlrq} from "@/api/sems/historyYlrq";
@@ -822,13 +905,25 @@ import Treeselect from "@riophae/vue-treeselect";
 import "@riophae/vue-treeselect/dist/vue-treeselect.css";
 import YearApprove from './yearapprove'
 import {getToken} from "@/utils/auth";
-import {exportReportYlgd} from "@/api/sems/reportYlgd";
+import {mylistPlant} from "@/api/system/plant";
+import {listTReportThird} from "@/api/sems/tReportThird";
 
 export default {
   name: "ReportYlrq",
   components: {Treeselect, YearApprove},
   data() {
     return {
+      submitData: {
+        plantCode: null,
+        year: null,
+      },
+      thirdListQuery: {
+        type: 1,
+      },
+      reportYlrqThirdList: [],
+      plantOptions: [],
+      plantCodeThird: null,
+      importThirdYear: null,
       exportCheckYear: null,
       dialogVisible: false,
       // 遮罩层
@@ -972,6 +1067,28 @@ export default {
         // 上传的地址
         url: process.env.VUE_APP_BASE_API + "/sems/reportYlrq/importForUpdate"
       },
+      // 第三方导入参数
+      thirdUpload: {
+        // 是否显示弹出层(用户导入)
+        open: false,
+        // 弹出层标题(用户导入)
+        title: "",
+        // 是否禁用上传
+        isUploading: false,
+        // 是否更新已经存在的用户数据
+        updateSupport: 0,
+        // 设置上传的请求头部
+        headers: {Authorization: "Bearer " + getToken()},
+        // 上传的地址
+        url: process.env.VUE_APP_BASE_API + "/sems/reportYlrq/importForThird"
+      },
+      // 第三方数据列表
+      thirdList: {
+        // 是否显示弹出层(用户导入)
+        open: false,
+        // 弹出层标题(用户导入)
+        title: "",
+      },
     };
   },
   watch: {
@@ -1089,6 +1206,15 @@ export default {
     this.getDicts("REPORT_CON").then(response => {
       this.conOptions = response.data;
     });
+    this.getDicts("PLANT_DIVIDE").then(response => {
+      this.plantCodeOptions = response.data;
+    });
+    let plantParams = {
+      pType: 1
+    }
+    mylistPlant(plantParams).then(response => {
+      this.plantOptions = response.data;
+    });
   },
   methods: {
     /** 查询压力容器年检报告列表 */
@@ -1555,12 +1681,46 @@ export default {
         confirmButtonText: this.$t('确定'),
         cancelButtonText: this.$t('取消'),
         type: "warning"
-      }).then(function() {
+      }).then(function () {
         return exportReportYlrq(queryParams);
       }).then(response => {
         this.download(response.msg);
       })
     },
+    //导入第三方数据
+    importThirdParty() {
+      this.thirdUpload.title = "第三方数据导入";
+      this.thirdUpload.open = true;
+    },
+    thirdSubmitFileForm() {
+      this.submitData.plantCode = this.plantCodeThird;
+      this.submitData.year = new Date(this.importThirdYear).getFullYear();
+      this.$refs.thirdUpload.submit();
+    },
+    //第三方数据列表
+    thirdPartyList() {
+      listTReportThird(this.thirdListQuery).then(response => {
+        this.reportYlrqThirdList = response.data;
+      });
+      this.thirdList.title = "第三方数据列表";
+      this.thirdList.open = true;
+    },
+    // 第三方文件上传中处理
+    handleFileUploadProgressThird(event, file, fileList) {
+      this.thirdUpload.isUploading = true;
+    },
+    // 第三方文件上传成功处理
+    handleFileSuccessThird(response, file, fileList) {
+      this.thirdUpload.open = false;
+      this.thirdUpload.isUploading = false;
+      this.$refs.thirdUpload.clearFiles();
+      if (response.data.length > 0) {
+        this.$alert(this.$t('导入成功'));
+      } else {
+        this.$alert(this.$t('导入成功'));
+      }
+      this.getList();
+    },
 
   }
 };