Procházet zdrojové kódy

Merge remote-tracking branch 'origin/master'

jiangbiao před 2 roky
rodič
revize
7e9568572c

+ 96 - 0
master/src/main/java/com/ruoyi/common/thread/sai/SaiApplyMailThread.java

@@ -0,0 +1,96 @@
+package com.ruoyi.common.thread.sai;
+
+import com.github.stuxuhai.jpinyin.PinyinException;
+import com.github.stuxuhai.jpinyin.PinyinFormat;
+import com.github.stuxuhai.jpinyin.PinyinHelper;
+import com.ruoyi.common.sendEmail.IMailService;
+import com.ruoyi.project.production.domain.TSaiApply;
+import com.ruoyi.project.system.domain.SysMessage;
+import com.ruoyi.project.system.service.ISysMessageService;
+import org.activiti.engine.task.Task;
+
+import java.text.SimpleDateFormat;
+import java.util.Date;
+
+/**
+ * SAI开项申请流程邮件通知线程
+ *
+ * @author Wang Zi Wen
+ * @email wangggziwen@163.com
+ * @date 2023/04/10 10:35:50
+ */
+public class SaiApplyMailThread implements Runnable {
+
+    private IMailService mailService;
+    private ISysMessageService sysMessageService;
+    private SysMessage message;
+    private String email;
+    private Task task;
+    private TSaiApply tSaiApply;
+    private String staffName;
+    private String staffNameEN;
+    private String loginName;
+
+    public SaiApplyMailThread() {}
+
+    public SaiApplyMailThread(IMailService mailService, ISysMessageService sysMessageService, SysMessage message, String email, Task task, TSaiApply tSaiApply, String staffName, String loginName) throws PinyinException {
+        this.mailService = mailService;
+        this.sysMessageService = sysMessageService;
+        this.email = email;
+        this.message = message;
+        this.task = task;
+        this.tSaiApply = tSaiApply;
+        this.staffName = staffName;
+        this.staffNameEN = PinyinHelper.convertToPinyinString(staffName.trim(), " ", PinyinFormat.WITHOUT_TONE);
+        this.loginName =  loginName;
+    }
+
+    @Override
+    public void run() {
+        this.sendMail();
+        sysMessageService.insertSysMessage(message);
+    }
+
+    private void sendMail() {
+        String jumpUrl = "/production/sai/apply";
+        //写html开始内容
+        String start = "<!DOCTYPE html><html><head><meta charset=\"utf-8\"><title></title></head><body><div style=\"background-color:#ECECEC; padding: 35px;\">" +
+                "<table cellpadding=\"0\" align=\"center\"" +
+                "style=\"width: 600px; margin: 0px auto; text-align: left; position: relative; border-top-left-radius: 5px; border-top-right-radius: 5px; border-bottom-right-radius: 5px; border-bottom-left-radius: 5px; font-size: 14px; font-family:微软雅黑, 黑体; line-height: 1.5; box-shadow: rgb(153, 153, 153) 0px 0px 5px; border-collapse: collapse; background-position: initial initial; background-repeat: initial initial;background:#fff;\">" +
+                "<tbody><tr><th valign=\"middle\" style=\"height: 25px; line-height: 25px; padding: 15px 35px; border-bottom-width: 1px; border-bottom-style: solid; border-bottom-color: #42a3d3; background-color: #49bcff; border-top-left-radius: 5px; border-top-right-radius: 5px; border-bottom-right-radius: 0px; border-bottom-left-radius: 0px;\">" +
+                "<font face=\"微软雅黑\" size=\"5\" style=\"color: rgb(255, 255, 255); \">CPMS管理系统 </font><font face=\"微软雅黑\" size=\"3\" style=\"color: rgb(255, 255, 255); \">CPMS System</font></th></tr>";
+        //表html中间内容
+        String prime = "";
+        String center = "<tr><td><div style=\"padding:25px 35px 40px; background-color:#fff;\"><h2 style=\"margin: 5px 0px; \">" +
+                "<font color=\"#333333\" style=\"line-height: 20px; \"><font style=\"line-height: 22px; \" size=\"4\">" +
+                "亲爱的staffName</font><br><font style=\"line-height: 22px; \" size=\"4\">" +
+                "Dear staffNameEN(loginName)</font></font></h2>" +
+                "<p>您有新的SAI开项申请待办任务,详情如下:<br>" +
+                "You have a new to-do task:<br>" +
+                "流程编号:<b>processId</b><br>" +
+                "任务名称:<b>taskName</b><br>" +
+                "问题描述:<b>taskDescription</b><br>" +
+                "申请时间:<b>taskApplyDate</b><br>" +
+                "请登录<a href=\"https://cpms.basf-ypc.net.cn/cpms/index.html#jumpUrl\">CPMS管理系统</a>查看。<br>" +
+                "Please log in the <a href=\"https://cpms.basf-ypc.net.cn/cpms/index.html#jumpUrl\">CPMS</a> to handle it.</p>" +
+                "<p align=\"right\">date</p>" +
+                "<div style=\"width:700px;margin:0 auto;\">" +
+                "<div style=\"padding:10px 10px 0;border-top:1px solid #ccc;color:#747474;margin-bottom:20px;line-height:1.3em;font-size:12px;\">" +
+                "<p>此为系统邮件,请勿回复<br>This e-Mail is an automatic reminder sent by CPMS, please do not reply</p>" +
+                "</div></div></div></td></tr>";
+        String one = center.replaceFirst("staffName", staffName);
+        String two = one.replaceFirst("staffNameEN", staffNameEN);
+        String three = two.replaceFirst("loginName", loginName);
+        String four = three.replaceFirst("processId", tSaiApply.getProcessId());
+        String five = four.replaceFirst("taskName", task.getName());
+        String six = five.replaceFirst("taskDescription", tSaiApply.getDescription());
+        String seven = six.replaceFirst("taskApplyDate", new SimpleDateFormat("yyyy-MM-dd hh:mm:ss").format(tSaiApply.getApplyDate()));
+        String result = seven.replaceFirst("date", String.valueOf(new Date())).replaceFirst("jumpUrl",jumpUrl).replaceFirst("jumpUrl",jumpUrl);
+        prime = prime + result;
+        //写html结尾内容
+        String end = "</tbody></table></div></body></html>";
+        //拼接html
+        String html = start + prime + end;
+        mailService.sendHtmlMail(email, "CPMS:您有新的SAI开项申请待办任务", html);
+    }
+}

+ 55 - 1
master/src/main/java/com/ruoyi/project/production/controller/TSaiApplyController.java

@@ -1,6 +1,10 @@
 package com.ruoyi.project.production.controller;
 
 import com.alibaba.fastjson.JSON;
+import com.github.stuxuhai.jpinyin.PinyinException;
+import com.ruoyi.common.sendEmail.IMailService;
+import com.ruoyi.common.thread.Trainning.MeetingInvitationMailThread;
+import com.ruoyi.common.thread.sai.SaiApplyMailThread;
 import com.ruoyi.common.utils.DateUtils;
 import com.ruoyi.common.utils.file.ExcelUtils;
 import com.ruoyi.common.utils.poi.ExcelUtil;
@@ -11,6 +15,8 @@ import com.ruoyi.framework.web.controller.BaseController;
 import com.ruoyi.framework.web.domain.AjaxResult;
 import com.ruoyi.framework.web.page.TableDataInfo;
 import com.ruoyi.project.approve.damain.DevTask;
+import com.ruoyi.project.plant.domain.TStaffmgr;
+import com.ruoyi.project.plant.service.ITStaffmgrService;
 import com.ruoyi.project.process.domain.TMoc;
 import com.ruoyi.project.production.controller.vo.SaiApplyExportVO;
 import com.ruoyi.project.production.domain.TSaiApply;
@@ -20,11 +26,13 @@ import com.ruoyi.project.production.service.ITSaiApproveFileService;
 import com.ruoyi.project.sems.domain.TApproverFile;
 import com.ruoyi.project.system.domain.SysDept;
 import com.ruoyi.project.system.domain.SysDictData;
+import com.ruoyi.project.system.domain.SysMessage;
 import com.ruoyi.project.system.domain.SysUser;
 import com.ruoyi.project.system.mapper.SysDeptMapper;
 import com.ruoyi.project.system.mapper.SysUserMapper;
 import com.ruoyi.project.system.service.ISysDeptService;
 import com.ruoyi.project.system.service.ISysDictTypeService;
+import com.ruoyi.project.system.service.ISysMessageService;
 import com.ruoyi.project.system.service.ISysUserService;
 import org.activiti.engine.ProcessEngine;
 import org.activiti.engine.ProcessEngines;
@@ -42,7 +50,10 @@ import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.multipart.MultipartFile;
 
+import javax.validation.constraints.Email;
+import javax.validation.constraints.Size;
 import java.io.IOException;
+import java.sql.Array;
 import java.text.SimpleDateFormat;
 import java.util.*;
 
@@ -77,6 +88,15 @@ public class TSaiApplyController extends BaseController
     @Autowired
     private ITSaiApproveFileService saiApproveFileService;
 
+    @Autowired
+    private ITStaffmgrService staffmgrService;
+
+    @Autowired
+    private ISysMessageService sysMessageService;
+
+    @Autowired
+    private IMailService mailService;
+
     /**
      * 查询SAI开项管理列表
      */
@@ -417,7 +437,7 @@ public class TSaiApplyController extends BaseController
     @Log(title = "SAI开项管理申请处理", businessType = BusinessType.UPDATE)
     @RepeatSubmit
     @PutMapping("/handle")
-    public AjaxResult handle(@RequestBody DevTask devTask) {
+    public AjaxResult handle(@RequestBody DevTask devTask) throws PinyinException {
         //更新数据
         TSaiApply form = devTask.getSaiApply();
         //使用任务服务完成任务(提交任务)
@@ -496,6 +516,7 @@ public class TSaiApplyController extends BaseController
                 .claim(taskId, getUserId().toString());
         taskService.addComment(taskId, processInstancesId, devTask.getComment());
         taskService.complete(taskId, param);
+        Task nextHandlerTask = null;
         // 标记taskId、TaskName
         if (nextHandler != null) {
             List<Task> list = processEngine.getTaskService()//获取任务service
@@ -505,6 +526,39 @@ public class TSaiApplyController extends BaseController
                 if (form.getProcessId().equals(t.getProcessInstanceId())) {
                     form.setTaskId(t.getId());
                     form.setTaskName(t.getName());
+                    nextHandlerTask = t;
+                }
+            }
+        }
+        if (nextHandler != null) {
+            String[] split = null;
+            if (nextHandler.indexOf(",") != -1) {
+                split = nextHandler.split(",");
+            } else {
+                split = new String[1];
+                split[0] = nextHandler;
+            }
+            for (int i = 0; i < split.length; i++) {
+                if (!split[i].equals("20276")) {    // 张力飞不发邮件
+                    SysUser sysUser = userService.selectUserById(Long.parseLong(split[i]));
+                    String staffId = sysUser.getStaffId();
+                    String loginName = sysUser.getUserName();
+                    TStaffmgr staffmgr = staffmgrService.selectTStaffmgrByStaffId(staffId);
+                    String staffName = staffmgr.getName();
+                    String email = sysUser.getEmail();
+                    if (email != null) {
+                        // 系统通知
+                        SysMessage message = new SysMessage();
+                        message.setUserId(Long.parseLong(split[i]));
+                        message.setMsgTitle("您有一条系统消息");
+                        message.setMsgContent("您有一条SAI开项申请消息待查看");
+                        // 发送邮件
+//                        email = "lihui@seashoreept.com";
+                        SaiApplyMailThread saiApplyMailThread = new SaiApplyMailThread(
+                                mailService, sysMessageService, message, email, nextHandlerTask, form, staffName, loginName);
+                        Thread thread = new Thread(saiApplyMailThread);
+                        thread.start();
+                    }
                 }
             }
         }

+ 71 - 3
master/src/main/java/com/ruoyi/project/production/controller/TSaiController.java

@@ -13,6 +13,7 @@ import com.ruoyi.common.utils.DateUtils;
 import com.ruoyi.common.utils.file.ExcelUtils;
 import com.ruoyi.project.plant.domain.TStaffmgr;
 import com.ruoyi.project.plant.service.ITStaffmgrService;
+import com.ruoyi.project.production.controller.vo.SaiExportVO;
 import com.ruoyi.project.production.controller.vo.SaiQueryVO;
 import com.ruoyi.project.system.domain.SysDept;
 import com.ruoyi.project.system.mapper.SysDeptMapper;
@@ -64,6 +65,60 @@ public class TSaiController extends BaseController
     @Autowired
     private ITStaffmgrService staffmgrService;
 
+    /**
+     * 计算CTS扣分 / 装置人均扣分
+     */
+    @PreAuthorize("@ss.hasPermi('production:sai:query')")
+    @GetMapping(value = "/calcScore2ByYear/{saiYear}")
+    public AjaxResult calcScore2ByYear(@PathVariable("saiYear") int saiYear)
+    {
+        String score = "未知";
+        String score2 = "未知";
+        SaiQueryVO tSai = new SaiQueryVO();
+        tSai.setSaiYear(saiYear);
+        List<TSai> tSais = tSaiService.selectTSaiListByYear(tSai);
+        BigDecimal sum = BigDecimal.ZERO;
+        BigDecimal sum2 = BigDecimal.ZERO;
+        BigDecimal avg = BigDecimal.ZERO;
+        BigDecimal avg2 = BigDecimal.ZERO;
+        for (TSai sai : tSais) {
+            if (sai.getSource().equals("装置") || sai.getSource().equals("督导")) {
+                Long saiLevel = sai.getSaiLevel();
+                if (saiLevel == 1L) {
+                    sum = sum.add(new BigDecimal("1"));
+                }
+                if (saiLevel == 2L) {
+                    sum = sum.add(new BigDecimal("2"));
+                }
+                if (saiLevel == 3L) {
+                    sum = sum.add(new BigDecimal("3"));
+                }
+            }
+            if (sai.getSource().equals("CTS")) {
+                Long saiLevel = sai.getSaiLevel();
+                if (saiLevel == 1L) {
+                    sum2 = sum2.add(new BigDecimal("1"));
+                }
+                if (saiLevel == 2L) {
+                    sum2 = sum2.add(new BigDecimal("2"));
+                }
+                if (saiLevel == 3L) {
+                    sum2 = sum2.add(new BigDecimal("3"));
+                }
+            }
+        }
+        TStaffmgr staffmgr = new TStaffmgr();
+        staffmgr.setDeptId(103L);
+        List<TStaffmgr> tStaffmgrs = staffmgrService.selectTStaffmgrList(staffmgr);
+        int num = tStaffmgrs.size();
+        if (sum.compareTo(BigDecimal.ZERO) != 0 && num != 0 && sum2.compareTo(BigDecimal.ZERO) != 0) {
+            avg = sum.divide(new BigDecimal(num), 3, RoundingMode.HALF_UP);
+            avg2 = sum2.divide(avg, 2, RoundingMode.HALF_UP);
+            score2 = avg2.toString();
+        }
+        return AjaxResult.success(score2);
+    }
+
     /**
      * 计算当年装置自查人均扣分
      */
@@ -96,7 +151,7 @@ public class TSaiController extends BaseController
         List<TStaffmgr> tStaffmgrs = staffmgrService.selectTStaffmgrList(staffmgr);
         int num = tStaffmgrs.size();
         if (sum.compareTo(BigDecimal.ZERO) != 0 && num != 0) {
-            avg = sum.divide(new BigDecimal(num), 3, RoundingMode.HALF_UP);
+            avg = sum.divide(new BigDecimal(num), 2, RoundingMode.HALF_UP);
             score = avg.toString();
         }
         return AjaxResult.success(score);
@@ -237,8 +292,21 @@ public class TSaiController extends BaseController
                 }
             }
         }
-        ExcelUtil<TSai> util = new ExcelUtil<TSai>(TSai.class);
-        return util.exportExcel(list, "sai");
+        List<SaiExportVO> saiExportVOList = new ArrayList<SaiExportVO>();
+        for (int i = 0; i < list.size(); i++) {
+            TSai entity = list.get(i);
+            SaiExportVO saiExportVO = new SaiExportVO();
+            saiExportVO.setNo((i + 1) + "");
+            saiExportVO.setInspectionDate(entity.getInspectionDate());
+            saiExportVO.setDificiency(entity.getDificiency());
+            saiExportVO.setActions(entity.getActions());
+            saiExportVO.setSaiLevel(entity.getSaiLevel());
+            saiExportVO.setCategory(entity.getCategory());
+            // TODO: 设置检查人,即SAI开项申请中的登记人
+            saiExportVOList.add(saiExportVO);
+        }
+        ExcelUtil<SaiExportVO> util = new ExcelUtil<SaiExportVO>(SaiExportVO.class);
+        return util.exportExcel(saiExportVOList, "SAI检查数据");
     }
 
     /**

+ 103 - 0
master/src/main/java/com/ruoyi/project/production/controller/vo/SaiExportVO.java

@@ -0,0 +1,103 @@
+package com.ruoyi.project.production.controller.vo;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.ruoyi.framework.aspectj.lang.annotation.Excel;
+import com.ruoyi.framework.web.domain.BaseEntity;
+
+import java.util.Date;
+
+/**
+ *  SAI检查管理导出VO
+ *
+ * @author Wang Zi Wen
+ * @email wangggziwen@163.com
+ * @date 2023/04/11 10:48:57
+ */
+public class SaiExportVO extends BaseEntity
+{
+    private static final long serialVersionUID = 1L;
+
+    @Excel(name = "序号", width = 8)
+    private String no;
+
+    /** 检查日期/时间 */
+    @JsonFormat(pattern = "yyyy-MM-dd" , timezone = "GMT+8")
+    @Excel(name = "检查日期", width = 30, dateFormat = "yyyy-MM-dd")
+    private Date inspectionDate;
+
+    /** 识别出的安全问题 */
+    @Excel(name = "识别出的问题")
+    private String dificiency;
+
+    /** 采取或要采取的措施 */
+    @Excel(name = "采取或要采取的措施")
+    private String actions;
+
+    /** 级别 */
+    @Excel(name = "SAI级别")
+    private Long saiLevel;
+
+    /** 类别 */
+    @Excel(name = "SAI类别")
+    private String category;
+
+    /** 检查人 */
+    @Excel(name = "检查人")
+    private String applicant;
+
+    public String getNo() {
+        return no;
+    }
+
+    public void setNo(String no) {
+        this.no = no;
+    }
+
+    public Date getInspectionDate() {
+        return inspectionDate;
+    }
+
+    public void setInspectionDate(Date inspectionDate) {
+        this.inspectionDate = inspectionDate;
+    }
+
+    public String getDificiency() {
+        return dificiency;
+    }
+
+    public void setDificiency(String dificiency) {
+        this.dificiency = dificiency;
+    }
+
+    public String getActions() {
+        return actions;
+    }
+
+    public void setActions(String actions) {
+        this.actions = actions;
+    }
+
+    public Long getSaiLevel() {
+        return saiLevel;
+    }
+
+    public void setSaiLevel(Long saiLevel) {
+        this.saiLevel = saiLevel;
+    }
+
+    public String getCategory() {
+        return category;
+    }
+
+    public void setCategory(String category) {
+        this.category = category;
+    }
+
+    public String getApplicant() {
+        return applicant;
+    }
+
+    public void setApplicant(String applicant) {
+        this.applicant = applicant;
+    }
+}

+ 1 - 0
master/src/main/resources/mybatis/production/TSaiApplyMapper.xml

@@ -84,6 +84,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         </where>
         <!-- 数据范围过滤 -->
         ${params.dataScope}
+        order by APPLY_DATE desc
     </select>
     
     <select id="selectTSaiApplyById" parameterType="Long" resultMap="TSaiApplyResult">

+ 8 - 0
ui/src/api/production/sai.js

@@ -1,5 +1,13 @@
 import request from '@/utils/request'
 
+// 计算CTS扣分 / 装置人均扣分
+export function calcScore2ByYear(saiYear) {
+  return request({
+    url: '/production/sai/calcScore2ByYear/' + saiYear,
+    method: 'get'
+  })
+}
+
 // 计算当年装置自查人均扣分
 export function calcScoreByYear(saiYear) {
   return request({

+ 1 - 1
ui/src/utils/drawMixin.js

@@ -31,7 +31,7 @@ export default {
 
   },
   updated(){
-   
+
   },
   beforeCreate() {
 

+ 1 - 1
ui/src/views/monitor/bccHome/index.vue

@@ -112,7 +112,7 @@
 
                 </el-row>
             </div>
-            <div class="swiper-slide">
+            <div class="swiper-slide" style="margin-left:30px">
                 <!-- 物料平衡 -->
                 <el-row class="wuliao suofang">
                   <material-balance :dashboarddata = 'dashboarddata'/>

+ 3 - 3
ui/src/views/production/apply/all/index.vue

@@ -143,12 +143,12 @@
       <el-table-column label="登记人" align="center" prop="applicantName" :show-overflow-tooltip="true"/>
       <el-table-column label="当前处理人" align="center" prop="handlerName" :show-overflow-tooltip="true"/>
       <el-table-column label="整改负责人" align="center" prop="executorName" :show-overflow-tooltip="true"/>
-      <el-table-column label="登记时间" align="center" prop="applyDate" width="100">
+      <el-table-column label="登记时间" align="center" prop="applyDate" width="100" sortable>
         <template slot-scope="scope">
           <span>{{ parseTime(scope.row.applyDate, '{y}-{m}-{d}') }}</span>
         </template>
       </el-table-column>
-      <el-table-column label="预计完成时间" align="center" prop="estimateFinishDate" width="100">
+      <el-table-column label="预计完成时间" align="center" prop="estimateFinishDate" width="100" sortable>
         <template slot-scope="scope">
           <span>{{ parseTime(scope.row.estimateFinishDate, '{y}-{m}-{d}') }}</span>
         </template>
@@ -1365,7 +1365,7 @@ export default {
             sai.inspectionDate = apply.applyDate;
             sai.dificiency = apply.description;
             sai.actions = apply.reaction;
-            sai.source = "公司";
+            sai.source = "装置";
             sai.deptId = 103;
             sai.saiLevel = "1";
             this.saiList.push(sai);

+ 3 - 3
ui/src/views/production/apply/mine/index.vue

@@ -143,12 +143,12 @@
       <el-table-column label="登记人" align="center" prop="applicantName" :show-overflow-tooltip="true"/>
       <el-table-column label="当前处理人" align="center" prop="handlerName" :show-overflow-tooltip="true"/>
       <el-table-column label="整改负责人" align="center" prop="executorName" :show-overflow-tooltip="true"/>
-      <el-table-column label="登记时间" align="center" prop="applyDate" width="100">
+      <el-table-column label="登记时间" align="center" prop="applyDate" width="100" sortable>
         <template slot-scope="scope">
           <span>{{ parseTime(scope.row.applyDate, '{y}-{m}-{d}') }}</span>
         </template>
       </el-table-column>
-      <el-table-column label="预计完成时间" align="center" prop="estimateFinishDate" width="100">
+      <el-table-column label="预计完成时间" align="center" prop="estimateFinishDate" width="100" sortable>
         <template slot-scope="scope">
           <span>{{ parseTime(scope.row.estimateFinishDate, '{y}-{m}-{d}') }}</span>
         </template>
@@ -1381,7 +1381,7 @@
               sai.inspectionDate = apply.applyDate;
               sai.dificiency = apply.description;
               sai.actions = apply.reaction;
-              sai.source = "公司";
+              sai.source = "装置";
               sai.deptId = 103;
               sai.saiLevel = "1";
               this.saiList.push(sai);

+ 3 - 3
ui/src/views/production/apply/pending/index.vue

@@ -143,12 +143,12 @@
       <el-table-column label="登记人" align="center" prop="applicantName" :show-overflow-tooltip="true"/>
       <el-table-column label="当前处理人" align="center" prop="handlerName" :show-overflow-tooltip="true"/>
       <el-table-column label="整改负责人" align="center" prop="executorName" :show-overflow-tooltip="true"/>
-      <el-table-column label="登记时间" align="center" prop="applyDate" width="100">
+      <el-table-column label="登记时间" align="center" prop="applyDate" width="100" sortable>
         <template slot-scope="scope">
           <span>{{ parseTime(scope.row.applyDate, '{y}-{m}-{d}') }}</span>
         </template>
       </el-table-column>
-      <el-table-column label="预计完成时间" align="center" prop="estimateFinishDate" width="100">
+      <el-table-column label="预计完成时间" align="center" prop="estimateFinishDate" width="100" sortable>
         <template slot-scope="scope">
           <span>{{ parseTime(scope.row.estimateFinishDate, '{y}-{m}-{d}') }}</span>
         </template>
@@ -1378,7 +1378,7 @@
               sai.inspectionDate = apply.applyDate;
               sai.dificiency = apply.description;
               sai.actions = apply.reaction;
-              sai.source = "公司";
+              sai.source = "装置";
               sai.deptId = 103;
               sai.saiLevel = "1";
               this.saiList.push(sai);

+ 20 - 12
ui/src/views/production/check/index.vue

@@ -12,7 +12,7 @@
       </el-form-item>
       <el-form-item :label="$t('数据来源')" prop="source">
         <el-select v-model="queryParams.source" :placeholder="$t('请选择') + $t('数据来源')">
-          <el-option key="公司" label="公司" value="公司"></el-option>
+          <el-option key="CTS" label="CTS" value="CTS"></el-option>
           <el-option key="装置" label="装置" value="装置"></el-option>
           <el-option key="督导" label="督导" value="督导"></el-option>
         </el-select>
@@ -75,15 +75,12 @@
     </el-row>
 
     <el-row class="colorMark">
-      <span style="float:left;">
-        装置自查人均扣分:{{score}}
+      <span style="float: left; text-align: left; margin-right: 25px;">
+        装置自查人均扣分:<u>{{score}}</u>
+      </span>
+      <span style="float: left; text-align: left;">
+        CTS扣分 / 装置人均扣分:<u>{{score2}}</u>
       </span>
-      <!--<svg-icon icon-class="rectangleGreen" class="rectangleGreen"></svg-icon>-->
-      <!--<span>合格</span>-->
-      <!--<svg-icon icon-class="rectangleYellow" class="rectangleYellow"></svg-icon>-->
-      <!--<span>预警</span>-->
-      <!--<svg-icon icon-class="rectanglered" class="rectangleRed"></svg-icon>-->
-      <!--<span>报警</span>-->
     </el-row>
 
     <el-table v-loading="loading" :data="saiList" @selection-change="handleSelectionChange" :height="clientHeight" border>
@@ -163,7 +160,7 @@
         </el-form-item>
         <el-form-item :label="$t('数据来源')" prop="source">
           <el-select v-model="form.source" :placeholder="$t('请选择') + $t('数据来源')">
-            <el-option key="公司" label="公司" value="公司"></el-option>
+            <el-option key="CTS" label="CTS" value="CTS"></el-option>
             <el-option key="装置" label="装置" value="装置"></el-option>
             <el-option key="督导" label="督导" value="督导"></el-option>
           </el-select>
@@ -215,7 +212,7 @@
 </template>
 
 <script>
-import { calcScoreByYear, listSai, listSaiByYear, getSai, delSai, addSai, updateSai, exportSai, importTemplate} from "@/api/production/sai";
+import { calcScoreByYear, calcScore2ByYear, listSai, listSaiByYear, getSai, delSai, addSai, updateSai, exportSai, importTemplate} from "@/api/production/sai";
 import { treeselect, alltreeselect } from "@/api/system/dept";
 import { getToken } from "@/utils/auth";
 import Treeselect from "@riophae/vue-treeselect";
@@ -227,6 +224,7 @@ export default {
   data() {
     return {
       score: null,
+      score2: null,
       // 遮罩层
       loading: true,
       // 选中数组
@@ -332,6 +330,7 @@ export default {
     // this.getList();
     this.getListByYear();
     this.calcScoreByYear();
+    this.calcScore2ByYear();
     this.getTreeselect();
   },
   methods: {
@@ -341,6 +340,12 @@ export default {
         this.score = response.msg;
       });
     },
+    /** 计算CTS扣分 / 装置人均扣分 */
+    calcScore2ByYear() {
+      calcScore2ByYear(this.queryParams.saiYear).then(response => {
+        this.score2 = response.msg;
+      });
+    },
     /** 评估年度默认为当年 */
     setYear() {
       this.queryParams.saiYear = new Date().getFullYear().toString();
@@ -353,6 +358,7 @@ export default {
         this.total = response.total;
         this.loading = false;
         this.calcScoreByYear();
+        this.calcScore2ByYear();
       });
     },
     getList() {
@@ -436,6 +442,7 @@ export default {
               this.open = false;
               this.getListByYear();
               this.calcScoreByYear();
+              this.calcScore2ByYear();
             });
           } else {
             addSai(this.form).then(response => {
@@ -443,6 +450,7 @@ export default {
               this.open = false;
               this.getListByYear();
               this.calcScoreByYear();
+              this.calcScore2ByYear();
             });
           }
         }
@@ -525,7 +533,7 @@ export default {
     text-align: right;
     font-weight:bold;
     font-size: 13px;
-    padding-bottom: 5px;
+    padding-bottom: 10px;
   }
   .rectangleLightgreen {
     width: 40px !important;