李旭东
2023-11-08 8bb87e050d73924843552f73563469711c833d03
Merge branch 'master' of http://111.30.93.211:10101/r/supipe
已修改8个文件
已添加7个文件
2480 ■■■■ 文件已修改
hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/pipeoutplan/service/impl/PipeOutPlanServiceImpl.java 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/rebarprint/controller/TSteelPrintController.java 47 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hd/pipe/secure/src/main/java/com/thhy/secure/modules/biz/hiddenDanger/controller/HiddenDangerController.java 92 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hd/pipe/secure/src/main/java/com/thhy/secure/modules/biz/hiddenDanger/entity/HiddenDangerEntity.java 81 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hd/pipe/secure/src/main/java/com/thhy/secure/modules/biz/hiddenDanger/entity/HiddenDangerImgEntity.java 37 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hd/pipe/secure/src/main/java/com/thhy/secure/modules/biz/hiddenDanger/mapper/HiddenDangerMapper.java 35 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hd/pipe/secure/src/main/java/com/thhy/secure/modules/biz/hiddenDanger/service/HiddenDangerService.java 31 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hd/pipe/secure/src/main/java/com/thhy/secure/modules/biz/hiddenDanger/service/impl/HiddenDangerServiceImpl.java 120 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hd/pipe/secure/src/main/resources/mapping/HiddenDangerMapper.xml 215 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
web/src/api/modules/ductRaw.js 24 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
web/src/components/element/Pagination.vue 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
web/src/views/DuctpiecePLM/PlanManage/DuctForward.vue 551 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
web/src/views/MaterialsIndex/components/embedded/Income.vue 736 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
web/src/views/MaterialsIndex/components/embedded/Type.vue 486 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
web/src/views/ProjectManage/SectionManage.vue 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/pipeoutplan/service/impl/PipeOutPlanServiceImpl.java
@@ -29,6 +29,8 @@
    @Autowired
    private PipeOutPlanMapper pipeOutPlanMapper;
    public static final Object LOCK = new Object();
    @Override
    @Transactional(rollbackFor = Exception.class)
    public BasicResult insert(PipeOutPlanEntity pipeOutPlanEntity) {
@@ -60,7 +62,7 @@
    @Transactional(rollbackFor = Exception.class)
    public BasicResult update(PipeOutPlanEntity pipeOutPlanEntity) {
        PipeOutPlanEntity isExit = pipeOutPlanMapper.selectInfoByProIdAndYear(pipeOutPlanEntity.getProId(), pipeOutPlanEntity.getPlanYear());
        if (!pipeOutPlanEntity.getPlanOutId().equals(isExit.getPlanOutId()) && isExit != null){
        if (isExit != null && !pipeOutPlanEntity.getPlanOutId().equals(isExit.getPlanOutId()) ){
            return BasicResult.faild("500","同一项目、年份有且只有一个计划",null);
        }
        pipeOutPlanMapper.update(pipeOutPlanEntity);
@@ -97,9 +99,11 @@
            String planOutId = obj.getPlanOutId();
            List<PipeOutPlanMothEntity> mothListByProIdAndYear = pipeOutPlanMapper.findMothListByProIdAndYear(proId, planYear.toString(), planOutId);
            Integer completePlanProductNum = 0;
            for (PipeOutPlanMothEntity pipeOutPlanMothEntity : mothListByProIdAndYear) {
                Integer completePlanProduct = pipeOutPlanMothEntity.getCompletePlanProduct();
                completePlanProductNum+=completePlanProduct;
            synchronized (this.LOCK){
                for (PipeOutPlanMothEntity pipeOutPlanMothEntity : mothListByProIdAndYear) {
                    Integer completePlanProduct = pipeOutPlanMothEntity.getCompletePlanProduct();
                    completePlanProductNum+=completePlanProduct;
                }
            }
            obj.setMonthList(mothListByProIdAndYear);
            obj.setCompletePipeNum(completePlanProductNum);
hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/rebarprint/controller/TSteelPrintController.java
@@ -8,6 +8,7 @@
import com.google.zxing.qrcode.decoder.ErrorCorrectionLevel;
import com.thhy.general.common.BasicResult;
import com.thhy.materials.modules.biz.rebarprint.service.TSteelPrintService;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
@@ -26,6 +27,21 @@
    @Resource
    private TSteelPrintService steelPrintService;
    @Value("${pipePrint.baseUrl}")
    private String baseUrl;
    @Value("${pipePrint.deviceInfoUrl}")
    private String deviceInfoUrl;
    @Value("${pipePrint.pipeHistoryInfoUrl}")
    private String pipeHistoryInfoUrl;
    @Value("${pipePrint.modelUrl}")
    private String modelUrl;
    @Value("${pipePrint.steelInfoUrl}")
    private String steelInfoUrl;
    //钢筋笼打印添加
    @PostMapping("/steelPrintInsert")
@@ -62,39 +78,16 @@
        String content = num;
        if (type != null){
            if(type == 1){
               // content = "http://111.30.93.212:8089/pipe/#/scanDetail?num="+num;
                content = "https://pipe.thhy-tj.com/pipe/#/scanDetail?bigDeviceId="+bigDeviceId;
                //content = "http://192.168.0.99:8080/#/scanDetail?num="+num;
                content = baseUrl + deviceInfoUrl + bigDeviceId;
            }else if (type == 2){
                //content = "http://111.30.93.212:8089/pipe/#/ScanBear?num="+num;
                content = "https://pipe.thhy-tj.com/pipe/#/ScanBear?num="+num;
                //content = "http://192.168.0.99:8080/#/ScanBear?num="+num;
                content = baseUrl + pipeHistoryInfoUrl + num;
            }else if(type == 3){
                //content = "http://111.30.93.212:8089/pipe/#/massInfo?mouldId="+mouldId;
                content = "https://pipe.thhy-tj.com/pipe/#/massInfo?mouldId="+mouldId;
                //content = "http://192.168.0.99:8080/#/massInfo?mouldId="+mouldId;
                content = baseUrl + modelUrl + mouldId;
            }else if(type == 4){
                //content = "http://111.30.93.212:8089/pipe/#/reinInfo?num="+num;
                content = "https://pipe.thhy-tj.com/pipe/#/reinInfo?num="+num;
                //content = "http://192.168.0.99:8080/#/reinInfo?num="+num;
                content = baseUrl + steelInfoUrl + num;
            }
        }
        System.out.println("steelProduceId=============="+steelProduceId);
//         Map<EncodeHintType, Object> hints = new HashMap<EncodeHintType, Object>();
//        // 指定编码格式
//        hints.put(EncodeHintType.CHARACTER_SET, "UTF-8");
//        // 指定纠错级别(L--7%,M--15%,Q--25%,H--30%)
//        hints.put(EncodeHintType.ERROR_CORRECTION, ErrorCorrectionLevel.H);
//        // 编码内容,编码类型(这里指定为二维码),生成图片宽度,生成图片高度,设置参数
//        BitMatrix bitMatrix = new MultiFormatWriter().encode(content, BarcodeFormat.QR_CODE, 200, 200, hints);
//        //设置请求头
//        response.setHeader("Content-Type","application/octet-stream");
//        response.setHeader("Content-Disposition", "attachment;filename=" + "编码.png");
//        OutputStream outputStream = response.getOutputStream();
//        MatrixToImageWriter.writeToStream(bitMatrix, "png", outputStream);
//        outputStream.flush();
//        outputStream.close();
        BufferedImage bufferedImage = ImageUtils.createQr(content);
        OutputStream outputStream = null;
hd/pipe/secure/src/main/java/com/thhy/secure/modules/biz/hiddenDanger/controller/HiddenDangerController.java
对比新文件
@@ -0,0 +1,92 @@
package com.thhy.secure.modules.biz.hiddenDanger.controller;
import com.thhy.general.common.BasicResult;
import com.thhy.secure.modules.biz.hiddenDanger.entity.HiddenDangerEntity;
import com.thhy.secure.modules.biz.hiddenDanger.service.HiddenDangerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.Map;
/**
 * @Author QiuYuHao
 * @CreateDate 2023-11-07 14:26:39
 * 隐患举报控制层
 */
@RestController
@RequestMapping(value = "hiddendanger")
public class HiddenDangerController {
    @Autowired
    private HiddenDangerService hiddenDangerService;
    /**
     * 新增
     * @param hiddenDangerEntity
     * @return
     */
    @PostMapping(value = "insert")
    BasicResult insert(@RequestBody HiddenDangerEntity hiddenDangerEntity){
        return hiddenDangerService.insert(hiddenDangerEntity);
    }
    /**
     * 修改接口
     * @param hiddenDangerEntity
     * @return
     */
    @PostMapping(value = "update")
    BasicResult update(@RequestBody HiddenDangerEntity hiddenDangerEntity){
        return hiddenDangerService.update(hiddenDangerEntity);
    }
    /**
     * 删除
     * @param id
     * @return
     */
    @GetMapping(value = "delete")
    BasicResult delete(@RequestParam String id){
        return hiddenDangerService.delete(id);
    }
    /**
     * web端列表
     * @param map
     * @return
     */
    @PostMapping(value = "selectPageList")
    BasicResult selectPageList(@RequestBody Map<String,Object> map){
        return hiddenDangerService.selectPageList(map);
    }
    /**
     * 小程序
     * @param map
     * @return
     */
    @PostMapping(value = "selectNoPageList")
    BasicResult selectNoPageList(@RequestBody Map<String,Object> map){
        return hiddenDangerService.selectNoPageList(map);
    }
    /**
     * web、小程序详情
     * @param id
     * @return
     */
    @GetMapping(value = "selectInfo")
    BasicResult selectInfo(@RequestParam String id){
        return hiddenDangerService.selectInfo(id);
    }
    /**
     * web审核接口
     * @param hiddenDangerEntity
     * @return
     */
    @PostMapping(value = "examine")
    BasicResult examine(@RequestBody HiddenDangerEntity hiddenDangerEntity){
        return hiddenDangerService.examine(hiddenDangerEntity);
    }
}
hd/pipe/secure/src/main/java/com/thhy/secure/modules/biz/hiddenDanger/entity/HiddenDangerEntity.java
对比新文件
@@ -0,0 +1,81 @@
package com.thhy.secure.modules.biz.hiddenDanger.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-11-07 14:27:33
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
public class HiddenDangerEntity implements Serializable {
    private String id;
    /**
     * 隐患地点
     */
    private String dangerLocation;
    /**
     * 隐患标题
     */
    private String title;
    /**
     * 隐患时间
     */
    private Date createTime;
    /**
     * 隐患审核状态 审核状态 0未审核 1审核通过 2审核失败
     */
    private Integer auditStatus;
    private String auditStatusName;
    public String getAuditStatusName() {
        String name = "";
        switch (auditStatus){
            case 0:
                name = "未审核";
                break;
            case 1:
                name = "已审核";
                break;
            case 2:
                name = "审核失败";
                break;
        }
        return name;
    }
    /**
     * 1Y0N
     */
    private Integer isUse;
    private String createUser;
    private String updateUser;
    private Date updateTime;
    private String companyId;
    /**
     * 积分
     */
    private Double integral;
    /**
     * 图片集合
     */
    private List<HiddenDangerImgEntity> imgEntities;
}
hd/pipe/secure/src/main/java/com/thhy/secure/modules/biz/hiddenDanger/entity/HiddenDangerImgEntity.java
对比新文件
@@ -0,0 +1,37 @@
package com.thhy.secure.modules.biz.hiddenDanger.entity;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
/**
 * @Author QiuYuHao
 * @CreateDate 2023-11-07 14:56:00
 * 隐患图片实体
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
public class HiddenDangerImgEntity implements Serializable {
    private String id;
    /**
     * 隐患id
     */
    private String hiddenDangerId;
    /**
     * 图片名称
     */
    private String imgName;
    /**
     * 图片地址
     */
    private String imgPath;
}
hd/pipe/secure/src/main/java/com/thhy/secure/modules/biz/hiddenDanger/mapper/HiddenDangerMapper.java
对比新文件
@@ -0,0 +1,35 @@
package com.thhy.secure.modules.biz.hiddenDanger.mapper;
import com.thhy.secure.modules.biz.hiddenDanger.entity.HiddenDangerEntity;
import com.thhy.secure.modules.biz.hiddenDanger.entity.HiddenDangerImgEntity;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
import java.util.Map;
/**
 * @Author QiuYuHao
 * @CreateDate 2023-11-07 14:31:40
 * 隐患mapper
 */
@Mapper
public interface HiddenDangerMapper {
    void insert(HiddenDangerEntity hiddenDangerEntity);
    void update(HiddenDangerEntity hiddenDangerEntity);
    void delete(String id);
    List<HiddenDangerEntity> selectPageList(Map<String,Object> map);
    HiddenDangerEntity selectInfo(String id);
    List<HiddenDangerImgEntity> selectImgList(String hiddenDangerId);
    void deleteImg(String hiddenDangerId);
    void insertImg(HiddenDangerImgEntity hiddenDangerImgEntity);
}
hd/pipe/secure/src/main/java/com/thhy/secure/modules/biz/hiddenDanger/service/HiddenDangerService.java
对比新文件
@@ -0,0 +1,31 @@
package com.thhy.secure.modules.biz.hiddenDanger.service;
import com.thhy.general.common.BasicResult;
import com.thhy.secure.modules.biz.hiddenDanger.entity.HiddenDangerEntity;
import java.util.List;
import java.util.Map;
/**
 * @Author QiuYuHao
 * @CreateDate 2023-11-07 14:32:02
 * 隐患接口
 */
public interface HiddenDangerService {
    BasicResult insert(HiddenDangerEntity hiddenDangerEntity);
    BasicResult update(HiddenDangerEntity hiddenDangerEntity);
    BasicResult delete(String id);
    BasicResult selectPageList(Map<String,Object> map);
    BasicResult selectNoPageList(Map<String,Object> map);
    BasicResult selectInfo(String id);
    BasicResult examine(HiddenDangerEntity hiddenDangerEntity);
}
hd/pipe/secure/src/main/java/com/thhy/secure/modules/biz/hiddenDanger/service/impl/HiddenDangerServiceImpl.java
对比新文件
@@ -0,0 +1,120 @@
package com.thhy.secure.modules.biz.hiddenDanger.service.impl;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.thhy.general.common.BasicResult;
import com.thhy.general.config.SysUserInfo;
import com.thhy.general.utils.UUIDUtils;
import com.thhy.general.utils.UserInfoUtils;
import com.thhy.secure.modules.biz.hiddenDanger.entity.HiddenDangerEntity;
import com.thhy.secure.modules.biz.hiddenDanger.mapper.HiddenDangerMapper;
import com.thhy.secure.modules.biz.hiddenDanger.service.HiddenDangerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Date;
import java.util.List;
import java.util.Map;
/**
 * @Author QiuYuHao
 * @CreateDate 2023-11-07 14:32:29
 * 隐患逻辑
 */
@Service
public class HiddenDangerServiceImpl implements HiddenDangerService {
    @Autowired
    private HiddenDangerMapper hiddenDangerMapper;
    private static final Object Lock = new Object();
    @Override
    @Transactional(rollbackFor = Exception.class)
    public BasicResult insert(HiddenDangerEntity hiddenDangerEntity) {
        SysUserInfo sysUserInfo = UserInfoUtils.getInstance().getUserInfo();
        String hiddenDangerId = UUIDUtils.create();
        hiddenDangerEntity.setId(hiddenDangerId);
        hiddenDangerEntity.setCreateUser(sysUserInfo.getUserId());
        hiddenDangerEntity.setCompanyId(sysUserInfo.getCompanyId());
        synchronized (Lock){
            hiddenDangerMapper.insert(hiddenDangerEntity);
            //图片
            hiddenDangerEntity.getImgEntities().forEach(obj->{
                obj.setId(UUIDUtils.create());
                obj.setHiddenDangerId(hiddenDangerId);
                hiddenDangerMapper.insertImg(obj);
            });
        }
        return BasicResult.success();
    }
    @Override
    @Transactional(rollbackFor = Exception.class)
    public BasicResult update(HiddenDangerEntity hiddenDangerEntity) {
        SysUserInfo sysUserInfo = UserInfoUtils.getInstance().getUserInfo();
        String userId = sysUserInfo.getUserId();
        hiddenDangerEntity.setUpdateUser(userId);
        hiddenDangerEntity.setUpdateTime(new Date());
        synchronized (Lock){
            hiddenDangerMapper.update(hiddenDangerEntity);
            //删除图片
            hiddenDangerMapper.deleteImg(hiddenDangerEntity.getId());
            //图片
            hiddenDangerEntity.getImgEntities().forEach(obj->{
                obj.setId(UUIDUtils.create());
                obj.setHiddenDangerId(hiddenDangerEntity.getId());
                hiddenDangerMapper.insertImg(obj);
            });
        }
        return BasicResult.success();
    }
    @Override
    @Transactional(rollbackFor = Exception.class)
    public BasicResult delete(String id) {
        synchronized (Lock) {
            hiddenDangerMapper.delete(id);
            hiddenDangerMapper.deleteImg(id);
        }
        return BasicResult.success();
    }
    @Override
    public BasicResult selectPageList(Map<String, Object> map) {
        SysUserInfo sysUserInfo = UserInfoUtils.getInstance().getUserInfo();
        map.put("companyId",sysUserInfo.getCompanyId());
        int pageNum = (int) map.get("pageNum");
        int pageSize = (int) map.get("pageSize");
        PageHelper.startPage(pageNum,pageSize);
        List<HiddenDangerEntity> hiddenDangerEntities = hiddenDangerMapper.selectPageList(map);
        hiddenDangerEntities.forEach(obj ->{
            String id = obj.getId();
            obj.setImgEntities(hiddenDangerMapper.selectImgList(id));
        });
        return BasicResult.success(new PageInfo<>(hiddenDangerEntities));
    }
    @Override
    public BasicResult selectNoPageList(Map<String, Object> map) {
        SysUserInfo sysUserInfo = UserInfoUtils.getInstance().getUserInfo();
        map.put("companyId",sysUserInfo.getCompanyId());
        List<HiddenDangerEntity> hiddenDangerEntities = hiddenDangerMapper.selectPageList(map);
        hiddenDangerEntities.forEach(obj ->{
            String id = obj.getId();
            obj.setImgEntities(hiddenDangerMapper.selectImgList(id));
        });
        return BasicResult.success(hiddenDangerEntities);
    }
    @Override
    public BasicResult selectInfo(String id) {
        return BasicResult.success(hiddenDangerMapper.selectInfo(id));
    }
    @Override
    public BasicResult examine(HiddenDangerEntity hiddenDangerEntity) {
        hiddenDangerMapper.update(hiddenDangerEntity);
        return BasicResult.success();
    }
}
hd/pipe/secure/src/main/resources/mapping/HiddenDangerMapper.xml
对比新文件
@@ -0,0 +1,215 @@
<?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.hiddenDanger.mapper.HiddenDangerMapper">
    <!--插入操作-->
    <insert id="insert">
        insert into t_hidden_danger
        <trim prefix="(" suffix=")" suffixOverrides="," >
            <if test="id != null">
                id,
            </if>
            <if test="dangerLocation != null">
                dangerLocation,
            </if>
            <if test="title != null">
                title,
            </if>
            <if test="createTime != null">
                createTime,
            </if>
            <if test="auditStatus != null">
                auditStatus,
            </if>
            <if test="isUse != null">
                isUse,
            </if>
            <if test="createUser != null">
                createUser,
            </if>
            <if test="updateUser != null">
                updateUser,
            </if>
            <if test="updateTime != null">
                updateTime,
            </if>
            <if test="companyId != null">
                companyId,
            </if>
            <if test="integral != null">
                integral,
            </if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides="," >
            <if test="id != null">
                #{id,jdbcType=VARCHAR},
            </if>
            <if test="dangerLocation != null">
                #{dangerLocation,jdbcType=VARCHAR},
            </if>
            <if test="title != null">
                #{title,jdbcType=VARCHAR},
            </if>
            <if test="createTime != null">
                #{createTime,jdbcType=TIMESTAMP},
            </if>
            <if test="auditStatus != null">
                #{auditStatus,jdbcType=INTEGER},
            </if>
            <if test="isUse != null">
                #{isUse,jdbcType=INTEGER},
            </if>
            <if test="createUser != null">
                #{createUser,jdbcType=VARCHAR},
            </if>
            <if test="updateUser != null">
                #{updateUser,jdbcType=VARCHAR},
            </if>
            <if test="updateTime != null">
                #{updateTime,jdbcType=TIMESTAMP},
            </if>
            <if test="companyId != null">
                #{companyId,jdbcType=TIMESTAMP},
            </if>
            <if test="integral != null">
                #{integral,jdbcType=DOUBLE},
            </if>
        </trim>
    </insert>
    <!--更新操作-->
    <update id="update">
        update t_hidden_danger
        <set>
            <if test="dangerLocation != null">
                dangerLocation = #{dangerLocation,jdbcType=VARCHAR},
            </if>
            <if test="title != null">
                title = #{title,jdbcType=VARCHAR},
            </if>
            <if test="createTime != null">
                createTime = #{createTime,jdbcType=TIMESTAMP},
            </if>
            <if test="auditStatus != null">
                auditStatus = #{auditStatus,jdbcType=INTEGER},
            </if>
            <if test="isUse != null">
                isUse = #{isUse,jdbcType=INTEGER},
            </if>
            <if test="createUser != null">
                createUser = #{createUser,jdbcType=VARCHAR},
            </if>
            <if test="updateUser != null">
                updateUser = #{updateUser,jdbcType=VARCHAR},
            </if>
            <if test="updateTime != null">
                updateTime = #{updateTime,jdbcType=TIMESTAMP},
            </if>
            <if test="companyId != null">
                companyId = #{companyId,jdbcType=VARCHAR},
            </if>
            <if test="integral != null">
                integral = #{integral,jdbcType=DOUBLE},
            </if>
        </set>
        where id=#{id,jdbcType=VARCHAR}
    </update>
    <!--逻辑删除-->
    <update id="delete">
        update t_hidden_danger
        SET isUse = 0
        where id=#{id}
    </update>
    <select id="selectInfo" resultType="com.thhy.secure.modules.biz.hiddenDanger.entity.HiddenDangerEntity">
        select
                t.id,
                t.dangerLocation,
                t.title,
                t.createTime,
                t.auditStatus,
                t.isUse,
                t.createUser,
                t.updateUser,
                t.updateTime,
                t.companyId
        from t_hidden_danger t
        where t.id=#{id}
    </select>
    <!--查询列表-->
    <select id="selectPageList" resultType="com.thhy.secure.modules.biz.hiddenDanger.entity.HiddenDangerEntity">
        SELECT
                t.id,
                t.dangerLocation,
                t.title,
                t.createTime,
                t.auditStatus,
                t.isUse,
                t.createUser,
                t.updateUser,
                t.updateTime,
                t.companyId
         from t_hidden_danger t
         LEFT JOIN sys_users su ON su.user_id = t.createUser
         LEFT JOIN sys_users su1 ON su1.user_id = t.updateUser
        WHERE
            t.isUse = 1
            and t.companyId = #{companyId}
            <if test="startTime!= null and endTime!=null and startTime != '' and endTime !=''">
                and t.createTime BETWEEN #{startTime} and #{endTime}
            </if>
        order by t.createUser desc
    </select>
    <!--根据ID删除-->
    <delete id="deleteImg">
        delete from t_hidden_danger_img
        where hiddenDangerId=#{hiddenDangerId}
    </delete>
    <select id="selectImgList" resultType="com.thhy.secure.modules.biz.hiddenDanger.entity.HiddenDangerImgEntity">
        SELECT
                id,
                hiddenDangerId,
                imgName,
                imgPath
        FROM t_hidden_danger_img
        WHERE hiddenDangerId = #{hiddenDangerId}
    </select>
    <insert id="insertImg">
        insert into t_hidden_danger_img
        <trim prefix="(" suffix=")" suffixOverrides="," >
            <if test="id != null">
                id,
            </if>
            <if test="hiddenDangerId != null">
                hiddenDangerId,
            </if>
            <if test="imgName != null">
                imgName,
            </if>
            <if test="imgPath != null">
                imgPath,
            </if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides="," >
            <if test="id != null">
                #{id,jdbcType=VARCHAR},
            </if>
            <if test="hiddenDangerId != null">
                #{hiddenDangerId,jdbcType=VARCHAR},
            </if>
            <if test="imgName != null">
                #{imgName,jdbcType=VARCHAR},
            </if>
            <if test="imgPath != null">
                #{imgPath,jdbcType=VARCHAR},
            </if>
        </trim>
    </insert>
</mapper>
web/src/api/modules/ductRaw.js
@@ -62,7 +62,29 @@
    //获取管片明细
    searchDuctDetails: params =>
        axios.post('/materials/needYear/selectPipeInfo', params),
    /**
     * 管片发运计划
    */
    ductForward: {
        // 查询管片生产计划信息
        searchDuctPlan: params =>
            axios.post('/materials/pipeoutplan/findAll', params),
        // 添加管片生产计划信息
        insertDuctPlan: params =>
            axios.post('/materials/pipeoutplan/insert', params),
        // 修改管片生产计划信息
        updateDuctPlan: params =>
            axios.post('/materials/pipeoutplan/update', params),
        // 删除管片生产计划信息
        deleteDuctPlan: params =>
         axios.get('/materials/pipeoutplan/delete', {params}),
        //获取月份列表
        getMonthsList: params =>
            axios.post('/materials/pipePlan/monthList', params),
        //获取管片明细
        searchDuctDetails: params =>
            axios.post('/m/pipeInfo/findList', params),
    },
    /**
     * 原料实际放量
     */
web/src/components/element/Pagination.vue
@@ -76,7 +76,16 @@
  font-weight: 400;
}
.pagination-container {
::v-deep.pagination-container {
  margin: 30px 0;
  .btn-prev {
    margin-right: 10px;
  }
  .el-pager .number {
    width: 28px;
    margin-right: 10px;
  }
}
</style>
web/src/views/DuctpiecePLM/PlanManage/DuctForward.vue
@@ -0,0 +1,551 @@
<template>
  <div class="main">
    <div class="main_header">
      <div class="header_item">
        <span class="header_label">项目名称:</span>
        <el-select v-model="search.proId" placeholder="请选择项目名称" clearable filterable>
          <el-option v-for="item in optionsProject" :key="item.proId" :label="item.proName" :value="item.proId">
          </el-option>
        </el-select>
      </div>
      <div class="header_item">
        <span class="header_label">年份:</span>
        <el-date-picker v-model="search.planYear" value-format="yyyy" type="year" placeholder="请选择年份">
        </el-date-picker>
      </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">
      <div style="overflow-y:auto;overflow-x:hidden;height:calc(100% - 5px)">
        <div class="plan_main_card" v-for="(item, index) in dataList" :key="index">
          <div class="plan_main_header">
            <div class="plan_header_left">
              <span class="plan_header_one">{{ item.proName }}</span>
              <span>{{ item.planYear }}年</span>
            </div>
            <div class="plan_header_right">
              <el-button style="background-image:none;border:1px solid #38B2FA;border-radius:5px;padding:5px 10px;"
                :size="size" v-if="showButton('update')" class="table_btn" @click="updateProp(item)">修改</el-button>
              <el-button
                style="background-image:none;border:1px solid #FD494B;background-color:#434F69;border-radius:5px;padding:5px 10px;"
                :size="size" class="delete_btn" v-if="showButton('delete')" @click="deleteInfo(item)">删除</el-button>
            </div>
          </div>
          <div class="plan_main_content">
            <div class="plan_content_items">
              <div class="plan_content_title">月份</div>
              <div class="plan_content_datas" style="background-color:#052C55;color:#39B5FE"
                v-for="(item, index) in item.monthList" :key="index">{{ item.month }}</div>
              <div class="plan_content_datas" style="background-color:#052C55;color:#39B5FE">合计</div>
            </div>
            <div class="plan_content_items" style="margin-bottom:0px;border-bottom-color:transparent;">
              <div class="plan_content_title">管片计划发运数量(片)</div>
              <div class="plan_content_datas" v-for="(iten, index) in item.monthList" :key="index">
                {{ iten.planProduct }}</div>
              <div class="plan_content_datas">{{ item.needPipeNum }}</div>
            </div>
            <div class="plan_content_items">
              <div class="plan_content_title">已发运管片数量(片)</div>
              <div class="plan_content_datas" v-for="(it, index) in item.monthList" style="cursor:pointer"
                @click="showDetails(item, index + 1)" :key="index">{{ it.completePlanProduct }}</div>
              <div class="plan_content_datas">{{ item.completePipeNum }}</div>
            </div>
          </div>
        </div>
      </div>
    </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="管片明细" :visible.sync="asyncBeardetails" width="65%">
      <div class="bears_content">
        <el-table v-loading="loadingDetails" :data="bearDetails" 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="ringNum" label="环号" align="center"></el-table-column>
          <el-table-column prop="pipeNum" label="管片编号" align="center" width="160"></el-table-column>
          <el-table-column prop="turnName" label="转向" align="center" width="120"></el-table-column>
          <el-table-column prop="reinforcementName" label="配筋" align="center"></el-table-column>
          <el-table-column prop="groutingHolesName" label="注浆孔" align="center"></el-table-column>
          <el-table-column prop="blockNumName" label="块号" align="center"></el-table-column>
          <el-table-column prop="mouldNum" label="模具" align="center"></el-table-column>
          <el-table-column prop="intoModTime" label="入模时间" align="center" width="160"></el-table-column>
          <el-table-column prop="pouringTime" label="浇筑时间" align="center" width="160"></el-table-column>
          <el-table-column prop="checkTime" label="质检时间" align="center" width="160"></el-table-column>
          <el-table-column prop="groupName" label="生产班组" align="center"></el-table-column>
          <el-table-column prop="proName" label="项目" align="center" width="250" show-overflow-tooltip></el-table-column>
          <el-table-column prop="checkResult" label="质量标注" align="center"></el-table-column>
        </el-table>
      </div>
      <div class="bear_footer">
        <el-pagination background @current-change="changeDetailsPageNum" @size-change="changeDetailsPageSize"
          :current-page="pageNumDetails" :page-sizes="[10, 20, 50, 100]" :page-size="pageSizeDetails"
          layout="total, sizes, prev, pager, next, jumper" :total="totalDetails">
        </el-pagination>
      </div>
    </el-dialog>
    <el-dialog class="prop_dialog" :title="asyncTitle === true ? '新增' : asyncTitle === false ? '修改' : '查看'"
      :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="proId">
          <el-select v-model="ruleForm.proId" placeholder="请选择项目名称" :disabled="disabled" clearable>
            <el-option v-for="item in optionsProject" :key="item.proId" :label="item.proName" :value="item.proId">
            </el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="年份:" prop="planYear">
          <el-date-picker v-model="ruleForm.planYear" value-format="yyyy" :disabled="disabled" type="year"
            placeholder="请选择年份">
          </el-date-picker>
        </el-form-item>
        <div class="months_items">
          <div v-for="(item, index) in monthLists" :key="index" class="month_index">
            <el-input placeholder="请输入" v-model="item.planProduct" type="number" :disabled="disabled">
              <template slot="prepend">{{ item.month }}月</template>
            </el-input>
          </div>
          <div class="months_nums">
            <span>合计:</span>
            <span style="color:#18F8F9;font-size:20px;font-weight:600;margin-left:5px">{{ allMonths }}</span>
            <span>环</span>
          </div>
        </div>
      </el-form>
      <div slot="footer" v-if="asyncTitle !== 'see'">
        <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} from '../../../plugins/public'; // 导入节流、动态切换组件尺寸方法
export default {
  data() {
    return {
      size: changeSize(), // 组件尺寸
      pageNum: 1,
      pageSize: 10,
      search: {},//查询条件
      total: 0,
      disabled: false,//是否禁止修改
      loading: false,
      allMonths: null,//计算出来的总数
      rowId: '',//某一行id
      dataList: [], //管片生产计划信息
      asyncBeardetails: false,
      bearDetails: [],//管片明细
      pageNumDetails: 1,
      pageSizeDetails: 10,
      totalDetails: 0,
      loadingDetails: true,
      proId: null,
      reinforcementId: null,
      years: null,
      optionsProject: [],//项目名称
      asyncTitle: true, // 对话框title 新增:true  修改:false
      asyncVisible: false, // 添加 修改对话框
      ruleForm: {}, // 按钮表单
      rules: {
        proId: [{
          required: true,
          message: '请选择项目名称',
          trigger: 'change'
        }],
        planYear: [{
          required: true,
          message: '请选择年份',
          trigger: 'change'
        }],
      },
      optionsHass: [],//配筋
      optionsBlocks: [],//块号
      monthLists: [],//弹框中的月
      numLists: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, '合计'],
    }
  },
  mounted() {
    const that = this;
    // 根据窗口大小动态修改组件尺寸
    window.onresize = () => {
      that.size = changeSize();
    }
    that.searchButtonInfo(true);
    that.getAllProjects()
  },
  watch: {
    'monthLists': {
      handler: function (val) {
        let allNum = 0
        val.map(item => {
          allNum += item.planProduct * 1
        })
        this.allMonths = allNum
        return this.allMonths
      },
      deep: true
    },
    asyncVisible(bol) {
      if (!bol) {
        this.ruleForm = {};
        this.$refs.ruleForm.resetFields();
      }
    }
  },
  methods: {
    //展示管片明细弹框
    showDetails(val, num) {
      console.log(val)
      this.asyncBeardetails = true
      if (num === 13) {
        this.asyncBeardetails = false
        return
      }
      this.proId = val.proId
      this.years = num < 10 ? val.planYear + '-0' + num : val.planYear + '-' + num
      this.searchBearDetails(val.proId, this.years)
    },
    //查询管片明细
    searchBearDetails(proId, years) {
      this.loadingDetails = true;
      this.bearDetails = [];
      this.$api.Ducts.ductForward.searchDuctDetails({
        proId: proId,
        goIn: 2,
        yearMonth: years,
        pageNum: this.pageNumDetails,
        pageSize: this.pageSizeDetails
      }).then((res) => {
        if (res.statusMsg === 'ok') {
          this.totalDetails = res.data.total;
          this.bearDetails = res.data.list;
        } else {
          this.$message.warning(res.statusMsg)
        }
        this.loadingDetails = false;
      }).catch(() => {
        this.loadingDetails = false
      });
    },
    // 切换管片明细页数
    changeDetailsPageNum(page) {
      this.pageNumDetails = page;
      this.searchBearDetails(this.proId, this.years);
    },
    // 切换管片明细每页条数
    changeDetailsPageSize(size) {
      this.pageSizeDetails = size;
      this.searchBearDetails(this.proId, this.years);
    },
    //获得所有项目名称
    getAllProjects() {
      let obj = {
        pageNum: 1,
        pageSize: 100000000
      }
      this.$api.Engineer.searchProjects(obj).then(res => {
        if (res.statusMsg === 'ok') {
          this.optionsProject = res.data.list
        } 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.Ducts.ductForward.searchDuctPlan(params).then((res) => {
        if (res.statusMsg === 'ok') {
          this.total = res.data.total;
          this.dataList = res.data.list;
          this.loading = false;
        } else {
          this.$message.warning(res.statusMsg)
        }
      })
    },
    // 新增按钮信息
    insertProp() {
      this.asyncTitle = true;
      this.asyncVisible = true;
      this.disabled = false
      this.monthLists = [
        {id: null, pipePlanId: null, month: 1, planProduct: 0},
        {id: null, pipePlanId: null, month: 2, planProduct: 0},
        {id: null, pipePlanId: null, month: 3, planProduct: 0},
        {id: null, pipePlanId: null, month: 4, planProduct: 0},
        {id: null, pipePlanId: null, month: 5, planProduct: 0},
        {id: null, pipePlanId: null, month: 6, planProduct: 0},
        {id: null, pipePlanId: null, month: 7, planProduct: 0},
        {id: null, pipePlanId: null, month: 8, planProduct: 0},
        {id: null, pipePlanId: null, month: 9, planProduct: 0},
        {id: null, pipePlanId: null, month: 10, planProduct: 0},
        {id: null, pipePlanId: null, month: 11, planProduct: 0},
        {id: null, pipePlanId: null, month: 12, planProduct: 0},
      ]
      this.allMonths = 0
    },
    // 修改按钮信息
    updateProp(row) {
      this.asyncTitle = false;
      this.asyncVisible = true;
      this.disabled = false
      this.ruleForm = row
      this.monthLists = JSON.parse(JSON.stringify(row.monthList))
      this.allMonths = row.needPipeNum
      this.$set(this.ruleForm, 'planYear', row.planYear + '')
      this.rowId = row.planId
    },
    // 删除按钮信息
    deleteInfo(row) {
      this.$confirm("该操作将删除该信息,是否继续删除?", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning"
      })
        .then(() => {
          console.log(row)
          this.$api.Ducts.ductForward.deleteDuctPlan({planOutId: row.planOutId})
            .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.monthList = this.monthLists
          params.needPipeNum = this.allMonths
          this.$api.Ducts.ductForward.insertDuctPlan(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.monthList = this.monthLists
          params.needPipeNum = this.allMonths
          this.$api.Ducts.ductForward.updateDuctPlan(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';
.bears_content {
  height: 500px;
  /deep/ .el-table th.el-table__cell {
    background: #082F57 !important;
    color: #18F6F8;
    border-right: 1px solid #18F6F8 !important;
    border-bottom: 1px solid #18F6F8 !important;
    border-top: 1px solid #18F6F8 !important;
    &:last-child {
      border-right-color: transparent !important;
    }
  }
  /deep/.el-table .el-table__cell {
    border-left: 1px solid #18F6F8 !important;
    border-right: 1px solid #18F6F8 !important;
    border-bottom: 1px solid #18F6F8 !important;
  }
  /deep/.el-table tr:nth-of-type(even) {
    background: transparent;
  }
}
.bear_footer {
  text-align: right;
  line-height: 20px;
  margin: 15px 0 15px;
}
.months_items {
  display: flex;
  flex-wrap: wrap;
  .month_index {
    margin-left: 10px;
    margin-bottom: 10px;
    max-width: calc(100%/3 - 10px);
    /deep/.el-input-group__prepend {
      color: #19F6F8;
      background-color: #122558;
      border-color: #1B428F;
    }
  }
  .months_nums {
    width: 100%;
    height: 50px;
    margin-bottom: 24px;
    border-radius: 3px;
    background-color: #0B5274;
    display: flex;
    align-items: center;
    span {
      margin-left: 15px;
      color: #fff;
    }
  }
}
.plan_main_card {
  width: calc(100% - 36px);
  border-top-left-radius: 6px;
  border-top-right-radius: 6px;
  border-bottom-left-radius: 6px;
  border-bottom-right-radius: 6px;
  background-color: #031A46;
  margin: 0px 5px 24px 0px;
  box-shadow: 0px 0px 8px 0px #0C4F79;
  .plan_main_header {
    width: 100%;
    height: 48px;
    border-top-left-radius: 6px;
    border-top-right-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background-color: rgba(57, 181, 254, 0.3);
    .plan_header_left {
      display: flex;
      span {
        flex: none;
        color: #39B5FE;
        margin-left: 20px;
        font-size: 16px;
        font-weight: 600;
      }
      .plan_header_one {
        margin-left: 40px;
        position: relative;
        &::before {
          position: absolute;
          left: -14px;
          top: -1px;
          content: '';
          width: 5px;
          height: 20px;
          background-color: #39B5FE;
        }
      }
    }
    .plan_header_right {
      margin-right: 15px;
    }
  }
  .plan_main_content {
    width: 100%;
    height: calc(100% - 30px);
    background-color: #031A46;
    padding-top: 20px;
    padding-bottom: 10px;
    border-bottom-left-radius: 6px;
    border-bottom-right-radius: 6px;
    .plan_content_items {
      display: flex;
      border: 1px solid #39B5FE;
      margin: 0px 15px 8px 15px;
      .plan_content_title {
        width: 145px;
        padding: 12px 0px;
        flex: none;
        color: #39B5FE;
        text-align: center;
        background-color: #052C55;
      }
      .plan_content_datas {
        flex: 1;
        padding: 12px 0px;
        color: #fff;
        text-align: center;
        border-left: 1px solid #1CB7E0;
      }
    }
  }
}
</style>
web/src/views/MaterialsIndex/components/embedded/Income.vue
@@ -1,369 +1,369 @@
<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" placeholder="请选择预埋件名称" clearable></el-input>
      </div>
      <div class="header_item">
        <span class="header_label">规格型号:</span>
        <el-select v-model="search.embedmentModel" placeholder="请选择规格型号" clearable>
          <el-option v-for="item in optionsNames" :key="item.id" :label="item.embedmentModel"
            :value="item.embedmentModel">
          </el-option>
        </el-select>
      </div>
      <div class="header_item">
        <span class="header_label">时间范围:</span>
        <el-date-picker v-model="search.time" type="daterange" :default-time="['00:00:00', '23:59:59']" clearable
          value-format="yyyy-MM-dd HH:mm:ss" range-separator="-" start-placeholder="起始时间" end-placeholder="结束时间">
        </el-date-picker>
      </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>
        <el-button icon="el-icon-upload2" v-if="showButton('export')" @click="exportIncomeData">导出Excel</el-button>
        <el-button icon="el-icon-postcard" v-if="showButton('export')" @click="exportIncomeFile">导出模板</el-button>
        <el-upload class="upload-demo" style="margin-left:10px" action="" :multiple="false" :http-request="httpRequest"
          :show-file-list="false" :file-list="fileList">
          <el-button icon="el-icon-download" v-if="showButton('exportIn')" :size="size">导入Excel</el-button>
        </el-upload>
      </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="embedmentName" label="预埋件名称" align="center" width="180"></el-table-column>
        <el-table-column prop="embedmentModel" label="规格型号" align="center" width="120"></el-table-column>
        <el-table-column prop="changeStock" label="入库数量" align="center"></el-table-column>
        <el-table-column prop="singlePrice" label="单价" align="center" show-overflow-tooltip></el-table-column>
        <el-table-column prop="amount" label="金额" align="center"></el-table-column>
        <el-table-column prop="createTime" label="入库时间" align="center" show-overflow-tooltip></el-table-column>
        <el-table-column prop="remark" label="备注" align="center" show-overflow-tooltip></el-table-column>
        <el-table-column label="操作" align="center" width="140">
          <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('delete')"
              @click="deleteInfo(scope.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="embedmentId">
          <el-select v-model="ruleForm.embedmentId" :size="size" placeholder="请选择预埋件名称" @change="changeName">
            <el-option v-for="item in optionsNames" :key="item.id"
              :label="`${item.embedmentName} - ${item.embedmentModel}`" :value="item.id">
            </el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="规格型号:" prop="embedmentModel">
          <el-input v-model="ruleForm.embedmentModel" placeholder="请选择规格型号" disabled></el-input>
        </el-form-item>
        <el-form-item label="入库数量:" prop="changeStock">
          <el-input v-model="ruleForm.changeStock" :size="size" type="number" clearable placeholder="请输入入库数量"
            @blur="priceChange"></el-input>
        </el-form-item>
        <el-form-item label="单价:" prop="singlePrice">
          <el-input v-model="ruleForm.singlePrice" type="number" :size="size" clearable placeholder="请输入单价"
            @blur="priceChange"></el-input>
        </el-form-item>
        <el-form-item label="金额:" prop="amount">
          <el-input v-model="ruleForm.amount" :size="size" clearable placeholder="请输入金额" :disabled="disabled"></el-input>
        </el-form-item>
        <el-form-item label="备注:" prop="remark">
          <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,
      search: {},//查询条件
      total: 0,
      loading: false,
      disabled: false,//是否禁止修改
      dataList: [], //入库记录信息列表
      asyncTitle: true, // 对话框title 新增:true  修改:false
      asyncVisible: false, // 添加 修改对话框
      ruleForm: {
        embedmentModel: '',
      }, // 按钮表单
      rules: {
        embedmentId: [{
          required: true,
          message: '请选择物品型号',
          trigger: 'change'
        }],
        embedmentModel: [{
          required: true,
          message: '请选择供应商',
          trigger: 'blur'
        }],
        changeStock: [{
          required: true,
          message: '请输入入库数量',
          trigger: 'blur'
        }],
        singlePrice: [{
          required: true,
          message: '请输入单价',
          trigger: 'blur'
        }],
        amount: [{
          required: true,
          message: '请输入金额',
          trigger: 'blur'
        }],
      },
      optionsNames: [],//物品名称
      fileList: [],//导入
    }
  },
  watch: {
    asyncVisible(bol) {
      if (!bol) {
        this.ruleForm = {};
        this.$refs.ruleForm.resetFields();
      }
    }
  },
  mounted() {
    const that = this;
    // 根据窗口大小动态修改组件尺寸
    window.onresize = () => {
      that.size = changeSize();
    }
  },
  methods: {
    //导出数据
    exportIncomeData() {
      this.functionLoading();
      let params = Object.assign({}, this.search, {
        stockType: 1
      })
      this.$api.Materials.embedded.incomeExportxls(params).then(res => {
        downFiles(res, '入库记录信息', 'xls')
        this.loadingView.close()
      })
        .catch(() => {
          this.loadingView.close();
        })
    },
    //计算金额
    priceChange() {
      if (this.ruleForm.singlePrice !== undefined && this.ruleForm.changeStock !== undefined) {
        this.$set(this.ruleForm, 'amount', this.ruleForm.singlePrice * 1 * this.ruleForm.changeStock)
      } else {
        this.$set(this.ruleForm, 'amount', ' ')
      }
    },
    //获取所有预埋件名称
    getNameList() {
      let params = {
        pageNum: 1,
        pageSize: 100000000
      }
      this.$api.Materials.embedded.typeGetLists(params).then(res => {
        if (res.statusMsg === 'ok') {
          this.optionsNames = res.data.list
        }
      })
    },
    //自定义上传
    httpRequest({file}) {
      this.functionLoading();
      const formData = new FormData();
      formData.set('file', file);
      this.$api.Materials.embedded.incomeInXls(formData).then((res) => {
        if (res.success) {
          this.searchButtonInfo();
          this.$message.success('上传成功!');
          this.loadingView.close();
        } else {
          this.$message.warning(typeof (res.data) === 'object' ? res.statusMsg : res.data);
          this.loadingView.close();
        }
      })
        .catch(() => {
          this.$message.error('请检查网络设置!');
          this.loadingView.close();
        })
    },
    // 转圈圈
    functionLoading() {
      this.loadingView = this.$loading({
        lock: true,
        text: '请稍后...',
        spinner: 'el-icon-loading',
        background: 'rgba(0, 0, 0, 0.7)'
      });
    },
    //导出模板
    exportIncomeFile() {
      this.functionLoading();
      this.$api.Materials.embedded.incomeExportXls({}).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,
        stockType: 1
      })
      params.strTime = this.search.time && this.search.time[0]
      params.endTime = this.search.time && this.search.time[1]
      delete params.time
      this.loading = true;
      this.$api.Materials.embedded.incomeGetLists(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;
      })
    },
    // 根据预埋件名称选择规格型号
    changeName(val) {
      const array = this.optionsNames
      for (let index = 0; index < array.length; index++) {
        const item = array[index]
        if (item.id === val) {
          this.ruleForm.embedmentModel = item.embedmentModel
          break
        }
      }
    },
    // 修改按钮信息
    updateProp(index) {
      this.asyncTitle = false;
      this.asyncVisible = true;
      this.disabled = true
      this.ruleForm = this.dataList[index]
    },
    // 新增按钮信息
    insertProp() {
      this.asyncTitle = true;
      this.asyncVisible = true;
      this.disabled = true
    },
    // 删除按钮信息
    deleteInfo(row) {
      this.$confirm("该操作将删除该信息,是否继续删除?", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning"
      }).then(() => {
        this.$api.Materials.embedded.incomeDel({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.changeStock = this.ruleForm.changeStock * 1
          params.singlePrice = this.ruleForm.singlePrice * 1
          params.stockType = 1
          this.$api.Materials.embedded.incomeInsert(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.changeStock = this.ruleForm.changeStock * 1
          params.singlePrice = this.ruleForm.singlePrice * 1
          params.stockType = 1
          this.$api.Materials.embedded.incomeUpdate(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" placeholder="请输入预埋件名称" clearable></el-input>
      </div>
      <div class="header_item">
        <span class="header_label">规格型号:</span>
        <el-select v-model="search.embedmentModel" placeholder="请选择规格型号" clearable>
          <el-option v-for="item in optionsNames" :key="item.id" :label="item.embedmentModel"
            :value="item.embedmentModel">
          </el-option>
        </el-select>
      </div>
      <div class="header_item">
        <span class="header_label">时间范围:</span>
        <el-date-picker v-model="search.time" type="daterange" :default-time="['00:00:00', '23:59:59']" clearable
          value-format="yyyy-MM-dd HH:mm:ss" range-separator="-" start-placeholder="起始时间" end-placeholder="结束时间">
        </el-date-picker>
      </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>
        <el-button icon="el-icon-upload2" v-if="showButton('export')" @click="exportIncomeData">导出Excel</el-button>
        <el-button icon="el-icon-postcard" v-if="showButton('export')" @click="exportIncomeFile">导出模板</el-button>
        <el-upload class="upload-demo" style="margin-left:10px" action="" :multiple="false" :http-request="httpRequest"
          :show-file-list="false" :file-list="fileList">
          <el-button icon="el-icon-download" v-if="showButton('exportIn')" :size="size">导入Excel</el-button>
        </el-upload>
      </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="embedmentName" label="预埋件名称" align="center" width="180"></el-table-column>
        <el-table-column prop="embedmentModel" label="规格型号" align="center" width="120"></el-table-column>
        <el-table-column prop="changeStock" label="入库数量" align="center"></el-table-column>
        <el-table-column prop="singlePrice" label="单价" align="center" show-overflow-tooltip></el-table-column>
        <el-table-column prop="amount" label="金额" align="center"></el-table-column>
        <el-table-column prop="createTime" label="入库时间" align="center" show-overflow-tooltip></el-table-column>
        <el-table-column prop="remark" label="备注" align="center" show-overflow-tooltip></el-table-column>
        <el-table-column label="操作" align="center" width="140">
          <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('delete')"
              @click="deleteInfo(scope.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="embedmentId">
          <el-select v-model="ruleForm.embedmentId" :size="size" placeholder="请选择预埋件名称" @change="changeName">
            <el-option v-for="item in optionsNames" :key="item.id"
              :label="`${item.embedmentName} - ${item.embedmentModel}`" :value="item.id">
            </el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="规格型号:" prop="embedmentModel">
          <el-input v-model="ruleForm.embedmentModel" placeholder="请选择规格型号" disabled></el-input>
        </el-form-item>
        <el-form-item label="入库数量:" prop="changeStock">
          <el-input v-model="ruleForm.changeStock" :size="size" type="number" clearable placeholder="请输入入库数量"
            @blur="priceChange"></el-input>
        </el-form-item>
        <el-form-item label="单价:" prop="singlePrice">
          <el-input v-model="ruleForm.singlePrice" type="number" :size="size" clearable placeholder="请输入单价"
            @blur="priceChange"></el-input>
        </el-form-item>
        <el-form-item label="金额:" prop="amount">
          <el-input v-model="ruleForm.amount" :size="size" clearable placeholder="请输入金额" :disabled="disabled"></el-input>
        </el-form-item>
        <el-form-item label="备注:" prop="remark">
          <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,
      search: {},//查询条件
      total: 0,
      loading: false,
      disabled: false,//是否禁止修改
      dataList: [], //入库记录信息列表
      asyncTitle: true, // 对话框title 新增:true  修改:false
      asyncVisible: false, // 添加 修改对话框
      ruleForm: {
        embedmentModel: '',
      }, // 按钮表单
      rules: {
        embedmentId: [{
          required: true,
          message: '请选择物品型号',
          trigger: 'change'
        }],
        embedmentModel: [{
          required: true,
          message: '请选择供应商',
          trigger: 'blur'
        }],
        changeStock: [{
          required: true,
          message: '请输入入库数量',
          trigger: 'blur'
        }],
        singlePrice: [{
          required: true,
          message: '请输入单价',
          trigger: 'blur'
        }],
        amount: [{
          required: true,
          message: '请输入金额',
          trigger: 'blur'
        }],
      },
      optionsNames: [],//物品名称
      fileList: [],//导入
    }
  },
  watch: {
    asyncVisible(bol) {
      if (!bol) {
        this.ruleForm = {};
        this.$refs.ruleForm.resetFields();
      }
    }
  },
  mounted() {
    const that = this;
    // 根据窗口大小动态修改组件尺寸
    window.onresize = () => {
      that.size = changeSize();
    }
  },
  methods: {
    //导出数据
    exportIncomeData() {
      this.functionLoading();
      let params = Object.assign({}, this.search, {
        stockType: 1
      })
      this.$api.Materials.embedded.incomeExportxls(params).then(res => {
        downFiles(res, '入库记录信息', 'xls')
        this.loadingView.close()
      })
        .catch(() => {
          this.loadingView.close();
        })
    },
    //计算金额
    priceChange() {
      if (this.ruleForm.singlePrice !== undefined && this.ruleForm.changeStock !== undefined) {
        this.$set(this.ruleForm, 'amount', this.ruleForm.singlePrice * 1 * this.ruleForm.changeStock)
      } else {
        this.$set(this.ruleForm, 'amount', ' ')
      }
    },
    //获取所有预埋件名称
    getNameList() {
      let params = {
        pageNum: 1,
        pageSize: 100000000
      }
      this.$api.Materials.embedded.typeGetLists(params).then(res => {
        if (res.statusMsg === 'ok') {
          this.optionsNames = res.data.list
        }
      })
    },
    //自定义上传
    httpRequest({file}) {
      this.functionLoading();
      const formData = new FormData();
      formData.set('file', file);
      this.$api.Materials.embedded.incomeInXls(formData).then((res) => {
        if (res.success) {
          this.searchButtonInfo();
          this.$message.success('上传成功!');
          this.loadingView.close();
        } else {
          this.$message.warning(typeof (res.data) === 'object' ? res.statusMsg : res.data);
          this.loadingView.close();
        }
      })
        .catch(() => {
          this.$message.error('请检查网络设置!');
          this.loadingView.close();
        })
    },
    // 转圈圈
    functionLoading() {
      this.loadingView = this.$loading({
        lock: true,
        text: '请稍后...',
        spinner: 'el-icon-loading',
        background: 'rgba(0, 0, 0, 0.7)'
      });
    },
    //导出模板
    exportIncomeFile() {
      this.functionLoading();
      this.$api.Materials.embedded.incomeExportXls({}).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,
        stockType: 1
      })
      params.strTime = this.search.time && this.search.time[0]
      params.endTime = this.search.time && this.search.time[1]
      delete params.time
      this.loading = true;
      this.$api.Materials.embedded.incomeGetLists(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;
      })
    },
    // 根据预埋件名称选择规格型号
    changeName(val) {
      const array = this.optionsNames
      for (let index = 0; index < array.length; index++) {
        const item = array[index]
        if (item.id === val) {
          this.ruleForm.embedmentModel = item.embedmentModel
          break
        }
      }
    },
    // 修改按钮信息
    updateProp(index) {
      this.asyncTitle = false;
      this.asyncVisible = true;
      this.disabled = true
      this.ruleForm = this.dataList[index]
    },
    // 新增按钮信息
    insertProp() {
      this.asyncTitle = true;
      this.asyncVisible = true;
      this.disabled = true
    },
    // 删除按钮信息
    deleteInfo(row) {
      this.$confirm("该操作将删除该信息,是否继续删除?", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning"
      }).then(() => {
        this.$api.Materials.embedded.incomeDel({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.changeStock = this.ruleForm.changeStock * 1
          params.singlePrice = this.ruleForm.singlePrice * 1
          params.stockType = 1
          this.$api.Materials.embedded.incomeInsert(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.changeStock = this.ruleForm.changeStock * 1
          params.singlePrice = this.ruleForm.singlePrice * 1
          params.stockType = 1
          this.$api.Materials.embedded.incomeUpdate(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/Type.vue
@@ -1,244 +1,244 @@
<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 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="embedmentName" label="预埋件名称" align="center"></el-table-column>
        <el-table-column prop="dictName" label="类别" align="center"></el-table-column>
        <el-table-column prop="embedmentModel" label="型号规格" align="center"></el-table-column>
        <el-table-column prop="unit" label="计量单位" align="center"></el-table-column>
        <el-table-column prop="position" label="位置" align="center"></el-table-column>
        <el-table-column prop="remark" label="备注" align="center" show-overflow-tooltip></el-table-column>
        <el-table-column label="操作" align="center">
          <template #default="{ row }">
            <el-button class="table_btn" size="mini" v-if="showButton('update')" @click="updateProp(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="embedmentName">
          <el-input v-model="ruleForm.embedmentName" :size="size" clearable placeholder="请输入预埋件名称"
            @input="changeInput"></el-input>
        </el-form-item>
        <el-form-item label="类别:" prop="embedmentType">
          <el-select v-model="ruleForm.embedmentType" placeholder="请选择类别">
            <el-option v-for="item in optionsType" :key="item.dictId" :label="item.dictName" :value="item.dictId">
            </el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="规格型号:" prop="embedmentModel">
          <el-input v-model="ruleForm.embedmentModel" :size="size" clearable placeholder="请输入规格型号"></el-input>
        </el-form-item>
        <el-form-item label="计量单位:" prop="unit">
          <el-input v-model="ruleForm.unit" :size="size" clearable placeholder="请输入计量单位"></el-input>
        </el-form-item>
        <el-form-item label="位置:" prop="position">
          <el-input v-model="ruleForm.position" :size="size" clearable placeholder="请输入位置"></el-input>
        </el-form-item>
        <el-form-item label="备注:" prop="remark">
          <el-input v-model="ruleForm.remark" :size="size" clearable placeholder="请输入备注" type="textarea"
            :rows="2"></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} from '@/plugins/public'; // 导入节流、动态切换组件尺寸方法
export default {
  data() {
    return {
      size: changeSize(), // 组件尺寸
      pageNum: 1,
      pageSize: 10,
      search: {},//查询条件
      total: 0,
      loading: false,
      optionsType: [],//辅材类别
      dataList: [], //辅材种类信息列表
      asyncTitle: true, // 对话框title 新增:true  修改:false
      asyncVisible: false, // 添加 修改对话框
      ruleForm: {}, // 按钮表单
      rules: {
        embedmentName: [{
          required: true,
          message: '请输入物品名称',
          trigger: 'blur'
        }],
        embedmentModel: [{
          required: true,
          message: '请输入规格型号',
          trigger: 'blur'
        }],
        unit: [{
          required: true,
          message: '请输入单位',
          trigger: 'blur'
        }],
        position: [{
          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();
    }
    that.searchButtonInfo(true);
  },
  methods: {
    //输入增加限制
    changeInput(val) {
      let reg = RegExp(/-/)
      if (reg.test(val)) {
        this.$message.warning('禁止输入‘-’字符!!!')
        this.$set(this.ruleForm, 'embedmentName', '')
      }
    },
    //获取辅材类别信息
    getAllTypes() {
      let params = {
        pageNum: 1,
        pageSize: 100000000
      }
      this.$api.Materials.embedded.typeModels(params).then(res => {
        if (res.statusMsg === 'ok') {
          this.optionsType = res.data
        } 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.Materials.embedded.typeGetLists(params).then((res) => {
        if (res.statusMsg === 'ok') {
          this.total = res.data.total;
          this.dataList = res.data.list;
        }
        this.loading = false;
      })
    },
    // 新增按钮信息
    insertProp() {
      this.asyncTitle = true;
      this.asyncVisible = true;
    },
    // 修改按钮信息
    updateProp(row) {
      this.asyncTitle = false;
      this.asyncVisible = true;
      this.$api.Materials.embedded.typeDetail({id: row.id}).then(res => {
        if (res.statusMsg === 'ok') {
          this.ruleForm = res.data
        } else {
          this.$message.warning(res.statusMsg)
        }
      })
    },
    // 提交添加按钮信息
    submitInsert: throttle(function () {
      this.$refs.ruleForm.validate((valid) => {
        if (valid) {
          const params = Object.assign({}, this.ruleForm);
          this.$api.Materials.embedded.typeInsert(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);
          this.$api.Materials.embedded.typeUpdate(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 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="embedmentName" label="预埋件名称" align="center"></el-table-column>
        <el-table-column prop="dictName" label="类别" align="center"></el-table-column>
        <el-table-column prop="embedmentModel" label="型号规格" align="center"></el-table-column>
        <el-table-column prop="unit" label="计量单位" align="center"></el-table-column>
        <el-table-column prop="position" label="位置" align="center"></el-table-column>
        <el-table-column prop="remark" label="备注" align="center" show-overflow-tooltip></el-table-column>
        <el-table-column label="操作" align="center">
          <template #default="{ row }">
            <el-button class="table_btn" size="mini" v-if="showButton('update')" @click="updateProp(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="embedmentName">
          <el-input v-model="ruleForm.embedmentName" :size="size" clearable placeholder="请输入预埋件名称"
            @input="changeInput"></el-input>
        </el-form-item>
        <el-form-item label="类别:" prop="embedmentType">
          <el-select v-model="ruleForm.embedmentType" placeholder="请选择类别">
            <el-option v-for="item in optionsType" :key="item.dictId" :label="item.dictName" :value="item.dictId">
            </el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="规格型号:" prop="embedmentModel">
          <el-input v-model="ruleForm.embedmentModel" :size="size" clearable placeholder="请输入规格型号"></el-input>
        </el-form-item>
        <el-form-item label="计量单位:" prop="unit">
          <el-input v-model="ruleForm.unit" :size="size" clearable placeholder="请输入计量单位"></el-input>
        </el-form-item>
        <el-form-item label="位置:" prop="position">
          <el-input v-model="ruleForm.position" :size="size" clearable placeholder="请输入位置"></el-input>
        </el-form-item>
        <el-form-item label="备注:" prop="remark">
          <el-input v-model="ruleForm.remark" :size="size" clearable placeholder="请输入备注" type="textarea"
            :rows="2"></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} from '@/plugins/public'; // 导入节流、动态切换组件尺寸方法
export default {
  data() {
    return {
      size: changeSize(), // 组件尺寸
      pageNum: 1,
      pageSize: 10,
      search: {},//查询条件
      total: 0,
      loading: false,
      optionsType: [],//辅材类别
      dataList: [], //辅材种类信息列表
      asyncTitle: true, // 对话框title 新增:true  修改:false
      asyncVisible: false, // 添加 修改对话框
      ruleForm: {}, // 按钮表单
      rules: {
        embedmentName: [{
          required: true,
          message: '请输入物品名称',
          trigger: 'blur'
        }],
        embedmentModel: [{
          required: true,
          message: '请输入规格型号',
          trigger: 'blur'
        }],
        unit: [{
          required: true,
          message: '请输入单位',
          trigger: 'blur'
        }],
        position: [{
          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();
    }
    that.searchButtonInfo(true);
  },
  methods: {
    //输入增加限制
    changeInput(val) {
      let reg = RegExp(/-/)
      if (reg.test(val)) {
        this.$message.warning('禁止输入‘-’字符!!!')
        this.$set(this.ruleForm, 'embedmentName', '')
      }
    },
    //获取辅材类别信息
    getAllTypes() {
      let params = {
        pageNum: 1,
        pageSize: 100000000
      }
      this.$api.Materials.embedded.typeModels(params).then(res => {
        if (res.statusMsg === 'ok') {
          this.optionsType = res.data
        } 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.Materials.embedded.typeGetLists(params).then((res) => {
        if (res.statusMsg === 'ok') {
          this.total = res.data.total;
          this.dataList = res.data.list;
        }
        this.loading = false;
      })
    },
    // 新增按钮信息
    insertProp() {
      this.asyncTitle = true;
      this.asyncVisible = true;
    },
    // 修改按钮信息
    updateProp(row) {
      this.asyncTitle = false;
      this.asyncVisible = true;
      this.$api.Materials.embedded.typeDetail({id: row.id}).then(res => {
        if (res.statusMsg === 'ok') {
          this.ruleForm = res.data
        } else {
          this.$message.warning(res.statusMsg)
        }
      })
    },
    // 提交添加按钮信息
    submitInsert: throttle(function () {
      this.$refs.ruleForm.validate((valid) => {
        if (valid) {
          const params = Object.assign({}, this.ruleForm);
          this.$api.Materials.embedded.typeInsert(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);
          this.$api.Materials.embedded.typeUpdate(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/SectionManage.vue
@@ -48,7 +48,7 @@
          <el-input v-model="ruleForm.unitProjectName" clearable placeholder="请输入单位工程名称"></el-input>
        </el-form-item>
        <el-form-item label="需求负责人:" prop="segmentAdmin">
          <el-select v-model="ruleForm.segmentAdmin" placeholder="请选择求负责人">
          <el-select v-model="ruleForm.segmentAdmin" placeholder="请选择需求负责人">
            <el-option v-for="item in optionsUser" :key="item.userId" :label="item.realName" :value="item.userId">
            </el-option>
          </el-select>