admin
2024-08-04 5cc19d00f0a79e2b643c5e0c5db721499bbcd1dd
1P1S配置表代码生成
已添加8个文件
1066 ■■■■■ 文件已修改
jcdm-main/src/main/java/com/jcdm/main/da/psConf/controller/DaPsConfController.java 98 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jcdm-main/src/main/java/com/jcdm/main/da/psConf/domain/DaPsConf.java 221 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jcdm-main/src/main/java/com/jcdm/main/da/psConf/mapper/DaPsConfMapper.java 63 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jcdm-main/src/main/java/com/jcdm/main/da/psConf/service/IDaPsConfService.java 63 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jcdm-main/src/main/java/com/jcdm/main/da/psConf/service/impl/DaPsConfServiceImpl.java 98 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jcdm-main/src/main/resources/mapper/da/psConf/DaPsConfMapper.xml 124 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jcdm-ui/src/api/main/da/psConf/psConf.js 44 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jcdm-ui/src/views/main/da/psConf/index.vue 355 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jcdm-main/src/main/java/com/jcdm/main/da/psConf/controller/DaPsConfController.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,98 @@
package com.jcdm.main.da.psConf.controller;
import com.jcdm.common.annotation.Log;
import com.jcdm.common.core.controller.BaseController;
import com.jcdm.common.core.domain.AjaxResult;
import com.jcdm.common.core.page.TableDataInfo;
import com.jcdm.common.enums.BusinessType;
import com.jcdm.common.utils.poi.ExcelUtil;
import com.jcdm.main.da.psConf.domain.DaPsConf;
import com.jcdm.main.da.psConf.service.IDaPsConfService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
 * 1P1S配置Controller
 *
 * @author Yi
 * @date 2024-08-04
 */
@RestController
@RequestMapping("/da/psConf")
public class DaPsConfController extends BaseController
{
    @Autowired
    private IDaPsConfService daPsConfService;
    /**
     * æŸ¥è¯¢1P1S配置列表
     */
    @PreAuthorize("@ss.hasPermi('da:psConf:list')")
    @GetMapping("/list")
    public TableDataInfo list(DaPsConf daPsConf)
    {
        startPage();
        List<DaPsConf> list = daPsConfService.selectDaPsConfList(daPsConf);
        return getDataTable(list);
    }
    /**
     * å¯¼å‡º1P1S配置列表
     */
    @PreAuthorize("@ss.hasPermi('da:psConf:export')")
    @Log(title = "1P1S配置", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, DaPsConf daPsConf)
    {
        List<DaPsConf> list = daPsConfService.selectDaPsConfList(daPsConf);
        ExcelUtil<DaPsConf> util = new ExcelUtil<DaPsConf>(DaPsConf.class);
        util.exportExcel(response, list, "1P1S配置数据");
    }
    /**
     * èŽ·å–1P1S配置详细信息
     */
    @PreAuthorize("@ss.hasPermi('da:psConf:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(daPsConfService.selectDaPsConfById(id));
    }
    /**
     * æ–°å¢ž1P1S配置
     */
    @PreAuthorize("@ss.hasPermi('da:psConf:add')")
    @Log(title = "1P1S配置", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody DaPsConf daPsConf)
    {
        return toAjax(daPsConfService.insertDaPsConf(daPsConf));
    }
    /**
     * ä¿®æ”¹1P1S配置
     */
    @PreAuthorize("@ss.hasPermi('da:psConf:edit')")
    @Log(title = "1P1S配置", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody DaPsConf daPsConf)
    {
        return toAjax(daPsConfService.updateDaPsConf(daPsConf));
    }
    /**
     * åˆ é™¤1P1S配置
     */
    @PreAuthorize("@ss.hasPermi('da:psConf:remove')")
    @Log(title = "1P1S配置", businessType = BusinessType.DELETE)
    @DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(daPsConfService.deleteDaPsConfByIds(ids));
    }
}
jcdm-main/src/main/java/com/jcdm/main/da/psConf/domain/DaPsConf.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,221 @@
package com.jcdm.main.da.psConf.domain;
import com.jcdm.common.annotation.Excel;
import com.jcdm.common.core.domain.BaseEntity;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
/**
 * 1P1S配置对象 da_ps_conf
 *
 * @author Yi
 * @date 2024-08-04
 */
public class DaPsConf extends BaseEntity
{
    private static final long serialVersionUID = 1L;
    /** ä¸»é”®id */
    private Long id;
    /** åŽ‚商代码 */
    @Excel(name = "厂商代码")
    private String mfCode;
    /** äº§å“ç±»åž‹ä»£ç  */
    @Excel(name = "产品类型代码")
    private String proTypeCode;
    /** ç”µæ± ç±»åž‹ä»£ç  */
    @Excel(name = "电池类型代码")
    private String batteryTypeCode;
    /** è§„格代码 */
    @Excel(name = "规格代码")
    private String specificationsCode;
    /** è¿½æº¯ä¿¡æ¯ä»£ç  */
    @Excel(name = "追溯信息代码")
    private String traceInfoCode;
    /** ç”Ÿäº§æ—¥æœŸä»£ç  */
    @Excel(name = "生产日期代码")
    private String proDateCode;
    /** åºåˆ—号 */
    @Excel(name = "序列号")
    private String sfcCode;
    /** çŠ¶æ€ (启用enable,禁用disable) */
    @Excel(name = "状态 (启用enable,禁用disable)")
    private String state;
    /** å¤‡æ³¨ */
    @Excel(name = "备注")
    private String remarks;
    /** é¢„留字段1 */
    @Excel(name = "预留字段1")
    private String spareField1;
    /** é¢„留字段2 */
    @Excel(name = "预留字段2")
    private String spareField2;
    /** åˆ›å»ºç”¨æˆ· */
    @Excel(name = "创建用户")
    private String createUser;
    /** æ›´æ”¹ç”¨æˆ· */
    @Excel(name = "更改用户")
    private String updateUser;
    public void setId(Long id)
    {
        this.id = id;
    }
    public Long getId()
    {
        return id;
    }
    public void setMfCode(String mfCode)
    {
        this.mfCode = mfCode;
    }
    public String getMfCode()
    {
        return mfCode;
    }
    public void setProTypeCode(String proTypeCode)
    {
        this.proTypeCode = proTypeCode;
    }
    public String getProTypeCode()
    {
        return proTypeCode;
    }
    public void setBatteryTypeCode(String batteryTypeCode)
    {
        this.batteryTypeCode = batteryTypeCode;
    }
    public String getBatteryTypeCode()
    {
        return batteryTypeCode;
    }
    public void setSpecificationsCode(String specificationsCode)
    {
        this.specificationsCode = specificationsCode;
    }
    public String getSpecificationsCode()
    {
        return specificationsCode;
    }
    public void setTraceInfoCode(String traceInfoCode)
    {
        this.traceInfoCode = traceInfoCode;
    }
    public String getTraceInfoCode()
    {
        return traceInfoCode;
    }
    public void setProDateCode(String proDateCode)
    {
        this.proDateCode = proDateCode;
    }
    public String getProDateCode()
    {
        return proDateCode;
    }
    public void setSfcCode(String sfcCode)
    {
        this.sfcCode = sfcCode;
    }
    public String getSfcCode()
    {
        return sfcCode;
    }
    public void setState(String state)
    {
        this.state = state;
    }
    public String getState()
    {
        return state;
    }
    public void setRemarks(String remarks)
    {
        this.remarks = remarks;
    }
    public String getRemarks()
    {
        return remarks;
    }
    public void setSpareField1(String spareField1)
    {
        this.spareField1 = spareField1;
    }
    public String getSpareField1()
    {
        return spareField1;
    }
    public void setSpareField2(String spareField2)
    {
        this.spareField2 = spareField2;
    }
    public String getSpareField2()
    {
        return spareField2;
    }
    public void setCreateUser(String createUser)
    {
        this.createUser = createUser;
    }
    public String getCreateUser()
    {
        return createUser;
    }
    public void setUpdateUser(String updateUser)
    {
        this.updateUser = updateUser;
    }
    public String getUpdateUser()
    {
        return updateUser;
    }
    @Override
    public String toString() {
        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
            .append("id", getId())
            .append("mfCode", getMfCode())
            .append("proTypeCode", getProTypeCode())
            .append("batteryTypeCode", getBatteryTypeCode())
            .append("specificationsCode", getSpecificationsCode())
            .append("traceInfoCode", getTraceInfoCode())
            .append("proDateCode", getProDateCode())
            .append("sfcCode", getSfcCode())
            .append("state", getState())
            .append("remarks", getRemarks())
            .append("spareField1", getSpareField1())
            .append("spareField2", getSpareField2())
            .append("createUser", getCreateUser())
            .append("createTime", getCreateTime())
            .append("updateUser", getUpdateUser())
            .append("updateTime", getUpdateTime())
            .toString();
    }
}
jcdm-main/src/main/java/com/jcdm/main/da/psConf/mapper/DaPsConfMapper.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,63 @@
package com.jcdm.main.da.psConf.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.jcdm.main.da.psConf.domain.DaPsConf;
import java.util.List;
/**
 * 1P1S配置Mapper接口
 *
 * @author Yi
 * @date 2024-08-04
 */
public interface DaPsConfMapper extends BaseMapper<DaPsConf>
{
    /**
     * æŸ¥è¯¢1P1S配置
     *
     * @param id 1P1S配置主键
     * @return 1P1S配置
     */
    public DaPsConf selectDaPsConfById(Long id);
    /**
     * æŸ¥è¯¢1P1S配置列表
     *
     * @param daPsConf 1P1S配置
     * @return 1P1S配置集合
     */
    public List<DaPsConf> selectDaPsConfList(DaPsConf daPsConf);
    /**
     * æ–°å¢ž1P1S配置
     *
     * @param daPsConf 1P1S配置
     * @return ç»“æžœ
     */
    public int insertDaPsConf(DaPsConf daPsConf);
    /**
     * ä¿®æ”¹1P1S配置
     *
     * @param daPsConf 1P1S配置
     * @return ç»“æžœ
     */
    public int updateDaPsConf(DaPsConf daPsConf);
    /**
     * åˆ é™¤1P1S配置
     *
     * @param id 1P1S配置主键
     * @return ç»“æžœ
     */
    public int deleteDaPsConfById(Long id);
    /**
     * æ‰¹é‡åˆ é™¤1P1S配置
     *
     * @param ids éœ€è¦åˆ é™¤çš„数据主键集合
     * @return ç»“æžœ
     */
    public int deleteDaPsConfByIds(Long[] ids);
}
jcdm-main/src/main/java/com/jcdm/main/da/psConf/service/IDaPsConfService.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,63 @@
package com.jcdm.main.da.psConf.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.jcdm.main.da.psConf.domain.DaPsConf;
import java.util.List;
/**
 * 1P1S配置Service接口
 *
 * @author Yi
 * @date 2024-08-04
 */
public interface IDaPsConfService extends IService<DaPsConf>
{
    /**
     * æŸ¥è¯¢1P1S配置
     *
     * @param id 1P1S配置主键
     * @return 1P1S配置
     */
    public DaPsConf selectDaPsConfById(Long id);
    /**
     * æŸ¥è¯¢1P1S配置列表
     *
     * @param daPsConf 1P1S配置
     * @return 1P1S配置集合
     */
    public List<DaPsConf> selectDaPsConfList(DaPsConf daPsConf);
    /**
     * æ–°å¢ž1P1S配置
     *
     * @param daPsConf 1P1S配置
     * @return ç»“æžœ
     */
    public int insertDaPsConf(DaPsConf daPsConf);
    /**
     * ä¿®æ”¹1P1S配置
     *
     * @param daPsConf 1P1S配置
     * @return ç»“æžœ
     */
    public int updateDaPsConf(DaPsConf daPsConf);
    /**
     * æ‰¹é‡åˆ é™¤1P1S配置
     *
     * @param ids éœ€è¦åˆ é™¤çš„1P1S配置主键集合
     * @return ç»“æžœ
     */
    public int deleteDaPsConfByIds(Long[] ids);
    /**
     * åˆ é™¤1P1S配置信息
     *
     * @param id 1P1S配置主键
     * @return ç»“æžœ
     */
    public int deleteDaPsConfById(Long id);
}
jcdm-main/src/main/java/com/jcdm/main/da/psConf/service/impl/DaPsConfServiceImpl.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,98 @@
package com.jcdm.main.da.psConf.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.jcdm.common.utils.DateUtils;
import com.jcdm.main.da.psConf.domain.DaPsConf;
import com.jcdm.main.da.psConf.mapper.DaPsConfMapper;
import com.jcdm.main.da.psConf.service.IDaPsConfService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
 * 1P1S配置Service业务层处理
 *
 * @author Yi
 * @date 2024-08-04
 */
@Service
public class DaPsConfServiceImpl extends ServiceImpl<DaPsConfMapper,DaPsConf> implements IDaPsConfService
{
    @Autowired
    private DaPsConfMapper daPsConfMapper;
    /**
     * æŸ¥è¯¢1P1S配置
     *
     * @param id 1P1S配置主键
     * @return 1P1S配置
     */
    @Override
    public DaPsConf selectDaPsConfById(Long id)
    {
        return daPsConfMapper.selectDaPsConfById(id);
    }
    /**
     * æŸ¥è¯¢1P1S配置列表
     *
     * @param daPsConf 1P1S配置
     * @return 1P1S配置
     */
    @Override
    public List<DaPsConf> selectDaPsConfList(DaPsConf daPsConf)
    {
        return daPsConfMapper.selectDaPsConfList(daPsConf);
    }
    /**
     * æ–°å¢ž1P1S配置
     *
     * @param daPsConf 1P1S配置
     * @return ç»“æžœ
     */
    @Override
    public int insertDaPsConf(DaPsConf daPsConf)
    {
        daPsConf.setCreateTime(DateUtils.getNowDate());
        return daPsConfMapper.insertDaPsConf(daPsConf);
    }
    /**
     * ä¿®æ”¹1P1S配置
     *
     * @param daPsConf 1P1S配置
     * @return ç»“æžœ
     */
    @Override
    public int updateDaPsConf(DaPsConf daPsConf)
    {
        daPsConf.setUpdateTime(DateUtils.getNowDate());
        return daPsConfMapper.updateDaPsConf(daPsConf);
    }
    /**
     * æ‰¹é‡åˆ é™¤1P1S配置
     *
     * @param ids éœ€è¦åˆ é™¤çš„1P1S配置主键
     * @return ç»“æžœ
     */
    @Override
    public int deleteDaPsConfByIds(Long[] ids)
    {
        return daPsConfMapper.deleteDaPsConfByIds(ids);
    }
    /**
     * åˆ é™¤1P1S配置信息
     *
     * @param id 1P1S配置主键
     * @return ç»“æžœ
     */
    @Override
    public int deleteDaPsConfById(Long id)
    {
        return daPsConfMapper.deleteDaPsConfById(id);
    }
}
jcdm-main/src/main/resources/mapper/da/psConf/DaPsConfMapper.xml
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,124 @@
<?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.jcdm.main.da.psConf.mapper.DaPsConfMapper">
    <resultMap type="DaPsConf" id="DaPsConfResult">
        <result property="id"    column="id"    />
        <result property="mfCode"    column="mf_code"    />
        <result property="proTypeCode"    column="pro_type_code"    />
        <result property="batteryTypeCode"    column="battery_type_code"    />
        <result property="specificationsCode"    column="specifications_code"    />
        <result property="traceInfoCode"    column="trace_info_code"    />
        <result property="proDateCode"    column="pro_date_code"    />
        <result property="sfcCode"    column="sfc_code"    />
        <result property="state"    column="state"    />
        <result property="remarks"    column="remarks"    />
        <result property="spareField1"    column="spare_field1"    />
        <result property="spareField2"    column="spare_field2"    />
        <result property="createUser"    column="create_user"    />
        <result property="createTime"    column="create_time"    />
        <result property="updateUser"    column="update_user"    />
        <result property="updateTime"    column="update_time"    />
    </resultMap>
    <sql id="selectDaPsConfVo">
        select id, mf_code, pro_type_code, battery_type_code, specifications_code, trace_info_code, pro_date_code, sfc_code, state, remarks, spare_field1, spare_field2, create_user, create_time, update_user, update_time from da_ps_conf
    </sql>
    <select id="selectDaPsConfList" parameterType="DaPsConf" resultMap="DaPsConfResult">
        <include refid="selectDaPsConfVo"/>
        <where>
            <if test="mfCode != null  and mfCode != ''"> and mf_code = #{mfCode}</if>
            <if test="proTypeCode != null  and proTypeCode != ''"> and pro_type_code = #{proTypeCode}</if>
            <if test="batteryTypeCode != null  and batteryTypeCode != ''"> and battery_type_code = #{batteryTypeCode}</if>
            <if test="specificationsCode != null  and specificationsCode != ''"> and specifications_code = #{specificationsCode}</if>
            <if test="traceInfoCode != null  and traceInfoCode != ''"> and trace_info_code = #{traceInfoCode}</if>
            <if test="proDateCode != null  and proDateCode != ''"> and pro_date_code = #{proDateCode}</if>
            <if test="sfcCode != null  and sfcCode != ''"> and sfc_code = #{sfcCode}</if>
            <if test="state != null  and state != ''"> and state = #{state}</if>
            <if test="remarks != null  and remarks != ''"> and remarks = #{remarks}</if>
            <if test="spareField1 != null  and spareField1 != ''"> and spare_field1 = #{spareField1}</if>
            <if test="spareField2 != null  and spareField2 != ''"> and spare_field2 = #{spareField2}</if>
            <if test="createUser != null  and createUser != ''"> and create_user = #{createUser}</if>
            <if test="updateUser != null  and updateUser != ''"> and update_user = #{updateUser}</if>
        </where>
    </select>
    <select id="selectDaPsConfById" parameterType="Long" resultMap="DaPsConfResult">
        <include refid="selectDaPsConfVo"/>
        where id = #{id}
    </select>
    <insert id="insertDaPsConf" parameterType="DaPsConf" useGeneratedKeys="true" keyProperty="id">
        insert into da_ps_conf
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="mfCode != null">mf_code,</if>
            <if test="proTypeCode != null">pro_type_code,</if>
            <if test="batteryTypeCode != null">battery_type_code,</if>
            <if test="specificationsCode != null">specifications_code,</if>
            <if test="traceInfoCode != null">trace_info_code,</if>
            <if test="proDateCode != null">pro_date_code,</if>
            <if test="sfcCode != null">sfc_code,</if>
            <if test="state != null">state,</if>
            <if test="remarks != null">remarks,</if>
            <if test="spareField1 != null">spare_field1,</if>
            <if test="spareField2 != null">spare_field2,</if>
            <if test="createUser != null">create_user,</if>
            <if test="createTime != null">create_time,</if>
            <if test="updateUser != null">update_user,</if>
            <if test="updateTime != null">update_time,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="mfCode != null">#{mfCode},</if>
            <if test="proTypeCode != null">#{proTypeCode},</if>
            <if test="batteryTypeCode != null">#{batteryTypeCode},</if>
            <if test="specificationsCode != null">#{specificationsCode},</if>
            <if test="traceInfoCode != null">#{traceInfoCode},</if>
            <if test="proDateCode != null">#{proDateCode},</if>
            <if test="sfcCode != null">#{sfcCode},</if>
            <if test="state != null">#{state},</if>
            <if test="remarks != null">#{remarks},</if>
            <if test="spareField1 != null">#{spareField1},</if>
            <if test="spareField2 != null">#{spareField2},</if>
            <if test="createUser != null">#{createUser},</if>
            <if test="createTime != null">#{createTime},</if>
            <if test="updateUser != null">#{updateUser},</if>
            <if test="updateTime != null">#{updateTime},</if>
         </trim>
    </insert>
    <update id="updateDaPsConf" parameterType="DaPsConf">
        update da_ps_conf
        <trim prefix="SET" suffixOverrides=",">
            <if test="mfCode != null">mf_code = #{mfCode},</if>
            <if test="proTypeCode != null">pro_type_code = #{proTypeCode},</if>
            <if test="batteryTypeCode != null">battery_type_code = #{batteryTypeCode},</if>
            <if test="specificationsCode != null">specifications_code = #{specificationsCode},</if>
            <if test="traceInfoCode != null">trace_info_code = #{traceInfoCode},</if>
            <if test="proDateCode != null">pro_date_code = #{proDateCode},</if>
            <if test="sfcCode != null">sfc_code = #{sfcCode},</if>
            <if test="state != null">state = #{state},</if>
            <if test="remarks != null">remarks = #{remarks},</if>
            <if test="spareField1 != null">spare_field1 = #{spareField1},</if>
            <if test="spareField2 != null">spare_field2 = #{spareField2},</if>
            <if test="createUser != null">create_user = #{createUser},</if>
            <if test="createTime != null">create_time = #{createTime},</if>
            <if test="updateUser != null">update_user = #{updateUser},</if>
            <if test="updateTime != null">update_time = #{updateTime},</if>
        </trim>
        where id = #{id}
    </update>
    <delete id="deleteDaPsConfById" parameterType="Long">
        delete from da_ps_conf where id = #{id}
    </delete>
    <delete id="deleteDaPsConfByIds" parameterType="String">
        delete from da_ps_conf where id in
        <foreach item="id" collection="array" open="(" separator="," close=")">
            #{id}
        </foreach>
    </delete>
</mapper>
jcdm-ui/src/api/main/da/psConf/psConf.js
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,44 @@
import request from '@/utils/request'
// æŸ¥è¯¢1P1S配置列表
export function listPsConf(query) {
  return request({
    url: '/da/psConf/list',
    method: 'get',
    params: query
  })
}
// æŸ¥è¯¢1P1S配置详细
export function getPsConf(id) {
  return request({
    url: '/da/psConf/' + id,
    method: 'get'
  })
}
// æ–°å¢ž1P1S配置
export function addPsConf(data) {
  return request({
    url: '/da/psConf',
    method: 'post',
    data: data
  })
}
// ä¿®æ”¹1P1S配置
export function updatePsConf(data) {
  return request({
    url: '/da/psConf',
    method: 'put',
    data: data
  })
}
// åˆ é™¤1P1S配置
export function delPsConf(id) {
  return request({
    url: '/da/psConf/' + id,
    method: 'delete'
  })
}
jcdm-ui/src/views/main/da/psConf/index.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,355 @@
<template>
  <div class="app-container">
    <el-card class="box-card">
        <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
          <el-form-item label="厂商代码" prop="mfCode">
            <el-input
              v-model="queryParams.mfCode"
              placeholder="请输入厂商代码"
              clearable
              @keyup.enter.native="handleQuery"
            />
          </el-form-item>
          <el-form-item label="产品类型代码" prop="proTypeCode">
            <el-input
              v-model="queryParams.proTypeCode"
              placeholder="请输入产品类型代码"
              clearable
              @keyup.enter.native="handleQuery"
            />
          </el-form-item>
          <el-form-item style="float: right">
            <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
            <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
          </el-form-item>
        </el-form>
    </el-card>
    <el-card style="margin-top: 10px" class="box-card">
        <el-row :gutter="10" class="mb8">
          <el-col :span="1.5">
            <el-button
              type="primary"
              plain
              icon="el-icon-plus"
              size="mini"
              @click="handleAdd"
              v-hasPermi="['da:psConf:add']"
            >新增</el-button>
          </el-col>
          <el-col :span="1.5">
            <el-button
              type="success"
              plain
              icon="el-icon-edit"
              size="mini"
              :disabled="single"
              @click="handleUpdate"
              v-hasPermi="['da:psConf:edit']"
            >修改</el-button>
          </el-col>
          <el-col :span="1.5">
            <el-button
              type="danger"
              plain
              icon="el-icon-delete"
              size="mini"
              :disabled="multiple"
              @click="handleDelete"
              v-hasPermi="['da:psConf:remove']"
            >删除</el-button>
          </el-col>
          <el-col :span="1.5">
            <el-button
              type="warning"
              plain
              icon="el-icon-download"
              size="mini"
              @click="handleExport"
              v-hasPermi="['da:psConf:export']"
            >导出</el-button>
          </el-col>
          <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
        </el-row>
        <el-table border v-loading="loading" :data="psConfList" @selection-change="handleSelectionChange">
          <el-table-column type="selection" width="55" align="center" />
          <el-table-column label="厂商代码" align="center" prop="mfCode">
          </el-table-column>
          <el-table-column label="产品类型代码" align="center" prop="proTypeCode">
          </el-table-column>
          <el-table-column label="电池类型代码" align="center" prop="batteryTypeCode">
          </el-table-column>
          <el-table-column label="规格代码" align="center" prop="specificationsCode">
          </el-table-column>
          <el-table-column label="追溯信息代码" align="center" prop="traceInfoCode">
          </el-table-column>
          <el-table-column label="生产日期代码" align="center" prop="proDateCode">
          </el-table-column>
          <el-table-column label="序列号" align="center" prop="sfcCode">
          </el-table-column>
          <el-table-column label="状态 (启用enable,禁用disable)" align="center" prop="state">
          </el-table-column>
          <el-table-column label="备注" align="center" prop="remarks">
          </el-table-column>
          <el-table-column label="预留字段1" align="center" prop="spareField1">
          </el-table-column>
          <el-table-column label="预留字段2" align="center" prop="spareField2">
          </el-table-column>
          <el-table-column label="创建用户" align="center" prop="createUser">
          </el-table-column>
          <el-table-column label="更改用户" align="center" prop="updateUser">
          </el-table-column>
          <el-table-column fixed="right" width="200" label="操作" align="center" class-name="small-padding fixed-width">
            <template slot-scope="scope">
              <el-button
                size="mini"
                type="success"
                plain
                style="width: 72px"
                icon="el-icon-edit"
                @click="handleUpdate(scope.row)"
                v-hasPermi="['da:psConf:edit']"
              >修改</el-button>
              <el-button
                size="mini"
                type="danger"
                plain
                style="width: 72px"
                icon="el-icon-delete"
                @click="handleDelete(scope.row)"
                v-hasPermi="['da:psConf:remove']"
              >删除</el-button>
            </template>
          </el-table-column>
        </el-table>
    </el-card>
    <pagination
      v-show="total>0"
      :total="total"
      :page.sync="queryParams.pageNum"
      :limit.sync="queryParams.pageSize"
      @pagination="getList"
    />
    <!-- æ·»åŠ æˆ–修改1P1S配置对话框 -->
    <el-dialog v-dialogpop-up :title="title" :visible.sync="open" width="500px" append-to-body>
      <span slot="title">
        <i class="el-icon-s-order"></i>
        {{titleName}}
      </span>
      <el-form ref="form" :model="form" :rules="rules" label-width="80px">
        <el-form-item label="厂商代码" prop="mfCode">
          <el-input v-model="form.mfCode" placeholder="请输入厂商代码" />
        </el-form-item>
        <el-form-item label="产品类型代码" prop="proTypeCode">
          <el-input v-model="form.proTypeCode" placeholder="请输入产品类型代码" />
        </el-form-item>
        <el-form-item label="电池类型代码" prop="batteryTypeCode">
          <el-input v-model="form.batteryTypeCode" placeholder="请输入电池类型代码" />
        </el-form-item>
        <el-form-item label="规格代码" prop="specificationsCode">
          <el-input v-model="form.specificationsCode" placeholder="请输入规格代码" />
        </el-form-item>
        <el-form-item label="追溯信息代码" prop="traceInfoCode">
          <el-input v-model="form.traceInfoCode" placeholder="请输入追溯信息代码" />
        </el-form-item>
        <el-form-item label="生产日期代码" prop="proDateCode">
          <el-input v-model="form.proDateCode" placeholder="请输入生产日期代码" />
        </el-form-item>
        <el-form-item label="序列号" prop="sfcCode">
          <el-input v-model="form.sfcCode" placeholder="请输入序列号" />
        </el-form-item>
        <el-form-item label="状态 (启用enable,禁用disable)" prop="state">
          <el-input v-model="form.state" placeholder="请输入状态 (启用enable,禁用disable)" />
        </el-form-item>
        <el-form-item label="备注" prop="remarks">
          <el-input v-model="form.remarks" placeholder="请输入备注" />
        </el-form-item>
        <el-form-item label="预留字段1" prop="spareField1">
          <el-input v-model="form.spareField1" placeholder="请输入预留字段1" />
        </el-form-item>
        <el-form-item label="预留字段2" prop="spareField2">
          <el-input v-model="form.spareField2" placeholder="请输入预留字段2" />
        </el-form-item>
        <el-form-item label="创建用户" prop="createUser">
          <el-input v-model="form.createUser" placeholder="请输入创建用户" />
        </el-form-item>
        <el-form-item label="更改用户" prop="updateUser">
          <el-input v-model="form.updateUser" placeholder="请输入更改用户" />
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitForm">ç¡® å®š</el-button>
        <el-button @click="cancel">取 æ¶ˆ</el-button>
      </div>
    </el-dialog>
  </div>
</template>
<script>
import { listPsConf, getPsConf, delPsConf, addPsConf, updatePsConf } from "@/api/main/da/psConf/psConf";
export default {
  name: "PsConf",
  data() {
    return {
      // é®ç½©å±‚
      loading: true,
      titleName: "",
      // é€‰ä¸­æ•°ç»„
      ids: [],
      // éžå•ä¸ªç¦ç”¨
      single: true,
      // éžå¤šä¸ªç¦ç”¨
      multiple: true,
      // æ˜¾ç¤ºæœç´¢æ¡ä»¶
      showSearch: true,
      // æ€»æ¡æ•°
      total: 0,
      // 1P1S配置表格数据
      psConfList: [],
      // å¼¹å‡ºå±‚标题
      title: "",
      // æ˜¯å¦æ˜¾ç¤ºå¼¹å‡ºå±‚
      open: false,
      // æŸ¥è¯¢å‚æ•°
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        mfCode: null,
        proTypeCode: null,
        batteryTypeCode: null,
        specificationsCode: null,
        traceInfoCode: null,
        proDateCode: null,
        sfcCode: null,
        state: null,
        remarks: null,
        spareField1: null,
        spareField2: null,
        createUser: null,
        updateUser: null,
      },
      // è¡¨å•å‚æ•°
      form: {},
      // è¡¨å•æ ¡éªŒ
      rules: {
        id: [
          { required: true, message: "主键id不能为空", trigger: "blur" }
        ],
      }
    };
  },
  created() {
    this.getList();
  },
  methods: {
    /** æŸ¥è¯¢1P1S配置列表 */
    getList() {
      this.loading = true;
      listPsConf(this.queryParams).then(response => {
        this.psConfList = response.rows;
        this.total = response.total;
        this.loading = false;
      });
    },
    // å–消按钮
    cancel() {
      this.open = false;
      this.reset();
    },
    // è¡¨å•é‡ç½®
    reset() {
      this.form = {
        id: null,
        mfCode: null,
        proTypeCode: null,
        batteryTypeCode: null,
        specificationsCode: null,
        traceInfoCode: null,
        proDateCode: null,
        sfcCode: null,
        state: null,
        remarks: null,
        spareField1: null,
        spareField2: null,
        createUser: null,
        createTime: null,
        updateUser: null,
        updateTime: null
      };
      this.resetForm("form");
    },
    /** æœç´¢æŒ‰é’®æ“ä½œ */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getList();
    },
    /** é‡ç½®æŒ‰é’®æ“ä½œ */
    resetQuery() {
      this.resetForm("queryForm");
      this.handleQuery();
    },
    // å¤šé€‰æ¡†é€‰ä¸­æ•°æ®
    handleSelectionChange(selection) {
      this.ids = selection.map(item => item.id)
      this.single = selection.length!==1
      this.multiple = !selection.length
    },
    /** æ–°å¢žæŒ‰é’®æ“ä½œ */
    handleAdd() {
      this.reset();
      this.open = true;
      this.titleName = "添加1P1S配置";
    },
    /** ä¿®æ”¹æŒ‰é’®æ“ä½œ */
    handleUpdate(row) {
      this.reset();
      const id = row.id || this.ids
      getPsConf(id).then(response => {
        this.form = response.data;
        this.open = true;
        this.titleName = "修改1P1S配置";
      });
    },
    /** æäº¤æŒ‰é’® */
    submitForm() {
      this.$refs["form"].validate(valid => {
        if (valid) {
          if (this.form.id != null) {
            updatePsConf(this.form).then(response => {
              this.$modal.msgSuccess("修改成功");
              this.open = false;
              this.getList();
            });
          } else {
            addPsConf(this.form).then(response => {
              this.$modal.msgSuccess("新增成功");
              this.open = false;
              this.getList();
            });
          }
        }
      });
    },
    /** åˆ é™¤æŒ‰é’®æ“ä½œ */
    handleDelete(row) {
      const ids = row.id || this.ids;
      this.$modal.confirm('是否确认删除1P1S配置编号为"' + ids + '"的数据项?').then(function() {
        return delPsConf(ids);
      }).then(() => {
        this.getList();
        this.$modal.msgSuccess("删除成功");
      }).catch(() => {});
    },
    /** å¯¼å‡ºæŒ‰é’®æ“ä½œ */
    handleExport() {
      this.download('da/psConf/export', {
        ...this.queryParams
      }, `psConf_${new Date().getTime()}.xlsx`)
    }
  }
};
</script>