wangggziwen 2 years ago
parent
commit
2a607a9cdc

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

@@ -8,10 +8,8 @@ import java.util.List;
 import com.alibaba.fastjson.JSON;
 import com.ruoyi.common.utils.DateUtils;
 import com.ruoyi.common.utils.file.ExcelUtils;
-import com.ruoyi.project.process.domain.TMoc;
 import com.ruoyi.project.production.controller.vo.SaiQueryVO;
 import com.ruoyi.project.system.domain.SysDept;
-import com.ruoyi.project.system.domain.SysDictData;
 import com.ruoyi.project.system.service.ISysDeptService;
 import com.ruoyi.project.system.service.ISysDictTypeService;
 import com.ruoyi.project.system.service.ISysUserService;
@@ -106,7 +104,7 @@ public class TSaiController extends BaseController
                 int cellNum = row.getPhysicalNumberOfCells();
                 TSai entity = new TSai();
                 entity.setDelFlag("0");
-                entity.setDeptId(userService.selectUserById(userId).getDeptId());
+//                entity.setDeptId(userService.selectUserById(userId).getDeptId());
                 for (int j = 0; j < cellNum; j++) {
                     Cell cell = row.getCell(j);
                     //  cell.setCellType(CellType.STRING);

+ 34 - 0
master/src/main/java/com/ruoyi/project/production/domain/TSai.java

@@ -24,6 +24,8 @@ public class TSai extends BaseEntity
     @Excel(name = "检查的装置/设施")
     private String plantId;
 
+    private String plantName;
+
     /** 检查日期/时间 */
     @JsonFormat(pattern = "yyyy-MM-dd" , timezone = "GMT+8")
     @Excel(name = "检查日期/时间", width = 30, dateFormat = "yyyy-MM-dd")
@@ -49,6 +51,8 @@ public class TSai extends BaseEntity
     @Excel(name = "用户")
     private String userDept;
 
+    private String userDeptName;
+
     /** 数据来源 */
     @Excel(name = "数据来源")
     private String source;
@@ -59,6 +63,9 @@ public class TSai extends BaseEntity
     /** 部门编号 */
     private Long deptId;
 
+    /** 部门名称 */
+    private String deptName;
+
     public void setSaiId(Long saiId)
     {
         this.saiId = saiId;
@@ -158,6 +165,30 @@ public class TSai extends BaseEntity
         this.dificiency = dificiency;
     }
 
+    public String getPlantName() {
+        return plantName;
+    }
+
+    public void setPlantName(String plantName) {
+        this.plantName = plantName;
+    }
+
+    public String getUserDeptName() {
+        return userDeptName;
+    }
+
+    public void setUserDeptName(String userDeptName) {
+        this.userDeptName = userDeptName;
+    }
+
+    public String getDeptName() {
+        return deptName;
+    }
+
+    public void setDeptName(String deptName) {
+        this.deptName = deptName;
+    }
+
     @Override
     public String toString() {
         return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
@@ -176,6 +207,9 @@ public class TSai extends BaseEntity
             .append("updateBy", getUpdateBy())
             .append("updateTime", getUpdateTime())
             .append("deptId", getDeptId())
+            .append("deptName", getDeptName())
+            .append("userDeptName", getUserDeptName())
+            .append("plantName", getPlantName())
             .toString();
     }
 }

+ 19 - 1
master/src/main/java/com/ruoyi/project/production/service/impl/TSaiServiceImpl.java

@@ -3,6 +3,9 @@ package com.ruoyi.project.production.service.impl;
 import java.util.List;
 import com.ruoyi.common.utils.DateUtils;
 import com.ruoyi.project.production.controller.vo.SaiQueryVO;
+import com.ruoyi.project.system.domain.SysDept;
+import com.ruoyi.project.system.mapper.SysDeptMapper;
+import com.ruoyi.project.system.service.ISysDictTypeService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import com.ruoyi.project.production.mapper.TSaiMapper;
@@ -21,6 +24,9 @@ public class TSaiServiceImpl implements ITSaiService
     @Autowired
     private TSaiMapper tSaiMapper;
 
+    @Autowired
+    private SysDeptMapper sysDeptMapper;
+
     /**
      * 查询SAI信息
      *
@@ -42,7 +48,19 @@ public class TSaiServiceImpl implements ITSaiService
     @Override
     public List<TSai> selectTSaiListByYear(SaiQueryVO tSai)
     {
-        return tSaiMapper.selectTSaiListByYear(tSai);
+        List<TSai> tSais = tSaiMapper.selectTSaiListByYear(tSai);
+        List<SysDept> sysDepts = sysDeptMapper.selectDeptList(new SysDept());
+        for (TSai sai : tSais) {
+            for (SysDept sysDept : sysDepts) {
+                if (sysDept.getDeptId().toString().equals(sai.getPlantId())) {
+                    sai.setPlantName(sysDept.getDeptName());
+                }
+                if (sysDept.getDeptId().toString().equals(sai.getUserDept())) {
+                    sai.setUserDeptName(sysDept.getDeptName());
+                }
+            }
+        }
+        return tSais;
     }
 
     /**

+ 4 - 1
master/src/main/resources/mybatis/production/TSaiMapper.xml

@@ -23,7 +23,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </resultMap>
 
     <sql id="selectTSaiVo">
-        select d.sai_id, d.plant_id, d.inspection_date, d.dificiency, d.sai_level, d.category, d.actions, d.user_dept, d.source, d.del_flag, d.create_by, d.create_time, d.update_by, d.update_time ,s.dept_name from t_sai d
+        select d.sai_id, d.plant_id, d.inspection_date, d.dificiency, d.sai_level, d.category, d.actions, d.user_dept, d.source, d.del_flag, d.create_by, d.create_time, d.update_by, d.update_time ,d.dept_id, s.dept_name from t_sai d
       left join sys_dept s on s.dept_id = d.dept_id
     </sql>
 
@@ -34,6 +34,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="source != null  and source != ''"> and source like concat(concat('%', #{source}), '%') </if>
             and d.del_flag = 0
         </where>
+        order by d.inspection_date asc
         <!-- 数据范围过滤 -->
         ${params.dataScope}
     </select>
@@ -81,6 +82,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="createTime != null">create_time,</if>
             <if test="updateBy != null">update_by,</if>
             <if test="updateTime != null">update_time,</if>
+            <if test="deptId != null">dept_id,</if>
          </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
             <if test="saiId != null">#{saiId},</if>
@@ -97,6 +99,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="createTime != null">#{createTime},</if>
             <if test="updateBy != null">#{updateBy},</if>
             <if test="updateTime != null">#{updateTime},</if>
+            <if test="deptId != null">#{deptId},</if>
          </trim>
     </insert>
 

+ 82 - 20
ui/src/views/production/sai/index.vue

@@ -1,23 +1,30 @@
 <template>
   <div class="app-container">
     <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
-      <el-form-item label="年份" prop="saiYear">
+      <el-form-item label="评估年度" prop="saiYear">
         <el-date-picker clearable size="small" style="width: 200px"
           v-model="queryParams.saiYear"
           type="year"
           value-format="yyyy"
-          placeholder="选择年份"
+          placeholder="选择评估年度"
           @change="handleQuery">
         </el-date-picker>
       </el-form-item>
-      <el-form-item label="数据来源" prop="source">
-        <el-input
-          v-model="queryParams.source"
-          placeholder="请输入数据来源"
-          clearable
-          size="small"
-          @keyup.enter.native="handleQuery"
-        />
+      <!--<el-form-item label="数据来源" prop="source">-->
+        <!--<el-input-->
+          <!--v-model="queryParams.source"-->
+          <!--placeholder="请输入数据来源"-->
+          <!--clearable-->
+          <!--size="small"-->
+          <!--@keyup.enter.native="handleQuery"-->
+        <!--/>-->
+      <!--</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="装置" label="装置" value="装置"></el-option>
+          <el-option key="督导" label="督导" value="督导"></el-option>
+        </el-select>
       </el-form-item>
       <el-form-item>
         <el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
@@ -76,9 +83,22 @@
 	  <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
     </el-row>
 
+    <el-row class="colorMark">
+      <span style="float:left;">
+        <svg-icon id="score" icon-class="rectangleGreen" class="rectangleGreen"></svg-icon>
+        安全行为指数:{{score}}
+      </span>
+      <svg-icon icon-class="rectangleGreen" class="rectangleGreen"></svg-icon>
+      <span>范围1</span>
+      <svg-icon icon-class="rectangleYellow" class="rectangleYellow"></svg-icon>
+      <span>范围2</span>
+      <svg-icon icon-class="rectanglered" class="rectangleRed"></svg-icon>
+      <span>范围3</span>
+    </el-row>
+
     <el-table v-loading="loading" :data="saiList" @selection-change="handleSelectionChange" :height="clientHeight" border>
       <el-table-column type="selection" width="55" align="center" />
-      <el-table-column label="检查的装置/设施" align="center" prop="plantId" :show-overflow-tooltip="true"/>
+      <el-table-column label="检查的装置/设施" align="center" prop="plantName" :show-overflow-tooltip="true"/>
       <el-table-column label="检查日期/时间" align="center" prop="inspectionDate" width="100">
         <template slot-scope="scope">
           <span>{{ parseTime(scope.row.inspectionDate, '{y}-{m}-{d}') }}</span>
@@ -88,7 +108,7 @@
       <el-table-column label="级别" align="center" prop="saiLevel" :show-overflow-tooltip="true"/>
       <el-table-column label="类别" align="center" prop="category" :show-overflow-tooltip="true"/>
       <el-table-column label="采取或要采取的措施" align="center" prop="actions" :show-overflow-tooltip="true"/>
-      <el-table-column label="用户" align="center" prop="userDept" :show-overflow-tooltip="true"/>
+      <el-table-column label="用户" align="center" prop="userDeptName" :show-overflow-tooltip="true"/>
       <el-table-column label="数据来源" align="center" prop="source" :show-overflow-tooltip="true"/>
       <el-table-column label="操作" align="center" fixed="right" width="120" class-name="small-padding fixed-width">
         <template slot-scope="scope">
@@ -122,8 +142,11 @@
     <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
       <el-form ref="form" :model="form" :rules="rules" label-width="80px">
         <el-form-item label="检查的装置/设施" prop="plantId">
-          <el-input v-model="form.plantId" placeholder="请输入检查的装置/设施" />
+          <treeselect v-model="form.plantId" :options="deptOptions" :show-count="true" placeholder="请选择检查的装置/设施" />
         </el-form-item>
+        <!--<el-form-item label="检查的装置/设施" prop="plantId">-->
+          <!--<el-input v-model="form.plantId" placeholder="请输入检查的装置/设施" />-->
+        <!--</el-form-item>-->
         <el-form-item label="检查日期/时间" prop="inspectionDate">
           <el-date-picker clearable size="small" style="width: 200px"
             v-model="form.inspectionDate"
@@ -145,14 +168,21 @@
           <el-input v-model="form.actions" placeholder="请输入采取或要采取的措施" />
         </el-form-item>
         <el-form-item label="用户" prop="userDept">
-          <el-input v-model="form.userDept" placeholder="请输入用户" />
+          <treeselect v-model="form.userDept" :options="deptOptions" :show-count="true" placeholder="请选择用户" />
+        </el-form-item>
+        <!--<el-form-item label="用户" prop="userDept">-->
+          <!--<el-input v-model="form.userDept" placeholder="请输入用户" />-->
+        <!--</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="装置" label="装置" value="装置"></el-option>
+            <el-option key="督导" label="督导" value="督导"></el-option>
+          </el-select>
         </el-form-item>
-        <el-form-item label="数据来源" prop="source">
-          <el-input v-model="form.source" placeholder="请输入数据来源" />
+        <el-form-item label="归属部门" prop="deptId">
+            <treeselect v-model="form.deptId" :options="deptOptions" :show-count="true" placeholder="请选择归属部门" />
         </el-form-item>
-          <el-form-item label="归属部门" prop="deptId">
-              <treeselect v-model="form.deptId" :options="deptOptions" :show-count="true" placeholder="请选择归属部门" />
-          </el-form-item>
       </el-form>
       <div slot="footer" class="dialog-footer">
         <el-button type="primary" @click="submitForm">确 定</el-button>
@@ -208,6 +238,7 @@ export default {
   components: { Treeselect },
   data() {
     return {
+      score: 0,
       // 遮罩层
       loading: true,
       // 选中数组
@@ -217,7 +248,7 @@ export default {
       // 非多个禁用
       multiple: true,
       // 显示搜索条件
-      showSearch: true,
+      showSearch: false,
       // 总条数
       total: 0,
       // SAI信息表格数据
@@ -262,6 +293,7 @@ export default {
         userDept: null,
         source: null,
         saiYear: null,
+        deptId:null,
       },
       // 表单参数
       form: {},
@@ -460,3 +492,33 @@ export default {
   }
 };
 </script>
+
+<style>
+  .colorMark {
+    color: #6f6f6f;
+    text-align: right;
+    font-weight:bold;
+    font-size: 13px;
+    padding-bottom: 5px;
+  }
+  .rectangleLightgreen {
+    width: 40px !important;
+    height: 20px !important;
+  }
+  .rectangleFlesh {
+    width: 40px !important;
+    height: 20px !important;
+  }
+  .rectangleYellow {
+    width: 40px !important;
+    height: 20px !important;
+  }
+  .rectangleRed {
+    width: 40px !important;
+    height: 20px !important;
+  }
+  .rectangleGreen {
+    width: 40px !important;
+    height: 20px !important;
+  }
+</style>