Browse Source

SAI检查管理:添加“检查人”字段,对应SAI开项管理的“登记人”

wangggziwen 2 years ago
parent
commit
4aae8451cb

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

@@ -290,6 +290,10 @@ public class TSaiController extends BaseController
                 if (sysDept.getDeptId().toString().equals(sai.getUserDept())) {
                     sai.setUserDeptName(sysDept.getDeptName());
                 }
+                String applicant = sai.getApplicant();
+                if (applicant != null) {
+                    sai.setApplicantName(userService.selectUserById(Long.parseLong(applicant)).getNickName());
+                }
             }
         }
         List<SaiExportVO> saiExportVOList = new ArrayList<SaiExportVO>();
@@ -302,7 +306,7 @@ public class TSaiController extends BaseController
             saiExportVO.setActions(entity.getActions());
             saiExportVO.setSaiLevel(entity.getSaiLevel());
             saiExportVO.setCategory(entity.getCategory());
-            // TODO: 设置检查人,即SAI开项申请中的登记人
+            saiExportVO.setApplicant(entity.getApplicantName());
             saiExportVOList.add(saiExportVO);
         }
         ExcelUtil<SaiExportVO> util = new ExcelUtil<SaiExportVO>(SaiExportVO.class);

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

@@ -59,6 +59,27 @@ public class TSai extends BaseEntity
     @Excel(name = "SAI开项申请编号")
     private Long saiApplyId;
 
+    /** 登记人 */
+    private String applicant;
+
+    private String applicantName;
+
+    public String getApplicant() {
+        return applicant;
+    }
+
+    public void setApplicant(String applicant) {
+        this.applicant = applicant;
+    }
+
+    public String getApplicantName() {
+        return applicantName;
+    }
+
+    public void setApplicantName(String applicantName) {
+        this.applicantName = applicantName;
+    }
+
     public Long getSaiApplyId() {
         return saiApplyId;
     }

+ 5 - 1
master/src/main/java/com/ruoyi/project/production/service/impl/TSaiApplyServiceImpl.java

@@ -44,7 +44,11 @@ public class TSaiApplyServiceImpl implements ITSaiApplyService
     @Override
     public TSaiApply selectTSaiApplyById(Long saiApplyId)
     {
-        return tSaiApplyMapper.selectTSaiApplyById(saiApplyId);
+        TSaiApply tSaiApply = tSaiApplyMapper.selectTSaiApplyById(saiApplyId);
+        if (tSaiApply.getApplicant() != null) {
+            tSaiApply.setApplicantName(sysUserMapper.selectUserById(Long.parseLong(tSaiApply.getApplicant())).getNickName());
+        }
+        return tSaiApply;
     }
 
     /**

+ 9 - 0
master/src/main/java/com/ruoyi/project/production/service/impl/TSaiServiceImpl.java

@@ -5,7 +5,9 @@ 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.mapper.SysUserMapper;
 import com.ruoyi.project.system.service.ISysDictTypeService;
+import com.ruoyi.project.system.service.impl.SysUserServiceImpl;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import com.ruoyi.project.production.mapper.TSaiMapper;
@@ -27,6 +29,9 @@ public class TSaiServiceImpl implements ITSaiService
     @Autowired
     private SysDeptMapper sysDeptMapper;
 
+    @Autowired
+    private SysUserServiceImpl sysUserService;
+
     /**
      * 查询SAI信息
      *
@@ -59,6 +64,10 @@ public class TSaiServiceImpl implements ITSaiService
                     sai.setUserDeptName(sysDept.getDeptName());
                 }
             }
+            String applicant = sai.getApplicant();
+            if (applicant != null) {
+                sai.setApplicantName(sysUserService.selectUserById(Long.parseLong(applicant)).getNickName());
+            }
         }
         return tSais;
     }

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

@@ -21,10 +21,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="updateTime"    column="update_time"    />
         <result property="deptName" column="dept_name" />
         <result property="saiApplyId"    column="sai_apply_id"    />
+        <result property="applicant"    column="applicant"    />
     </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 ,d.dept_id, d.sai_apply_id, 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, d.sai_apply_id, d.applicant, s.dept_name from t_sai d
       left join sys_dept s on s.dept_id = d.dept_id
     </sql>
 
@@ -53,6 +54,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="userDept != null  and userDept != ''"> and user_dept = #{userDept}</if>
             <if test="source != null  and source != ''"> and source = #{source}</if>
             <if test="saiApplyId != null "> and sai_apply_id = #{saiApplyId}</if>
+            <if test="applicant != null "> and applicant = #{applicant}</if>
             and d.del_flag = 0
         </where>
         <!-- 数据范围过滤 -->
@@ -86,6 +88,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="updateTime != null">update_time,</if>
             <if test="deptId != null">dept_id,</if>
             <if test="saiApplyId != null">sai_apply_id,</if>
+            <if test="applicant != null">applicant,</if>
          </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
             <if test="saiId != null">#{saiId},</if>
@@ -104,6 +107,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="updateTime != null">#{updateTime},</if>
             <if test="deptId != null">#{deptId},</if>
             <if test="saiApplyId != null">#{saiApplyId},</if>
+            <if test="applicant != null">#{applicant},</if>
          </trim>
     </insert>
 
@@ -124,6 +128,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="updateBy != null">update_by = #{updateBy},</if>
             <if test="updateTime != null">update_time = #{updateTime},</if>
             <if test="saiApplyId != null">sai_apply_id = #{saiApplyId},</if>
+            <if test="applicant != null">applicant = #{applicant},</if>
         </trim>
         where sai_id = #{saiId}
     </update>

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

@@ -531,7 +531,7 @@
         <el-table-column label="采取或要采取的措施" align="center" prop="actions" :show-overflow-tooltip="true"/>
         <el-table-column label="用户" align="center" prop="userDeptId" :show-overflow-tooltip="true"/>
         <el-table-column label="数据来源" align="center" prop="source" :show-overflow-tooltip="true"/>
-        <!--<el-table-column label="检查人" align="center" prop="applicantName" :show-overflow-tooltip="true"/>-->
+        <el-table-column label="检查人" align="center" prop="applicantName" :show-overflow-tooltip="true"/>
       </el-table>
       <div slot="footer" class="dialog-footer">
         <el-button type="primary" @click="submitSaiForm">确 定</el-button>
@@ -1369,8 +1369,8 @@ export default {
             sai.source = "装置";
             sai.deptId = 103;
             sai.saiLevel = "1";
-            // sai.applicant = apply.applicant;
-            // sai.applicantName = apply.applicantName;
+            sai.applicant = apply.applicant;
+            sai.applicantName = apply.applicantName;
             this.saiList.push(sai);
           });
         }

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

@@ -531,7 +531,7 @@
         <el-table-column label="采取或要采取的措施" align="center" prop="actions" :show-overflow-tooltip="true"/>
         <el-table-column label="用户" align="center" prop="userDeptId" :show-overflow-tooltip="true"/>
         <el-table-column label="数据来源" align="center" prop="source" :show-overflow-tooltip="true"/>
-        <!--<el-table-column label="检查人" align="center" prop="applicantName" :show-overflow-tooltip="true"/>-->
+        <el-table-column label="检查人" align="center" prop="applicantName" :show-overflow-tooltip="true"/>
       </el-table>
       <div slot="footer" class="dialog-footer">
         <el-button type="primary" @click="submitSaiForm">确 定</el-button>
@@ -1385,8 +1385,8 @@
               sai.source = "装置";
               sai.deptId = 103;
               sai.saiLevel = "1";
-              // sai.applicant = apply.applicant;
-              // sai.applicantName = apply.applicantName;
+              sai.applicant = apply.applicant;
+              sai.applicantName = apply.applicantName;
               this.saiList.push(sai);
             });
           }

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

@@ -531,7 +531,7 @@
         <el-table-column label="采取或要采取的措施" align="center" prop="actions" :show-overflow-tooltip="true"/>
         <el-table-column label="用户" align="center" prop="userDeptId" :show-overflow-tooltip="true"/>
         <el-table-column label="数据来源" align="center" prop="source" :show-overflow-tooltip="true"/>
-        <!--<el-table-column label="检查人" align="center" prop="applicantName" :show-overflow-tooltip="true"/>-->
+        <el-table-column label="检查人" align="center" prop="applicantName" :show-overflow-tooltip="true"/>
       </el-table>
       <div slot="footer" class="dialog-footer">
         <el-button type="primary" @click="submitSaiForm">确 定</el-button>
@@ -1382,8 +1382,8 @@
               sai.source = "装置";
               sai.deptId = 103;
               sai.saiLevel = "1";
-              // sai.applicant = apply.applicant;
-              // sai.applicantName = apply.applicantName;
+              sai.applicant = apply.applicant;
+              sai.applicantName = apply.applicantName;
               this.saiList.push(sai);
             });
           }

+ 48 - 1
ui/src/views/production/check/index.vue

@@ -97,6 +97,7 @@
       <el-table-column label="采取或要采取的措施" align="center" prop="actions" :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" prop="applicantName" :show-overflow-tooltip="true"/>
       <el-table-column label="操作" align="center" fixed="right" width="120" class-name="small-padding fixed-width">
         <template slot-scope="scope">
           <el-button
@@ -165,6 +166,20 @@
             <el-option key="督导" label="督导" value="督导"></el-option>
           </el-select>
         </el-form-item>
+        <el-form-item :label="$t('检查人')" prop="applicant">
+          <el-select
+            filterable
+            clearable
+            v-model="form.applicant"
+            placeholder="请选择检查人">
+            <el-option
+              v-for="dict in applicantOptions"
+              :key="dict.dictValue"
+              :label="dict.dictLabel"
+              :value="dict.dictValue"
+            ></el-option>
+          </el-select>
+        </el-form-item>
         <el-form-item label="归属部门" prop="deptId">
             <treeselect v-model="form.deptId" :options="deptOptions" :show-count="true" placeholder="请选择归属部门" />
         </el-form-item>
@@ -217,12 +232,15 @@ import { treeselect, alltreeselect } from "@/api/system/dept";
 import { getToken } from "@/utils/auth";
 import Treeselect from "@riophae/vue-treeselect";
 import "@riophae/vue-treeselect/dist/vue-treeselect.css";
+import { listStaffmgrByDeptAndTeam, getLoginStaffInfo } from "@/api/plant/staffmgr";
 
 export default {
   name: "Sai",
   components: { Treeselect },
   data() {
     return {
+      // 登记人列表
+      applicantOptions: [],
       score: null,
       score2: null,
       // 遮罩层
@@ -332,8 +350,35 @@ export default {
     this.calcScoreByYear();
     this.calcScore2ByYear();
     this.getTreeselect();
+    this.listStaffmgrByDeptAndTeam(null, null);
   },
   methods: {
+    /** 加载当前登录员工信息 */
+    getLoginStaffInfo() {
+      getLoginStaffInfo().then(response => {
+        let staff = response.data;
+        if (staff != null) {
+          this.form.applicant = staff.userId;
+        }
+      });
+    },
+    /** 加载登记人列表 */
+    listStaffmgrByDeptAndTeam(applicantDept, applicantTeam) {
+      listStaffmgrByDeptAndTeam({
+        deptId: applicantDept,
+        team: applicantTeam
+      }).then(response => {
+        let staffList = response.rows;
+        this.applicantOptions = [];
+        for (let i = 0; i < staffList.length; i++) {
+          let staffOption = {
+            dictLabel: staffList[i].name,
+            dictValue: staffList[i].userId
+          }
+          this.applicantOptions.push(staffOption);
+        }
+      });
+    },
     /** 计算当年装置自查人均扣分 */
     calcScoreByYear() {
       calcScoreByYear(this.queryParams.saiYear).then(response => {
@@ -396,7 +441,8 @@ export default {
         createBy: null,
         createTime: null,
         updateBy: null,
-        updateTime: null
+        updateTime: null,
+        applicant: null
       };
       this.resetForm("form");
     },
@@ -419,6 +465,7 @@ export default {
     /** 新增按钮操作 */
     handleAdd() {
       this.reset();
+      this.getLoginStaffInfo();
       this.open = true;
       this.title = "添加SAI信息";
     },