李旭东
2023-10-27 2d8dafdddd85653371e463ee43f960f2366d9313
Merge branch 'master' of http://111.30.93.211:10101/r/supipe

# Conflicts:
# web/src/api/index.js
已修改18个文件
已添加13个文件
5180 ■■■■■ 文件已修改
hd/pipe/engineeringManage/src/main/java/com/thhy/engineering/modules/biz/engineering/service/impl/SysSegmentServiceImpl.java 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hd/pipe/engineeringManage/src/main/java/com/thhy/engineering/modules/biz/moldquality/controller/MoldQualityController.java 86 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hd/pipe/engineeringManage/src/main/java/com/thhy/engineering/modules/biz/moldquality/entity/MoldQualityEntity.java 79 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hd/pipe/engineeringManage/src/main/java/com/thhy/engineering/modules/biz/moldquality/entity/MoldQualityFileEntity.java 28 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hd/pipe/engineeringManage/src/main/java/com/thhy/engineering/modules/biz/moldquality/mapper/MoldQualityFileMapper.java 22 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hd/pipe/engineeringManage/src/main/java/com/thhy/engineering/modules/biz/moldquality/mapper/MoldQualityMapper.java 34 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hd/pipe/engineeringManage/src/main/java/com/thhy/engineering/modules/biz/moldquality/service/MoldQualityService.java 47 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hd/pipe/engineeringManage/src/main/java/com/thhy/engineering/modules/biz/moldquality/service/impl/MoldQualityServiceImpl.java 106 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hd/pipe/engineeringManage/src/main/resources/mapping/MoldQualityFileMapper.xml 38 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hd/pipe/engineeringManage/src/main/resources/mapping/MoldQualityMapper.xml 273 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/embedment/entity/SysEmbedmentGoodsEntity.java 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/embedment/entity/SysEmbedmentRecordEntity.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hd/pipe/mobile/src/main/java/com/thhy/mobile/modules/biz/checkdevice/entity/CheckDeviceDto.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hd/pipe/mobile/src/main/resources/mapping/CheckDeviceMapper.xml 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hd/pipe/secure/src/main/resources/mapping/PipeReportMapper.xml 103 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
web/src/api/index.js 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
web/src/api/modules/quality.js 34 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
web/src/components/element/Pagination.vue 158 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
web/src/components/element/Table.vue 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
web/src/views/DuctpiecePLM/ReportCenter/BearReport.vue 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
web/src/views/DuctpiecePLM/ReportCenter/DuctReport.vue 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
web/src/views/GoodManage/components/AuxiliaryInvent.vue 606 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
web/src/views/MaterialsIndex/components/embedded/Invent.vue 586 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
web/src/views/ProjectManage/ProjectsIndex.vue 1026 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
web/src/views/ProjectManage/SectionManage.vue 101 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
web/src/views/QualityManage/DieDetection.vue 58 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
web/src/views/QualityManage/components/PatternCheck.vue 471 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
web/src/views/QualityManage/components/ThreedCheck.vue 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
web/src/views/SecureManage/RiskGrad/AreaGuarantee.vue 748 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
web/src/views/SecureManage/RiskGrad/DangerInform.vue 526 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
web/src/views/SecureManage/SmartHelmet/TrackBack.vue 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hd/pipe/engineeringManage/src/main/java/com/thhy/engineering/modules/biz/engineering/service/impl/SysSegmentServiceImpl.java
@@ -12,6 +12,7 @@
import com.thhy.general.common.BasicResult;
import com.thhy.general.config.SysUserInfo;
import com.thhy.general.utils.UserInfoUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@@ -98,7 +99,7 @@
        String unitProjectName = values.get("unitProjectName").toString();
        String segmentId =  segmentMapper.segmentNameByProjectName(unitProjectName);
        if(!segmentId1.equals(segmentId)){
        if(StringUtils.isNotBlank(segmentId) && !segmentId1.equals(segmentId)){
            return  BasicResult.faild("11111","error","标段名称被占用");
        }
        segmentMapper.segmentUpdate(values);
hd/pipe/engineeringManage/src/main/java/com/thhy/engineering/modules/biz/moldquality/controller/MoldQualityController.java
对比新文件
@@ -0,0 +1,86 @@
package com.thhy.engineering.modules.biz.moldquality.controller;
import com.thhy.engineering.modules.biz.moldquality.entity.MoldQualityEntity;
import com.thhy.engineering.modules.biz.moldquality.service.MoldQualityService;
import com.thhy.general.common.BasicResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.Map;
/**
 * @Author QiuYuHao
 * @CreateDate 2023-10-25 14:57:04
 * 模具质量检测控制层
 */
@RestController
@RequestMapping(value = "moldQuality")
public class MoldQualityController {
    @Autowired
    private MoldQualityService moldQualityService;
    @PostMapping(value = "insert")
    BasicResult insert(@RequestBody MoldQualityEntity moldQualityEntity){
        return moldQualityService.insert(moldQualityEntity);
    }
    @GetMapping(value = "delete")
    BasicResult delete(Integer id){
        return moldQualityService.delete(id);
    }
    @PostMapping(value = "update")
    BasicResult update(@RequestBody MoldQualityEntity moldQualityEntity){
        return moldQualityService.update(moldQualityEntity);
    }
    /**
     * 查询列表
     * @param map
     * @return
     */
    @PostMapping(value = "findAll")
    BasicResult findAll(@RequestBody Map<String,Object> map){
        return moldQualityService.findAll(map);
    }
    /**
     * 根据id查询一条
     * @param id
     * @return
     */
    @GetMapping(value = "findOneById")
    BasicResult findOneById(Integer id){
        return moldQualityService.findOneById(id);
    }
    /**
     * 获取模具编号列表
     * @return
     */
    @GetMapping(value = "getMoldNum")
    BasicResult getMoldNum(String proId){
        return moldQualityService.getMoldNum(proId);
    }
    /**
     * 根据项目和模具编号获取模具型号列表
     * @return
     */
    @PostMapping(value = "getMoldCode")
    BasicResult getMoldCode(@RequestBody Map<String,Object> map){
        return moldQualityService.getMoldCode(map);
    }
    /**
     * 获取1条模具
     * @return
     */
    @PostMapping(value = "getMoldByProIdAndModNumAndModCode")
    BasicResult getMoldByProIdAndModNumAndModCode(@RequestBody Map<String,Object> map){
        return moldQualityService.getMoldByProIdAndModNumAndModCode(map);
    }
}
hd/pipe/engineeringManage/src/main/java/com/thhy/engineering/modules/biz/moldquality/entity/MoldQualityEntity.java
对比新文件
@@ -0,0 +1,79 @@
package com.thhy.engineering.modules.biz.moldquality.entity;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
/**
 * @Author QiuYuHao
 * @CreateDate 2023-10-25 14:58:20
 * 模具质量检测实体
 */
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class MoldQualityEntity implements Serializable {
    private Integer id;
    /**
     *  模具型号
     */
    private String    mouldCode;
    /**
     *  模具编号
     */
    private String    mouldNum;
    /**
     *  块号
     */
    private String    blockNum;
    /**
     *  尺寸
     */
    private String    size;
    /**
     *  转向
     */
    private String    turn;
    /**
     *  注浆孔
     */
    private String    groutingHole;
    /**
     *  检测内容
     */
    private String    content;
    /**
     *  上传监测表
     */
    private List<MoldQualityFileEntity> moldQualityFileEntities;
    /**
     *  检查表日期
     */
    private Date    checkDate;
    /**
     *  检测单位
     */
    private String    checkUnit;
    private Date    createDate;
    private String    createUser;
    private String companyId;
    private String proId;
    private String proName;
}
hd/pipe/engineeringManage/src/main/java/com/thhy/engineering/modules/biz/moldquality/entity/MoldQualityFileEntity.java
对比新文件
@@ -0,0 +1,28 @@
package com.thhy.engineering.modules.biz.moldquality.entity;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
import java.util.Date;
/**
 * @Author QiuYuHao
 * @CreateDate 2023-10-26 8:53:53
 * 模具质量检测文件表
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
public class MoldQualityFileEntity implements Serializable {
    private Integer id;
    private Integer    moldQualityId;
    private String fileName;
    private String fileUrl;
    private Date createTime;
}
hd/pipe/engineeringManage/src/main/java/com/thhy/engineering/modules/biz/moldquality/mapper/MoldQualityFileMapper.java
对比新文件
@@ -0,0 +1,22 @@
package com.thhy.engineering.modules.biz.moldquality.mapper;
import com.thhy.engineering.modules.biz.moldquality.entity.MoldQualityFileEntity;
import org.apache.ibatis.annotations.Mapper;
import org.bouncycastle.voms.VOMSAttribute;
import java.util.List;
/**
 * @Author QiuYuHao
 * @CreateDate 2023-10-26 8:59:05
 * 模具质量检测文件表mapper
 */
@Mapper
public interface MoldQualityFileMapper {
    void insertList(List<MoldQualityFileEntity> list);
    void delete(Integer moldQualityId);
    List<MoldQualityFileEntity> findFileList(Integer moldQualityId);
}
hd/pipe/engineeringManage/src/main/java/com/thhy/engineering/modules/biz/moldquality/mapper/MoldQualityMapper.java
对比新文件
@@ -0,0 +1,34 @@
package com.thhy.engineering.modules.biz.moldquality.mapper;
import com.thhy.engineering.modules.biz.moldquality.entity.MoldQualityEntity;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
import java.util.Map;
/**
 * @Author QiuYuHao
 * @CreateDate 2023-10-25 15:03:34
 * 模具质量检测mapper
 */
@Mapper
public interface MoldQualityMapper {
    void insert(MoldQualityEntity moldQualityEntity);
    MoldQualityEntity findNewOne();
    void delete(Integer id);
    void update(MoldQualityEntity moldQualityEntity);
    List<MoldQualityEntity> findAll(Map<String,Object> map);
    MoldQualityEntity findOneById(Integer id);
    List<Map> getMoldNum(String proId);
    List<Map> getMoldCode(Map<String, Object> map);
    Map getMoldByProIdAndModNumAndModCode(Map<String,Object> map);
}
hd/pipe/engineeringManage/src/main/java/com/thhy/engineering/modules/biz/moldquality/service/MoldQualityService.java
对比新文件
@@ -0,0 +1,47 @@
package com.thhy.engineering.modules.biz.moldquality.service;
import com.thhy.engineering.modules.biz.moldquality.entity.MoldQualityEntity;
import com.thhy.general.common.BasicResult;
import java.util.Map;
/**
 * @Author QiuYuHao
 * @CreateDate 2023-10-25 15:06:07
 * 模具检测逻辑层
 */
public interface MoldQualityService {
    BasicResult insert(MoldQualityEntity moldQualityEntity);
    BasicResult delete(Integer id);
    BasicResult update(MoldQualityEntity moldQualityEntity);
    BasicResult findAll(Map<String,Object> map);
    BasicResult findOneById(Integer id);
    /**
     * 获取模具编号列表
     * @return
     */
    BasicResult getMoldNum(String proId);
    /**
     * 获取模具型号列表
     * @return
     * @param map
     */
    BasicResult getMoldCode(Map<String,Object> map);
    /**
     * 获取1条模具
     * @return
     */
    BasicResult getMoldByProIdAndModNumAndModCode(Map<String,Object> map);
}
hd/pipe/engineeringManage/src/main/java/com/thhy/engineering/modules/biz/moldquality/service/impl/MoldQualityServiceImpl.java
对比新文件
@@ -0,0 +1,106 @@
package com.thhy.engineering.modules.biz.moldquality.service.impl;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.thhy.engineering.modules.biz.moldquality.entity.MoldQualityEntity;
import com.thhy.engineering.modules.biz.moldquality.entity.MoldQualityFileEntity;
import com.thhy.engineering.modules.biz.moldquality.mapper.MoldQualityFileMapper;
import com.thhy.engineering.modules.biz.moldquality.mapper.MoldQualityMapper;
import com.thhy.engineering.modules.biz.moldquality.service.MoldQualityService;
import com.thhy.general.common.BasicResult;
import com.thhy.general.config.SysUserInfo;
import com.thhy.general.utils.UserInfoUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
import java.util.Map;
/**
 * @Author QiuYuHao
 * @CreateDate 2023-10-25 15:06:40
 * 磨具监测实现层
 */
@Service
public class MoldQualityServiceImpl implements MoldQualityService {
    @Autowired
    private MoldQualityMapper mapper;
    @Autowired
    private MoldQualityFileMapper moldQualityFileMapper;
    @Override
    @Transactional(rollbackFor = Exception.class)
    public BasicResult insert(MoldQualityEntity moldQualityEntity) {
        SysUserInfo sysUserInfo = UserInfoUtils.getInstance().getUserInfo();
        moldQualityEntity.setCompanyId(sysUserInfo.getCompanyId());
        moldQualityEntity.setCreateUser(sysUserInfo.getRealName());
        mapper.insert(moldQualityEntity);
        MoldQualityEntity newOne = mapper.findNewOne();
        moldQualityEntity.getMoldQualityFileEntities().forEach(modFile->{
            modFile.setMoldQualityId(newOne.getId());
        });
        moldQualityFileMapper.insertList(moldQualityEntity.getMoldQualityFileEntities());
        return BasicResult.success();
    }
    @Override
    @Transactional(rollbackFor = Exception.class)
    public BasicResult delete(Integer id) {
        mapper.delete(id);
        moldQualityFileMapper.delete(id);
        return BasicResult.success();
    }
    @Override
    @Transactional(rollbackFor = Exception.class)
    public BasicResult update(MoldQualityEntity moldQualityEntity) {
        mapper.update(moldQualityEntity);
        moldQualityFileMapper.delete(moldQualityEntity.getId());
        List<MoldQualityFileEntity> moldQualityFileEntities = moldQualityEntity.getMoldQualityFileEntities();
        moldQualityFileEntities.forEach(moldFile->{
            moldFile.setMoldQualityId(moldQualityEntity.getId());
        });
        moldQualityFileMapper.insertList(moldQualityFileEntities);
        return BasicResult.success();
    }
    @Override
    public BasicResult findAll(Map<String, Object> map) {
        SysUserInfo sysUserInfo = UserInfoUtils.getInstance().getUserInfo();
        String companyId = sysUserInfo.getCompanyId();
        map.put("companyId",companyId);
        PageHelper.startPage((int)map.get("pageNum"),(int)map.get("pageSize"));
        List<MoldQualityEntity> all = mapper.findAll(map);
        all.forEach(moldQualityOne->{
            moldQualityOne.setMoldQualityFileEntities(moldQualityFileMapper.findFileList(moldQualityOne.getId()));
        });
        PageInfo<MoldQualityEntity> moldQualityEntities = new PageInfo<>(all);
        return BasicResult.success(moldQualityEntities);
    }
    @Override
    public BasicResult findOneById(Integer id) {
        MoldQualityEntity oneById = mapper.findOneById(id);
        oneById.setMoldQualityFileEntities(moldQualityFileMapper.findFileList(oneById.getId()));
        return BasicResult.success(oneById);
    }
    @Override
    public BasicResult getMoldNum(String proId) {
        return BasicResult.success(mapper.getMoldNum(proId));
    }
    @Override
    public BasicResult getMoldCode(Map<String, Object> map) {
        return BasicResult.success(mapper.getMoldCode(map));
    }
    @Override
    public BasicResult getMoldByProIdAndModNumAndModCode(Map<String, Object> map) {
        return BasicResult.success(mapper.getMoldByProIdAndModNumAndModCode(map));
    }
}
hd/pipe/engineeringManage/src/main/resources/mapping/MoldQualityFileMapper.xml
对比新文件
@@ -0,0 +1,38 @@
<?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.thhy.engineering.modules.biz.moldquality.mapper.MoldQualityFileMapper">
    <!--查询列表-->
    <select id="findFileList" resultType="com.thhy.engineering.modules.biz.moldquality.entity.MoldQualityFileEntity">
        SELECT
            t.id,
            t.moldQualityId,
            t.fileName,
            t.fileUrl,
            t.createTime
        from t_mold_quality_file t
        where 1=1
        <if test="moldQualityId != null and moldQualityId !=''">
            and t.moldQualityId = #{moldQualityId}
        </if>
    </select>
    <!--插入操作-->
    <insert id="insertList" parameterType="java.util.List">
        INSERT INTO t_mold_quality_file ( moldQualityId,fileName, fileUrl )
        VALUES
        <foreach collection = "list" item = "item" separator=",">
            ( #{item.moldQualityId},#{item.fileName},#{item.fileUrl} )
        </foreach>
    </insert>
    <!--根据ID删除-->
    <delete id="delete">
        delete from t_mold_quality_file
        where moldQualityId=#{moldQualityId}
    </delete>
</mapper>
hd/pipe/engineeringManage/src/main/resources/mapping/MoldQualityMapper.xml
对比新文件
@@ -0,0 +1,273 @@
<?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.thhy.engineering.modules.biz.moldquality.mapper.MoldQualityMapper">
    <!--查询列表-->
    <select id="findAll" parameterType="java.util.Map" resultType="com.thhy.engineering.modules.biz.moldquality.entity.MoldQualityEntity">
        SELECT
            t.id,
            t.mouldCode,
            t.mouldNum,
            t.blockNum,
            t.size,
            t.turn,
            t.groutingHole,
            t.content,
            t.checkDate,
            t.checkUnit,
            t.createDate,
            t.createUser,
            t.companyId,
            t.proId,
            sp.pro_name proName
        from t_mold_quality t
        left join sys_project sp ON sp.pro_id = t.proId
        where sp.company_id = #{companyId}
        <if test="proId != null and proId !=''">
            and t.proId = #{proId}
        </if>
        <if test="mouldNum != null and mouldNum !=''">
            and t.mouldNum = #{mouldNum}
        </if>
        <if test="mouldCode != null and mouldCode !=''">
            and t.mouldCode = #{mouldCode}
        </if>
        order by t.createDate desc
    </select>
    <select id="findNewOne" resultType="com.thhy.engineering.modules.biz.moldquality.entity.MoldQualityEntity">
        SELECT
                t.id,
                t.mouldCode,
                t.mouldNum,
                t.blockNum,
                t.size,
                t.turn,
                t.groutingHole,
                t.content,
                t.checkDate,
                t.checkUnit,
                t.createDate,
                t.createUser,
                t.companyId,
                t.proId
        from t_mold_quality t
        order by t.createDate desc
        limit 1
    </select>
    <!--插入操作-->
    <insert id="insert">
        insert into t_mold_quality
        <trim prefix="(" suffix=")" suffixOverrides="," >
            <if test="id != null">
                id,
            </if>
            <if test="mouldCode != null">
                mouldCode,
            </if>
            <if test="mouldNum != null">
                mouldNum,
            </if>
            <if test="blockNum != null">
                blockNum,
            </if>
            <if test="size != null">
                size,
            </if>
            <if test="turn != null">
                turn,
            </if>
            <if test="groutingHole != null">
                groutingHole,
            </if>
            <if test="content != null">
                content,
            </if>
            <if test="checkDate != null">
                checkDate,
            </if>
            <if test="checkUnit != null">
                checkUnit,
            </if>
            <if test="createDate != null">
                createDate,
            </if>
            <if test="createUser != null">
                createUser,
            </if>
            <if test="companyId != null">
                companyId,
            </if>
            <if test="proId != null">
                proId,
            </if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides="," >
            <if test="id != null">
                #{id,jdbcType=INTEGER},
            </if>
            <if test="mouldCode != null">
                #{mouldCode,jdbcType=VARCHAR},
            </if>
            <if test="mouldNum != null">
                #{mouldNum,jdbcType=VARCHAR},
            </if>
            <if test="blockNum != null">
                #{blockNum,jdbcType=VARCHAR},
            </if>
            <if test="size != null">
                #{size,jdbcType=VARCHAR},
            </if>
            <if test="turn != null">
                #{turn,jdbcType=VARCHAR},
            </if>
            <if test="groutingHole != null">
                #{groutingHole,jdbcType=VARCHAR},
            </if>
            <if test="content != null">
                #{content,jdbcType=VARCHAR},
            </if>
            <if test="checkDate != null">
                #{checkDate,jdbcType=TIMESTAMP},
            </if>
            <if test="checkUnit != null">
                #{checkUnit,jdbcType=VARCHAR},
            </if>
            <if test="createDate != null">
                #{createDate,jdbcType=TIMESTAMP},
            </if>
            <if test="createUser != null">
                #{createUser,jdbcType=VARCHAR},
            </if>
            <if test="companyId != null">
                #{companyId,jdbcType=VARCHAR},
            </if>
            <if test="proId != null">
                #{proId,jdbcType=VARCHAR},
            </if>
        </trim>
    </insert>
    <!--更新操作-->
    <update id="update">
        update t_mold_quality
        <set>
            <if test="mouldCode != null">
                mouldCode = #{mouldCode,jdbcType=VARCHAR},
            </if>
            <if test="mouldNum != null">
                mouldNum = #{mouldNum,jdbcType=VARCHAR},
            </if>
            <if test="blockNum != null">
                blockNum = #{blockNum,jdbcType=VARCHAR},
            </if>
            <if test="size != null">
                size = #{size,jdbcType=VARCHAR},
            </if>
            <if test="turn != null">
                turn = #{turn,jdbcType=VARCHAR},
            </if>
            <if test="groutingHole != null">
                groutingHole = #{groutingHole,jdbcType=VARCHAR},
            </if>
            <if test="content != null">
                content = #{content,jdbcType=VARCHAR},
            </if>
            <if test="checkDate != null">
                checkDate = #{checkDate,jdbcType=TIMESTAMP},
            </if>
            <if test="checkUnit != null">
                checkUnit = #{checkUnit,jdbcType=VARCHAR},
            </if>
            <if test="createDate != null">
                createDate = #{createDate,jdbcType=TIMESTAMP},
            </if>
            <if test="createUser != null">
                createUser = #{createUser,jdbcType=VARCHAR},
            </if>
            <if test="companyId != null">
                companyId = #{companyId,jdbcType=VARCHAR},
            </if>
            <if test="proId != null">
                proId = #{proId,jdbcType=VARCHAR},
            </if>
        </set>
        where id=#{id,jdbcType=INTEGER}
    </update>
    <!--根据ID删除-->
    <delete id="delete">
        delete from t_mold_quality
        where id=#{id}
    </delete>
    <select id="findOneById" resultType="com.thhy.engineering.modules.biz.moldquality.entity.MoldQualityEntity">
        select
                t.id,
                t.mouldCode,
                t.mouldNum,
                t.blockNum,
                t.size,
                t.turn,
                t.groutingHole,
                t.content,
                t.checkDate,
                t.checkUnit,
                t.createDate,
                t.createUser,
                t.companyId,
                t.proId,
                sp.pro_name proName
        from t_mold_quality t
        left join sys_project sp ON sp.pro_id = t.proId
        where t.id=#{id}
    </select>
    <select id="getMoldNum" resultType="java.util.Map">
        select
                DISTINCT mould_num mouldNum
        from sys_mould
        where pro_id =#{proId,jdbcType=VARCHAR}
    </select>
    <select id="getMoldCode" resultType="java.util.Map">
        select
                DISTINCT mould_code mouldCode
        from sys_mould
        where 1=1
        <if test="proId != null and proId !=''">
            and pro_id = #{proId}
        </if>
        <if test="mouldNum != null and mouldNum !=''">
            and mould_num = #{mouldNum}
        </if>
    </select>
    <select id="getMoldByProIdAndModNumAndModCode" resultType="java.util.Map">
        select
                sd1.dict_name as mouldTypeName,
                sd2.dict_name as mouldSizeName,
                sd3.dict_name as mouldTurnName,
                sd4.dict_name as groutingHolesName
        from sys_mould t
                     left join sys_dict sd1 on sd1.dict_id = t.mould_type
                     left join sys_dict sd2 on sd2.dict_id = t.mould_size
                     left join sys_dict sd3 on sd3.dict_id = t.mould_turn
                     left join sys_dict sd4 on sd4.dict_id = t.grouting_holes
        WHERE t.is_use = 1
        <if test="mouldNum!=null and mouldNum!=''">
            and t.mould_num = #{mouldNum}
        </if>
        <if test="proId!=null and proId!=''">
            and t.pro_id = #{proId}
        </if>
        <if test="mouldCode!=null and mouldCode!=''">
            and t.mould_code = #{mouldCode}
        </if>
    </select>
</mapper>
hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/embedment/entity/SysEmbedmentGoodsEntity.java
@@ -31,6 +31,7 @@
     * 预埋件类型  字典
     */
    private String embedmentType;
    @Excel(sort = 3,title = "类型")
    private String dictName;
    /**
@@ -42,23 +43,25 @@
    /**
     * 计量单位
     */
    @Excel(sort = 3,title = "计量单位")
    @Excel(sort = 4,title = "计量单位")
    private String unit;
    /**
     * 库存数量
     */
    @Excel(sort = 5,title = "库存数量")
    private Integer stock;
    /**
     * 位置
     */
    @Excel(sort = 4,title = "位置")
    @Excel(sort = 7,title = "位置")
    private String position;
    /**
     * 报警数量
     */
    @Excel(sort = 6,title = "报警数")
    private Integer alarmCount;
    /**
@@ -76,7 +79,6 @@
     */
    private String createUser;
    @Excel(sort = 5,title = "备注")
    private String remark;
    private String companyId;
@@ -84,7 +86,7 @@
     * This field was generated by MyBatis Generator.
     * This field corresponds to the database table sys_assist_good
     *
     * @mbg.generated Tue Apr 11 08:58:47 CST 2023
     * @mbg.generated Tue AembedmentInsetRecord/embedmentRecordListpr 11 08:58:47 CST 2023
     */
    private static final long serialVersionUID = 1L;
hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/embedment/entity/SysEmbedmentRecordEntity.java
@@ -29,9 +29,10 @@
    //预埋件名称
    private String embedmentName;
    //预埋件规格
    @Excel(sort = 1,title = "规格型号")
    private String embedmentModel;
    @Excel(sort = 1,title = "预埋件名称")
    @Excel(sort = 0,title = "预埋件名称")
    private String embedmentNameAndModel;
    public String getEmbedmentNameAndModel() {
@@ -46,7 +47,7 @@
    /**
     * 出库量/入库量
     */
    @Excel(sort = 2,title = "数量")
    @Excel(sort = 2,title = "入库数量")
    private Integer changeStock;
    /**
@@ -90,6 +91,7 @@
    /**
     * 入库时间
     */
    @Excel(sort = 6,title = "入库时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private String createTime;
hd/pipe/mobile/src/main/java/com/thhy/mobile/modules/biz/checkdevice/entity/CheckDeviceDto.java
@@ -15,4 +15,6 @@
    private Date endTime;
    private String id;
    private String bigNumber;
}
hd/pipe/mobile/src/main/resources/mapping/CheckDeviceMapper.xml
@@ -107,6 +107,9 @@
                <if test="bigDeviceName !=null and bigDeviceName !=''">
                    bd.big_device_name LIKE concat('%',#{bigDeviceName},'%') AND
                </if>
                <if test="bigNumber !=null and bigNumber !=''">
                    bd.big_number LIKE concat('%',#{bigNumber},'%') AND
                </if>
                <if test="startTime !=null">
                    t.check_time &gt;= #{startTime} AND
                </if>
hd/pipe/secure/src/main/resources/mapping/PipeReportMapper.xml
对比新文件
@@ -0,0 +1,103 @@
<?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.thhy.secure.modules.biz.pipereport.mapper.PipeReportMapper">
   <select id="getPipeReportList" resultType="com.thhy.secure.modules.biz.pipereport.entity.PipeReportEntity">
       SELECT
               c.pro_id proId,
               c.pro_name proName,
               IFNULL(c.produceTotal,0) produceTotal,
               IFNULL(d.qualifiedTotal,0) qualifiedTotal,
               IFNULL(e.shippingNum,0) shippingNum
       FROM      (
                         SELECT
                             COUNT(a.pro_id) produceTotal,
                             b.pro_id,
                             b.pro_name
                         FROM  sys_project b
                         LEFT JOIN t_pipe_info a on b.pro_id = a.pro_id
                         WHERE b.is_use =1 and b.company_id = #{companyId}
                         GROUP BY b.pro_id
                         ) c
                         LEFT JOIN
                         (
                                 SELECT
                                         COUNT(a.pro_id) qualifiedTotal,
                                         a.pro_id,
                                         b.pro_name
                                 FROM t_pipe_info a
                                              LEFT JOIN sys_project b on b.pro_id = a.pro_id
                                 WHERE a.check_result = 1 and b.company_id = #{companyId}
                                 GROUP BY a.pro_id
                                 ) d ON d.pro_id = c.pro_id
                         LEFT JOIN
                         (
                                 SELECT
                                         COUNT(a.pro_id) shippingNum,
                                         a.pro_id,
                                         b.pro_name
                                 FROM t_pipe_out a
                                              LEFT JOIN sys_project b on b.pro_id = a.pro_id
                                 WHERE b.company_id = #{companyId}
                                 GROUP BY a.pro_id
                                 ) e on e.pro_id = c.pro_id
   </select>
    <select id="getSteelReportList" resultType="com.thhy.secure.modules.biz.pipereport.entity.PipeReportEntity">
                SELECT
                        c.pro_id proId,
                        c.pro_name proName,
                        IFNULL(c.produceTotal,0) produceTotal,
                        IFNULL(d.qualifiedTotal,0) qualifiedTotal,
                        IFNULL(e.moldedNotNum,0) moldedNotNum,
                        IFNULL(f.moldedNum,0) moldedNum
                FROM(
                            SELECT
                                    COUNT(a.pro_id) produceTotal,
                                    b.pro_id,
                                    b.pro_name
                            FROM sys_project b
                                         LEFT JOIN t_steel_produce a on b.pro_id = a.pro_id
                            WHERE b.is_use =1 and b.company_id = #{companyId}
                            GROUP BY b.pro_id
                            ) c
                            LEFT JOIN
                            (
                                    SELECT
                                            COUNT(a.pro_id) qualifiedTotal,
                                            a.pro_id,
                                            b.pro_name
                                    FROM t_steel_produce a
                                                 LEFT JOIN sys_project b on b.pro_id = a.pro_id
                                    WHERE a.is_qualified = 1 and a.is_use = 1  and b.company_id = #{companyId}
                                    GROUP BY a.pro_id
                                    ) d ON d.pro_id = c.pro_id
                            LEFT JOIN
                            (
                                    SELECT
                                            COUNT(a.pro_id) moldedNotNum,
                                            a.pro_id,
                                            b.pro_name
                                    FROM t_steel_produce a
                                                 LEFT JOIN sys_project b on b.pro_id = a.pro_id
                                    WHERE a.is_model = 2 and a.is_use = 1  and b.company_id = #{companyId}
                                    GROUP BY a.pro_id
                                    ) e on e.pro_id = c.pro_id
                            LEFT JOIN
                            (
                                    SELECT
                                            COUNT(a.pro_id) moldedNum,
                                            a.pro_id,
                                            b.pro_name
                                    FROM t_steel_produce a
                                                 LEFT JOIN sys_project b on b.pro_id = a.pro_id
                                    WHERE a.is_model = 1 and a.is_use = 1  and b.company_id = #{companyId}
                                    GROUP BY a.pro_id
                                    ) f on f.pro_id = c.pro_id
    </select>
</mapper>
web/src/api/index.js
@@ -23,6 +23,7 @@
import Safety from './modules/safety'; // 安全管理模块
import Scan from './modules/scan'; // 扫码跳转到对应页面
import Green from './modules/green'; // 扫码跳转到对应页面
import Quality from './modules/quality'; // 质量管理界面
export default {
  System,
@@ -46,5 +47,6 @@
  Analyse,
  Safety,
  Scan,
  Green
  Green,
  Quality
}
web/src/api/modules/quality.js
对比新文件
@@ -0,0 +1,34 @@
/**
 * 质量管理
 */
 import axios from '../request';
 export default{
    /**
     * 模具质量检测
     */
    // 获取模具编号
    getMouldNumberLists: params =>
        axios.get('/engineering/moldQuality/getMoldNum', {params}),
    // 获取模具型号
    getMuuldCodeLists: params =>
        axios.post('/engineering/moldQuality/getMoldCode', params),
    //通过项目,模具编号,型号获取尺寸等信息
    getProjectThroughSizes: params =>
        axios.post('/engineering/moldQuality/getMoldByProIdAndModNumAndModCode', params),
    //查询质量尺寸检查列表
    searchQulityLists: params =>
        axios.post('/engineering/moldQuality/findAll', params),
    //添加质量尺寸
    addQulityInfo: params =>
        axios.post('/engineering/moldQuality/insert', params),
    //修改质量尺寸
    updateQulityInfo: params =>
        axios.post('/engineering/moldQuality/update', params),
    //质量尺寸详情
    detailsQulityInfo: params =>
        axios.get('/engineering/moldQuality/findOneById', {params}),
    //删除质量尺寸
    deleteQulityInfo: params =>
        axios.get('/engineering/moldQuality/delete', {params}),
 }
web/src/components/element/Pagination.vue
@@ -1,78 +1,82 @@
<template>
  <div class="pagination-container">
    <el-pagination @current-change="handleCurrentChange" @size-change="handleSizeChange" :page-sizes="[10, 20, 30]"
      :total="total" :current-page="pageNum" :page-size="pageSize"
      layout="total, sizes, prev, pager, next, jumper"></el-pagination>
  </div>
</template>
<script>
export default {
  name: "pagination",
  data() {
    return {};
  },
  props: {
    // 总页数
    total: {
      type: Number,
    },
    // 当前页
    pageNum: {
      type: Number,
    },
    // 每页显示条数
    pageSize: {
      type: Number,
    },
  },
  methods: {
    // 当前页码变化
    handleCurrentChange(val) {
      this.$emit("change-page-num", val);
    },
    //  每页查看条数变化
    handleSizeChange(val) {
      this.$emit("change-page-size", val);
    },
  },
  // watch: {
  //   pageSize: {
  //     // immediate: true,
  //     handler(newValue, oldValue) {
  //       this.page._pageSize = this.newValue;
  //       console.log("pageSize", newValue, oldValue);
  //     },
  //   },
  //   pageNum: {
  //     // immediate: true,
  //     handler(newValue, oldValue) {
  //       this.page._currentPage = newValue;
  //       console.log("pageNum", newValue, oldValue);
  //     },
  //   },
  // },
};
</script>
<style lang="scss" scoped>
// 主体底部样式
::v-deep.el-pagination .btn-prev,
::v-deep.el-pagination .btn-next,
::v-deep.el-pagination .el-pager li {
  background-color: rgba(20, 25, 58, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.12);
  font-weight: 400;
  color: #E2E4E9;
  border-radius: 4px;
}
::v-deep.el-pagination .el-pager li:not(.disabled).active {
  color: #fff;
  border: 1px solid #39B5FE;
  background-color: #0B3562;
  font-weight: 400;
}
.pagination-container {
  margin-top: 30px;
}
<template>
  <div class="pagination-container">
    <el-pagination @current-change="handleCurrentChange" @size-change="handleSizeChange" :page-sizes="[10, 20, 30]"
      :total="total" :current-page="pageNum" :page-size="pageSize"
      layout="total, sizes, prev, pager, next, jumper"></el-pagination>
  </div>
</template>
<script>
export default {
  name: "pagination",
  data() {
    return {};
  },
  props: {
    // 总页数
    total: {
      type: Number,
    },
    // 当前页
    pageNum: {
      type: Number,
    },
    // 每页显示条数
    pageSize: {
      type: Number,
    },
  },
  methods: {
    // 当前页码变化
    handleCurrentChange(val) {
      this.$emit("change-page-num", val);
    },
    //  每页查看条数变化
    handleSizeChange(val) {
      this.$emit("change-page-size", val);
    },
  },
  // watch: {
  //   pageSize: {
  //     // immediate: true,
  //     handler(newValue, oldValue) {
  //       this.page._pageSize = this.newValue;
  //       console.log("pageSize", newValue, oldValue);
  //     },
  //   },
  //   pageNum: {
  //     // immediate: true,
  //     handler(newValue, oldValue) {
  //       this.page._currentPage = newValue;
  //       console.log("pageNum", newValue, oldValue);
  //     },
  //   },
  // },
};
</script>
<style lang="scss" scoped>
.el-pagination {
  text-align: right;
}
// 主体底部样式
::v-deep.el-pagination .btn-prev,
::v-deep.el-pagination .btn-next,
::v-deep.el-pagination .el-pager li {
  background-color: rgba(20, 25, 58, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.12);
  font-weight: 400;
  color: #E2E4E9;
  border-radius: 4px;
}
::v-deep.el-pagination .el-pager li:not(.disabled).active {
  color: #fff;
  border: 1px solid #39B5FE;
  background-color: #0B3562;
  font-weight: 400;
}
.pagination-container {
  margin: 30px 0;
}
</style>
web/src/components/element/Table.vue
@@ -142,9 +142,12 @@
<style lang="scss" scoped>
.box {
  height: 100%;
  display: flex;
  flex-direction: column;
}
.el-table {
  overflow: auto;
  border: none;
  height: 100%;
}
web/src/views/DuctpiecePLM/ReportCenter/BearReport.vue
@@ -108,6 +108,8 @@
          if(res.statusMsg === 'ok') {
            this.total = res.data.total;
            this.dataList = res.data.list;
          }else{
            this.$message.warning(res.statusMsg)
          }
          this.loading = false;
        })
web/src/views/DuctpiecePLM/ReportCenter/DuctReport.vue
@@ -108,6 +108,8 @@
          if(res.statusMsg === 'ok') {
            this.total = res.data.total;
            this.dataList = res.data.list;
          }else{
            this.$message.warning(res.statusMsg)
          }
          this.loading = false;
        })
web/src/views/GoodManage/components/AuxiliaryInvent.vue
@@ -1,304 +1,304 @@
<template>
  <div class="main tabs_main" style="height:89%">
    <div class="main_header">
      <div class="header_item">
        <span class="header_label">物品名称:</span>
        <el-input v-model="search.assistName" :size="size" clearable placeholder="请输入物品名称"></el-input>
      </div>
      <div class="header_item">
        <el-button   :size="size" icon="el-icon-search" v-if="showButton('search')" @click="searchButtonInfo(true)">查询</el-button>
        <el-button  :size="size" icon="el-icon-upload2" v-if="showButton('export')" @click="exportFile">导出Excel</el-button>
      </div>
    </div>
    <div class="main_content">
      <el-table
        v-loading="loading"
        :data="dataList"
        height="100%"
        :cell-style="cellStyle">
        <el-table-column align="center" label="序号" width="60">
          <template #default="scope">
            <span>{{(pageNum - 1) * pageSize + scope.$index + 1}}</span>
          </template>
        </el-table-column>
        <el-table-column prop="assistName" label="物品名称" align="center"></el-table-column>
        <el-table-column prop="assistModel" label="型号规格" align="center" ></el-table-column>
        <el-table-column prop="dictName" label="类别" align="center" ></el-table-column>
        <el-table-column prop="unit" label="计量单位" align="center"></el-table-column>
        <el-table-column prop="stock" label="库存数量" align="center" >
          <template #default="{row}">
              {{row.stock === null?0:row.stock}}
          </template>
        </el-table-column>
        <el-table-column prop="alarmCount" label="报警数" align="center" >
          <template #default="{row}">
              {{row.alarmCount === null?0:row.alarmCount}}
          </template>
        </el-table-column>
        <el-table-column prop="position" label="位置" align="center" show-overflow-tooltip></el-table-column>
        <el-table-column label="操作" align="center" width="200">
          <template #default="{ row }">
            <el-button class="table_btn" size="mini" v-if="showButton('update')" @click="updateProp(row)">库存校正</el-button>
            <el-button class="delete_btn" size="mini" v-if="showButton('update')" @click="updatePropAlarm(row)">预警设置</el-button>
          </template>
        </el-table-column>
      </el-table>
    </div>
    <div class="main_footer">
      <el-pagination
        background
        @current-change="changePageNum"
        @size-change="changePageSize"
        :current-page="pageNum"
        :page-sizes="[10, 20, 50, 100]"
        :page-size="pageSize"
        layout="total, sizes, prev, pager, next, jumper"
        :total="total">
      </el-pagination>
    </div>
    <el-dialog
      class="prop_dialog"
      :title="asyncTitle ? '预警设置' : '库存校正'"
      :close-on-click-modal="false"
      :visible.sync="asyncVisible"
      width="35%">
      <el-form ref="ruleForm" :model="ruleForm" :rules="rules" label-width="auto" class="rule_form">
        <el-form-item label="物品名称:" prop="assistName">
          <el-input v-model="ruleForm.assistName" :size="size" clearable placeholder="请输入物品名称" :disabled="disabled"></el-input>
        </el-form-item>
        <el-form-item label="规格型号:" prop="assistModel">
          <el-input v-model="ruleForm.assistModel" :size="size" clearable placeholder="请输入规格型号" :disabled="disabled"></el-input>
        </el-form-item>
        <el-form-item label="库存数量:" prop="correctionBefore" v-if="!asyncTitle">
          <el-input v-model="ruleForm.correctionBefore" :size="size" clearable placeholder="请输入库存数量" :disabled="disabled"></el-input>
        </el-form-item>
        <el-form-item label="校正数量:" prop="correctionNum" v-if="!asyncTitle">
          <el-input v-model="ruleForm.correctionNum" type="number" :size="size" clearable placeholder="请输入校正数量" @blur="changeAfter"></el-input>
        </el-form-item>
        <el-form-item label="校正后数量:" prop="correctionAfter" v-if="!asyncTitle">
          <el-input v-model="ruleForm.correctionAfter" :size="size" clearable placeholder="请输入校正后数量" :disabled="true"></el-input>
        </el-form-item>
        <el-form-item label="预警数量:" prop="alarmCount" v-if="asyncTitle">
          <el-input v-model="ruleForm.alarmCount" :size="size" clearable placeholder="请输入预警数量" ></el-input>
        </el-form-item>
        <el-form-item label="备注:" prop="remark" v-if="!asyncTitle">
          <el-input v-model="ruleForm.remark" :size="size" type="textarea" :rows="2" clearable placeholder="请输入备注"></el-input>
        </el-form-item>
      </el-form>
      <div slot="footer">
        <el-button @click="asyncVisible = false">取 消</el-button>
        <el-button class="submit_btn" @click="asyncTitle ? submitInsert() : submitUpdate()">提 交</el-button>
      </div>
    </el-dialog>
  </div>
</template>
<script>
import { buttonPinia } from '../../../pinia/index';
import { throttle, changeSize,downFiles } from '../../../plugins/public'; // 导入节流、动态切换组件尺寸方法
  export default {
    data() {
      return {
        size: changeSize(), // 组件尺寸
        pageNum: 1,
        pageSize: 10,
        assistId:"",//一行ID
        search:{},//查询条件
        total: 0,
        loading: false,
        disabled:false,//是否禁止修改
        dataList: [], //库存管理信息列表
        asyncTitle: true, // 对话框title 预警设置:true  库存校正:false
        asyncVisible: false, // 添加 修改对话框
        ruleForm: {
        }, // 按钮表单
        rules: {
          assistName: [{
            required: true,
            message: '请输入物品名称',
            trigger: 'blur'
          }],
          assistModel: [{
            required: true,
            message: '请输入规格型号',
            trigger: 'blur'
          }],
          alarmCount: [{
            required: true,
            message: '请输入预警数量',
            trigger: 'blur'
          }],
          correctionBefore: [{
            required: true,
            message: '请输入库存数量',
            trigger: 'blur'
          }],
          correctionNum: [{
            required: true,
            message: '请输入校正数量',
            trigger: 'blur'
          }],
          correctionAfter: [{
            required: true,
            message: '请输入校正后数量',
            trigger: 'blur'
          }],
        },
      }
    },
    watch: {
      asyncVisible(bol) {
        if(!bol) {
          this.ruleForm = {};
          this.$refs.ruleForm.resetFields();
        }
      }
    },
    mounted() {
      const that = this;
      // 根据窗口大小动态修改组件尺寸
      window.onresize = () => {
        that.size = changeSize();
      }
    },
    methods: {
      cellStyle({row,column}){
        if(row.stock <= row.alarmCount &&column.property =="stock"){
          return {
            'color':'red'
          }
        }
      },
      //计算出校正后重量
      changeAfter(){
        this.$set(this.ruleForm,'correctionAfter',this.ruleForm.correctionBefore+this.ruleForm.correctionNum*1)
      },
      // 转圈圈
        functionLoading() {
            this.loadingView = this.$loading({
                lock: true,
                text: '请稍后...',
                spinner: 'el-icon-loading',
                background: 'rgba(0, 0, 0, 0.7)'
            });
        },
      //导出Excel
      exportFile(){
        this.functionLoading();
        let params  = Object.assign({},this.search)
        this.$api.Auxiliary.exportInventDatas(params).then(res => {
            downFiles(res, '库存管理信息', 'xls')
            this.loadingView.close()
        })
        .catch(() => {
          this.loadingView.close();
        })
      },
      // 查询按钮列表信息
      searchButtonInfo(bol) {
        if(bol) {
          this.pageNum = 1;
        }
        let params = Object.assign({},this.search,{
          pageNum: this.pageNum,
          pageSize: this.pageSize
        })
        this.loading = true;
        this.$api.Auxiliary.searchAuxiliaryType(params).then((res) => {
          if(res.statusMsg === 'ok') {
            this.total = res.data.total;
            this.dataList = res.data.list;
          }
          this.loading = false;
        })
      },
      //预警设置按钮
      updatePropAlarm(row){
        this.assistId = row.id
        this.asyncTitle = true;
        this.asyncVisible = true;
        this.disabled = true
        this.$api.Auxiliary.detailsAuxiliaryType({assistId: row.id}).then(res=>{
            if(res.statusMsg === 'ok'){
                this.ruleForm = res.data
            }else{
                this.$message.warning(res.statusMsg)
            }
        })
      },
      //库存校正按钮
      updateProp(row) {
        this.assistId = row.id
        this.asyncTitle = false;
        this.asyncVisible = true;
        this.disabled = true
        this.$api.Auxiliary.detailsAuxiliaryType({assistId: row.id}).then(res=>{
            if(res.statusMsg === 'ok'){
                this.ruleForm = res.data
                this.$set(this.ruleForm,'correctionBefore',res.data.stock)
                this.$set(this.ruleForm,'remark','')
            }else{
                this.$message.warning(res.statusMsg)
            }
        })
      },
      // 提交库存校正按钮信息
      submitUpdate: throttle(function() {
        this.$refs.ruleForm.validate((valid) => {
          if(valid) {
            const params = Object.assign({}, this.ruleForm);
            params.correctionNum = this.ruleForm.correctionNum*1
            params.correctionBefore = this.ruleForm.correctionBefore*1
            params.assistId = this.assistId
            delete params.id
            this.$api.Auxiliary.addAuxiliaryCheck(params).then((res) => {
              if(res.statusMsg === 'ok') {
                this.asyncVisible = false;
                this.searchButtonInfo(true);
                this.$message.success('库存校正成功!');
              } else {
                this.$message.warning(res.statusMsg);
              }
            })
          }
        })
      }, 3000),
      // 提交预警设置按钮信息
      submitInsert: throttle(function() {
        this.$refs.ruleForm.validate((valid) => {
          if(valid) {
            const params = Object.assign({}, this.ruleForm);
            this.$api.Auxiliary.updateAuxiliaryType(params).then((res) => {
              if(res.statusMsg === 'ok') {
                this.asyncVisible = false;
                this.searchButtonInfo(true);
                this.$message.success('预警设置成功!');
              } else {
                this.$message.warning(res.statusMsg);
              }
            })
          }
        })
      }, 3000),
      // 判断按钮权限信息
      showButton(str) {
        const pinia = buttonPinia();
        return pinia.$state.buttonInfo.includes(str);
      },
      // 切换页数
      changePageNum(page) {
        this.pageNum = page;
        this.searchButtonInfo();
      },
      // 切换每页条数
      changePageSize(size) {
        this.pageSize = size;
        this.searchButtonInfo();
      }
    }
  }
</script>
<style lang="scss" scoped>
@import'@/style/layout-main.scss';
<template>
  <div class="main tabs_main" style="height:89%">
    <div class="main_header">
      <div class="header_item">
        <span class="header_label">物品名称:</span>
        <el-input v-model="search.assistName" :size="size" clearable placeholder="请输入物品名称"></el-input>
      </div>
      <div class="header_item">
        <el-button   :size="size" icon="el-icon-search" v-if="showButton('search')" @click="searchButtonInfo(true)">查询</el-button>
        <el-button  :size="size" icon="el-icon-upload2" v-if="showButton('export')" @click="exportFile">导出Excel</el-button>
      </div>
    </div>
    <div class="main_content">
      <el-table
        v-loading="loading"
        :data="dataList"
        height="100%"
        :cell-style="cellStyle">
        <el-table-column align="center" label="序号" width="60">
          <template #default="scope">
            <span>{{(pageNum - 1) * pageSize + scope.$index + 1}}</span>
          </template>
        </el-table-column>
        <el-table-column prop="assistName" label="物品名称" align="center"></el-table-column>
        <el-table-column prop="assistModel" label="型号规格" align="center" ></el-table-column>
        <el-table-column prop="dictName" label="类别" align="center" ></el-table-column>
        <el-table-column prop="unit" label="计量单位" align="center"></el-table-column>
        <el-table-column prop="stock" label="库存数量" align="center" >
          <template #default="{row}">
              {{row.stock === null?0:row.stock}}
          </template>
        </el-table-column>
        <el-table-column prop="alarmCount" label="报警数" align="center" >
          <template #default="{row}">
              {{row.alarmCount === null?0:row.alarmCount}}
          </template>
        </el-table-column>
        <el-table-column prop="position" label="位置" align="center" show-overflow-tooltip></el-table-column>
        <el-table-column label="操作" align="center" width="200">
          <template #default="{ row }">
            <el-button class="table_btn" size="mini" v-if="showButton('update')" @click="updateProp(row)">库存校正</el-button>
            <el-button class="delete_btn" size="mini" v-if="showButton('update')" @click="updatePropAlarm(row)">预警设置</el-button>
          </template>
        </el-table-column>
      </el-table>
    </div>
    <div class="main_footer">
      <el-pagination
        background
        @current-change="changePageNum"
        @size-change="changePageSize"
        :current-page="pageNum"
        :page-sizes="[10, 20, 50, 100]"
        :page-size="pageSize"
        layout="total, sizes, prev, pager, next, jumper"
        :total="total">
      </el-pagination>
    </div>
    <el-dialog
      class="prop_dialog"
      :title="asyncTitle ? '预警设置' : '库存校正'"
      :close-on-click-modal="false"
      :visible.sync="asyncVisible"
      width="35%">
      <el-form ref="ruleForm" :model="ruleForm" :rules="rules" label-width="auto" class="rule_form">
        <el-form-item label="物品名称:" prop="assistName">
          <el-input v-model="ruleForm.assistName" :size="size" clearable placeholder="请输入物品名称" :disabled="disabled"></el-input>
        </el-form-item>
        <el-form-item label="规格型号:" prop="assistModel">
          <el-input v-model="ruleForm.assistModel" :size="size" clearable placeholder="请输入规格型号" :disabled="disabled"></el-input>
        </el-form-item>
        <el-form-item label="库存数量:" prop="correctionBefore" v-if="!asyncTitle">
          <el-input v-model="ruleForm.correctionBefore" :size="size" clearable placeholder="请输入库存数量" :disabled="disabled"></el-input>
        </el-form-item>
        <el-form-item label="校正数量:" prop="correctionNum" v-if="!asyncTitle">
          <el-input v-model="ruleForm.correctionNum" type="number" :size="size" clearable placeholder="请输入校正数量" @input="changeAfter"></el-input>
        </el-form-item>
        <el-form-item label="校正后数量:" prop="correctionAfter" v-if="!asyncTitle">
          <el-input v-model="ruleForm.correctionAfter" :size="size" clearable placeholder="请输入校正后数量" :disabled="true"></el-input>
        </el-form-item>
        <el-form-item label="预警数量:" prop="alarmCount" v-if="asyncTitle">
          <el-input v-model="ruleForm.alarmCount" :size="size" clearable placeholder="请输入预警数量" ></el-input>
        </el-form-item>
        <el-form-item label="备注:" prop="remark" v-if="!asyncTitle">
          <el-input v-model="ruleForm.remark" :size="size" type="textarea" :rows="2" clearable placeholder="请输入备注"></el-input>
        </el-form-item>
      </el-form>
      <div slot="footer">
        <el-button @click="asyncVisible = false">取 消</el-button>
        <el-button class="submit_btn" @click="asyncTitle ? submitInsert() : submitUpdate()">提 交</el-button>
      </div>
    </el-dialog>
  </div>
</template>
<script>
import { buttonPinia } from '../../../pinia/index';
import { throttle, changeSize,downFiles } from '../../../plugins/public'; // 导入节流、动态切换组件尺寸方法
  export default {
    data() {
      return {
        size: changeSize(), // 组件尺寸
        pageNum: 1,
        pageSize: 10,
        assistId:"",//一行ID
        search:{},//查询条件
        total: 0,
        loading: false,
        disabled:false,//是否禁止修改
        dataList: [], //库存管理信息列表
        asyncTitle: true, // 对话框title 预警设置:true  库存校正:false
        asyncVisible: false, // 添加 修改对话框
        ruleForm: {
        }, // 按钮表单
        rules: {
          assistName: [{
            required: true,
            message: '请输入物品名称',
            trigger: 'blur'
          }],
          assistModel: [{
            required: true,
            message: '请输入规格型号',
            trigger: 'blur'
          }],
          alarmCount: [{
            required: true,
            message: '请输入预警数量',
            trigger: 'blur'
          }],
          correctionBefore: [{
            required: true,
            message: '请输入库存数量',
            trigger: 'blur'
          }],
          correctionNum: [{
            required: true,
            message: '请输入校正数量',
            trigger: 'blur'
          }],
          correctionAfter: [{
            required: true,
            message: '请输入校正后数量',
            trigger: 'blur'
          }],
        },
      }
    },
    watch: {
      asyncVisible(bol) {
        if(!bol) {
          this.ruleForm = {};
          this.$refs.ruleForm.resetFields();
        }
      }
    },
    mounted() {
      const that = this;
      // 根据窗口大小动态修改组件尺寸
      window.onresize = () => {
        that.size = changeSize();
      }
    },
    methods: {
      cellStyle({row,column}){
        if(row.stock <= row.alarmCount &&column.property =="stock"){
          return {
            'color':'red'
          }
        }
      },
      //计算出校正后重量
      changeAfter(){
        this.$set(this.ruleForm,'correctionAfter',this.ruleForm.correctionBefore+this.ruleForm.correctionNum*1)
      },
      // 转圈圈
        functionLoading() {
            this.loadingView = this.$loading({
                lock: true,
                text: '请稍后...',
                spinner: 'el-icon-loading',
                background: 'rgba(0, 0, 0, 0.7)'
            });
        },
      //导出Excel
      exportFile(){
        this.functionLoading();
        let params  = Object.assign({},this.search)
        this.$api.Auxiliary.exportInventDatas(params).then(res => {
            downFiles(res, '库存管理信息', 'xls')
            this.loadingView.close()
        })
        .catch(() => {
          this.loadingView.close();
        })
      },
      // 查询按钮列表信息
      searchButtonInfo(bol) {
        if(bol) {
          this.pageNum = 1;
        }
        let params = Object.assign({},this.search,{
          pageNum: this.pageNum,
          pageSize: this.pageSize
        })
        this.loading = true;
        this.$api.Auxiliary.searchAuxiliaryType(params).then((res) => {
          if(res.statusMsg === 'ok') {
            this.total = res.data.total;
            this.dataList = res.data.list;
          }
          this.loading = false;
        })
      },
      //预警设置按钮
      updatePropAlarm(row){
        this.assistId = row.id
        this.asyncTitle = true;
        this.asyncVisible = true;
        this.disabled = true
        this.$api.Auxiliary.detailsAuxiliaryType({assistId: row.id}).then(res=>{
            if(res.statusMsg === 'ok'){
                this.ruleForm = res.data
            }else{
                this.$message.warning(res.statusMsg)
            }
        })
      },
      //库存校正按钮
      updateProp(row) {
        this.assistId = row.id
        this.asyncTitle = false;
        this.asyncVisible = true;
        this.disabled = true
        this.$api.Auxiliary.detailsAuxiliaryType({assistId: row.id}).then(res=>{
            if(res.statusMsg === 'ok'){
                this.ruleForm = res.data
                this.$set(this.ruleForm,'correctionBefore',res.data.stock)
                this.$set(this.ruleForm,'remark','')
            }else{
                this.$message.warning(res.statusMsg)
            }
        })
      },
      // 提交库存校正按钮信息
      submitUpdate: throttle(function() {
        this.$refs.ruleForm.validate((valid) => {
          if(valid) {
            const params = Object.assign({}, this.ruleForm);
            params.correctionNum = this.ruleForm.correctionNum*1
            params.correctionBefore = this.ruleForm.correctionBefore*1
            params.assistId = this.assistId
            delete params.id
            this.$api.Auxiliary.addAuxiliaryCheck(params).then((res) => {
              if(res.statusMsg === 'ok') {
                this.asyncVisible = false;
                this.searchButtonInfo(true);
                this.$message.success('库存校正成功!');
              } else {
                this.$message.warning(res.statusMsg);
              }
            })
          }
        })
      }, 3000),
      // 提交预警设置按钮信息
      submitInsert: throttle(function() {
        this.$refs.ruleForm.validate((valid) => {
          if(valid) {
            const params = Object.assign({}, this.ruleForm);
            this.$api.Auxiliary.updateAuxiliaryType(params).then((res) => {
              if(res.statusMsg === 'ok') {
                this.asyncVisible = false;
                this.searchButtonInfo(true);
                this.$message.success('预警设置成功!');
              } else {
                this.$message.warning(res.statusMsg);
              }
            })
          }
        })
      }, 3000),
      // 判断按钮权限信息
      showButton(str) {
        const pinia = buttonPinia();
        return pinia.$state.buttonInfo.includes(str);
      },
      // 切换页数
      changePageNum(page) {
        this.pageNum = page;
        this.searchButtonInfo();
      },
      // 切换每页条数
      changePageSize(size) {
        this.pageSize = size;
        this.searchButtonInfo();
      }
    }
  }
</script>
<style lang="scss" scoped>
@import'@/style/layout-main.scss';
</style>
web/src/views/MaterialsIndex/components/embedded/Invent.vue
@@ -1,294 +1,294 @@
<template>
  <div class="main tabs_main" style="height:89%">
    <div class="main_header">
      <div class="header_item">
        <span class="header_label">预埋件名称:</span>
        <el-input v-model="search.embedmentName" :size="size" clearable placeholder="请输入预埋件名称"></el-input>
      </div>
      <div class="header_item">
        <el-button :size="size" icon="el-icon-search" v-if="showButton('search')"
          @click="searchButtonInfo(true)">查询</el-button>
        <el-button :size="size" icon="el-icon-upload2" v-if="showButton('export')" @click="exportFile">导出Excel</el-button>
      </div>
    </div>
    <div class="main_content">
      <el-table v-loading="loading" :data="dataList" height="100%" :cell-style="cellStyle">
        <el-table-column align="center" label="序号" width="60">
          <template #default="scope">
            <span>{{ (pageNum - 1) * pageSize + scope.$index + 1 }}</span>
          </template>
        </el-table-column>
        <el-table-column prop="embedmentName" label="预埋件名称" align="center"></el-table-column>
        <el-table-column prop="embedmentModel" label="型号规格" align="center"></el-table-column>
        <el-table-column prop="dictName" label="类别" align="center"></el-table-column>
        <el-table-column prop="unit" label="计量单位" align="center"></el-table-column>
        <el-table-column prop="stock" label="库存数量" align="center">
          <template #default="{ row }">
            {{ row.stock === null ? 0 : row.stock }}
          </template>
        </el-table-column>
        <el-table-column prop="alarmCount" label="报警数" align="center">
          <template #default="{ row }">
            {{ row.alarmCount === null ? 0 : row.alarmCount }}
          </template>
        </el-table-column>
        <el-table-column prop="position" label="位置" align="center" show-overflow-tooltip></el-table-column>
        <el-table-column label="操作" align="center" width="200">
          <template #default="scope">
            <el-button class="table_btn" size="mini" v-if="showButton('update')"
              @click="updateProp(scope.$index)">库存校正</el-button>
            <el-button class="delete_btn" size="mini" v-if="showButton('update')"
              @click="updatePropAlarm(scope.$index)">预警设置</el-button>
          </template>
        </el-table-column>
      </el-table>
    </div>
    <div class="main_footer">
      <el-pagination background @current-change="changePageNum" @size-change="changePageSize" :current-page="pageNum"
        :page-sizes="[10, 20, 50, 100]" :page-size="pageSize" layout="total, sizes, prev, pager, next, jumper"
        :total="total">
      </el-pagination>
    </div>
    <el-dialog class="prop_dialog" :title="asyncTitle ? '预警设置' : '库存校正'" :close-on-click-modal="false"
      :visible.sync="asyncVisible" width="35%">
      <el-form ref="ruleForm" :model="ruleForm" :rules="rules" label-width="auto" class="rule_form">
        <el-form-item label="物品名称:" prop="embedmentName">
          <el-input v-model="ruleForm.embedmentName" :size="size" clearable placeholder="请输入物品名称"
            :disabled="disabled"></el-input>
        </el-form-item>
        <el-form-item label="规格型号:" prop="embedmentModel">
          <el-input v-model="ruleForm.embedmentModel" :size="size" clearable placeholder="请输入规格型号"
            :disabled="disabled"></el-input>
        </el-form-item>
        <el-form-item label="库存数量:" prop="correctionBefore" v-if="!asyncTitle">
          <el-input v-model="ruleForm.correctionBefore" :size="size" clearable placeholder="请输入库存数量"
            :disabled="disabled"></el-input>
        </el-form-item>
        <el-form-item label="校正数量:" prop="correctionNum" v-if="!asyncTitle">
          <el-input v-model="ruleForm.correctionNum" type="number" :size="size" clearable placeholder="请输入校正数量"
            @blur="changeAfter"></el-input>
        </el-form-item>
        <el-form-item label="校正后数量:" prop="correctionAfter" v-if="!asyncTitle">
          <el-input v-model="ruleForm.correctionAfter" :size="size" clearable placeholder="请输入校正后数量"
            :disabled="true"></el-input>
        </el-form-item>
        <el-form-item label="预警数量:" prop="alarmCount" v-if="asyncTitle">
          <el-input v-model="ruleForm.alarmCount" :size="size" clearable placeholder="请输入预警数量"></el-input>
        </el-form-item>
        <el-form-item label="备注:" prop="remark" v-if="!asyncTitle">
          <el-input v-model="ruleForm.remark" :size="size" type="textarea" :rows="2" clearable
            placeholder="请输入备注"></el-input>
        </el-form-item>
      </el-form>
      <div slot="footer">
        <el-button @click="asyncVisible = false">取 消</el-button>
        <el-button class="submit_btn" @click="asyncTitle ? submitInsert() : submitUpdate()">提 交</el-button>
      </div>
    </el-dialog>
  </div>
</template>
<script>
import {buttonPinia} from '@/pinia/index';
import {throttle, changeSize, downFiles} from '@/plugins/public'; // 导入节流、动态切换组件尺寸方法
export default {
  data() {
    return {
      size: changeSize(), // 组件尺寸
      pageNum: 1,
      pageSize: 10,
      id: "",//一行ID
      search: {},//查询条件
      total: 0,
      loading: false,
      disabled: false,//是否禁止修改
      dataList: [], //库存管理信息列表
      asyncTitle: true, // 对话框title 预警设置:true  库存校正:false
      asyncVisible: false, // 添加 修改对话框
      ruleForm: {
      }, // 按钮表单
      rules: {
        embedmentName: [{
          required: true,
          message: '请输入预埋件名称',
          trigger: 'blur'
        }],
        embedmentModel: [{
          required: true,
          message: '请输入规格型号',
          trigger: 'blur'
        }],
        alarmCount: [{
          required: true,
          message: '请输入预警数量',
          trigger: 'blur'
        }],
        correctionBefore: [{
          required: true,
          message: '请输入库存数量',
          trigger: 'blur'
        }],
        correctionNum: [{
          required: true,
          message: '请输入校正数量',
          trigger: 'blur'
        }],
        correctionAfter: [{
          required: true,
          message: '请输入校正后数量',
          trigger: 'blur'
        }],
      },
    }
  },
  watch: {
    asyncVisible(bol) {
      if (!bol) {
        this.ruleForm = {};
        this.$refs.ruleForm.resetFields();
      }
    }
  },
  mounted() {
    const that = this;
    // 根据窗口大小动态修改组件尺寸
    window.onresize = () => {
      that.size = changeSize();
    }
  },
  methods: {
    cellStyle({row, column}) {
      if (row.stock <= row.alarmCount && column.property == "stock") {
        return {
          'color': 'red'
        }
      }
    },
    //计算出校正后重量
    changeAfter() {
      this.$set(this.ruleForm, 'correctionAfter', this.ruleForm.correctionBefore + this.ruleForm.correctionNum * 1)
    },
    // 转圈圈
    functionLoading() {
      this.loadingView = this.$loading({
        lock: true,
        text: '请稍后...',
        spinner: 'el-icon-loading',
        background: 'rgba(0, 0, 0, 0.7)'
      });
    },
    //导出Excel
    exportFile() {
      this.functionLoading();
      let params = Object.assign({}, this.search)
      this.$api.Materials.embedded.inventExportxls(params).then(res => {
        downFiles(res, '库存管理信息', 'xls')
        this.loadingView.close()
      })
        .catch(() => {
          this.loadingView.close();
        })
    },
    // 查询按钮列表信息
    searchButtonInfo(bol) {
      if (bol) {
        this.pageNum = 1;
      }
      let params = Object.assign({}, this.search, {
        pageNum: this.pageNum,
        pageSize: this.pageSize
      })
      this.loading = true;
      this.$api.Materials.embedded.inventGetLists(params).then((res) => {
        if (res.statusMsg === 'ok') {
          this.total = res.data.total;
          this.dataList = res.data.list;
        }
        this.loading = false;
      })
    },
    //预警设置按钮
    updatePropAlarm(index) {
      const row = {...this.dataList[index]}
      this.id = row.id
      this.asyncTitle = true;
      this.asyncVisible = true;
      this.disabled = true
      this.ruleForm = row
    },
    //库存校正按钮
    updateProp(index) {
      const row = {...this.dataList[index]}
      this.id = row.id
      this.asyncTitle = false;
      this.asyncVisible = true;
      this.disabled = true
      this.ruleForm = row
      this.ruleForm.correctionBefore = row.stock
      this.ruleForm.remark = row.remark
    },
    // 提交库存校正按钮信息
    submitUpdate: throttle(function () {
      this.$refs.ruleForm.validate((valid) => {
        if (valid) {
          const params = {
            id: this.ruleForm.id,
            correctionNum: this.ruleForm.correctionNum,
            correctionAfter: this.ruleForm.correctionAfter,
            correctionBefore: this.ruleForm.correctionBefore,
            remark: this.ruleForm.remark,
          }
          this.$api.Materials.embedded.inventCheck(params).then((res) => {
            if (res.statusMsg === 'ok') {
              this.asyncVisible = false;
              this.searchButtonInfo(true);
              this.$message.success('库存校正成功!');
            } else {
              this.$message.warning(res.statusMsg);
            }
          })
        }
      })
    }, 3000),
    // 提交预警设置按钮信息
    submitInsert: throttle(function () {
      this.$refs.ruleForm.validate((valid) => {
        if (valid) {
          const params = {
            id: this.ruleForm.id,
            alarmCount: this.ruleForm.alarmCount
          }
          this.$api.Materials.embedded.inventPresAlarm(params).then((res) => {
            if (res.statusMsg === 'ok') {
              this.asyncVisible = false;
              this.searchButtonInfo(true);
              this.$message.success('预警设置成功!');
            } else {
              this.$message.warning(res.statusMsg);
            }
          })
        }
      })
    }, 3000),
    // 判断按钮权限信息
    showButton(str) {
      const pinia = buttonPinia();
      return pinia.$state.buttonInfo.includes(str);
    },
    // 切换页数
    changePageNum(page) {
      this.pageNum = page;
      this.searchButtonInfo();
    },
    // 切换每页条数
    changePageSize(size) {
      this.pageSize = size;
      this.searchButtonInfo();
    }
  }
}
</script>
<style lang="scss" scoped>
@import '@/style/layout-main.scss';
<template>
  <div class="main tabs_main" style="height:89%">
    <div class="main_header">
      <div class="header_item">
        <span class="header_label">预埋件名称:</span>
        <el-input v-model="search.embedmentName" :size="size" clearable placeholder="请输入预埋件名称"></el-input>
      </div>
      <div class="header_item">
        <el-button :size="size" icon="el-icon-search" v-if="showButton('search')"
          @click="searchButtonInfo(true)">查询</el-button>
        <el-button :size="size" icon="el-icon-upload2" v-if="showButton('export')" @click="exportFile">导出Excel</el-button>
      </div>
    </div>
    <div class="main_content">
      <el-table v-loading="loading" :data="dataList" height="100%" :cell-style="cellStyle">
        <el-table-column align="center" label="序号" width="60">
          <template #default="scope">
            <span>{{ (pageNum - 1) * pageSize + scope.$index + 1 }}</span>
          </template>
        </el-table-column>
        <el-table-column prop="embedmentName" label="预埋件名称" align="center"></el-table-column>
        <el-table-column prop="embedmentModel" label="型号规格" align="center"></el-table-column>
        <el-table-column prop="dictName" label="类别" align="center"></el-table-column>
        <el-table-column prop="unit" label="计量单位" align="center"></el-table-column>
        <el-table-column prop="stock" label="库存数量" align="center">
          <template #default="{ row }">
            {{ row.stock === null ? 0 : row.stock }}
          </template>
        </el-table-column>
        <el-table-column prop="alarmCount" label="报警数" align="center">
          <template #default="{ row }">
            {{ row.alarmCount === null ? 0 : row.alarmCount }}
          </template>
        </el-table-column>
        <el-table-column prop="position" label="位置" align="center" show-overflow-tooltip></el-table-column>
        <el-table-column label="操作" align="center" width="200">
          <template #default="scope">
            <el-button class="table_btn" size="mini" v-if="showButton('update')"
              @click="updateProp(scope.$index)">库存校正</el-button>
            <el-button class="delete_btn" size="mini" v-if="showButton('update')"
              @click="updatePropAlarm(scope.$index)">预警设置</el-button>
          </template>
        </el-table-column>
      </el-table>
    </div>
    <div class="main_footer">
      <el-pagination background @current-change="changePageNum" @size-change="changePageSize" :current-page="pageNum"
        :page-sizes="[10, 20, 50, 100]" :page-size="pageSize" layout="total, sizes, prev, pager, next, jumper"
        :total="total">
      </el-pagination>
    </div>
    <el-dialog class="prop_dialog" :title="asyncTitle ? '预警设置' : '库存校正'" :close-on-click-modal="false"
      :visible.sync="asyncVisible" width="35%">
      <el-form ref="ruleForm" :model="ruleForm" :rules="rules" label-width="auto" class="rule_form">
        <el-form-item label="预埋件名称:" prop="embedmentName">
          <el-input v-model="ruleForm.embedmentName" :size="size" clearable placeholder="请输入物品名称"
            :disabled="disabled"></el-input>
        </el-form-item>
        <el-form-item label="规格型号:" prop="embedmentModel">
          <el-input v-model="ruleForm.embedmentModel" :size="size" clearable placeholder="请输入规格型号"
            :disabled="disabled"></el-input>
        </el-form-item>
        <el-form-item label="库存数量:" prop="correctionBefore" v-if="!asyncTitle">
          <el-input v-model="ruleForm.correctionBefore" :size="size" clearable placeholder="请输入库存数量"
            :disabled="disabled"></el-input>
        </el-form-item>
        <el-form-item label="校正数量:" prop="correctionNum" v-if="!asyncTitle">
          <el-input v-model="ruleForm.correctionNum" type="number" :size="size" clearable placeholder="请输入校正数量"
            @input="changeAfter"></el-input>
        </el-form-item>
        <el-form-item label="校正后数量:" prop="correctionAfter" v-if="!asyncTitle">
          <el-input v-model="ruleForm.correctionAfter" :size="size" clearable placeholder="请输入校正后数量"
            :disabled="true"></el-input>
        </el-form-item>
        <el-form-item label="预警数量:" prop="alarmCount" v-if="asyncTitle">
          <el-input v-model="ruleForm.alarmCount" :size="size" clearable placeholder="请输入预警数量"></el-input>
        </el-form-item>
        <el-form-item label="备注:" prop="remark" v-if="!asyncTitle">
          <el-input v-model="ruleForm.remark" :size="size" type="textarea" :rows="2" clearable
            placeholder="请输入备注"></el-input>
        </el-form-item>
      </el-form>
      <div slot="footer">
        <el-button @click="asyncVisible = false">取 消</el-button>
        <el-button class="submit_btn" @click="asyncTitle ? submitInsert() : submitUpdate()">提 交</el-button>
      </div>
    </el-dialog>
  </div>
</template>
<script>
import {buttonPinia} from '@/pinia/index';
import {throttle, changeSize, downFiles} from '@/plugins/public'; // 导入节流、动态切换组件尺寸方法
export default {
  data() {
    return {
      size: changeSize(), // 组件尺寸
      pageNum: 1,
      pageSize: 10,
      id: "",//一行ID
      search: {},//查询条件
      total: 0,
      loading: false,
      disabled: false,//是否禁止修改
      dataList: [], //库存管理信息列表
      asyncTitle: true, // 对话框title 预警设置:true  库存校正:false
      asyncVisible: false, // 添加 修改对话框
      ruleForm: {
      }, // 按钮表单
      rules: {
        embedmentName: [{
          required: true,
          message: '请输入预埋件名称',
          trigger: 'blur'
        }],
        embedmentModel: [{
          required: true,
          message: '请输入规格型号',
          trigger: 'blur'
        }],
        alarmCount: [{
          required: true,
          message: '请输入预警数量',
          trigger: 'blur'
        }],
        correctionBefore: [{
          required: true,
          message: '请输入库存数量',
          trigger: 'blur'
        }],
        correctionNum: [{
          required: true,
          message: '请输入校正数量',
          trigger: 'blur'
        }],
        correctionAfter: [{
          required: true,
          message: '请输入校正后数量',
          trigger: 'blur'
        }],
      },
    }
  },
  watch: {
    asyncVisible(bol) {
      if (!bol) {
        this.ruleForm = {};
        this.$refs.ruleForm.resetFields();
      }
    }
  },
  mounted() {
    const that = this;
    // 根据窗口大小动态修改组件尺寸
    window.onresize = () => {
      that.size = changeSize();
    }
  },
  methods: {
    cellStyle({row, column}) {
      if (row.stock <= row.alarmCount && column.property == "stock") {
        return {
          'color': 'red'
        }
      }
    },
    //计算出校正后重量
    changeAfter() {
      this.$set(this.ruleForm, 'correctionAfter', this.ruleForm.correctionBefore + this.ruleForm.correctionNum * 1)
    },
    // 转圈圈
    functionLoading() {
      this.loadingView = this.$loading({
        lock: true,
        text: '请稍后...',
        spinner: 'el-icon-loading',
        background: 'rgba(0, 0, 0, 0.7)'
      });
    },
    //导出Excel
    exportFile() {
      this.functionLoading();
      let params = Object.assign({}, this.search)
      this.$api.Materials.embedded.inventExportxls(params).then(res => {
        downFiles(res, '库存管理信息', 'xls')
        this.loadingView.close()
      })
        .catch(() => {
          this.loadingView.close();
        })
    },
    // 查询按钮列表信息
    searchButtonInfo(bol) {
      if (bol) {
        this.pageNum = 1;
      }
      let params = Object.assign({}, this.search, {
        pageNum: this.pageNum,
        pageSize: this.pageSize
      })
      this.loading = true;
      this.$api.Materials.embedded.inventGetLists(params).then((res) => {
        if (res.statusMsg === 'ok') {
          this.total = res.data.total;
          this.dataList = res.data.list;
        }
        this.loading = false;
      })
    },
    //预警设置按钮
    updatePropAlarm(index) {
      const row = {...this.dataList[index]}
      this.id = row.id
      this.asyncTitle = true;
      this.asyncVisible = true;
      this.disabled = true
      this.ruleForm = row
    },
    //库存校正按钮
    updateProp(index) {
      const row = {...this.dataList[index]}
      this.id = row.id
      this.asyncTitle = false;
      this.asyncVisible = true;
      this.disabled = true
      this.ruleForm = row
      this.ruleForm.correctionBefore = row.stock
      this.ruleForm.remark = row.remark
    },
    // 提交库存校正按钮信息
    submitUpdate: throttle(function () {
      this.$refs.ruleForm.validate((valid) => {
        if (valid) {
          const params = {
            id: this.ruleForm.id,
            correctionNum: this.ruleForm.correctionNum,
            correctionAfter: this.ruleForm.correctionAfter,
            correctionBefore: this.ruleForm.correctionBefore,
            remark: this.ruleForm.remark,
          }
          this.$api.Materials.embedded.inventCheck(params).then((res) => {
            if (res.statusMsg === 'ok') {
              this.asyncVisible = false;
              this.searchButtonInfo(true);
              this.$message.success('库存校正成功!');
            } else {
              this.$message.warning(res.statusMsg);
            }
          })
        }
      })
    }, 3000),
    // 提交预警设置按钮信息
    submitInsert: throttle(function () {
      this.$refs.ruleForm.validate((valid) => {
        if (valid) {
          const params = {
            id: this.ruleForm.id,
            alarmCount: this.ruleForm.alarmCount
          }
          this.$api.Materials.embedded.inventPresAlarm(params).then((res) => {
            if (res.statusMsg === 'ok') {
              this.asyncVisible = false;
              this.searchButtonInfo(true);
              this.$message.success('预警设置成功!');
            } else {
              this.$message.warning(res.statusMsg);
            }
          })
        }
      })
    }, 3000),
    // 判断按钮权限信息
    showButton(str) {
      const pinia = buttonPinia();
      return pinia.$state.buttonInfo.includes(str);
    },
    // 切换页数
    changePageNum(page) {
      this.pageNum = page;
      this.searchButtonInfo();
    },
    // 切换每页条数
    changePageSize(size) {
      this.pageSize = size;
      this.searchButtonInfo();
    }
  }
}
</script>
<style lang="scss" scoped>
@import '@/style/layout-main.scss';
</style>
web/src/views/ProjectManage/ProjectsIndex.vue
@@ -1,514 +1,514 @@
<template>
  <!-- 工程项目管理 ==> 项目管理-->
  <div class="main">
    <!-- header-->
    <div class="main_header" style="flex-direction: row-reverse;">
      <div class="header_item" style="margin-right:0px">
        <el-button class="search_btn" icon="el-icon-plus" v-permission="'insert'" @click="addRow">新增</el-button>
      </div>
    </div>
    <!-- content-->
    <div class="main_content">
      <el-table v-loading="loading" :data="dataList" height="100%">
        <el-table-column align="center" label="序号" width="48">
          <template #default="scope">
            <span>{{ (queryInfo.pageNum - 1) * queryInfo.pageSize + scope.$index + 1 }}</span>
          </template>
        </el-table-column>
        <el-table-column label="已完成(块)" align="center">
          <template #default="{ row }">
            <div style="cursor: pointer;" @click="showDetail(row)">{{ row.completedQuantity }}</div>
          </template>
        </el-table-column>
        <el-table-column prop="proName" label="项目名称" align="center" width="160"></el-table-column>
        <el-table-column label="尺寸" align="center" show-overflow-tooltip>
          <template #default="{ row }">
            <div>{{ showInfo(row.proSizes) }}</div>
          </template>
        </el-table-column>
        <el-table-column label="配筋" align="center" show-overflow-tooltip>
          <template #default="{ row }">
            <div>{{ showInfo(row.proHas) }}</div>
          </template>
        </el-table-column>
        <el-table-column label="转向" align="center" show-overflow-tooltip>
          <template #default="{ row }">
            <div>{{ showInfo(row.proTurns) }}</div>
          </template>
        </el-table-column>
        <el-table-column label="注浆孔" align="center" show-overflow-tooltip>
          <template #default="{ row }">
            <div>{{ showInfo(row.proGroutings) }}</div>
          </template>
        </el-table-column>
        <el-table-column label="块号" align="center" show-overflow-tooltip>
          <template #default="{ row }">
            <div>{{ showInfo(row.proBloks) }}</div>
          </template>
        </el-table-column>
        <el-table-column prop="createUnit" label="建设单位" align="center"></el-table-column>
        <el-table-column prop="planUnit" label="设计单位" align="center"></el-table-column>
        <el-table-column prop="supervisionUnit" label="监理单位" align="center"></el-table-column>
        <el-table-column prop="constructionUnit" label="施工单位" align="center"></el-table-column>
        <el-table-column prop="outsideDiameter" label="外径" align="center"></el-table-column>
        <el-table-column prop="innerDiameter" label="内径" align="center"></el-table-column>
        <el-table-column prop="thickness" label="厚度" align="center"></el-table-column>
        <el-table-column prop="ringWidth" label="环宽" align="center"></el-table-column>
        <el-table-column prop="concreteStrengthGrade" label="混凝土强度等级" align="center"></el-table-column>
        <el-table-column prop="impermeabilityLevel" label="抗渗等级" align="center"></el-table-column>
        <el-table-column prop="waterproofType" label="有无外弧面防水" align="center">
          <template #default="{ row }">
            <div>{{ row.waterproofType === 0 ? '有' : '无' }}</div>
          </template>
        </el-table-column>
        <el-table-column prop="startDate" label="开始日期" align="center" width="86"></el-table-column>
        <el-table-column prop="proTime" label="工期(月)" align="center"></el-table-column>
        <el-table-column prop="planOutput" label="总需求(环)" align="center"></el-table-column>
        <el-table-column label="操作" align="center" width="140">
          <template #default="scope">
            <el-button class="table_btn" size="mini" v-permission="'stop'" @click="deleteRow(scope.row)">停用</el-button>
            <el-button class="delete_btn" size="mini" v-permission="'update'"
              @click="updateRow(scope.$index)">修改</el-button>
          </template>
        </el-table-column>
      </el-table>
    </div>
    <!-- footer-->
    <div class="main_footer">
      <el-pagination background @current-change="changePageNum" @size-change="changePageSize"
        :current-page="queryInfo.pageNum" :page-sizes="[10, 20, 50, 100]" :page-size="queryInfo.pageSize"
        layout="total, sizes, prev, pager, next, jumper" :total="total">
      </el-pagination>
    </div>
    <!-- dialog -->
    <el-dialog class="prop_dialog" v-if="isRender" :title="dialogTitle" :visible.sync="asyncVisible" width="35%"
      @close="closeForm">
      <el-form ref="ruleForm" size="mini" :model="ruleForm" :rules="rules" label-width="auto" class="rule_form">
        <el-form-item label="项目名称" prop="proName">
          <el-input v-model="ruleForm.proName" clearable placeholder="请输入项目名称"></el-input>
        </el-form-item>
        <el-form-item label="项目简介:" prop="proDesc">
          <el-input v-model="ruleForm.proDesc" type="textarea" :rows="3" clearable placeholder="请输入内容"></el-input>
        </el-form-item>
        <el-form-item label="尺寸(m):" prop="sizes">
          <el-select v-model="ruleForm.sizes" placeholder="请选择尺寸" multiple>
            <el-option v-for="item in optionsSize" :key="item.dictId" :label="item.dictName" :value="item.dictId">
            </el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="配筋:" prop="hass">
          <el-select v-model="ruleForm.hass" placeholder="请选择配筋" multiple>
            <el-option v-for="item in optionsHass" :key="item.dictId" :label="item.dictName" :value="item.dictId">
            </el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="转向:" prop="turns">
          <el-select v-model="ruleForm.turns" placeholder="请选择转向" multiple>
            <el-option v-for="item in optionsTurn" :key="item.dictId" :label="item.dictName" :value="item.dictId">
            </el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="注浆孔:" prop="groutings">
          <el-select v-model="ruleForm.groutings" placeholder="请选择注浆孔" multiple>
            <el-option v-for="item in optionsGrout" :key="item.dictId" :label="item.dictName" :value="item.dictId">
            </el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="块号:" prop="bloks">
          <el-select v-model="ruleForm.bloks" placeholder="请选择块号" multiple>
            <el-option v-for="item in optionsBlocks" :key="item.dictId" :label="item.dictName" :value="item.dictId">
            </el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="建设单位:" prop="createUnit">
          <el-input v-model="ruleForm.createUnit" clearable placeholder="请输入"></el-input>
        </el-form-item>
        <el-form-item label="设计单位:" prop="planUnit">
          <el-input v-model="ruleForm.planUnit" clearable placeholder="请输入"></el-input>
        </el-form-item>
        <el-form-item label="监理单位:" prop="supervisionUnit">
          <el-input v-model="ruleForm.supervisionUnit" clearable placeholder="请输入"></el-input>
        </el-form-item>
        <el-form-item label="施工单位:" prop="constructionUnit">
          <el-input v-model="ruleForm.constructionUnit" clearable placeholder="请输入"></el-input>
        </el-form-item>
        <el-form-item label="外径:" prop="outsideDiameter">
          <el-input v-model="ruleForm.outsideDiameter" clearable placeholder="请输入"></el-input>
        </el-form-item>
        <el-form-item label="内径:" prop="innerDiameter">
          <el-input v-model="ruleForm.innerDiameter" clearable placeholder="请输入"></el-input>
        </el-form-item>
        <el-form-item label="厚度:" prop="thickness">
          <el-input v-model="ruleForm.thickness" clearable placeholder="请输入"></el-input>
        </el-form-item>
        <el-form-item label="环宽:" prop="ringWidth">
          <el-input v-model="ruleForm.ringWidth" clearable placeholder="请输入"></el-input>
        </el-form-item>
        <el-form-item label="混凝土强度等级:" prop="concreteStrengthGrade">
          <el-input v-model="ruleForm.concreteStrengthGrade" clearable placeholder="请输入"></el-input>
        </el-form-item>
        <el-form-item label="抗渗等级:" prop="impermeabilityLevel">
          <el-input v-model="ruleForm.impermeabilityLevel" clearable placeholder="请输入"></el-input>
        </el-form-item>
        <el-form-item label="有无外弧面防水:" prop="waterproofType">
          <el-radio-group v-model="ruleForm.waterproofType">
            <el-radio :label="0">有</el-radio>
            <el-radio :label="1">无</el-radio>
          </el-radio-group>
        </el-form-item>
        <el-form-item label="开始日期:" prop="startDate">
          <el-date-picker v-model="ruleForm.startDate" type="date" style="width:100%" value-format="yyyy-MM-dd"
            placeholder="请选择开始日期">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="工期(月):" prop="proTime">
          <el-input v-model="ruleForm.proTime" type="number" clearable placeholder="请输入"></el-input>
        </el-form-item>
        <el-form-item label="总需求(环):" prop="planOutput">
          <el-input v-model="ruleForm.planOutput" type="number" clearable placeholder="请输入"></el-input>
        </el-form-item>
      </el-form>
      <div slot="footer">
        <el-button @click="asyncVisible = false">取 消</el-button>
        <el-button class="submit_btn" @click="onSubmit('ruleForm')">提 交</el-button>
      </div>
    </el-dialog>
    <!-- detail dialog -->
    <el-dialog class="prop_dialog" v-if="detail.isRenderDetail" title="管片数量" :visible.sync="detail.asyncVisible"
      width="800px">
      <cpnTable :table-index="true" :table-data="detail.tableData" :table-columns="detail.tableColumns"
        :page-total="detail.total" :page-num.sync="detail.pageNum" :page-size.sync="detail.pageSize"
        :page-change="pageChange">
      </cpnTable>
    </el-dialog>
  </div>
</template>
<script>
import {throttle} from '../../plugins/public'; // 导入节流、动态切换组件尺寸方法
import cpnTable from '@/components/element/Table'
export default {
  data() {
    return {
      isRender: false,
      loading: false,
      submitMode: '', // add update
      asyncVisible: false, // 添加 修改对话框
      total: 0,
      queryInfo: {
        pageNum: 1,
        pageSize: 10,
      },
      dataList: [],
      ruleForm: {}, // 表单数据 {}
      rules: {
        proName: [{required: true, message: '请输入', trigger: 'blur'}],
        proDesc: [{required: true, message: '请输入', trigger: 'blur'}],
        sizes: [{required: true, message: '请选择', trigger: 'blur'}],
        hass: [{required: true, message: '请选择', trigger: 'blur'}],
        turns: [{required: true, message: '请选择', trigger: 'blur'}],
        groutings: [{required: true, message: '请选择', trigger: 'blur'}],
        bloks: [{required: true, message: '请选择', trigger: 'blur'}],
        createUnit: [{required: true, message: '请输入', trigger: 'blur'}],
        planUnit: [{required: true, message: '请输入', trigger: 'blur'}],
        supervisionUnit: [{required: true, message: '请输入', trigger: 'blur'}],
        constructionUnit: [{required: true, message: '请输入', trigger: 'blur'}],
        outsideDiameter: [{required: true, message: '请输入', trigger: 'blur'}],
        innerDiameter: [{required: true, message: '请输入', trigger: 'blur'}],
        thickness: [{required: true, message: '请输入', trigger: 'blur'}],
        ringWidth: [{required: true, message: '请输入', trigger: 'blur'}],
        concreteStrengthGrade: [{required: true, message: '请输入', trigger: 'blur'}],
        impermeabilityLevel: [{required: true, message: '请输入', trigger: 'blur'}],
        waterproofType: [{required: true, message: '请选择', trigger: 'blur'}],
      },
      optionsSize: [],//尺寸下拉框
      optionsHass: [],//配筋下拉框
      optionsTurn: [],//转向下拉框
      optionsGrout: [],//注浆孔下拉框
      optionsBlocks: [],//块号下拉框
      detail: {
        rowId: '',
        isRenderDetail: false,
        asyncVisible: false,
        pageNum: 1,
        pageSize: 10,
        total: 0,
        tableData: [],
        tableColumns: [],
      }
    }
  },
  components: {
    cpnTable
  },
  computed: {
    dialogTitle() {
      return this.submitMode === 'update' ? '修改项目' : '新增项目'
    },
    isUpdate() {
      return this.submitMode === 'update'
    },
  },
  created() {
    this.setFormProps()
    this.getAllTypes()
    this.getLists()
  },
  methods: {
    getLists() {
      let params = this.queryInfo
      this.loading = true
      this.$api.Engineer.searchProjects(params).then(res => {
        this.loading = false
        if (res.statusMsg === 'ok') {
          this.total = res.data.total
          this.dataList = res.data.list
        }
      })
    },
    //获取尺寸配筋转向等信息
    getAllTypes() {
      let params = {pageNum: 1, pageSize: 100000000}
      this.$api.Dictionary.searchDictionary(params).then(res => {
        if (res.statusMsg === 'ok') {
          res.data.list.forEach(item => {
            switch (item.dictType) {
              case '1':
                this.optionsSize.push(item)
                break
              case '2':
                this.optionsHass.push(item)
                break
              case '3':
                this.optionsTurn.push(item)
                break
              case '4':
                this.optionsGrout.push(item)
                break
              case '5':
                this.optionsBlocks.push(item)
                break
            }
          })
        }
      })
    },
    setFormProps(options = {}) {
      let _form = {
        proName: '', // 项目名称
        proDesc: '', // 项目描述
        sizes: '',  // 尺寸
        hass: '', // 配筋
        turns: '', // 转向
        groutings: '', // 注浆孔
        bloks: '', // 块号
        createUnit: '', // 建设单位
        planUnit: '', // 设计单位
        supervisionUnit: '', // 监理单位
        constructionUnit: '', // 施工单位
        outsideDiameter: '', // 外径
        innerDiameter: '', // 内径
        thickness: '', // 厚度
        ringWidth: '', // 环宽
        concreteStrengthGrade: '', // 混凝土强度等级
        impermeabilityLevel: '', // 抗渗等级
        waterproofType: '', // 有无外弧面防水
        startDate: '', // 开始日期
        proTime: '', // 工期
        planOutput: '', // 总需求
      }
      this.ruleForm = Object.keys(options).length ? options : _form
    },
    //table上展示尺寸等信息
    showInfo(val) {
      let str = ''
      let str1 = ''
      if (val.length === 1) {
        str = val[0].dictName
      } else {
        val.forEach(item => {
          str += item.dictName + ','
        })
        str1 = str.lastIndexOf(',')
        str = str.substring(0, str1)
      }
      return str
    },
    resetForm(formName) {
      this.$refs[formName].resetFields()
    },
    showForm() {
      !this.isRender && (this.isRender = true)
      this.asyncVisible = true
    },
    closeForm() {
      this.asyncVisible = false
      this.resetForm('ruleForm')
      this.setFormProps()
    },
    addRow() {
      this.submitMode = 'add'
      this.showForm()
    },
    updateRow(rowIndex) {
      const rowData = this.dataList[rowIndex]
      // 以下字段不能直接使用,需要处理后赋值
      // a:[b,c]   a:ruleForm的key b:rowData的key c:rowData[key]数据里的key
      const formFormatKeys = {
        sizes: ['proSizes', 'sizes'],
        hass: ['proHas', 'hasSteel'],
        turns: ['proTurns', 'turn'],
        groutings: ['proGroutings', 'groutingHoles'],
        bloks: ['proBloks', 'blockNum'],
      }
      Object.keys(formFormatKeys).forEach(item => {
        const targetKey = formFormatKeys[item].shift()
        const targetValKey = formFormatKeys[item].pop()
        if (Array.isArray(rowData[targetKey])) {
          rowData[targetKey].forEach(val => {
            formFormatKeys[item].push(val[targetValKey])
          })
        } else {
          formFormatKeys[item] = rowData[targetKey]
        }
      })
      Object.keys(this.ruleForm).forEach(item => {
        if (rowData.hasOwnProperty.call(rowData, item)) {
          this.ruleForm[item] = rowData[item]
        } else if (formFormatKeys[item]) {
          this.ruleForm[item] = formFormatKeys[item]
        }
      })
      this.ruleForm.proId = rowData.proId
      this.submitMode = 'update'
      this.showForm()
    },
    deleteRow(row) {
      this.$confirm("该操作将删除该信息,是否继续删除?", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning"
      }).then(() => {
        this.$api.Engineer.deleteProjects({proId: row.proId})
          .then(res => {
            if (res.statusMsg === 'ok') {
              this.getLists()
              this.$message.success("删除成功!")
            } else {
              this.$message.warning(res.statusMsg)
            }
          })
      }).catch(() => {
        this.$message.warning("您已取消")
      })
    },
    onSubmit: throttle(function (formName) {
      this.$refs[formName].validate((valid) => {
        if (!valid) return false
        const params = this.ruleForm
        if (this.isUpdate) {
          // 更新
          this.$api.Engineer.updateProjects(params).then((res) => {
            if (res.statusMsg === 'ok') {
              this.closeForm()
              this.getLists();
              this.$message.success('更新成功!')
            } else {
              this.$message.warning(res.statusMsg)
            }
          })
        } else {
          // 添加
          this.$api.Engineer.insertProjects(params).then((res) => {
            if (res.statusMsg === 'ok') {
              this.closeForm()
              this.getLists()
              this.$message.success('添加成功!')
            } else {
              this.$message.warning(res.statusMsg)
            }
          })
        }
      })
    }, 1000),
    changePageNum(page) {
      this.queryInfo.pageNum = page;
      this.getLists();
    },
    changePageSize(size) {
      this.queryInfo.pageSize = size
      this.getLists()
    },
    showDetail(row) {
      let detailData = this.detail
      !detailData.isRenderDetail && (detailData.isRenderDetail = true)
      detailData.asyncVisible = true
      detailData.rowId = row.proId
      detailData.total = 0
      detailData.tableData = []
      this.getDetailLists()
    },
    getDetailLists() {
      let detailData = this.detail
      this.$api.DuctpiecePLM.searchDuctpiecePLMList({
        proId: detailData.rowId,
        pageNum: detailData.pageNum,
        pageSize: detailData.pageSize
      }).then(res => {
        if (res.success) {
          if (!detailData.tableColumns.length) {
            detailData.tableColumns = [
              {index: true},
              {name: "环号", key: "ringNum"},
              {name: "管片编号", key: "pipeNum", width: 140},
              {name: "转向", key: "turnName", width: 106},
              {name: "配筋", key: "reinforcementName"},
              {name: "注浆孔", key: "groutingHolesName"},
              {name: "块号", key: "blockNumName"},
              {name: "模具", key: "mouldNum"},
              {name: "入模时间", key: "intoModTime", width: 136},
              {name: "浇筑时间", key: "pouringTime"},
              {name: "质检时间", key: "checkTime", width: 136},
              {name: "生产班组", key: "groupName"},
              {name: "项目", key: "proName", width: 240},
              {name: "质量标注", key: "checkResultStr"},
            ]
          }
          detailData.total = res.data.total
          detailData.tableData = res.data.list
        }
      })
    },
    pageChange() {
      this.getDetailLists()
    },
  }
}
</script>
<style lang="scss" scoped>
@import '../../style/layout-main.scss';
/deep/ {
  &::-webkit-scrollbar {
    width: 8px;
    height: 8px;
  }
  &::-webkit-scrollbar-corner {
    background-color: transparent;
  }
  &::-webkit-scrollbar-thumb {
    border-radius: 10px;
    box-shadow: inset 0 0 5px transparent;
    background: #39B5FE;
  }
  &::-webkit-scrollbar-track {
    box-shadow: inset 0 0 5px transparent;
    border-radius: 10px;
    background: rgba(76, 188, 254, .3);
  }
}
<template>
  <!-- 工程项目管理 ==> 项目管理-->
  <div class="main">
    <!-- header-->
    <div class="main_header" style="flex-direction: row-reverse;">
      <div class="header_item" style="margin-right:0px">
        <el-button class="search_btn" icon="el-icon-plus" v-permission="'insert'" @click="addRow">新增</el-button>
      </div>
    </div>
    <!-- content-->
    <div class="main_content">
      <el-table v-loading="loading" :data="dataList" height="100%">
        <el-table-column align="center" label="序号" width="48">
          <template #default="scope">
            <span>{{ (queryInfo.pageNum - 1) * queryInfo.pageSize + scope.$index + 1 }}</span>
          </template>
        </el-table-column>
        <el-table-column label="已完成(块)" align="center">
          <template #default="{ row }">
            <div style="cursor: pointer;" @click="showDetail(row)">{{ row.completedQuantity }}</div>
          </template>
        </el-table-column>
        <el-table-column prop="proName" label="项目名称" align="center" width="160"></el-table-column>
        <el-table-column label="尺寸" align="center" show-overflow-tooltip>
          <template #default="{ row }">
            <div>{{ showInfo(row.proSizes) }}</div>
          </template>
        </el-table-column>
        <el-table-column label="配筋" align="center" show-overflow-tooltip>
          <template #default="{ row }">
            <div>{{ showInfo(row.proHas) }}</div>
          </template>
        </el-table-column>
        <el-table-column label="转向" align="center" width="130">
          <template #default="{ row }">
            <div>{{ showInfo(row.proTurns) }}</div>
          </template>
        </el-table-column>
        <el-table-column label="注浆孔" align="center" show-overflow-tooltip>
          <template #default="{ row }">
            <div>{{ showInfo(row.proGroutings) }}</div>
          </template>
        </el-table-column>
        <el-table-column label="块号" align="center" show-overflow-tooltip>
          <template #default="{ row }">
            <div>{{ showInfo(row.proBloks) }}</div>
          </template>
        </el-table-column>
        <el-table-column prop="createUnit" label="建设单位" align="center"></el-table-column>
        <el-table-column prop="planUnit" label="设计单位" align="center"></el-table-column>
        <el-table-column prop="supervisionUnit" label="监理单位" align="center"></el-table-column>
        <el-table-column prop="constructionUnit" label="施工单位" align="center"></el-table-column>
        <el-table-column prop="outsideDiameter" label="外径" align="center"></el-table-column>
        <el-table-column prop="innerDiameter" label="内径" align="center"></el-table-column>
        <el-table-column prop="thickness" label="厚度" align="center"></el-table-column>
        <el-table-column prop="ringWidth" label="环宽" align="center"></el-table-column>
        <el-table-column prop="concreteStrengthGrade" label="混凝土强度等级" align="center"></el-table-column>
        <el-table-column prop="impermeabilityLevel" label="抗渗等级" align="center"></el-table-column>
        <el-table-column prop="waterproofType" label="有无外弧面防水" align="center">
          <template #default="{ row }">
            <div>{{ row.waterproofType === 0 ? '有' : '无' }}</div>
          </template>
        </el-table-column>
        <el-table-column prop="startDate" label="开始日期" align="center" width="86"></el-table-column>
        <el-table-column prop="proTime" label="工期(月)" align="center"></el-table-column>
        <el-table-column prop="planOutput" label="总需求(环)" align="center"></el-table-column>
        <el-table-column label="操作" align="center" width="140">
          <template #default="scope">
            <el-button class="table_btn" size="mini" v-permission="'stop'" @click="deleteRow(scope.row)">停用</el-button>
            <el-button class="delete_btn" size="mini" v-permission="'update'"
              @click="updateRow(scope.$index)">修改</el-button>
          </template>
        </el-table-column>
      </el-table>
    </div>
    <!-- footer-->
    <div class="main_footer">
      <el-pagination background @current-change="changePageNum" @size-change="changePageSize"
        :current-page="queryInfo.pageNum" :page-sizes="[10, 20, 50, 100]" :page-size="queryInfo.pageSize"
        layout="total, sizes, prev, pager, next, jumper" :total="total">
      </el-pagination>
    </div>
    <!-- dialog -->
    <el-dialog class="prop_dialog" v-if="isRender" :title="dialogTitle" :visible.sync="asyncVisible" width="35%"
      @close="closeForm">
      <el-form ref="ruleForm" size="mini" :model="ruleForm" :rules="rules" label-width="auto" class="rule_form">
        <el-form-item label="项目名称" prop="proName">
          <el-input v-model="ruleForm.proName" clearable placeholder="请输入项目名称"></el-input>
        </el-form-item>
        <el-form-item label="项目简介:" prop="proDesc">
          <el-input v-model="ruleForm.proDesc" type="textarea" :rows="3" clearable placeholder="请输入内容"></el-input>
        </el-form-item>
        <el-form-item label="尺寸(m):" prop="sizes">
          <el-select v-model="ruleForm.sizes" placeholder="请选择尺寸" multiple>
            <el-option v-for="item in optionsSize" :key="item.dictId" :label="item.dictName" :value="item.dictId">
            </el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="配筋:" prop="hass">
          <el-select v-model="ruleForm.hass" placeholder="请选择配筋" multiple>
            <el-option v-for="item in optionsHass" :key="item.dictId" :label="item.dictName" :value="item.dictId">
            </el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="转向:" prop="turns">
          <el-select v-model="ruleForm.turns" placeholder="请选择转向" multiple>
            <el-option v-for="item in optionsTurn" :key="item.dictId" :label="item.dictName" :value="item.dictId">
            </el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="注浆孔:" prop="groutings">
          <el-select v-model="ruleForm.groutings" placeholder="请选择注浆孔" multiple>
            <el-option v-for="item in optionsGrout" :key="item.dictId" :label="item.dictName" :value="item.dictId">
            </el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="块号:" prop="bloks">
          <el-select v-model="ruleForm.bloks" placeholder="请选择块号" multiple>
            <el-option v-for="item in optionsBlocks" :key="item.dictId" :label="item.dictName" :value="item.dictId">
            </el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="建设单位:" prop="createUnit">
          <el-input v-model="ruleForm.createUnit" clearable placeholder="请输入"></el-input>
        </el-form-item>
        <el-form-item label="设计单位:" prop="planUnit">
          <el-input v-model="ruleForm.planUnit" clearable placeholder="请输入"></el-input>
        </el-form-item>
        <el-form-item label="监理单位:" prop="supervisionUnit">
          <el-input v-model="ruleForm.supervisionUnit" clearable placeholder="请输入"></el-input>
        </el-form-item>
        <el-form-item label="施工单位:" prop="constructionUnit">
          <el-input v-model="ruleForm.constructionUnit" clearable placeholder="请输入"></el-input>
        </el-form-item>
        <el-form-item label="外径:" prop="outsideDiameter">
          <el-input v-model="ruleForm.outsideDiameter" clearable placeholder="请输入"></el-input>
        </el-form-item>
        <el-form-item label="内径:" prop="innerDiameter">
          <el-input v-model="ruleForm.innerDiameter" clearable placeholder="请输入"></el-input>
        </el-form-item>
        <el-form-item label="厚度:" prop="thickness">
          <el-input v-model="ruleForm.thickness" clearable placeholder="请输入"></el-input>
        </el-form-item>
        <el-form-item label="环宽:" prop="ringWidth">
          <el-input v-model="ruleForm.ringWidth" clearable placeholder="请输入"></el-input>
        </el-form-item>
        <el-form-item label="混凝土强度等级:" prop="concreteStrengthGrade">
          <el-input v-model="ruleForm.concreteStrengthGrade" clearable placeholder="请输入"></el-input>
        </el-form-item>
        <el-form-item label="抗渗等级:" prop="impermeabilityLevel">
          <el-input v-model="ruleForm.impermeabilityLevel" clearable placeholder="请输入"></el-input>
        </el-form-item>
        <el-form-item label="有无外弧面防水:" prop="waterproofType">
          <el-radio-group v-model="ruleForm.waterproofType">
            <el-radio :label="0">有</el-radio>
            <el-radio :label="1">无</el-radio>
          </el-radio-group>
        </el-form-item>
        <el-form-item label="开始日期:" prop="startDate">
          <el-date-picker v-model="ruleForm.startDate" type="date" style="width:100%" value-format="yyyy-MM-dd"
            placeholder="请选择开始日期">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="工期(月):" prop="proTime">
          <el-input v-model="ruleForm.proTime" type="number" clearable placeholder="请输入"></el-input>
        </el-form-item>
        <el-form-item label="总需求(环):" prop="planOutput">
          <el-input v-model="ruleForm.planOutput" type="number" clearable placeholder="请输入"></el-input>
        </el-form-item>
      </el-form>
      <div slot="footer">
        <el-button @click="asyncVisible = false">取 消</el-button>
        <el-button class="submit_btn" @click="onSubmit('ruleForm')">提 交</el-button>
      </div>
    </el-dialog>
    <!-- detail dialog -->
    <el-dialog class="prop_dialog" v-if="detail.isRenderDetail" title="管片数量" :visible.sync="detail.asyncVisible"
      width="800px">
      <cpnTable :table-index="true" :table-data="detail.tableData" :table-columns="detail.tableColumns"
        :page-total="detail.total" :page-num.sync="detail.pageNum" :page-size.sync="detail.pageSize"
        :page-change="pageChange">
      </cpnTable>
    </el-dialog>
  </div>
</template>
<script>
import {throttle} from '../../plugins/public'; // 导入节流、动态切换组件尺寸方法
import cpnTable from '@/components/element/Table'
export default {
  data() {
    return {
      isRender: false,
      loading: false,
      submitMode: '', // add update
      asyncVisible: false, // 添加 修改对话框
      total: 0,
      queryInfo: {
        pageNum: 1,
        pageSize: 10,
      },
      dataList: [],
      ruleForm: {}, // 表单数据 {}
      rules: {
        proName: [{required: true, message: '请输入', trigger: 'blur'}],
        proDesc: [{required: true, message: '请输入', trigger: 'blur'}],
        sizes: [{required: true, message: '请选择', trigger: 'blur'}],
        hass: [{required: true, message: '请选择', trigger: 'blur'}],
        turns: [{required: true, message: '请选择', trigger: 'blur'}],
        groutings: [{required: true, message: '请选择', trigger: 'blur'}],
        bloks: [{required: true, message: '请选择', trigger: 'blur'}],
        createUnit: [{required: true, message: '请输入', trigger: 'blur'}],
        planUnit: [{required: true, message: '请输入', trigger: 'blur'}],
        supervisionUnit: [{required: true, message: '请输入', trigger: 'blur'}],
        constructionUnit: [{required: true, message: '请输入', trigger: 'blur'}],
        outsideDiameter: [{required: true, message: '请输入', trigger: 'blur'}],
        innerDiameter: [{required: true, message: '请输入', trigger: 'blur'}],
        thickness: [{required: true, message: '请输入', trigger: 'blur'}],
        ringWidth: [{required: true, message: '请输入', trigger: 'blur'}],
        concreteStrengthGrade: [{required: true, message: '请输入', trigger: 'blur'}],
        impermeabilityLevel: [{required: true, message: '请输入', trigger: 'blur'}],
        waterproofType: [{required: true, message: '请选择', trigger: 'blur'}],
      },
      optionsSize: [],//尺寸下拉框
      optionsHass: [],//配筋下拉框
      optionsTurn: [],//转向下拉框
      optionsGrout: [],//注浆孔下拉框
      optionsBlocks: [],//块号下拉框
      detail: {
        rowId: '',
        isRenderDetail: false,
        asyncVisible: false,
        pageNum: 1,
        pageSize: 10,
        total: 0,
        tableData: [],
        tableColumns: [],
      }
    }
  },
  components: {
    cpnTable
  },
  computed: {
    dialogTitle() {
      return this.submitMode === 'update' ? '修改项目' : '新增项目'
    },
    isUpdate() {
      return this.submitMode === 'update'
    },
  },
  created() {
    this.setFormProps()
    this.getAllTypes()
    this.getLists()
  },
  methods: {
    getLists() {
      let params = this.queryInfo
      this.loading = true
      this.$api.Engineer.searchProjects(params).then(res => {
        this.loading = false
        if (res.statusMsg === 'ok') {
          this.total = res.data.total
          this.dataList = res.data.list
        }
      })
    },
    //获取尺寸配筋转向等信息
    getAllTypes() {
      let params = {pageNum: 1, pageSize: 100000000}
      this.$api.Dictionary.searchDictionary(params).then(res => {
        if (res.statusMsg === 'ok') {
          res.data.list.forEach(item => {
            switch (item.dictType) {
              case '1':
                this.optionsSize.push(item)
                break
              case '2':
                this.optionsHass.push(item)
                break
              case '3':
                this.optionsTurn.push(item)
                break
              case '4':
                this.optionsGrout.push(item)
                break
              case '5':
                this.optionsBlocks.push(item)
                break
            }
          })
        }
      })
    },
    setFormProps(options = {}) {
      let _form = {
        proName: '', // 项目名称
        proDesc: '', // 项目描述
        sizes: '',  // 尺寸
        hass: '', // 配筋
        turns: '', // 转向
        groutings: '', // 注浆孔
        bloks: '', // 块号
        createUnit: '', // 建设单位
        planUnit: '', // 设计单位
        supervisionUnit: '', // 监理单位
        constructionUnit: '', // 施工单位
        outsideDiameter: '', // 外径
        innerDiameter: '', // 内径
        thickness: '', // 厚度
        ringWidth: '', // 环宽
        concreteStrengthGrade: '', // 混凝土强度等级
        impermeabilityLevel: '', // 抗渗等级
        waterproofType: '', // 有无外弧面防水
        startDate: '', // 开始日期
        proTime: '', // 工期
        planOutput: '', // 总需求
      }
      this.ruleForm = Object.keys(options).length ? options : _form
    },
    //table上展示尺寸等信息
    showInfo(val) {
      let str = ''
      let str1 = ''
      if (val.length === 1) {
        str = val[0].dictName
      } else {
        val.forEach(item => {
          str += item.dictName + ','
        })
        str1 = str.lastIndexOf(',')
        str = str.substring(0, str1)
      }
      return str
    },
    resetForm(formName) {
      this.$refs[formName].resetFields()
    },
    showForm() {
      !this.isRender && (this.isRender = true)
      this.asyncVisible = true
    },
    closeForm() {
      this.asyncVisible = false
      this.resetForm('ruleForm')
      this.setFormProps()
    },
    addRow() {
      this.submitMode = 'add'
      this.showForm()
    },
    updateRow(rowIndex) {
      const rowData = this.dataList[rowIndex]
      // 以下字段不能直接使用,需要处理后赋值
      // a:[b,c]   a:ruleForm的key b:rowData的key c:rowData[key]数据里的key
      const formFormatKeys = {
        sizes: ['proSizes', 'sizes'],
        hass: ['proHas', 'hasSteel'],
        turns: ['proTurns', 'turn'],
        groutings: ['proGroutings', 'groutingHoles'],
        bloks: ['proBloks', 'blockNum'],
      }
      Object.keys(formFormatKeys).forEach(item => {
        const targetKey = formFormatKeys[item].shift()
        const targetValKey = formFormatKeys[item].pop()
        if (Array.isArray(rowData[targetKey])) {
          rowData[targetKey].forEach(val => {
            formFormatKeys[item].push(val[targetValKey])
          })
        } else {
          formFormatKeys[item] = rowData[targetKey]
        }
      })
      Object.keys(this.ruleForm).forEach(item => {
        if (rowData.hasOwnProperty.call(rowData, item)) {
          this.ruleForm[item] = rowData[item]
        } else if (formFormatKeys[item]) {
          this.ruleForm[item] = formFormatKeys[item]
        }
      })
      this.ruleForm.proId = rowData.proId
      this.submitMode = 'update'
      this.showForm()
    },
    deleteRow(row) {
      this.$confirm("该操作将删除该信息,是否继续删除?", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning"
      }).then(() => {
        this.$api.Engineer.deleteProjects({proId: row.proId})
          .then(res => {
            if (res.statusMsg === 'ok') {
              this.getLists()
              this.$message.success("删除成功!")
            } else {
              this.$message.warning(res.statusMsg)
            }
          })
      }).catch(() => {
        this.$message.warning("您已取消")
      })
    },
    onSubmit: throttle(function (formName) {
      this.$refs[formName].validate((valid) => {
        if (!valid) return false
        const params = this.ruleForm
        if (this.isUpdate) {
          // 更新
          this.$api.Engineer.updateProjects(params).then((res) => {
            if (res.statusMsg === 'ok') {
              this.closeForm()
              this.getLists();
              this.$message.success('更新成功!')
            } else {
              this.$message.warning(res.statusMsg)
            }
          })
        } else {
          // 添加
          this.$api.Engineer.insertProjects(params).then((res) => {
            if (res.statusMsg === 'ok') {
              this.closeForm()
              this.getLists()
              this.$message.success('添加成功!')
            } else {
              this.$message.warning(res.statusMsg)
            }
          })
        }
      })
    }, 1000),
    changePageNum(page) {
      this.queryInfo.pageNum = page;
      this.getLists();
    },
    changePageSize(size) {
      this.queryInfo.pageSize = size
      this.getLists()
    },
    showDetail(row) {
      let detailData = this.detail
      !detailData.isRenderDetail && (detailData.isRenderDetail = true)
      detailData.asyncVisible = true
      detailData.rowId = row.proId
      detailData.total = 0
      detailData.tableData = []
      this.getDetailLists()
    },
    getDetailLists() {
      let detailData = this.detail
      this.$api.DuctpiecePLM.searchDuctpiecePLMList({
        proId: detailData.rowId,
        pageNum: detailData.pageNum,
        pageSize: detailData.pageSize
      }).then(res => {
        if (res.success) {
          if (!detailData.tableColumns.length) {
            detailData.tableColumns = [
              {index: true},
              {name: "环号", key: "ringNum"},
              {name: "管片编号", key: "pipeNum", width: 140},
              {name: "转向", key: "turnName", width: 106},
              {name: "配筋", key: "reinforcementName"},
              {name: "注浆孔", key: "groutingHolesName"},
              {name: "块号", key: "blockNumName"},
              {name: "模具", key: "mouldNum"},
              {name: "入模时间", key: "intoModTime", width: 136},
              {name: "浇筑时间", key: "pouringTime"},
              {name: "质检时间", key: "checkTime", width: 136},
              {name: "生产班组", key: "groupName"},
              {name: "项目", key: "proName", width: 240},
              {name: "质量标注", key: "checkResultStr"},
            ]
          }
          detailData.total = res.data.total
          detailData.tableData = res.data.list
        }
      })
    },
    pageChange() {
      this.getDetailLists()
    },
  }
}
</script>
<style lang="scss" scoped>
@import '../../style/layout-main.scss';
/deep/ {
  &::-webkit-scrollbar {
    width: 8px;
    height: 8px;
  }
  &::-webkit-scrollbar-corner {
    background-color: transparent;
  }
  &::-webkit-scrollbar-thumb {
    border-radius: 10px;
    box-shadow: inset 0 0 5px transparent;
    background: #39B5FE;
  }
  &::-webkit-scrollbar-track {
    box-shadow: inset 0 0 5px transparent;
    border-radius: 10px;
    background: rgba(76, 188, 254, .3);
  }
}
</style>
web/src/views/ProjectManage/SectionManage.vue
@@ -31,8 +31,8 @@
    <!-- dialog -->
    <el-dialog class="prop_dialog" v-if="isRender" :title="dialogTitle" :visible.sync="asyncVisible" width="660px"
      @close="closeForm">
      <cpnForm :form-config="formConfig"></cpnForm>
      <!-- form组件未开发完 -->
      <!-- <cpnForm :form-config="formConfig"></cpnForm> -->
      <el-form ref="ruleForm" :model="ruleForm" :rules="rules" label-width="auto" class="rule_form">
        <el-form-item label="项目名称:" prop="proId">
@@ -113,7 +113,7 @@
<script>
import {throttle} from '../../plugins/public'; // 导入节流、动态切换组件尺寸方法
import cpnTable from '@/components/element/Table'
import cpnForm from '@/components/element/Form'
// import cpnForm from '@/components/element/Form'
export default {
  data() {
    return {
@@ -197,65 +197,64 @@
          }
        ]
      },
      // formConfig: {
      //   formModels: {
      //     proId: '', // 项目名称id
      //     mileage: '', // 起讫里程
      //     unitProjectName: '',  // 单位工程名称
      //     segmentAdmin: '', // 需求负责人
      //     shieldEnp: '', // 盾构单位
      //     startTime: null, // 开始时间
      //     endTime: null, // 结束时间
      //     duration: '', // 工期
      //     station: '', // 站点
      //     segmentList: [], // 标段需求
      //   },
      //   formItems: [
      //     {
      //       type: 'input', label: '用户id'
      //     },
      //     {
      //       type: 'input', label: '用户名'
      //     },
      formConfig: {
        formModels: {
          proId: '', // 项目名称id
          mileage: '', // 起讫里程
          unitProjectName: '',  // 单位工程名称
          segmentAdmin: '', // 需求负责人
          shieldEnp: '', // 盾构单位
          startTime: null, // 开始时间
          endTime: null, // 结束时间
          duration: '', // 工期
          station: '', // 站点
          segmentList: [], // 标段需求
        },
        formItems: [
          {
            type: 'input', label: '用户id'
          },
          {
            type: 'input', label: '用户名'
          },
          {
            type: 'input', label: '真实姓名'
          },
          {
            type: 'input', label: '电话号码'
          },
          {
            type: 'select', label: '用户状态', options: [
              {label: '禁用', value: 0},
              {label: '启用', value: 1}
            ]
          },
          {
            type: 'datepicker', label: '创建时间', otherOptions: {
              startPlaceholder: '开始时间',
              endPlaceholder: '结束时间',
              type: 'daterange',
              'unlink-panels': true
            }
          }
        ],
        itemColLayout: {
          span: 8
        }
      }
      //     {
      //       type: 'input', label: '真实姓名'
      //     },
      //     {
      //       type: 'input', label: '电话号码'
      //     },
      //     {
      //       type: 'select', label: '用户状态', options: [
      //         {label: '禁用', value: 0},
      //         {label: '启用', value: 1}
      //       ]
      //     },
      //     {
      //       type: 'datepicker', label: '创建时间', otherOptions: {
      //         startPlaceholder: '开始时间',
      //         endPlaceholder: '结束时间',
      //         type: 'daterange',
      //         'unlink-panels': true
      //       }
      //     }
      //   ],
      //   itemColLayout: {
      //     span: 8
      //   }
      // }
    }
  },
  components: {
    cpnTable,
    cpnForm
    // cpnForm
  },
  computed: {
    isUpdate() {
      return this.submitMode === 'update'
    },
    dialogTitle() {
      return this.isUpdate ? '修改新增单位工程' : '新增单位工程'
      return this.isUpdate ? '修改单位工程' : '新增单位工程'
    },
  },
  created() {
web/src/views/QualityManage/DieDetection.vue
@@ -1,3 +1,57 @@
<template>
    <div>模具质量检测</div>
</template>
  <div class="main">
    <div class="main_tabs">
      <el-tabs v-model="activeName" @tab-click="handleClick">
            <el-tab-pane label="模具尺寸检查" name="first">
                <pattern-check ref="pattern"></pattern-check>
            </el-tab-pane>
            <el-tab-pane label="三维检查" name="second">
                <threed-check ref="threed"></threed-check>
            </el-tab-pane>
        </el-tabs>
    </div>
  </div>
</template>
<script>
import PatternCheck from './components/PatternCheck.vue'//模具尺寸检查
import ThreedCheck from './components/ThreedCheck.vue'//三维检查
export default {
    components:{
        PatternCheck,
        ThreedCheck,
    },
    data(){
        return{
            activeName:'first'
        }
    },
    mounted(){
        this.$refs.pattern.searchButtonInfo(true);
        this.$refs.pattern.getAllPersons();
    },
    methods:{
        //切换界面
        handleClick(tab){
            switch(tab.name){
                case 'second':
                    this.$refs.threed.searchButtonInfo(true);
                    this.$refs.threed.getAllPersons();
                    break;
                default:
                    this.$refs.pattern.searchButtonInfo(true);
                    this.$refs.pattern.getAllPersons();
            }
        },
    }
}
</script>
<style scoped lang="scss">
@import'@/style/layout-main.scss';
/deep/ .el-tabs__content{
    position: static;
}
/deep/.main {
  background: none;
}
</style>
web/src/views/QualityManage/components/PatternCheck.vue
对比新文件
@@ -0,0 +1,471 @@
<template>
  <div class="main tabs_main" style="height:89%">
    <div class="main_header">
      <div class="header_item">
        <span class="header_label">项目名称:</span>
        <el-select v-model="search.proId" placeholder="请选择项目名称" clearable  @change="getNumberList">
            <el-option
                v-for="item in optionsProjects"
                :key="item.proId"
                :label="item.proName"
                :value="item.proId">
            </el-option>
        </el-select>
      </div>
      <div class="header_item">
        <span class="header_label">模具编号:</span>
        <el-select v-model="search.mouldNum" placeholder="请选择模具编号" clearable filterable>
            <el-option
                v-for="(item,index) in optionsMoulds"
                :key="index"
                :label="item.mouldNum"
                :value="item.mouldNum">
            </el-option>
        </el-select>
      </div>
      <div class="header_item">
        <span class="header_label">模具型号:</span>
        <el-select v-model="search.mouldCode" placeholder="请选择模具型号" clearable>
            <el-option
                v-for="(item,index) in optionsCodes"
                :key="index"
                :label="item.mouldCode"
                :value="item.mouldCode">
            </el-option>
        </el-select>
      </div>
      <div class="header_item">
        <el-button icon="el-icon-search" v-if="showButton('search')" @click="searchButtonInfo(true)">查询</el-button>
        <el-button class="search_btn" icon="el-icon-plus" v-if="showButton('insert')" @click="insertProp">新增</el-button>
      </div>
    </div>
    <div class="main_content">
      <el-table
        v-loading="loading"
        :data="dataList"
        height="100%">
        <el-table-column align="center" label="序号" width="60">
          <template #default="scope">
            <span>{{(pageNum - 1) * pageSize + scope.$index + 1}}</span>
          </template>
        </el-table-column>
        <el-table-column prop="proName" label="项目名称" align="center" ></el-table-column>
        <el-table-column prop="mouldNum" label="模具编号" align="center" ></el-table-column>
        <el-table-column prop="mouldCode" label="模具型号" align="center" ></el-table-column>
        <el-table-column prop="blockNum" label="块号" align="center" show-overflow-tooltip></el-table-column>
        <el-table-column prop="size" label="尺寸" align="center" show-overflow-tooltip></el-table-column>
        <el-table-column prop="turn" label="转向" align="center"></el-table-column>
        <el-table-column prop="groutingHole" label="注浆孔" align="center"></el-table-column>
        <el-table-column prop="content" label="检测内容" show-overflow-tooltip align="center"></el-table-column>
        <el-table-column prop="checkDate" label="检查表日期" align="center"></el-table-column>
        <el-table-column prop="checkUnit" label="检测单位" align="center"></el-table-column>
        <el-table-column label="操作" align="center" width="150">
          <template #default="{ row }">
            <el-button class="table_btn" size="mini" v-if="showButton('update')" @click="updateProp(row)">修改</el-button>
            <el-button class="delete_btn" size="mini"  v-if="showButton('delete')" @click="deleteInfo(row)">删除</el-button>
          </template>
        </el-table-column>
      </el-table>
    </div>
    <div class="main_footer">
      <el-pagination
        background
        @current-change="changePageNum"
        @size-change="changePageSize"
        :current-page="pageNum"
        :page-sizes="[10, 20, 50, 100]"
        :page-size="pageSize"
        layout="total, sizes, prev, pager, next, jumper"
        :total="total">
      </el-pagination>
    </div>
    <el-dialog
      class="prop_dialog"
      :title="asyncTitle === true ? '新增' :'修改'"
      :close-on-click-modal="false"
      :visible.sync="asyncVisible"
      width="45%">
      <el-form ref="ruleForm" :model="ruleForm" :rules="rules" label-width="auto" class="rule_form">
        <el-form-item label="项目名称" prop="proId">
          <el-select v-model="ruleForm.proId" placeholder="请选择项目名称"  @change="getNumberList">
                <el-option
                    v-for="item in optionsProjects"
                    :key="item.proId"
                    :label="item.proName"
                    :value="item.proId">
                </el-option>
            </el-select>
        </el-form-item>
        <el-form-item label="模具编号" prop="mouldNum">
          <el-select v-model="ruleForm.mouldNum" placeholder="请选择模具编号" clearable @change="getSizeLists(1)">
                <el-option
                    v-for="(item,index) in optionsMoulds"
                    :key="index"
                    :label="item.mouldNum"
                    :value="item.mouldNum">
                </el-option>
            </el-select>
        </el-form-item>
        <el-form-item label="模具型号" prop="mouldCode">
          <el-select v-model="ruleForm.mouldCode" placeholder="请选择模具型号" clearable @change="getSizeLists(2)">
                <el-option
                    v-for="(item,index) in optionsCodes"
                    :key="index"
                    :label="item.mouldCode"
                    :value="item.mouldCode">
                </el-option>
            </el-select>
        </el-form-item>
        <el-form-item label="块号" prop="blockNum">
          <el-input v-model="ruleForm.blockNum" :size="size" clearable placeholder="请输入块号" :disabled="true"></el-input>
        </el-form-item>
        <el-form-item label="尺寸:" prop="size">
          <el-input v-model="ruleForm.size" :size="size" clearable placeholder="请输入尺寸" :disabled="true"></el-input>
        </el-form-item>
        <el-form-item label="转向:" prop="turn">
          <el-input v-model="ruleForm.turn" :size="size" clearable placeholder="请输入转向" :disabled="true"></el-input>
        </el-form-item>
        <el-form-item label="注浆孔:" prop="groutingHole">
          <el-input v-model="ruleForm.groutingHole" :size="size" clearable placeholder="请输入注浆孔" :disabled="true"></el-input>
        </el-form-item>
        <el-form-item label="检测内容:" prop="content">
          <el-input v-model="ruleForm.content" :size="size" type="textarea" :rows="3" clearable placeholder="请输入检测内容"></el-input>
        </el-form-item>
        <el-form-item label="上传检查表:" prop="files">
          <upload-file :file-list.sync="ruleForm.files">
                <template #info>
                    <span>点击上传文件,支持xls、xlsx、ppt、doc、docx、pdf格式</span>
                </template>
          </upload-file>
        </el-form-item>
        <el-form-item label="检查表日期:" prop="checkDate">
            <el-date-picker
                v-model="ruleForm.checkDate"
                type="date"
                value-format="yyyy-MM-dd HH:mm:ss"
                placeholder="请选择日期">
            </el-date-picker>
        </el-form-item>
        <el-form-item label="检测单位:" prop="checkUnit">
          <el-input v-model="ruleForm.checkUnit" :size="size" clearable placeholder="请输入检测单位"></el-input>
        </el-form-item>
      </el-form>
      <div slot="footer">
        <el-button  @click="asyncVisible = false">取 消</el-button>
        <el-button class="submit_btn" @click="asyncTitle ? submitInsert() : submitUpdate()">提 交</el-button>
      </div>
    </el-dialog>
  </div>
</template>
<script>
import { buttonPinia } from '../../../pinia/index';
import UploadFile from '../../../components/uploadFile';
import { throttle, changeSize } from '../../../plugins/public'; // 导入节流、动态切换组件尺寸方法
  export default {
    components:{
       UploadFile
    },
    data() {
      return {
        size: changeSize(), // 组件尺寸
        pageNum: 1,
        pageSize: 10,
        search:{},//查询条件
        total: 0,
        loading: false,
        dataList: [], //模具尺寸检查信息列表
        asyncTitle: true, // 对话框title 新增:true  修改:false
        asyncVisible: false, // 添加 修改对话框
        ruleForm: {
            files:[]
        }, // 按钮表单
        rules: {
        files: [{
            required: true,
            message: '请选择上传文件',
            trigger: ['blur','change']
          }],
          proId: [{
            required: true,
            message: '请选择项目名称',
            trigger: 'change'
          }],
          mouldNum: [{
            required: true,
            message: '请选择模具编号',
            trigger: ['blur','change']
          }],
          mouldCode: [{
            required: true,
            message: '请选择模具型号',
            trigger: ['change','blur']
          }],
          checkDate: [{
            required: true,
            message: '请选择检查表日期',
            trigger: 'change'
          }],
          content: [{
            required: true,
            message: '请输入检测内容',
            trigger: 'blur'
          }],
          checkUnit: [{
            required: true,
            message: '请输入检测单位',
            trigger: 'blur'
          }],
        },
        optionsMoulds:[],//模具编号
        optionsCodes:[],//模具型号
        optionsProjects:[],//所有项目
      }
    },
    watch: {
      asyncVisible(bol) {
        if(!bol) {
          this.ruleForm = {};
          this.$refs.ruleForm.resetFields();
        }else{
            this.$set(this.ruleForm,'files',[])
        }
      }
    },
    mounted() {
      const that = this;
      // 根据窗口大小动态修改组件尺寸
      window.onresize = () => {
        that.size = changeSize();
      }
    },
    methods: {
    //获得所有项目
    getAllPersons(){
        let params = {
            pageNum: 1,
            pageSize: 100000000
        }
        this.$api.Engineer.searchProjects(params).then(res=>{
            if(res.statusMsg === 'ok'){
                this.optionsProjects = res.data.list
            }else{
                this.$message.warning(res.statusMsg)
            }
        })
    },
    //根据项目获取编号,型号
    getNumberList(val){
        if(this.asyncVisible===false&&this.search.proId ===''){
            this.$set(this.search,'mouldNum','')
            this.$set(this.search,'mouldCode','')
        }
        if(this.asyncTitle){
            this.$set(this.ruleForm,'mouldNum','')
            this.$set(this.ruleForm,'mouldCode','')
            this.$set(this.ruleForm,'blockNum','')
            this.$set(this.ruleForm,'size','')
            this.$set(this.ruleForm,'turn','')
            this.$set(this.ruleForm,'groutingHole','')
        }
        this.$api.Quality.getMouldNumberLists({proId:val}).then(res=>{
            if(res.statusMsg === 'ok'){
                this.optionsMoulds = res.data
            }else{
                this.$message.warning(res.statusMsg)
            }
        })
        this.$api.Quality.getMuuldCodeLists({proId:val}).then(res=>{
            if(res.statusMsg === 'ok'){
                this.optionsCodes = res.data
            }else{
                this.$message.warning(res.statusMsg)
            }
        })
    },
    //获取尺寸等信息
    getSizeLists(val){
        let params
        if(this.asyncTitle){
            params={
                proId:this.ruleForm.proId,
                mouldNum:this.ruleForm.mouldNum,
                mouldCode:this.ruleForm.mouldCode
            }
        }else{
            params={
                proId:this.ruleForm.proId,
                mouldNum:this.ruleForm.mouldNum,
                mouldCode:this.ruleForm.mouldCode
            }
        }
        if(val===1){
            this.$set(this.ruleForm,'mouldCode','')
            let obj = {proId:this.ruleForm.proId,mouldNum:this.ruleForm.mouldNum}
            this.$api.Quality.getMuuldCodeLists(obj).then(res=>{
                if(res.statusMsg === 'ok'){
                    this.optionsCodes = res.data
                }else{
                    this.$message.warning(res.statusMsg)
                }
            })
        }else{
            this.$api.Quality.getProjectThroughSizes(params).then(res=>{
                if(res.statusMsg === 'ok'){
                    this.$set(this.ruleForm,'blockNum',res.data.mouldTypeName)
                    this.$set(this.ruleForm,'size',res.data.mouldSizeName)
                    this.$set(this.ruleForm,'turn',res.data.mouldTurnName)
                    this.$set(this.ruleForm,'groutingHole',res.data.groutingHolesName)
                }else{
                    this.$message.warning(res.statusMsg)
                }
            })
        }
    },
      // 查询按钮列表信息
      searchButtonInfo(bol) {
        if(bol) {
          this.pageNum = 1;
        }
        let params = Object.assign({},this.search,{
          pageNum: this.pageNum,
          pageSize: this.pageSize
        })
        this.loading = true;
        this.$api.Quality.searchQulityLists(params).then((res) => {
          if(res.statusMsg === 'ok') {
            this.total = res.data.total;
            this.dataList = res.data.list;
          }else{
            this.$message.warning(res.statusMsg)
          }
          this.loading = false;
        })
      },
      // 新增按钮信息
      insertProp() {
        this.asyncTitle = true;
        this.asyncVisible = true;
      },
      // 修改按钮信息
      updateProp(row) {
        this.asyncTitle = false;
        this.asyncVisible = true;
        this.getNumberList(row.proId)
        this.$api.Quality.detailsQulityInfo({id: row.id}).then(res=>{
            if(res.statusMsg === 'ok'){
                this.ruleForm = res.data
                this.$set(this.ruleForm, 'files', res.data.moldQualityFileEntities.map((item, index) => {
                    const type = item.fileName.split('.');
                    return {
                        id: index + 1,
                        type: type[type.length - 1],
                        name: item.fileName,
                        url: item.fileUrl
                    }
                }))
                res.data.tbigPaths.filter(iten=>iten.fileType ===1).map(item=>{
                    this.imageList.push({
                        id: this.imageList.length + 1,
                        url:`https://pipe.thhy-tj.com/${item.filePath}`,
                        name:item.filePathName,
                        nameImg:item.filePathName
                    })
                })
            }else{
                this.$message.warning(res.statusMsg)
            }
        })
      },
      // 删除按钮信息
      deleteInfo(row) {
        this.$confirm("该操作将删除该信息,是否继续删除?", "提示", {
          confirmButtonText: "确定",
          cancelButtonText: "取消",
          type: "warning"
       })
       .then(() => {
         this.$api.Quality.deleteQulityInfo({id: row.id})
        .then(res => {
          if(res.statusMsg === 'ok') {
            this.searchButtonInfo(true);
            this.$message.success("删除成功!");
          } else {
            this.$message.warning(res.statusMsg);
          }
        })
       })
       .catch(() => {
         this.$message.warning("您已取消");
       })
      },
      // 提交添加按钮信息
      submitInsert: throttle(function() {
        this.$refs.ruleForm.validate((valid) => {
          if(valid) {
            const params = Object.assign({}, this.ruleForm);
            params.moldQualityFileEntities = params.files&&params.files.map(item => {
               return {
                    fileName:item.name,
                    fileUrl:item.url
               }
            });
            delete params.files
            this.$api.Quality.addQulityInfo(params).then((res) => {
              if(res.statusMsg === 'ok') {
                this.asyncVisible = false;
                this.searchButtonInfo(true);
                this.$message.success('添加成功!');
              } else {
                this.$message.warning(res.statusMsg);
              }
            })
          }
        })
      }, 3000),
      // 提交修改按钮信息
      submitUpdate: throttle(function() {
        this.$refs.ruleForm.validate((valid) => {
          if(valid) {
            const params = Object.assign({}, this.ruleForm);
            params.moldQualityFileEntities = params.files&&params.files.map(item => {
               return {
                    fileName:item.name,
                    fileUrl:item.url
               }
            });
            delete params.files
            this.$api.Quality.updateQulityInfo(params).then((res) => {
              if(res.statusMsg === 'ok') {
                this.asyncVisible = false;
                this.searchButtonInfo(true);
                this.$message.success('修改成功!');
              } else {
                this.$message.warning(res.statusMsg);
              }
            })
          }
        })
      }, 3000),
      // 判断按钮权限信息
      showButton(str) {
        const pinia = buttonPinia();
        return pinia.$state.buttonInfo.includes(str);
      },
      // 切换页数
      changePageNum(page) {
        this.pageNum = page;
        this.searchButtonInfo();
      },
      // 切换每页条数
      changePageSize(size) {
        this.pageSize = size;
        this.searchButtonInfo();
      }
    }
  }
</script>
<style lang="sass" scoped>
@import '../../../style/layout-main.scss';
</style>
web/src/views/QualityManage/components/ThreedCheck.vue
对比新文件
@@ -0,0 +1,3 @@
<template>
    <div>三维检测</div>
</template>
web/src/views/SecureManage/RiskGrad/AreaGuarantee.vue
@@ -1,375 +1,375 @@
<template>
    <!-- 安全管理 ==> 风险分级管控 => 区域包保-->
    <div class="main">
        <!-- header -->
        <div class="main_header">
            <div class="header_item">
                <span class="header_label">区域名称:</span>
                <el-select v-model="queryInfo.regionHazardInformId" clearable placeholder="请选择域名称">
                    <el-option v-for="item in areaNames" :key="item.id" :label="item.region" :value="item.id">
                    </el-option>
                </el-select>
            </div>
            <div class="header_item">
                <el-button icon="el-icon-search" v-permission="'search'" @click="queryReset">查询</el-button>
                <el-button class="search_btn" icon="el-icon-plus" v-permission="'insert'" @click="addRow">新增</el-button>
            </div>
        </div>
        <!-- table -->
        <div class="main_content">
            <cpnTable :table-index="true" :table-data="dataList" :table-columns="tableColumns" :page-total="total"
                :page-num.sync="queryInfo.pageNum" :page-size.sync="queryInfo.pageSize" :page-change="pageChange">
            </cpnTable>
        </div>
        <!-- dialog -->
        <el-dialog class="prop_dialog" v-if="isRender" :title="dialogTitle" :visible.sync="asyncVisible" @close="closeForm">
            <el-form ref="ruleForm" :model="ruleForm" :rules="rules" label-width="auto" class="rule_form">
                <el-form-item label="区域名称:" prop="regionHazardInformId">
                    <el-select v-model="ruleForm.regionHazardInformId" placeholder="请选择区域名称">
                        <el-option v-for="item in areaNames" :key="item.id" :label="item.region" :value="item.id">
                        </el-option>
                    </el-select>
                </el-form-item>
                <el-form-item label="包保领导:" prop="leader">
                    <el-select v-model="ruleForm.leader" filterable multiple placeholder="请选择包保领导">
                        <el-option v-for="item in allPersons" :key="item.key" :label="item.label" :value="item.key">
                        </el-option>
                    </el-select>
                </el-form-item>
                <el-form-item label="小组成员:" prop="staff">
                    <el-transfer ref="transfer" v-model="ruleForm.staff" filterable :filter-method="filterMethod"
                        filter-placeholder="请输入员工姓名" :titles="['未选择', '已选择']" :data="allPersons">
                    </el-transfer>
                </el-form-item>
                <el-form-item label="风险源情况:" prop="riskSourceSituation">
                    <el-input type="textarea" v-model="ruleForm.riskSourceSituation" clearable placeholder="请输入风险源情况">
                    </el-input>
                </el-form-item>
                <el-form-item label="应对措施:" prop="countermeasures">
                    <el-input type="textarea" v-model="ruleForm.countermeasures" clearable placeholder="请输入应对措施">
                    </el-input>
                </el-form-item>
            </el-form>
            <div slot="footer">
                <el-button @click="asyncVisible = false">取 消</el-button>
                <el-button class="submit_btn" @click="onSubmit('ruleForm')">提 交</el-button>
            </div>
        </el-dialog>
    </div>
</template>
<script>
import {throttle} from '@/plugins/public'; // 导入节流、动态切换组件尺寸方法
import cpnTable from '@/components/element/Table'
export default {
    data() {
        return {
            isRender: false,
            loading: false,
            asyncVisible: false,
            submitMode: '', // add update
            total: 0,
            queryInfo: {
                pageNum: 1,
                pageSize: 10,
                regionHazardInformId: '',
            },
            areaNames: [], // 区域名称
            allPersons: [], // 所有人员渲染数据.穿梭框和选择框一起使用.
            dataList: [], // table渲染数据
            tableColumns: [], // table配置
            ruleForm: {}, // 按钮表单
            rules: {
                regionHazardInformId: [{required: true, message: '请选择区域名称', trigger: 'change'}],
                leader: [{required: true, message: '请选择包保领导', trigger: 'change'}],
                staff: [{required: true, message: '请选择小组成员', trigger: 'blur'}],
                riskSourceSituation: [{required: true, message: '请输入风险源情况', trigger: 'blur'}],
                countermeasures: [{required: true, message: '请输入应对措施', trigger: 'blur'}],
            },
            $http: '', // api路径赋值
        }
    },
    components: {
        cpnTable
    },
    computed: {
        isUpdate() {
            return this.submitMode === 'update'
        },
        dialogTitle() {
            return this.isUpdate ? '修改区域' : '新增区域'
        },
    },
    created() {
        this.$http = this.$api.Safety.RiskGrad.allocation
        this.setFormProps()
        this.setTableColumn()
        this.getLists()
        this.getAreaName()
    },
    methods: {
        // 获取table列表数据
        getLists() {
            this.loading = true
            let params = this.queryInfo
            this.$http.getLists(params).then(res => {
                if (res.statusMsg === 'ok') {
                    this.total = res.data.total
                    this.dataList = res.data.list
                }
                this.loading = false
            })
        },
        // 获取管服人员数据...showDialog时调用
        getPerson() {
            this.getPerson = this.runOnce(() => {
                return new Promise(resolve => {
                    this.$api.Personnerl.SEARCHMORTGAGEELIST({
                        userType: 1,
                        pageNum: 1,
                        pageSize: 9999
                    }).then((res) => {
                        if (res.success) {
                            const list = res.data.list
                            const out = []
                            list.forEach(item => {
                                out.push({
                                    label: item.realName, // 穿梭框规定字段, 可绑定props属性修改默认规定的字段.
                                    key: item.userId, // 穿梭框规定使字段
                                })
                            })
                            this.allPersons = out
                            resolve()
                        }
                    })
                })
            })
            return this.getPerson()
        },
        // 获取区域信息
        getAreaName() {
            this.$api.Safety.RiskGrad.warning.getLists({
                pageNum: 1,
                pageSize: 9999
            }).then((res) => {
                if (res.success) {
                    const list = res.data.list
                    const out = []
                    list.forEach(item => {
                        out.push({
                            id: item.id,
                            region: item.region,
                        })
                    })
                    this.areaNames = out
                }
            })
        },
        // 初始化 ruleform
        setFormProps(options = {}) {
            let _form = {
                regionHazardInformId: '', // 区域名称id
                leader: [],  // 包保领导
                staff: [],  // 小组成员
                riskSourceSituation: '', // 风险源情况
                countermeasures: '',  // 应对措施
            }
            this.ruleForm = Object.keys(options).length ? options : _form
        },
        // 初始化 table 配置
        setTableColumn() {
            this.tableColumns = [
                {index: true},
                {
                    name: "区域名称", key: "regionHazardInformId", formatter: (row) => {
                        return row.region
                    }
                },
                {
                    name: "包保领导", key: "leaderList", formatter: (row) => {
                        let el = ''
                        row.leaderList.forEach(item => {
                            el += item.realName + '、'
                        })
                        return el
                    }
                },
                {
                    name: "小组成员", key: "staffList", formatter: (row) => {
                        let el = ''
                        row.staffList.forEach(item => {
                            el += item.realName + '、'
                        })
                        return el
                    }
                },
                {name: "风险源情况", key: "riskSourceSituation"},
                {name: "应对措施", key: "countermeasures"},
                {
                    operation: true, name: "操作", width: 140, value: [
                        {name: "修改", class: "table_btn", permission: "update", handleRow: this.updateRow},
                        {name: "删除", class: "delete_btn", permission: "delete", handleRow: this.deleteRow},
                    ]
                },
            ]
        },
        runOnce(fn, context) { //控制让函数只触发一次
            return () => {
                if (!fn) return
                try {
                    return fn.apply(context || this, arguments)
                }
                finally {
                    fn = null
                }
            }
        },
        // 穿梭框搜索关键字变化时触发
        filterMethod(query, item) {
            return item.label.indexOf(query) > -1
        },
        // 重置表单
        resetForm(formName) {
            this.$refs[formName].resetFields()
        },
        // 重置穿梭框选中状态
        resetTransfer(transferName) {
            this.$refs[transferName].$refs.leftPanel.checked = []
            this.$refs[transferName].$refs.rightPanel.checked = []
        },
        // 显示表单
        async showForm() {
            !this.isRender && (this.isRender = true)
            this.asyncVisible = true
            await this.getPerson()
        },
        // 隐藏表单
        closeForm() {
            this.asyncVisible = false
            this.resetForm('ruleForm')
            this.resetTransfer('transfer')
        },
        // 查询按钮列表信息
        queryReset() {
            this.queryInfo.pageNum = 1
            this.queryInfo.pageSize = 10
            this.getLists()
        },
        // 添加数据
        addRow() {
            this.submitMode = 'add'
            this.showForm()
        },
        // 更新数据
        async updateRow(row) {
            this.submitMode = 'update'
            await this.showForm()
            this.$nextTick(() => {
                this.ruleForm.id = ''
                const strongObj = {
                    staff: [],
                    leader: [],
                }
                row.staffList.forEach(item => {
                    strongObj.staff.push(item.userId)
                })
                row.leaderList.forEach(item => {
                    strongObj.leader.push(item.userId)
                })
                Object.keys(this.ruleForm).forEach(item => {
                    if (row.hasOwnProperty.call(row, item)) {
                        this.ruleForm[item] = strongObj[item] || row[item]
                    }
                })
            })
        },
        // 删除数据
        deleteRow(row) {
            const params = {id: row.id}
            this.$confirm("该操作将删除该信息,是否继续删除?", "提示", {
                confirmButtonText: "确定",
                cancelButtonText: "取消",
                type: "warning"
            }).then(() => {
                this.$http.delete(params).then(res => {
                    if (res.statusMsg === 'ok') {
                        this.queryReset();
                        this.$message.success("删除成功!")
                    } else {
                        this.$message.warning(res.statusMsg)
                    }
                })
            }).catch(() => {
                this.$message.warning("您已取消")
            })
        },
        // 提交表单
        onSubmit: throttle(function (formName) {
            this.$refs[formName].validate(valid => {
                if (!valid) return
                const params = this.ruleForm
                if (this.isUpdate) {
                    // 更新
                    this.$http.update(params).then((res) => {
                        if (res.statusMsg === 'ok') {
                            this.closeForm()
                            this.getLists()
                            this.$message.success('更新成功!')
                        } else {
                            this.$message.warning(res.statusMsg)
                        }
                    })
                } else {
                    // 添加
                    this.$http.insert(params).then((res) => {
                        if (res.statusMsg === 'ok') {
                            this.closeForm()
                            this.getLists()
                            this.$message.success('添加成功!')
                        } else {
                            this.$message.warning(res.statusMsg)
                        }
                    })
                }
            })
        }, 1000),
        // 分页改变
        pageChange() {
            this.getLists()
        },
    }
}
</script>
<style lang="scss" scoped>
@import '@/style/layout-main.scss';
/deep/ {
    &::-webkit-scrollbar {
        width: 8px;
        height: 8px;
    }
    &::-webkit-scrollbar-corner {
        background-color: transparent;
    }
    &::-webkit-scrollbar-thumb {
        border-radius: 10px;
        box-shadow: inset 0 0 5px transparent;
        background: #39B5FE;
    }
    &::-webkit-scrollbar-track {
        box-shadow: inset 0 0 5px transparent;
        border-radius: 10px;
        background: rgba(76, 188, 254, .3);
    }
}
<template>
    <!-- 安全管理 ==> 风险分级管控 => 区域包保-->
    <div class="main">
        <!-- header -->
        <div class="main_header">
            <div class="header_item">
                <span class="header_label">区域名称:</span>
                <el-select v-model="queryInfo.regionHazardInformId" clearable placeholder="请选择域名称">
                    <el-option v-for="item in areaNames" :key="item.id" :label="item.region" :value="item.id">
                    </el-option>
                </el-select>
            </div>
            <div class="header_item">
                <el-button icon="el-icon-search" v-permission="'search'" @click="queryReset">查询</el-button>
                <el-button class="search_btn" icon="el-icon-plus" v-permission="'insert'" @click="addRow">新增</el-button>
            </div>
        </div>
        <!-- table -->
        <div class="main_content">
            <cpnTable :table-index="true" :table-data="dataList" :table-columns="tableColumns" :page-total="total"
                :page-num.sync="queryInfo.pageNum" :page-size.sync="queryInfo.pageSize" :page-change="pageChange">
            </cpnTable>
        </div>
        <!-- dialog -->
        <el-dialog class="prop_dialog" v-if="isRender" :title="dialogTitle" :visible.sync="asyncVisible" @close="closeForm">
            <el-form ref="ruleForm" :model="ruleForm" :rules="rules" label-width="auto" class="rule_form">
                <el-form-item label="区域名称:" prop="regionHazardInformId">
                    <el-select v-model="ruleForm.regionHazardInformId" placeholder="请选择区域名称">
                        <el-option v-for="item in areaNames" :key="item.id" :label="item.region" :value="item.id">
                        </el-option>
                    </el-select>
                </el-form-item>
                <el-form-item label="包保领导:" prop="leader">
                    <el-select v-model="ruleForm.leader" filterable multiple placeholder="请选择包保领导">
                        <el-option v-for="item in allPersons" :key="item.key" :label="item.label" :value="item.key">
                        </el-option>
                    </el-select>
                </el-form-item>
                <el-form-item label="小组成员:" prop="staff">
                    <el-transfer ref="transfer" v-model="ruleForm.staff" filterable :filter-method="filterMethod"
                        filter-placeholder="请输入员工姓名" :titles="['未选择', '已选择']" :data="allPersons">
                    </el-transfer>
                </el-form-item>
                <el-form-item label="风险源情况:" prop="riskSourceSituation">
                    <el-input type="textarea" v-model="ruleForm.riskSourceSituation" clearable placeholder="请输入风险源情况">
                    </el-input>
                </el-form-item>
                <el-form-item label="应对措施:" prop="countermeasures">
                    <el-input type="textarea" v-model="ruleForm.countermeasures" clearable placeholder="请输入应对措施">
                    </el-input>
                </el-form-item>
            </el-form>
            <div slot="footer">
                <el-button @click="asyncVisible = false">取 消</el-button>
                <el-button class="submit_btn" @click="onSubmit('ruleForm')">提 交</el-button>
            </div>
        </el-dialog>
    </div>
</template>
<script>
import {throttle} from '@/plugins/public'; // 导入节流、动态切换组件尺寸方法
import cpnTable from '@/components/element/Table'
export default {
    data() {
        return {
            isRender: false,
            loading: false,
            asyncVisible: false,
            submitMode: '', // add update
            total: 0,
            queryInfo: {
                pageNum: 1,
                pageSize: 10,
                regionHazardInformId: '',
            },
            areaNames: [], // 区域名称
            allPersons: [], // 所有人员渲染数据.穿梭框和选择框一起使用.
            dataList: [], // table渲染数据
            tableColumns: [], // table配置
            ruleForm: {}, // 按钮表单
            rules: {
                regionHazardInformId: [{required: true, message: '请选择区域名称', trigger: 'change'}],
                leader: [{required: true, message: '请选择包保领导', trigger: 'change'}],
                staff: [{required: true, message: '请选择小组成员', trigger: 'blur'}],
                riskSourceSituation: [{required: true, message: '请输入风险源情况', trigger: 'blur'}],
                countermeasures: [{required: true, message: '请输入应对措施', trigger: 'blur'}],
            },
            $http: '', // api路径赋值
        }
    },
    components: {
        cpnTable
    },
    computed: {
        isUpdate() {
            return this.submitMode === 'update'
        },
        dialogTitle() {
            return this.isUpdate ? '修改区域' : '新增区域'
        },
    },
    created() {
        this.$http = this.$api.Safety.RiskGrad.allocation
        this.setFormProps()
        this.setTableColumn()
        this.getLists()
        this.getAreaName()
    },
    methods: {
        // 获取table列表数据
        getLists() {
            this.loading = true
            let params = this.queryInfo
            this.$http.getLists(params).then(res => {
                if (res.statusMsg === 'ok') {
                    this.total = res.data.total
                    this.dataList = res.data.list
                }
                this.loading = false
            })
        },
        // 获取管服人员数据...showDialog时调用
        getPerson() {
            this.getPerson = this.runOnce(() => {
                return new Promise(resolve => {
                    this.$api.Personnerl.SEARCHMORTGAGEELIST({
                        userType: 1,
                        pageNum: 1,
                        pageSize: 9999
                    }).then((res) => {
                        if (res.success) {
                            const list = res.data.list
                            const out = []
                            list.forEach(item => {
                                out.push({
                                    label: item.realName, // 穿梭框规定字段, 可绑定props属性修改默认规定的字段.
                                    key: item.userId, // 穿梭框规定使字段
                                })
                            })
                            this.allPersons = out
                            resolve()
                        }
                    })
                })
            })
            return this.getPerson()
        },
        // 获取区域信息
        getAreaName() {
            this.$api.Safety.RiskGrad.warning.getLists({
                pageNum: 1,
                pageSize: 9999
            }).then((res) => {
                if (res.success) {
                    const list = res.data.list
                    const out = []
                    list.forEach(item => {
                        out.push({
                            id: item.id,
                            region: item.region,
                        })
                    })
                    this.areaNames = out
                }
            })
        },
        // 初始化 ruleform
        setFormProps(options = {}) {
            let _form = {
                regionHazardInformId: '', // 区域名称id
                leader: [],  // 包保领导
                staff: [],  // 小组成员
                riskSourceSituation: '', // 风险源情况
                countermeasures: '',  // 应对措施
            }
            this.ruleForm = Object.keys(options).length ? options : _form
        },
        // 初始化 table 配置
        setTableColumn() {
            this.tableColumns = [
                {index: true},
                {
                    name: "区域名称", key: "regionHazardInformId", formatter: (row) => {
                        return row.region
                    }
                },
                {
                    name: "包保领导", key: "leaderList", formatter: (row) => {
                        let el = []
                        row.leaderList.forEach(item => {
                            el.push(item.realName)
                        })
                        return el.join('、')
                    }
                },
                {
                    name: "小组成员", key: "staffList", formatter: (row) => {
                        let el = []
                        row.staffList.forEach(item => {
                            el.push(item.realName)
                        })
                        return el.join('、')
                    }
                },
                {name: "风险源情况", key: "riskSourceSituation", showOverflowTip: true},
                {name: "应对措施", key: "countermeasures", showOverflowTip: true},
                {
                    operation: true, name: "操作", width: 140, value: [
                        {name: "修改", class: "table_btn", permission: "update", handleRow: this.updateRow},
                        {name: "删除", class: "delete_btn", permission: "delete", handleRow: this.deleteRow},
                    ]
                },
            ]
        },
        runOnce(fn, context) { //控制让函数只触发一次
            return () => {
                if (!fn) return
                try {
                    return fn.apply(context || this, arguments)
                }
                finally {
                    fn = null
                }
            }
        },
        // 穿梭框搜索关键字变化时触发
        filterMethod(query, item) {
            return item.label.indexOf(query) > -1
        },
        // 重置表单
        resetForm(formName) {
            this.$refs[formName].resetFields()
        },
        // 重置穿梭框选中状态
        resetTransfer(transferName) {
            this.$refs[transferName].$refs.leftPanel.checked = []
            this.$refs[transferName].$refs.rightPanel.checked = []
        },
        // 显示表单
        async showForm() {
            !this.isRender && (this.isRender = true)
            this.asyncVisible = true
            await this.getPerson()
        },
        // 隐藏表单
        closeForm() {
            this.asyncVisible = false
            this.resetForm('ruleForm')
            this.resetTransfer('transfer')
        },
        // 查询按钮列表信息
        queryReset() {
            this.queryInfo.pageNum = 1
            this.queryInfo.pageSize = 10
            this.getLists()
        },
        // 添加数据
        addRow() {
            this.submitMode = 'add'
            this.showForm()
        },
        // 更新数据
        async updateRow(row) {
            this.submitMode = 'update'
            await this.showForm()
            this.$nextTick(() => {
                this.ruleForm.id = ''
                const strongObj = {
                    staff: [],
                    leader: [],
                }
                row.staffList.forEach(item => {
                    strongObj.staff.push(item.userId)
                })
                row.leaderList.forEach(item => {
                    strongObj.leader.push(item.userId)
                })
                Object.keys(this.ruleForm).forEach(item => {
                    if (row.hasOwnProperty.call(row, item)) {
                        this.ruleForm[item] = strongObj[item] || row[item]
                    }
                })
            })
        },
        // 删除数据
        deleteRow(row) {
            const params = {id: row.id}
            this.$confirm("该操作将删除该信息,是否继续删除?", "提示", {
                confirmButtonText: "确定",
                cancelButtonText: "取消",
                type: "warning"
            }).then(() => {
                this.$http.delete(params).then(res => {
                    if (res.statusMsg === 'ok') {
                        this.queryReset();
                        this.$message.success("删除成功!")
                    } else {
                        this.$message.warning(res.statusMsg)
                    }
                })
            }).catch(() => {
                this.$message.warning("您已取消")
            })
        },
        // 提交表单
        onSubmit: throttle(function (formName) {
            this.$refs[formName].validate(valid => {
                if (!valid) return
                const params = this.ruleForm
                if (this.isUpdate) {
                    // 更新
                    this.$http.update(params).then((res) => {
                        if (res.statusMsg === 'ok') {
                            this.closeForm()
                            this.getLists()
                            this.$message.success('更新成功!')
                        } else {
                            this.$message.warning(res.statusMsg)
                        }
                    })
                } else {
                    // 添加
                    this.$http.insert(params).then((res) => {
                        if (res.statusMsg === 'ok') {
                            this.closeForm()
                            this.getLists()
                            this.$message.success('添加成功!')
                        } else {
                            this.$message.warning(res.statusMsg)
                        }
                    })
                }
            })
        }, 1000),
        // 分页改变
        pageChange() {
            this.getLists()
        },
    }
}
</script>
<style lang="scss" scoped>
@import '@/style/layout-main.scss';
/deep/ {
    &::-webkit-scrollbar {
        width: 8px;
        height: 8px;
    }
    &::-webkit-scrollbar-corner {
        background-color: transparent;
    }
    &::-webkit-scrollbar-thumb {
        border-radius: 10px;
        box-shadow: inset 0 0 5px transparent;
        background: #39B5FE;
    }
    &::-webkit-scrollbar-track {
        box-shadow: inset 0 0 5px transparent;
        border-radius: 10px;
        background: rgba(76, 188, 254, .3);
    }
}
</style>
web/src/views/SecureManage/RiskGrad/DangerInform.vue
@@ -1,268 +1,260 @@
<template>
    <!-- 安全管理 ==> 风险分级管控 => 危险源告知-->
    <div class="main">
        <!-- header -->
        <div class="main_header">
            <div class="header_item">
                <span class="header_label">安全等级:</span>
                <el-select v-model="queryInfo.levelType" placeholder="请选择安全等级" clearable>
                    <el-option v-for="item in safetyLevels" :key="item.levelType" :label="item.name"
                        :value="item.levelType">
                    </el-option>
                </el-select>
            </div>
            <div class="header_item">
                <el-button icon="el-icon-search" v-permission="'search'" @click="queryReset">查询</el-button>
                <el-button class="search_btn" icon="el-icon-plus" v-permission="'insert'" @click="addRow">新增</el-button>
            </div>
        </div>
        <!-- table -->
        <div class="main_content">
            <cpnTable :table-index="true" :table-data="dataList" :table-columns="tableColumns" :page-total="total"
                :page-num.sync="queryInfo.pageNum" :page-size.sync="queryInfo.pageSize" :page-change="pageChange">
            </cpnTable>
        </div>
        <!-- dialog -->
        <el-dialog class="prop_dialog" v-if="isRender" :title="dialogTitle" :visible.sync="asyncVisible" width="460px"
            @close="closeForm">
            <el-form ref="ruleForm" :model="ruleForm" :rules="rules" label-width="auto" class="rule_form">
                <el-form-item label="区域名称:" prop="region">
                    <el-input v-model="ruleForm.region" clearable placeholder="请输入区域名称"></el-input>
                </el-form-item>
                <el-form-item label="安全等级:" prop="levelType">
                    <el-select v-model="ruleForm.levelType" placeholder="请选择">
                        <el-option v-for="item in safetyLevels" :key="item.levelType" :label="item.name"
                            :value="item.levelType">
                        </el-option>
                    </el-select>
                </el-form-item>
                <el-form-item label="区域颜色:" prop="regionColor">
                    <el-input v-model="ruleForm.regionColor" placeholder="请选择区域颜色" disabled></el-input>
                    <el-color-picker v-model="ruleForm.regionColor"></el-color-picker>
                </el-form-item>
            </el-form>
            <div slot="footer">
                <el-button @click="asyncVisible = false">取 消</el-button>
                <el-button class="submit_btn" @click="onSubmit('ruleForm')">提 交</el-button>
            </div>
        </el-dialog>
    </div>
</template>
<script>
import {throttle} from '@/plugins/public'; // 导入节流、动态切换组件尺寸方法
import cpnTable from '@/components/element/Table'
export default {
    data() {
        return {
            isRender: false,
            loading: false,
            asyncVisible: false,
            submitMode: '', // add update
            total: 0,
            queryInfo: {
                pageNum: 1,
                pageSize: 10,
                levelType: '',
            },
            safetyLevelMap: {
                1: {name: 'IV-A级', levelType: 1},
                2: {name: 'IV-B级', levelType: 1},
                3: {name: 'IV-C级', levelType: 1},
                4: {name: 'IV-D级', levelType: 1},
            }, //  安全等级 map
            safetyLevels: [
                {name: 'IV-A级', levelType: 1},
                {name: 'IV-B级', levelType: 2},
                {name: 'IV-C级', levelType: 3},
                {name: 'IV-D级', levelType: 4},
            ], // 安全等级 arr
            dataList: [],
            tableColumns: [], // table配置
            ruleForm: {}, // 按钮表单
            rules: {
                region: [{required: true, message: '请输入区域名称', trigger: 'blur'}],
                levelType: [{required: true, message: '请选择安全等级', trigger: 'change'}],
                regionColor: [{required: true, message: '请选择区域颜色', trigger: 'change'}],
            },
            $http: '', // api路径赋值
        }
    },
    components: {
        cpnTable
    },
    computed: {
        isUpdate() {
            return this.submitMode === 'update'
        },
        dialogTitle() {
            return this.isUpdate ? '修改区域' : '新增区域'
        },
    },
    created() {
        this.$http = this.$api.Safety.RiskGrad.warning
        this.setFormProps()
        this.setTableColumn()
        this.getLists()
    },
    methods: {
        // 获取table列表数据
        getLists() {
            this.loading = true
            let params = this.queryInfo
            this.$http.getLists(params).then(res => {
                if (res.statusMsg === 'ok') {
                    this.total = res.data.total
                    this.dataList = res.data.list
                }
                this.loading = false
            })
        },
        // 初始化 ruleform
        setFormProps(options = {}) {
            let _form = {
                region: '', // 区域名称
                levelType: '', // 安全等级
                regionColor: '',  // 区域等级颜色
            }
            this.ruleForm = Object.keys(options).length ? options : _form
        },
        // 初始化 table 配置
        setTableColumn() {
            this.tableColumns = [
                {index: true},
                {name: "区域名称", key: "region"},
                {name: "安全等级", key: "levelType", formatter: (row) => {return this.safetyLevelMap[row.levelType].name}},
                {name: "区域颜色", key: "regionColor"},
                {
                    operation: true, name: "操作", width: 140, value: [
                        {name: "修改", class: "table_btn", permission: "update", handleRow: this.updateRow},
                        {name: "删除", class: "delete_btn", permission: "delete", handleRow: this.deleteRow},
                    ]
                },
            ]
        },
        // 重置表单
        resetForm(formName) {
            this.$refs[formName].resetFields()
        },
        // 显示表单
        showForm() {
            !this.isRender && (this.isRender = true)
            this.asyncVisible = true
        },
        // 隐藏表单
        closeForm() {
            this.asyncVisible = false
            this.resetForm('ruleForm')
        },
        // 查询按钮列表信息
        queryReset() {
            this.queryInfo.pageNum = 1
            this.queryInfo.pageSize = 10
            this.getLists()
        },
        // 添加数据
        addRow() {
            this.submitMode = 'add'
            this.showForm()
        },
        // 更新数据
        updateRow(row) {
            this.submitMode = 'update'
            this.showForm()
            this.$nextTick(() => {
                this.ruleForm.id = ''
                Object.keys(this.ruleForm).forEach(item => {
                    if (row.hasOwnProperty.call(row, item)) {
                        this.ruleForm[item] = row[item]
                    }
                })
            })
        },
        // 删除数据
        deleteRow(row) {
            const params = {id: row.id}
            this.$confirm("该操作将删除该信息,是否继续删除?", "提示", {
                confirmButtonText: "确定",
                cancelButtonText: "取消",
                type: "warning"
            }).then(() => {
                this.$http.delete(params).then(res => {
                    if (res.statusMsg === 'ok') {
                        this.queryReset();
                        this.$message.success("删除成功!")
                    } else {
                        this.$message.warning(res.statusMsg)
                    }
                })
            }).catch(() => {
                this.$message.warning("您已取消")
            })
        },
        // 提交表单
        onSubmit: throttle(function () {
            this.$refs.ruleForm.validate(valid => {
                if (!valid) return
                const params = this.ruleForm
                if (this.isUpdate) {
                    // 更新
                    this.$http.update(params).then((res) => {
                        if (res.statusMsg === 'ok') {
                            this.closeForm()
                            this.getLists()
                            this.$message.success('更新成功!')
                        } else {
                            this.$message.warning(res.statusMsg)
                        }
                    })
                } else {
                    // 添加
                    this.$http.insert(params).then((res) => {
                        if (res.statusMsg === 'ok') {
                            this.closeForm()
                            this.getLists()
                            this.$message.success('添加成功!')
                        } else {
                            this.$message.warning(res.statusMsg)
                        }
                    })
                }
            })
        }, 1000),
        // 分页改变
        pageChange() {
            this.getLists()
        },
    }
}
</script>
<style lang="scss" scoped>
@import '@/style/layout-main.scss';
/deep/ {
    &::-webkit-scrollbar {
        width: 8px;
        height: 8px;
    }
    &::-webkit-scrollbar-corner {
        background-color: transparent;
    }
    &::-webkit-scrollbar-thumb {
        border-radius: 10px;
        box-shadow: inset 0 0 5px transparent;
        background: #39B5FE;
    }
    &::-webkit-scrollbar-track {
        box-shadow: inset 0 0 5px transparent;
        border-radius: 10px;
        background: rgba(76, 188, 254, .3);
    }
}
<template>
    <!-- 安全管理 ==> 风险分级管控 => 危险源告知-->
    <div class="main">
        <!-- header -->
        <div class="main_header">
            <div class="header_item">
                <span class="header_label">安全等级:</span>
                <el-select v-model="queryInfo.levelType" placeholder="请选择安全等级" clearable>
                    <el-option v-for="item in safetyLevels" :key="item.levelType" :label="item.name"
                        :value="item.levelType">
                    </el-option>
                </el-select>
            </div>
            <div class="header_item">
                <el-button icon="el-icon-search" v-permission="'search'" @click="queryReset">查询</el-button>
                <el-button class="search_btn" icon="el-icon-plus" v-permission="'insert'" @click="addRow">新增</el-button>
            </div>
        </div>
        <!-- table -->
        <div class="main_content">
            <cpnTable :table-index="true" :table-data="dataList" :table-columns="tableColumns" :page-total="total"
                :page-num.sync="queryInfo.pageNum" :page-size.sync="queryInfo.pageSize" :page-change="pageChange">
            </cpnTable>
        </div>
        <!-- dialog -->
        <el-dialog class="prop_dialog" v-if="isRender" :title="dialogTitle" :visible.sync="asyncVisible" width="460px"
            @close="closeForm">
            <el-form ref="ruleForm" :model="ruleForm" :rules="rules" label-width="auto" class="rule_form">
                <el-form-item label="区域名称:" prop="region">
                    <el-input v-model="ruleForm.region" clearable placeholder="请输入区域名称"></el-input>
                </el-form-item>
                <el-form-item label="安全等级:" prop="levelType">
                    <el-select v-model="ruleForm.levelType" placeholder="请选择">
                        <el-option v-for="item in safetyLevels" :key="item.levelType" :label="item.name"
                            :value="item.levelType">
                        </el-option>
                    </el-select>
                </el-form-item>
                <el-form-item label="区域颜色:" prop="regionColor">
                    <el-input v-model="ruleForm.regionColor" placeholder="请选择区域颜色" disabled></el-input>
                    <el-color-picker v-model="ruleForm.regionColor"></el-color-picker>
                </el-form-item>
            </el-form>
            <div slot="footer">
                <el-button @click="asyncVisible = false">取 消</el-button>
                <el-button class="submit_btn" @click="onSubmit('ruleForm')">提 交</el-button>
            </div>
        </el-dialog>
    </div>
</template>
<script>
import {throttle} from '@/plugins/public'; // 导入节流、动态切换组件尺寸方法
import cpnTable from '@/components/element/Table'
export default {
    data() {
        return {
            isRender: false,
            loading: false,
            asyncVisible: false,
            submitMode: '', // add update
            total: 0,
            queryInfo: {
                pageNum: 1,
                pageSize: 10,
                levelType: '',
            },
            safetyLevelMap: {
                1: {name: 'IV-A级', levelType: 1},
                2: {name: 'IV-B级', levelType: 1},
                3: {name: 'IV-C级', levelType: 1},
                4: {name: 'IV-D级', levelType: 1},
            }, //  安全等级 map
            safetyLevels: [
                {name: 'IV-A级', levelType: 1},
                {name: 'IV-B级', levelType: 2},
                {name: 'IV-C级', levelType: 3},
                {name: 'IV-D级', levelType: 4},
            ], // 安全等级 arr
            dataList: [],
            tableColumns: [], // table配置
            ruleForm: {}, // 按钮表单
            rules: {
                region: [{required: true, message: '请输入区域名称', trigger: 'blur'}],
                levelType: [{required: true, message: '请选择安全等级', trigger: 'change'}],
                regionColor: [{required: true, message: '请选择区域颜色', trigger: 'change'}],
            },
            $http: '', // api路径赋值
        }
    },
    components: {
        cpnTable
    },
    computed: {
        isUpdate() {
            return this.submitMode === 'update'
        },
        dialogTitle() {
            return this.isUpdate ? '修改区域' : '新增区域'
        },
    },
    created() {
        this.$http = this.$api.Safety.RiskGrad.warning
        this.setFormProps()
        this.setTableColumn()
        this.getLists()
    },
    methods: {
        // 获取table列表数据
        getLists() {
            this.loading = true
            let params = this.queryInfo
            this.$http.getLists(params).then(res => {
                if (res.statusMsg === 'ok') {
                    this.total = res.data.total
                    this.dataList = res.data.list
                }
                this.loading = false
            })
        },
        // 初始化 ruleform
        setFormProps(options = {}) {
            let _form = {
                region: '', // 区域名称
                levelType: '', // 安全等级
                regionColor: '',  // 区域等级颜色
            }
            this.ruleForm = Object.keys(options).length ? options : _form
        },
        // 初始化 table 配置
        setTableColumn() {
            this.tableColumns = [
                {index: true},
                {name: "区域名称", key: "region"},
                {name: "安全等级", key: "levelType", formatter: (row) => {return this.safetyLevelMap[row.levelType].name}},
                {name: "区域颜色", key: "regionColor"},
                {
                    operation: true, name: "操作", width: 140, value: [
                        {name: "修改", class: "table_btn", permission: "update", handleRow: this.updateRow},
                        {name: "删除", class: "delete_btn", permission: "delete", handleRow: this.deleteRow},
                    ]
                },
            ]
        },
        // 重置表单
        resetForm(formName) {
            this.$refs[formName].resetFields()
        },
        // 显示表单
        showForm() {
            !this.isRender && (this.isRender = true)
            this.asyncVisible = true
        },
        // 隐藏表单
        closeForm() {
            this.asyncVisible = false
            this.resetForm('ruleForm')
        },
        // 查询按钮列表信息
        queryReset() {
            this.queryInfo.pageNum = 1
            this.queryInfo.pageSize = 10
            this.getLists()
        },
        // 添加数据
        addRow() {
            this.submitMode = 'add'
            this.showForm()
        },
        // 更新数据
        updateRow(row) {
            this.submitMode = 'update'
            this.showForm()
            this.$nextTick(() => {
                this.ruleForm.id = ''
                Object.keys(this.ruleForm).forEach(item => {
                    if (row.hasOwnProperty.call(row, item)) {
                        this.ruleForm[item] = row[item]
                    }
                })
            })
        },
        // 删除数据
        deleteRow(row) {
            const params = {id: row.id}
            this.$confirm("该操作将删除该信息,是否继续删除?", "提示", {
                confirmButtonText: "确定",
                cancelButtonText: "取消",
                type: "warning"
            }).then(() => {
                this.$http.delete(params).then(res => {
                    if (res.statusMsg === 'ok') {
                        this.queryReset();
                        this.$message.success("删除成功!")
                    } else {
                        this.$message.warning(res.statusMsg)
                    }
                })
            }).catch(() => {
                this.$message.warning("您已取消")
            })
        },
        // 提交表单
        onSubmit: throttle(function () {
            this.$refs.ruleForm.validate(valid => {
                if (!valid) return
                const params = this.ruleForm
                if (this.isUpdate) {
                    // 更新
                    this.$http.update(params).then((res) => {
                        if (res.statusMsg === 'ok') {
                            this.closeForm()
                            this.getLists()
                            this.$message.success('更新成功!')
                        } else {
                            this.$message.warning(res.statusMsg)
                        }
                    })
                } else {
                    // 添加
                    this.$http.insert(params).then((res) => {
                        if (res.statusMsg === 'ok') {
                            this.closeForm()
                            this.getLists()
                            this.$message.success('添加成功!')
                        } else {
                            this.$message.warning(res.statusMsg)
                        }
                    })
                }
            })
        }, 1000),
        // 分页改变
        pageChange() {
            this.getLists()
        },
    }
}
</script>
<style lang="scss" scoped>
@import '@/style/layout-main.scss';
</style>
<style lang="scss">
.el-color-dropdown__btns {
    .el-color-dropdown__btn {
        background: #fff;
        border: 1px solid #dcdfe6;
        color: #606266;
    }
    .el-color-dropdown__link-btn {
        border-color: transparent;
        background-color: transparent;
        color: #66b1ff;
    }
}
</style>
web/src/views/SecureManage/SmartHelmet/TrackBack.vue
@@ -152,10 +152,8 @@
            let out = {}
            const params = {
                userId: this.userId,
                // strTime: this.chart.date?.[0],
                // endTime: this.chart.date?.[1],
                strTime: '2023-06-01',
                endTime: '2023-06-31',
                strTime: this.chart.date?.[0],
                endTime: this.chart.date?.[1],
            }
            const {data, statusMsg} = await this.$http.getOnlineTime(params)
            if (statusMsg === 'ok') {
@@ -174,10 +172,8 @@
            }
            const params = {
                userId: this.userId,
                // strTime: this.chart.date?.[0],
                // endTime: this.chart.date?.[1],
                strTime: '2023-06-01',
                endTime: '2023-06-31',
                strTime: this.chart.date?.[0],
                endTime: this.chart.date?.[1],
            }
            const {data, statusMsg} = await this.$http.getTrackLists(params)
            if (statusMsg === 'ok') {