From e29b8859e673ad894de8aa6896e2951768da8092 Mon Sep 17 00:00:00 2001 From: 懒羊羊 <15939171744@163.com> Date: 星期二, 26 十二月 2023 10:20:07 +0800 Subject: [PATCH] 设备类型 --- jcdm-main/src/main/java/com/jcdm/main/em/equipmentType/domain/EmEquipmentType.java | 177 ++++++++++ jcdm-ui/src/api/main/em/equipmentType/equipmentType.js | 44 ++ jcdm-main/src/main/java/com/jcdm/main/em/equipmentType/service/IEmEquipmentTypeService.java | 61 +++ jcdm-main/src/main/java/com/jcdm/main/em/equipmentType/mapper/EmEquipmentTypeMapper.java | 61 +++ jcdm-main/src/main/java/com/jcdm/main/em/equipmentType/controller/EmEquipmentTypeController.java | 102 ++++++ jcdm-main/src/main/resources/mapper/em/equipmentType/EmEquipmentTypeMapper.xml | 111 ++++++ jcdm-main/src/main/java/com/jcdm/main/em/equipmentType/service/impl/EmEquipmentTypeServiceImpl.java | 96 +++++ jcdm-ui/src/views/main/em/equipmentType/index.vue | 323 +++++++++++++++++++ 8 files changed, 975 insertions(+), 0 deletions(-) diff --git a/jcdm-main/src/main/java/com/jcdm/main/em/equipmentType/controller/EmEquipmentTypeController.java b/jcdm-main/src/main/java/com/jcdm/main/em/equipmentType/controller/EmEquipmentTypeController.java new file mode 100644 index 0000000..9592094 --- /dev/null +++ b/jcdm-main/src/main/java/com/jcdm/main/em/equipmentType/controller/EmEquipmentTypeController.java @@ -0,0 +1,102 @@ +package com.jcdm.main.em.equipmentType.controller; + +import java.util.List; +import javax.servlet.http.HttpServletResponse; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.jcdm.common.annotation.Log; +import com.jcdm.common.core.controller.BaseController; +import com.jcdm.common.core.domain.AjaxResult; +import com.jcdm.common.enums.BusinessType; +import com.jcdm.main.em.equipmentType.domain.EmEquipmentType; +import com.jcdm.main.em.equipmentType.service.IEmEquipmentTypeService; +import com.jcdm.common.utils.poi.ExcelUtil; + +/** + * 璁惧绫诲瀷Controller + * + * @author ruimin + * @date 2023-12-26 + */ +@RestController +@RequestMapping("/em/equipmentType") +public class EmEquipmentTypeController extends BaseController +{ + @Autowired + private IEmEquipmentTypeService emEquipmentTypeService; + + /** + * 鏌ヨ璁惧绫诲瀷鍒楄〃 + */ + @PreAuthorize("@ss.hasPermi('em:equipmentType:list')") + @GetMapping("/list") + public AjaxResult list(EmEquipmentType emEquipmentType) + { + List<EmEquipmentType> list = emEquipmentTypeService.selectEmEquipmentTypeList(emEquipmentType); + return success(list); + } + + /** + * 瀵煎嚭璁惧绫诲瀷鍒楄〃 + */ + @PreAuthorize("@ss.hasPermi('em:equipmentType:export')") + @Log(title = "璁惧绫诲瀷", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, EmEquipmentType emEquipmentType) + { + List<EmEquipmentType> list = emEquipmentTypeService.selectEmEquipmentTypeList(emEquipmentType); + ExcelUtil<EmEquipmentType> util = new ExcelUtil<EmEquipmentType>(EmEquipmentType.class); + util.exportExcel(response, list, "璁惧绫诲瀷鏁版嵁"); + } + + /** + * 鑾峰彇璁惧绫诲瀷璇︾粏淇℃伅 + */ + @PreAuthorize("@ss.hasPermi('em:equipmentType:query')") + @GetMapping(value = "/{id}") + public AjaxResult getInfo(@PathVariable("id") Long id) + { + return success(emEquipmentTypeService.selectEmEquipmentTypeById(id)); + } + + /** + * 鏂板璁惧绫诲瀷 + */ + @PreAuthorize("@ss.hasPermi('em:equipmentType:add')") + @Log(title = "璁惧绫诲瀷", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody EmEquipmentType emEquipmentType) + { + return toAjax(emEquipmentTypeService.insertEmEquipmentType(emEquipmentType)); + } + + /** + * 淇敼璁惧绫诲瀷 + */ + @PreAuthorize("@ss.hasPermi('em:equipmentType:edit')") + @Log(title = "璁惧绫诲瀷", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody EmEquipmentType emEquipmentType) + { + return toAjax(emEquipmentTypeService.updateEmEquipmentType(emEquipmentType)); + } + + /** + * 鍒犻櫎璁惧绫诲瀷 + */ + @PreAuthorize("@ss.hasPermi('em:equipmentType:remove')") + @Log(title = "璁惧绫诲瀷", businessType = BusinessType.DELETE) + @DeleteMapping("/{ids}") + public AjaxResult remove(@PathVariable Long[] ids) + { + return toAjax(emEquipmentTypeService.deleteEmEquipmentTypeByIds(ids)); + } +} diff --git a/jcdm-main/src/main/java/com/jcdm/main/em/equipmentType/domain/EmEquipmentType.java b/jcdm-main/src/main/java/com/jcdm/main/em/equipmentType/domain/EmEquipmentType.java new file mode 100644 index 0000000..a3e03de --- /dev/null +++ b/jcdm-main/src/main/java/com/jcdm/main/em/equipmentType/domain/EmEquipmentType.java @@ -0,0 +1,177 @@ +package com.jcdm.main.em.equipmentType.domain; + +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.jcdm.common.annotation.Excel; +import com.jcdm.common.core.domain.TreeEntity; + +/** + * 璁惧绫诲瀷瀵硅薄 em_equipment_type + * + * @author ruimin + * @date 2023-12-26 + */ +public class EmEquipmentType extends TreeEntity +{ + private static final long serialVersionUID = 1L; + + /** ID */ + private Long id; + + /** 璁惧绫诲瀷缂栫爜 */ + @Excel(name = "璁惧绫诲瀷缂栫爜") + private String equipmentTypeCode; + + /** 璁惧绫诲瀷鍚嶇О */ + @Excel(name = "璁惧绫诲瀷鍚嶇О") + private String equipmentTypeName; + + /** 鐖剁被鍨婭D */ + @Excel(name = "鐖剁被鍨婭D") + private Long parentTypeId; + + /** 鏄惁鍚敤 */ + @Excel(name = "鏄惁鍚敤") + private String status; + + /** 鍒涘缓浜� */ + @Excel(name = "鍒涘缓浜�") + private String createUser; + + /** 鏇存柊浜� */ + @Excel(name = "鏇存柊浜�") + private String updateUser; + + /** 棰勭暀瀛楁1 */ + private String spareField1; + + /** 棰勭暀瀛楁2 */ + private String spareField2; + + /** 棰勭暀瀛楁3 */ + private Long spareField3; + + /** 棰勭暀瀛楁4 */ + private Long spareField4; + + public void setId(Long id) + { + this.id = id; + } + + public Long getId() + { + return id; + } + public void setEquipmentTypeCode(String equipmentTypeCode) + { + this.equipmentTypeCode = equipmentTypeCode; + } + + public String getEquipmentTypeCode() + { + return equipmentTypeCode; + } + public void setEquipmentTypeName(String equipmentTypeName) + { + this.equipmentTypeName = equipmentTypeName; + } + + public String getEquipmentTypeName() + { + return equipmentTypeName; + } + public void setParentTypeId(Long parentTypeId) + { + this.parentTypeId = parentTypeId; + } + + public Long getParentTypeId() + { + return parentTypeId; + } + public void setStatus(String status) + { + this.status = status; + } + + public String getStatus() + { + return status; + } + 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; + } + 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 setSpareField3(Long spareField3) + { + this.spareField3 = spareField3; + } + + public Long getSpareField3() + { + return spareField3; + } + public void setSpareField4(Long spareField4) + { + this.spareField4 = spareField4; + } + + public Long getSpareField4() + { + return spareField4; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("id", getId()) + .append("equipmentTypeCode", getEquipmentTypeCode()) + .append("equipmentTypeName", getEquipmentTypeName()) + .append("parentTypeId", getParentTypeId()) + .append("ancestors", getAncestors()) + .append("status", getStatus()) + .append("remark", getRemark()) + .append("createUser", getCreateUser()) + .append("createTime", getCreateTime()) + .append("updateUser", getUpdateUser()) + .append("updateTime", getUpdateTime()) + .append("spareField1", getSpareField1()) + .append("spareField2", getSpareField2()) + .append("spareField3", getSpareField3()) + .append("spareField4", getSpareField4()) + .toString(); + } +} diff --git a/jcdm-main/src/main/java/com/jcdm/main/em/equipmentType/mapper/EmEquipmentTypeMapper.java b/jcdm-main/src/main/java/com/jcdm/main/em/equipmentType/mapper/EmEquipmentTypeMapper.java new file mode 100644 index 0000000..e36e064 --- /dev/null +++ b/jcdm-main/src/main/java/com/jcdm/main/em/equipmentType/mapper/EmEquipmentTypeMapper.java @@ -0,0 +1,61 @@ +package com.jcdm.main.em.equipmentType.mapper; + +import java.util.List; +import com.jcdm.main.em.equipmentType.domain.EmEquipmentType; + +/** + * 璁惧绫诲瀷Mapper鎺ュ彛 + * + * @author ruimin + * @date 2023-12-26 + */ +public interface EmEquipmentTypeMapper +{ + /** + * 鏌ヨ璁惧绫诲瀷 + * + * @param id 璁惧绫诲瀷涓婚敭 + * @return 璁惧绫诲瀷 + */ + public EmEquipmentType selectEmEquipmentTypeById(Long id); + + /** + * 鏌ヨ璁惧绫诲瀷鍒楄〃 + * + * @param emEquipmentType 璁惧绫诲瀷 + * @return 璁惧绫诲瀷闆嗗悎 + */ + public List<EmEquipmentType> selectEmEquipmentTypeList(EmEquipmentType emEquipmentType); + + /** + * 鏂板璁惧绫诲瀷 + * + * @param emEquipmentType 璁惧绫诲瀷 + * @return 缁撴灉 + */ + public int insertEmEquipmentType(EmEquipmentType emEquipmentType); + + /** + * 淇敼璁惧绫诲瀷 + * + * @param emEquipmentType 璁惧绫诲瀷 + * @return 缁撴灉 + */ + public int updateEmEquipmentType(EmEquipmentType emEquipmentType); + + /** + * 鍒犻櫎璁惧绫诲瀷 + * + * @param id 璁惧绫诲瀷涓婚敭 + * @return 缁撴灉 + */ + public int deleteEmEquipmentTypeById(Long id); + + /** + * 鎵归噺鍒犻櫎璁惧绫诲瀷 + * + * @param ids 闇�瑕佸垹闄ょ殑鏁版嵁涓婚敭闆嗗悎 + * @return 缁撴灉 + */ + public int deleteEmEquipmentTypeByIds(Long[] ids); +} diff --git a/jcdm-main/src/main/java/com/jcdm/main/em/equipmentType/service/IEmEquipmentTypeService.java b/jcdm-main/src/main/java/com/jcdm/main/em/equipmentType/service/IEmEquipmentTypeService.java new file mode 100644 index 0000000..1196938 --- /dev/null +++ b/jcdm-main/src/main/java/com/jcdm/main/em/equipmentType/service/IEmEquipmentTypeService.java @@ -0,0 +1,61 @@ +package com.jcdm.main.em.equipmentType.service; + +import java.util.List; +import com.jcdm.main.em.equipmentType.domain.EmEquipmentType; + +/** + * 璁惧绫诲瀷Service鎺ュ彛 + * + * @author ruimin + * @date 2023-12-26 + */ +public interface IEmEquipmentTypeService +{ + /** + * 鏌ヨ璁惧绫诲瀷 + * + * @param id 璁惧绫诲瀷涓婚敭 + * @return 璁惧绫诲瀷 + */ + public EmEquipmentType selectEmEquipmentTypeById(Long id); + + /** + * 鏌ヨ璁惧绫诲瀷鍒楄〃 + * + * @param emEquipmentType 璁惧绫诲瀷 + * @return 璁惧绫诲瀷闆嗗悎 + */ + public List<EmEquipmentType> selectEmEquipmentTypeList(EmEquipmentType emEquipmentType); + + /** + * 鏂板璁惧绫诲瀷 + * + * @param emEquipmentType 璁惧绫诲瀷 + * @return 缁撴灉 + */ + public int insertEmEquipmentType(EmEquipmentType emEquipmentType); + + /** + * 淇敼璁惧绫诲瀷 + * + * @param emEquipmentType 璁惧绫诲瀷 + * @return 缁撴灉 + */ + public int updateEmEquipmentType(EmEquipmentType emEquipmentType); + + /** + * 鎵归噺鍒犻櫎璁惧绫诲瀷 + * + * @param ids 闇�瑕佸垹闄ょ殑璁惧绫诲瀷涓婚敭闆嗗悎 + * @return 缁撴灉 + */ + public int deleteEmEquipmentTypeByIds(Long[] ids); + + /** + * 鍒犻櫎璁惧绫诲瀷淇℃伅 + * + * @param id 璁惧绫诲瀷涓婚敭 + * @return 缁撴灉 + */ + public int deleteEmEquipmentTypeById(Long id); +} diff --git a/jcdm-main/src/main/java/com/jcdm/main/em/equipmentType/service/impl/EmEquipmentTypeServiceImpl.java b/jcdm-main/src/main/java/com/jcdm/main/em/equipmentType/service/impl/EmEquipmentTypeServiceImpl.java new file mode 100644 index 0000000..82abb15 --- /dev/null +++ b/jcdm-main/src/main/java/com/jcdm/main/em/equipmentType/service/impl/EmEquipmentTypeServiceImpl.java @@ -0,0 +1,96 @@ +package com.jcdm.main.em.equipmentType.service.impl; + +import java.util.List; +import com.jcdm.common.utils.DateUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.jcdm.main.em.equipmentType.mapper.EmEquipmentTypeMapper; +import com.jcdm.main.em.equipmentType.domain.EmEquipmentType; +import com.jcdm.main.em.equipmentType.service.IEmEquipmentTypeService; + +/** + * 璁惧绫诲瀷Service涓氬姟灞傚鐞� + * + * @author ruimin + * @date 2023-12-26 + */ +@Service +public class EmEquipmentTypeServiceImpl implements IEmEquipmentTypeService +{ + @Autowired + private EmEquipmentTypeMapper emEquipmentTypeMapper; + + /** + * 鏌ヨ璁惧绫诲瀷 + * + * @param id 璁惧绫诲瀷涓婚敭 + * @return 璁惧绫诲瀷 + */ + @Override + public EmEquipmentType selectEmEquipmentTypeById(Long id) + { + return emEquipmentTypeMapper.selectEmEquipmentTypeById(id); + } + + /** + * 鏌ヨ璁惧绫诲瀷鍒楄〃 + * + * @param emEquipmentType 璁惧绫诲瀷 + * @return 璁惧绫诲瀷 + */ + @Override + public List<EmEquipmentType> selectEmEquipmentTypeList(EmEquipmentType emEquipmentType) + { + return emEquipmentTypeMapper.selectEmEquipmentTypeList(emEquipmentType); + } + + /** + * 鏂板璁惧绫诲瀷 + * + * @param emEquipmentType 璁惧绫诲瀷 + * @return 缁撴灉 + */ + @Override + public int insertEmEquipmentType(EmEquipmentType emEquipmentType) + { + emEquipmentType.setCreateTime(DateUtils.getNowDate()); + return emEquipmentTypeMapper.insertEmEquipmentType(emEquipmentType); + } + + /** + * 淇敼璁惧绫诲瀷 + * + * @param emEquipmentType 璁惧绫诲瀷 + * @return 缁撴灉 + */ + @Override + public int updateEmEquipmentType(EmEquipmentType emEquipmentType) + { + emEquipmentType.setUpdateTime(DateUtils.getNowDate()); + return emEquipmentTypeMapper.updateEmEquipmentType(emEquipmentType); + } + + /** + * 鎵归噺鍒犻櫎璁惧绫诲瀷 + * + * @param ids 闇�瑕佸垹闄ょ殑璁惧绫诲瀷涓婚敭 + * @return 缁撴灉 + */ + @Override + public int deleteEmEquipmentTypeByIds(Long[] ids) + { + return emEquipmentTypeMapper.deleteEmEquipmentTypeByIds(ids); + } + + /** + * 鍒犻櫎璁惧绫诲瀷淇℃伅 + * + * @param id 璁惧绫诲瀷涓婚敭 + * @return 缁撴灉 + */ + @Override + public int deleteEmEquipmentTypeById(Long id) + { + return emEquipmentTypeMapper.deleteEmEquipmentTypeById(id); + } +} diff --git a/jcdm-main/src/main/resources/mapper/em/equipmentType/EmEquipmentTypeMapper.xml b/jcdm-main/src/main/resources/mapper/em/equipmentType/EmEquipmentTypeMapper.xml new file mode 100644 index 0000000..90f02b7 --- /dev/null +++ b/jcdm-main/src/main/resources/mapper/em/equipmentType/EmEquipmentTypeMapper.xml @@ -0,0 +1,111 @@ +<?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.em.equipmentType.mapper.EmEquipmentTypeMapper"> + + <resultMap type="EmEquipmentType" id="EmEquipmentTypeResult"> + <result property="id" column="id" /> + <result property="equipmentTypeCode" column="equipment_type_code" /> + <result property="equipmentTypeName" column="equipment_type_name" /> + <result property="parentTypeId" column="parent_type_id" /> + <result property="ancestors" column="ancestors" /> + <result property="status" column="status" /> + <result property="remark" column="remark" /> + <result property="createUser" column="create_user" /> + <result property="createTime" column="create_time" /> + <result property="updateUser" column="update_user" /> + <result property="updateTime" column="update_time" /> + <result property="spareField1" column="spare_field_1" /> + <result property="spareField2" column="spare_field_2" /> + <result property="spareField3" column="spare_field_3" /> + <result property="spareField4" column="spare_field_4" /> + </resultMap> + + <sql id="selectEmEquipmentTypeVo"> + select id, equipment_type_code, equipment_type_name, parent_type_id, ancestors, status, remark, create_user, create_time, update_user, update_time, spare_field_1, spare_field_2, spare_field_3, spare_field_4 from em_equipment_type + </sql> + + <select id="selectEmEquipmentTypeList" parameterType="EmEquipmentType" resultMap="EmEquipmentTypeResult"> + <include refid="selectEmEquipmentTypeVo"/> + <where> + <if test="equipmentTypeCode != null and equipmentTypeCode != ''"> and equipment_type_code = #{equipmentTypeCode}</if> + <if test="equipmentTypeName != null and equipmentTypeName != ''"> and equipment_type_name like concat('%', #{equipmentTypeName}, '%')</if> + </where> + </select> + + <select id="selectEmEquipmentTypeById" parameterType="Long" resultMap="EmEquipmentTypeResult"> + <include refid="selectEmEquipmentTypeVo"/> + where id = #{id} + </select> + + <insert id="insertEmEquipmentType" parameterType="EmEquipmentType"> + insert into em_equipment_type + <trim prefix="(" suffix=")" suffixOverrides=","> + <if test="id != null">id,</if> + <if test="equipmentTypeCode != null and equipmentTypeCode != ''">equipment_type_code,</if> + <if test="equipmentTypeName != null and equipmentTypeName != ''">equipment_type_name,</if> + <if test="parentTypeId != null">parent_type_id,</if> + <if test="ancestors != null and ancestors != ''">ancestors,</if> + <if test="status != null and status != ''">status,</if> + <if test="remark != null">remark,</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> + <if test="spareField1 != null">spare_field_1,</if> + <if test="spareField2 != null">spare_field_2,</if> + <if test="spareField3 != null">spare_field_3,</if> + <if test="spareField4 != null">spare_field_4,</if> + </trim> + <trim prefix="values (" suffix=")" suffixOverrides=","> + <if test="id != null">#{id},</if> + <if test="equipmentTypeCode != null and equipmentTypeCode != ''">#{equipmentTypeCode},</if> + <if test="equipmentTypeName != null and equipmentTypeName != ''">#{equipmentTypeName},</if> + <if test="parentTypeId != null">#{parentTypeId},</if> + <if test="ancestors != null and ancestors != ''">#{ancestors},</if> + <if test="status != null and status != ''">#{status},</if> + <if test="remark != null">#{remark},</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> + <if test="spareField1 != null">#{spareField1},</if> + <if test="spareField2 != null">#{spareField2},</if> + <if test="spareField3 != null">#{spareField3},</if> + <if test="spareField4 != null">#{spareField4},</if> + </trim> + </insert> + + <update id="updateEmEquipmentType" parameterType="EmEquipmentType"> + update em_equipment_type + <trim prefix="SET" suffixOverrides=","> + <if test="equipmentTypeCode != null and equipmentTypeCode != ''">equipment_type_code = #{equipmentTypeCode},</if> + <if test="equipmentTypeName != null and equipmentTypeName != ''">equipment_type_name = #{equipmentTypeName},</if> + <if test="parentTypeId != null">parent_type_id = #{parentTypeId},</if> + <if test="ancestors != null and ancestors != ''">ancestors = #{ancestors},</if> + <if test="status != null and status != ''">status = #{status},</if> + <if test="remark != null">remark = #{remark},</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> + <if test="spareField1 != null">spare_field_1 = #{spareField1},</if> + <if test="spareField2 != null">spare_field_2 = #{spareField2},</if> + <if test="spareField3 != null">spare_field_3 = #{spareField3},</if> + <if test="spareField4 != null">spare_field_4 = #{spareField4},</if> + </trim> + where id = #{id} + </update> + + <delete id="deleteEmEquipmentTypeById" parameterType="Long"> + delete from em_equipment_type where id = #{id} + </delete> + + <delete id="deleteEmEquipmentTypeByIds" parameterType="String"> + delete from em_equipment_type where id in + <foreach item="id" collection="array" open="(" separator="," close=")"> + #{id} + </foreach> + </delete> +</mapper> \ No newline at end of file diff --git a/jcdm-ui/src/api/main/em/equipmentType/equipmentType.js b/jcdm-ui/src/api/main/em/equipmentType/equipmentType.js new file mode 100644 index 0000000..fca880d --- /dev/null +++ b/jcdm-ui/src/api/main/em/equipmentType/equipmentType.js @@ -0,0 +1,44 @@ +import request from '@/utils/request' + +// 鏌ヨ璁惧绫诲瀷鍒楄〃 +export function listEquipmentType(query) { + return request({ + url: '/em/equipmentType/list', + method: 'get', + params: query + }) +} + +// 鏌ヨ璁惧绫诲瀷璇︾粏 +export function getEquipmentType(id) { + return request({ + url: '/em/equipmentType/' + id, + method: 'get' + }) +} + +// 鏂板璁惧绫诲瀷 +export function addEquipmentType(data) { + return request({ + url: '/em/equipmentType', + method: 'post', + data: data + }) +} + +// 淇敼璁惧绫诲瀷 +export function updateEquipmentType(data) { + return request({ + url: '/em/equipmentType', + method: 'put', + data: data + }) +} + +// 鍒犻櫎璁惧绫诲瀷 +export function delEquipmentType(id) { + return request({ + url: '/em/equipmentType/' + id, + method: 'delete' + }) +} diff --git a/jcdm-ui/src/views/main/em/equipmentType/index.vue b/jcdm-ui/src/views/main/em/equipmentType/index.vue new file mode 100644 index 0000000..d17536f --- /dev/null +++ b/jcdm-ui/src/views/main/em/equipmentType/index.vue @@ -0,0 +1,323 @@ +<template> + <div class="app-container"> + <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px"> + <el-form-item label="璁惧绫诲瀷缂栫爜" prop="equipmentTypeCode"> + <el-input + v-model="queryParams.equipmentTypeCode" + placeholder="璇疯緭鍏ヨ澶囩被鍨嬬紪鐮�" + clearable + @keyup.enter.native="handleQuery" + /> + </el-form-item> + <el-form-item label="璁惧绫诲瀷鍚嶇О" prop="equipmentTypeName"> + <el-input + v-model="queryParams.equipmentTypeName" + placeholder="璇疯緭鍏ヨ澶囩被鍨嬪悕绉�" + clearable + @keyup.enter.native="handleQuery" + /> + </el-form-item> + <el-form-item> + <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-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="['em:equipmentType:add']" + >鏂板</el-button> + </el-col> + <el-col :span="1.5"> + <el-button + type="info" + plain + icon="el-icon-sort" + size="mini" + @click="toggleExpandAll" + >灞曞紑/鎶樺彔</el-button> + </el-col> + <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> + </el-row> + + <el-table + v-if="refreshTable" + v-loading="loading" + :data="equipmentTypeList" + row-key="id" + :default-expand-all="isExpandAll" + :tree-props="{children: 'children', hasChildren: 'hasChildren'}" + > + <el-table-column label="璁惧绫诲瀷缂栫爜" align="center" prop="equipmentTypeCode"> + </el-table-column> + <el-table-column label="璁惧绫诲瀷鍚嶇О" align="center" prop="equipmentTypeName"> + </el-table-column> + <el-table-column label="鐖剁被鍨婭D" align="center" prop="parentTypeId"> + </el-table-column> + <el-table-column label="鎵�鏈夌埗鑺傜偣ID" align="center" prop="ancestors"> + </el-table-column> + <el-table-column label="鏄惁鍚敤" align="center" prop="status"> + </el-table-column> + <el-table-column label="澶囨敞" align="center" prop="remark"> + </el-table-column> + <el-table-column label="鍒涘缓浜�" align="center" prop="createUser"> + </el-table-column> + <el-table-column label="鍒涘缓鏃堕棿" align="center" prop="createTime"> + </el-table-column> + <el-table-column label="鏇存柊浜�" align="center" prop="updateUser"> + </el-table-column> + <el-table-column label="鏇存柊鏃堕棿" align="center" prop="updateTime"> + </el-table-column> + <el-table-column label="鎿嶄綔" align="center" class-name="small-padding fixed-width"> + <template slot-scope="scope"> + <el-button + size="mini" + type="text" + icon="el-icon-edit" + @click="handleUpdate(scope.row)" + v-hasPermi="['em:equipmentType:edit']" + >淇敼</el-button> + <el-button + size="mini" + type="text" + icon="el-icon-plus" + @click="handleAdd(scope.row)" + v-hasPermi="['em:equipmentType:add']" + >鏂板</el-button> + <el-button + size="mini" + type="text" + icon="el-icon-delete" + @click="handleDelete(scope.row)" + v-hasPermi="['em:equipmentType:remove']" + >鍒犻櫎</el-button> + </template> + </el-table-column> + </el-table> + + <!-- 娣诲姞鎴栦慨鏀硅澶囩被鍨嬪璇濇 --> + <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body> + <el-form ref="form" :model="form" :rules="rules" label-width="80px"> + <el-form-item label="璁惧绫诲瀷缂栫爜" prop="equipmentTypeCode"> + <el-input v-model="form.equipmentTypeCode" placeholder="璇疯緭鍏ヨ澶囩被鍨嬬紪鐮�" /> + </el-form-item> + <el-form-item label="璁惧绫诲瀷鍚嶇О" prop="equipmentTypeName"> + <el-input v-model="form.equipmentTypeName" placeholder="璇疯緭鍏ヨ澶囩被鍨嬪悕绉�" /> + </el-form-item> + <el-form-item label="鐖剁被鍨婭D" prop="parentTypeId"> + <treeselect v-model="form.parentTypeId" :options="equipmentTypeOptions" :normalizer="normalizer" placeholder="璇烽�夋嫨鐖剁被鍨婭D" /> + </el-form-item> +<!-- <el-form-item label="鏄惁鍚敤" prop="status">--> +<!-- <el-radio-group v-model="form.status">--> +<!-- <el-radio--> +<!-- v-for="dict in dict.type.${dictType}"--> +<!-- :key="dict.value"--> +<!-- :label="dict.value"--> +<!-- >{{dict.label}}</el-radio>--> +<!-- </el-radio-group>--> +<!-- </el-form-item>--> + <el-form-item label="澶囨敞" prop="remark"> + <el-input v-model="form.remark" 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 { listEquipmentType, getEquipmentType, delEquipmentType, addEquipmentType, updateEquipmentType } from "@/api/main/em/equipmentType/equipmentType"; +import Treeselect from "@riophae/vue-treeselect"; +import "@riophae/vue-treeselect/dist/vue-treeselect.css"; + +export default { + name: "EquipmentType", + components: { + Treeselect + }, + data() { + return { + // 閬僵灞� + loading: true, + // 鏄剧ず鎼滅储鏉′欢 + showSearch: true, + // 璁惧绫诲瀷琛ㄦ牸鏁版嵁 + equipmentTypeList: [], + // 璁惧绫诲瀷鏍戦�夐」 + equipmentTypeOptions: [], + // 寮瑰嚭灞傛爣棰� + title: "", + // 鏄惁鏄剧ず寮瑰嚭灞� + open: false, + // 鏄惁灞曞紑锛岄粯璁ゅ叏閮ㄥ睍寮� + isExpandAll: true, + // 閲嶆柊娓叉煋琛ㄦ牸鐘舵�� + refreshTable: true, + // 鏌ヨ鍙傛暟 + queryParams: { + equipmentTypeCode: null, + equipmentTypeName: null, + }, + // 琛ㄥ崟鍙傛暟 + form: {}, + // 琛ㄥ崟鏍¢獙 + rules: { + id: [ + { required: true, message: "ID涓嶈兘涓虹┖", trigger: "blur" } + ], + equipmentTypeCode: [ + { required: true, message: "璁惧绫诲瀷缂栫爜涓嶈兘涓虹┖", trigger: "blur" } + ], + equipmentTypeName: [ + { required: true, message: "璁惧绫诲瀷鍚嶇О涓嶈兘涓虹┖", trigger: "blur" } + ], + ancestors: [ + { required: true, message: "鎵�鏈夌埗鑺傜偣ID涓嶈兘涓虹┖", trigger: "blur" } + ], + status: [ + { required: true, message: "鏄惁鍚敤涓嶈兘涓虹┖", trigger: "change" } + ], + } + }; + }, + created() { + this.getList(); + }, + methods: { + /** 鏌ヨ璁惧绫诲瀷鍒楄〃 */ + getList() { + this.loading = true; + listEquipmentType(this.queryParams).then(response => { + this.equipmentTypeList = this.handleTree(response.data, "id", "parentTypeId"); + this.loading = false; + }); + }, + /** 杞崲璁惧绫诲瀷鏁版嵁缁撴瀯 */ + normalizer(node) { + if (node.children && !node.children.length) { + delete node.children; + } + return { + id: node.id, + label: node.equipmentTypeName, + children: node.children + }; + }, + /** 鏌ヨ璁惧绫诲瀷涓嬫媺鏍戠粨鏋� */ + getTreeselect() { + listEquipmentType().then(response => { + this.equipmentTypeOptions = []; + const data = { id: 0, equipmentTypeName: '椤剁骇鑺傜偣', children: [] }; + data.children = this.handleTree(response.data, "id", "parentTypeId"); + this.equipmentTypeOptions.push(data); + }); + }, + // 鍙栨秷鎸夐挳 + cancel() { + this.open = false; + this.reset(); + }, + // 琛ㄥ崟閲嶇疆 + reset() { + this.form = { + id: null, + equipmentTypeCode: null, + equipmentTypeName: null, + parentTypeId: null, + ancestors: null, + status: null, + remark: null, + createUser: null, + createTime: null, + updateUser: null, + updateTime: null, + spareField1: null, + spareField2: null, + spareField3: null, + spareField4: null + }; + this.resetForm("form"); + }, + /** 鎼滅储鎸夐挳鎿嶄綔 */ + handleQuery() { + this.getList(); + }, + /** 閲嶇疆鎸夐挳鎿嶄綔 */ + resetQuery() { + this.resetForm("queryForm"); + this.handleQuery(); + }, + /** 鏂板鎸夐挳鎿嶄綔 */ + handleAdd(row) { + this.reset(); + this.getTreeselect(); + if (row != null && row.id) { + this.form.parentTypeId = row.id; + } else { + this.form.parentTypeId = 0; + } + this.open = true; + this.title = "娣诲姞璁惧绫诲瀷"; + }, + /** 灞曞紑/鎶樺彔鎿嶄綔 */ + toggleExpandAll() { + this.refreshTable = false; + this.isExpandAll = !this.isExpandAll; + this.$nextTick(() => { + this.refreshTable = true; + }); + }, + /** 淇敼鎸夐挳鎿嶄綔 */ + handleUpdate(row) { + this.reset(); + this.getTreeselect(); + if (row != null) { + this.form.parentTypeId = row.parentTypeId; + } + getEquipmentType(row.id).then(response => { + this.form = response.data; + this.open = true; + this.title = "淇敼璁惧绫诲瀷"; + }); + }, + /** 鎻愪氦鎸夐挳 */ + submitForm() { + this.$refs["form"].validate(valid => { + if (valid) { + if (this.form.id != null) { + updateEquipmentType(this.form).then(response => { + this.$modal.msgSuccess("淇敼鎴愬姛"); + this.open = false; + this.getList(); + }); + } else { + addEquipmentType(this.form).then(response => { + this.$modal.msgSuccess("鏂板鎴愬姛"); + this.open = false; + this.getList(); + }); + } + } + }); + }, + /** 鍒犻櫎鎸夐挳鎿嶄綔 */ + handleDelete(row) { + this.$modal.confirm('鏄惁纭鍒犻櫎璁惧绫诲瀷缂栧彿涓�"' + row.id + '"鐨勬暟鎹」锛�').then(function() { + return delEquipmentType(row.id); + }).then(() => { + this.getList(); + this.$modal.msgSuccess("鍒犻櫎鎴愬姛"); + }).catch(() => {}); + } + } +}; +</script> -- Gitblit v1.9.3