风格类型管理端
parent
6506f893eb
commit
38c07f1fd5
|
@ -0,0 +1,104 @@
|
||||||
|
package com.zxf.web.controller.wheel;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
|
import com.zxf.common.utils.poi.ExcelUtil;
|
||||||
|
import com.zxf.system.domain.ZxfmnType;
|
||||||
|
import com.zxf.system.service.IZxfmnTypeService;
|
||||||
|
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.zxf.common.annotation.Log;
|
||||||
|
import com.zxf.common.core.controller.BaseController;
|
||||||
|
import com.zxf.common.core.domain.AjaxResult;
|
||||||
|
import com.zxf.common.enums.BusinessType;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* typeController
|
||||||
|
*
|
||||||
|
* @author zxf
|
||||||
|
* @date 2023-07-18
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/wheel/type")
|
||||||
|
public class ZxfmnTypeController extends BaseController
|
||||||
|
{
|
||||||
|
@Autowired
|
||||||
|
private IZxfmnTypeService zxfmnTypeService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询type列表
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('wheel:type:list')")
|
||||||
|
@GetMapping("/list")
|
||||||
|
public AjaxResult list(ZxfmnType zxfmnType)
|
||||||
|
{
|
||||||
|
List<ZxfmnType> list = zxfmnTypeService.selectZxfmnTypeList(zxfmnType);
|
||||||
|
return success(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出type列表
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('wheel:type:export')")
|
||||||
|
@Log(title = "type", businessType = BusinessType.EXPORT)
|
||||||
|
@PostMapping("/export")
|
||||||
|
public void export(HttpServletResponse response, ZxfmnType zxfmnType)
|
||||||
|
{
|
||||||
|
List<ZxfmnType> list = zxfmnTypeService.selectZxfmnTypeList(zxfmnType);
|
||||||
|
ExcelUtil<ZxfmnType> util = new ExcelUtil<ZxfmnType>(ZxfmnType.class);
|
||||||
|
util.exportExcel(response, list, "type数据");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取type详细信息
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('wheel:type:query')")
|
||||||
|
@GetMapping(value = "/{id}")
|
||||||
|
public AjaxResult getInfo(@PathVariable("id") Long id)
|
||||||
|
{
|
||||||
|
return success(zxfmnTypeService.selectZxfmnTypeById(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增type
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('wheel:type:add')")
|
||||||
|
@Log(title = "type", businessType = BusinessType.INSERT)
|
||||||
|
@PostMapping
|
||||||
|
public AjaxResult add(@RequestBody ZxfmnType zxfmnType)
|
||||||
|
{
|
||||||
|
return toAjax(zxfmnTypeService.insertZxfmnType(zxfmnType));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改type
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('wheel:type:edit')")
|
||||||
|
@Log(title = "type", businessType = BusinessType.UPDATE)
|
||||||
|
@PutMapping
|
||||||
|
public AjaxResult edit(@RequestBody ZxfmnType zxfmnType)
|
||||||
|
{
|
||||||
|
return toAjax(zxfmnTypeService.updateZxfmnType(zxfmnType));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除type
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('wheel:type:remove')")
|
||||||
|
@Log(title = "type", businessType = BusinessType.DELETE)
|
||||||
|
@DeleteMapping("/{ids}")
|
||||||
|
public AjaxResult remove(@PathVariable Long[] ids)
|
||||||
|
{
|
||||||
|
return toAjax(zxfmnTypeService.deleteZxfmnTypeByIds(ids));
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,135 @@
|
||||||
|
package com.zxf.system.domain;
|
||||||
|
|
||||||
|
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||||
|
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||||
|
import com.zxf.common.annotation.Excel;
|
||||||
|
import com.zxf.common.core.domain.TreeEntity;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* type对象 zxfmn_type
|
||||||
|
*
|
||||||
|
* @author zxf
|
||||||
|
* @date 2023-07-18
|
||||||
|
*/
|
||||||
|
public class ZxfmnType extends TreeEntity
|
||||||
|
{
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/** */
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/** 父id */
|
||||||
|
@Excel(name = "父id")
|
||||||
|
private Long pId;
|
||||||
|
|
||||||
|
/** 描述名称 */
|
||||||
|
@Excel(name = "描述名称")
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
/** 图片地址 */
|
||||||
|
@Excel(name = "图片地址")
|
||||||
|
private String imgUrl;
|
||||||
|
|
||||||
|
/** 是否一级 1 是 2 不是 */
|
||||||
|
@Excel(name = "是否一级 1 是 2 不是")
|
||||||
|
private String isP;
|
||||||
|
|
||||||
|
/** 是否展示 1 展示 2 不展示 */
|
||||||
|
@Excel(name = "是否展示 1 展示 2 不展示")
|
||||||
|
private String isFlag;
|
||||||
|
|
||||||
|
/** 扩展 */
|
||||||
|
@Excel(name = "扩展")
|
||||||
|
private String extend;
|
||||||
|
|
||||||
|
/** 二级富文本信息 */
|
||||||
|
@Excel(name = "二级富文本信息")
|
||||||
|
private String richText;
|
||||||
|
|
||||||
|
public void setId(Long id)
|
||||||
|
{
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getId()
|
||||||
|
{
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
public void setpId(Long pId)
|
||||||
|
{
|
||||||
|
this.pId = pId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getpId()
|
||||||
|
{
|
||||||
|
return pId;
|
||||||
|
}
|
||||||
|
public void setName(String name)
|
||||||
|
{
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName()
|
||||||
|
{
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
public void setImgUrl(String imgUrl)
|
||||||
|
{
|
||||||
|
this.imgUrl = imgUrl;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getImgUrl()
|
||||||
|
{
|
||||||
|
return imgUrl;
|
||||||
|
}
|
||||||
|
public void setIsP(String isP)
|
||||||
|
{
|
||||||
|
this.isP = isP;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getIsP()
|
||||||
|
{
|
||||||
|
return isP;
|
||||||
|
}
|
||||||
|
public void setIsFlag(String isFlag)
|
||||||
|
{
|
||||||
|
this.isFlag = isFlag;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getIsFlag()
|
||||||
|
{
|
||||||
|
return isFlag;
|
||||||
|
}
|
||||||
|
public void setExtend(String extend)
|
||||||
|
{
|
||||||
|
this.extend = extend;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getExtend()
|
||||||
|
{
|
||||||
|
return extend;
|
||||||
|
}
|
||||||
|
public void setRichText(String richText)
|
||||||
|
{
|
||||||
|
this.richText = richText;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getRichText()
|
||||||
|
{
|
||||||
|
return richText;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||||
|
.append("id", getId())
|
||||||
|
.append("pId", getpId())
|
||||||
|
.append("name", getName())
|
||||||
|
.append("imgUrl", getImgUrl())
|
||||||
|
.append("isP", getIsP())
|
||||||
|
.append("isFlag", getIsFlag())
|
||||||
|
.append("extend", getExtend())
|
||||||
|
.append("richText", getRichText())
|
||||||
|
.toString();
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,62 @@
|
||||||
|
package com.zxf.system.mapper;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.zxf.system.domain.ZxfmnType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* typeMapper接口
|
||||||
|
*
|
||||||
|
* @author zxf
|
||||||
|
* @date 2023-07-18
|
||||||
|
*/
|
||||||
|
public interface ZxfmnTypeMapper
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 查询type
|
||||||
|
*
|
||||||
|
* @param id type主键
|
||||||
|
* @return type
|
||||||
|
*/
|
||||||
|
public ZxfmnType selectZxfmnTypeById(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询type列表
|
||||||
|
*
|
||||||
|
* @param zxfmnType type
|
||||||
|
* @return type集合
|
||||||
|
*/
|
||||||
|
public List<ZxfmnType> selectZxfmnTypeList(ZxfmnType zxfmnType);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增type
|
||||||
|
*
|
||||||
|
* @param zxfmnType type
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int insertZxfmnType(ZxfmnType zxfmnType);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改type
|
||||||
|
*
|
||||||
|
* @param zxfmnType type
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int updateZxfmnType(ZxfmnType zxfmnType);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除type
|
||||||
|
*
|
||||||
|
* @param id type主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deleteZxfmnTypeById(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除type
|
||||||
|
*
|
||||||
|
* @param ids 需要删除的数据主键集合
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deleteZxfmnTypeByIds(Long[] ids);
|
||||||
|
}
|
|
@ -0,0 +1,62 @@
|
||||||
|
package com.zxf.system.service;
|
||||||
|
|
||||||
|
import com.zxf.system.domain.ZxfmnType;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* typeService接口
|
||||||
|
*
|
||||||
|
* @author zxf
|
||||||
|
* @date 2023-07-18
|
||||||
|
*/
|
||||||
|
public interface IZxfmnTypeService
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 查询type
|
||||||
|
*
|
||||||
|
* @param id type主键
|
||||||
|
* @return type
|
||||||
|
*/
|
||||||
|
public ZxfmnType selectZxfmnTypeById(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询type列表
|
||||||
|
*
|
||||||
|
* @param zxfmnType type
|
||||||
|
* @return type集合
|
||||||
|
*/
|
||||||
|
public List<ZxfmnType> selectZxfmnTypeList(ZxfmnType zxfmnType);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增type
|
||||||
|
*
|
||||||
|
* @param zxfmnType type
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int insertZxfmnType(ZxfmnType zxfmnType);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改type
|
||||||
|
*
|
||||||
|
* @param zxfmnType type
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int updateZxfmnType(ZxfmnType zxfmnType);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除type
|
||||||
|
*
|
||||||
|
* @param ids 需要删除的type主键集合
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deleteZxfmnTypeByIds(Long[] ids);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除type信息
|
||||||
|
*
|
||||||
|
* @param id type主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deleteZxfmnTypeById(Long id);
|
||||||
|
}
|
|
@ -0,0 +1,95 @@
|
||||||
|
package com.zxf.system.service.impl;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.zxf.system.domain.ZxfmnType;
|
||||||
|
import com.zxf.system.mapper.ZxfmnTypeMapper;
|
||||||
|
import com.zxf.system.service.IZxfmnTypeService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* typeService业务层处理
|
||||||
|
*
|
||||||
|
* @author zxf
|
||||||
|
* @date 2023-07-18
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class ZxfmnTypeServiceImpl implements IZxfmnTypeService
|
||||||
|
{
|
||||||
|
@Autowired
|
||||||
|
private ZxfmnTypeMapper zxfmnTypeMapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询type
|
||||||
|
*
|
||||||
|
* @param id type主键
|
||||||
|
* @return type
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public ZxfmnType selectZxfmnTypeById(Long id)
|
||||||
|
{
|
||||||
|
return zxfmnTypeMapper.selectZxfmnTypeById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询type列表
|
||||||
|
*
|
||||||
|
* @param zxfmnType type
|
||||||
|
* @return type
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<ZxfmnType> selectZxfmnTypeList(ZxfmnType zxfmnType)
|
||||||
|
{
|
||||||
|
return zxfmnTypeMapper.selectZxfmnTypeList(zxfmnType);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增type
|
||||||
|
*
|
||||||
|
* @param zxfmnType type
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int insertZxfmnType(ZxfmnType zxfmnType)
|
||||||
|
{
|
||||||
|
return zxfmnTypeMapper.insertZxfmnType(zxfmnType);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改type
|
||||||
|
*
|
||||||
|
* @param zxfmnType type
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int updateZxfmnType(ZxfmnType zxfmnType)
|
||||||
|
{
|
||||||
|
return zxfmnTypeMapper.updateZxfmnType(zxfmnType);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除type
|
||||||
|
*
|
||||||
|
* @param ids 需要删除的type主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int deleteZxfmnTypeByIds(Long[] ids)
|
||||||
|
{
|
||||||
|
return zxfmnTypeMapper.deleteZxfmnTypeByIds(ids);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除type信息
|
||||||
|
*
|
||||||
|
* @param id type主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int deleteZxfmnTypeById(Long id)
|
||||||
|
{
|
||||||
|
return zxfmnTypeMapper.deleteZxfmnTypeById(id);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,86 @@
|
||||||
|
<?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.zxf.system.mapper.ZxfmnTypeMapper">
|
||||||
|
|
||||||
|
<resultMap type="ZxfmnType" id="ZxfmnTypeResult">
|
||||||
|
<result property="id" column="id" />
|
||||||
|
<result property="pId" column="p_id" />
|
||||||
|
<result property="name" column="name" />
|
||||||
|
<result property="imgUrl" column="img_url" />
|
||||||
|
<result property="isP" column="is_p" />
|
||||||
|
<result property="isFlag" column="is_flag" />
|
||||||
|
<result property="extend" column="extend" />
|
||||||
|
<result property="richText" column="rich_text" />
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<sql id="selectZxfmnTypeVo">
|
||||||
|
select id, p_id, name, img_url, is_p, is_flag, extend, rich_text from zxfmn_type
|
||||||
|
</sql>
|
||||||
|
|
||||||
|
<select id="selectZxfmnTypeList" parameterType="ZxfmnType" resultMap="ZxfmnTypeResult">
|
||||||
|
<include refid="selectZxfmnTypeVo"/>
|
||||||
|
<where>
|
||||||
|
<if test="pId != null "> and p_id = #{pId}</if>
|
||||||
|
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
|
||||||
|
<if test="imgUrl != null and imgUrl != ''"> and img_url = #{imgUrl}</if>
|
||||||
|
<if test="isP != null and isP != ''"> and is_p = #{isP}</if>
|
||||||
|
<if test="isFlag != null and isFlag != ''"> and is_flag = #{isFlag}</if>
|
||||||
|
<if test="extend != null and extend != ''"> and extend = #{extend}</if>
|
||||||
|
<if test="richText != null and richText != ''"> and rich_text = #{richText}</if>
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectZxfmnTypeById" parameterType="Long" resultMap="ZxfmnTypeResult">
|
||||||
|
<include refid="selectZxfmnTypeVo"/>
|
||||||
|
where id = #{id}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<insert id="insertZxfmnType" parameterType="ZxfmnType" useGeneratedKeys="true" keyProperty="id">
|
||||||
|
insert into zxfmn_type
|
||||||
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="pId != null">p_id,</if>
|
||||||
|
<if test="name != null">name,</if>
|
||||||
|
<if test="imgUrl != null">img_url,</if>
|
||||||
|
<if test="isP != null">is_p,</if>
|
||||||
|
<if test="isFlag != null">is_flag,</if>
|
||||||
|
<if test="extend != null">extend,</if>
|
||||||
|
<if test="richText != null">rich_text,</if>
|
||||||
|
</trim>
|
||||||
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="pId != null">#{pId},</if>
|
||||||
|
<if test="name != null">#{name},</if>
|
||||||
|
<if test="imgUrl != null">#{imgUrl},</if>
|
||||||
|
<if test="isP != null">#{isP},</if>
|
||||||
|
<if test="isFlag != null">#{isFlag},</if>
|
||||||
|
<if test="extend != null">#{extend},</if>
|
||||||
|
<if test="richText != null">#{richText},</if>
|
||||||
|
</trim>
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<update id="updateZxfmnType" parameterType="ZxfmnType">
|
||||||
|
update zxfmn_type
|
||||||
|
<trim prefix="SET" suffixOverrides=",">
|
||||||
|
<if test="pId != null">p_id = #{pId},</if>
|
||||||
|
<if test="name != null">name = #{name},</if>
|
||||||
|
<if test="imgUrl != null">img_url = #{imgUrl},</if>
|
||||||
|
<if test="isP != null">is_p = #{isP},</if>
|
||||||
|
<if test="isFlag != null">is_flag = #{isFlag},</if>
|
||||||
|
<if test="extend != null">extend = #{extend},</if>
|
||||||
|
<if test="richText != null">rich_text = #{richText},</if>
|
||||||
|
</trim>
|
||||||
|
where id = #{id}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<delete id="deleteZxfmnTypeById" parameterType="Long">
|
||||||
|
delete from zxfmn_type where id = #{id}
|
||||||
|
</delete>
|
||||||
|
|
||||||
|
<delete id="deleteZxfmnTypeByIds" parameterType="String">
|
||||||
|
delete from zxfmn_type where id in
|
||||||
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||||
|
#{id}
|
||||||
|
</foreach>
|
||||||
|
</delete>
|
||||||
|
</mapper>
|
|
@ -0,0 +1,44 @@
|
||||||
|
import request from '@/utils/request'
|
||||||
|
|
||||||
|
// 查询type列表
|
||||||
|
export function listType(query) {
|
||||||
|
return request({
|
||||||
|
url: '/wheel/type/list',
|
||||||
|
method: 'get',
|
||||||
|
params: query
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 查询type详细
|
||||||
|
export function getType(id) {
|
||||||
|
return request({
|
||||||
|
url: '/wheel/type/' + id,
|
||||||
|
method: 'get'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 新增type
|
||||||
|
export function addType(data) {
|
||||||
|
return request({
|
||||||
|
url: '/wheel/type',
|
||||||
|
method: 'post',
|
||||||
|
data: data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 修改type
|
||||||
|
export function updateType(data) {
|
||||||
|
return request({
|
||||||
|
url: '/wheel/type',
|
||||||
|
method: 'put',
|
||||||
|
data: data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 删除type
|
||||||
|
export function delType(id) {
|
||||||
|
return request({
|
||||||
|
url: '/wheel/type/' + id,
|
||||||
|
method: 'delete'
|
||||||
|
})
|
||||||
|
}
|
|
@ -0,0 +1,335 @@
|
||||||
|
<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="父id" prop="pId">
|
||||||
|
<el-input
|
||||||
|
v-model="queryParams.pId"
|
||||||
|
placeholder="请输入父id"
|
||||||
|
clearable
|
||||||
|
@keyup.enter.native="handleQuery"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="描述名称" prop="name">
|
||||||
|
<el-input
|
||||||
|
v-model="queryParams.name"
|
||||||
|
placeholder="请输入描述名称"
|
||||||
|
clearable
|
||||||
|
@keyup.enter.native="handleQuery"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="是否一级 1 是 2 不是" prop="isP">
|
||||||
|
<el-input
|
||||||
|
v-model="queryParams.isP"
|
||||||
|
placeholder="请输入是否一级 1 是 2 不是"
|
||||||
|
clearable
|
||||||
|
@keyup.enter.native="handleQuery"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="是否展示 1 展示 2 不展示" prop="isFlag">
|
||||||
|
<el-select v-model="queryParams.isFlag" placeholder="请选择是否展示 1 展示 2 不展示" clearable>
|
||||||
|
<el-option
|
||||||
|
v-for="dict in dict.type.is_flag_state"
|
||||||
|
:key="dict.value"
|
||||||
|
:label="dict.label"
|
||||||
|
:value="dict.value"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="扩展" prop="extend">
|
||||||
|
<el-input
|
||||||
|
v-model="queryParams.extend"
|
||||||
|
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="['wheel:type: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="typeList"
|
||||||
|
row-key="id"
|
||||||
|
:default-expand-all="isExpandAll"
|
||||||
|
:tree-props="{children: 'children', hasChildren: 'hasChildren'}"
|
||||||
|
>
|
||||||
|
<el-table-column label="父id" prop="pId" />
|
||||||
|
<el-table-column label="描述名称" align="center" prop="name" />
|
||||||
|
<el-table-column label="图片地址" align="center" prop="imgUrl" width="100">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<image-preview :src="scope.row.imgUrl" :width="50" :height="50"/>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="是否一级 1 是 2 不是" align="center" prop="isP" />
|
||||||
|
<el-table-column label="是否展示 1 展示 2 不展示" align="center" prop="isFlag">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<dict-tag :options="dict.type.is_flag_state" :value="scope.row.isFlag"/>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="扩展" align="center" prop="extend" />
|
||||||
|
<el-table-column label="二级富文本信息" align="center" prop="richText" />
|
||||||
|
<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="['wheel:type:edit']"
|
||||||
|
>修改</el-button>
|
||||||
|
<el-button
|
||||||
|
size="mini"
|
||||||
|
type="text"
|
||||||
|
icon="el-icon-plus"
|
||||||
|
@click="handleAdd(scope.row)"
|
||||||
|
v-hasPermi="['wheel:type:add']"
|
||||||
|
>新增</el-button>
|
||||||
|
<el-button
|
||||||
|
size="mini"
|
||||||
|
type="text"
|
||||||
|
icon="el-icon-delete"
|
||||||
|
@click="handleDelete(scope.row)"
|
||||||
|
v-hasPermi="['wheel:type:remove']"
|
||||||
|
>删除</el-button>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
|
||||||
|
<!-- 添加或修改type对话框 -->
|
||||||
|
<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="父id" prop="pId">
|
||||||
|
<treeselect v-model="form.pId" :options="typeOptions" :normalizer="normalizer" placeholder="请选择父id" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="描述名称" prop="name">
|
||||||
|
<el-input v-model="form.name" placeholder="请输入描述名称" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="图片地址" prop="imgUrl">
|
||||||
|
<image-upload v-model="form.imgUrl"/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="是否一级 1 是 2 不是" prop="isP">
|
||||||
|
<el-input v-model="form.isP" placeholder="请输入是否一级 1 是 2 不是" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="是否展示 1 展示 2 不展示" prop="isFlag">
|
||||||
|
<el-select v-model="form.isFlag" placeholder="请选择是否展示 1 展示 2 不展示">
|
||||||
|
<el-option
|
||||||
|
v-for="dict in dict.type.is_flag_state"
|
||||||
|
:key="dict.value"
|
||||||
|
:label="dict.label"
|
||||||
|
:value="dict.value"
|
||||||
|
></el-option>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="扩展" prop="extend">
|
||||||
|
<el-input v-model="form.extend" placeholder="请输入扩展" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="二级富文本信息">
|
||||||
|
<editor v-model="form.richText" :min-height="192"/>
|
||||||
|
</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 { listType, getType, delType, addType, updateType } from "@/api/wheel/type";
|
||||||
|
import Treeselect from "@riophae/vue-treeselect";
|
||||||
|
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: "Type",
|
||||||
|
dicts: ['is_flag_state'],
|
||||||
|
components: {
|
||||||
|
Treeselect
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
// 遮罩层
|
||||||
|
loading: true,
|
||||||
|
// 显示搜索条件
|
||||||
|
showSearch: true,
|
||||||
|
// type表格数据
|
||||||
|
typeList: [],
|
||||||
|
// type树选项
|
||||||
|
typeOptions: [],
|
||||||
|
// 弹出层标题
|
||||||
|
title: "",
|
||||||
|
// 是否显示弹出层
|
||||||
|
open: false,
|
||||||
|
// 是否展开,默认全部展开
|
||||||
|
isExpandAll: true,
|
||||||
|
// 重新渲染表格状态
|
||||||
|
refreshTable: true,
|
||||||
|
// 查询参数
|
||||||
|
queryParams: {
|
||||||
|
pId: null,
|
||||||
|
name: null,
|
||||||
|
imgUrl: null,
|
||||||
|
isP: null,
|
||||||
|
isFlag: null,
|
||||||
|
extend: null,
|
||||||
|
richText: null
|
||||||
|
},
|
||||||
|
// 表单参数
|
||||||
|
form: {},
|
||||||
|
// 表单校验
|
||||||
|
rules: {
|
||||||
|
}
|
||||||
|
};
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
this.getList();
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
/** 查询type列表 */
|
||||||
|
getList() {
|
||||||
|
this.loading = true;
|
||||||
|
listType(this.queryParams).then(response => {
|
||||||
|
this.typeList = this.handleTree(response.data, "id", "pId");
|
||||||
|
this.loading = false;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
/** 转换type数据结构 */
|
||||||
|
normalizer(node) {
|
||||||
|
if (node.children && !node.children.length) {
|
||||||
|
delete node.children;
|
||||||
|
}
|
||||||
|
return {
|
||||||
|
id: node.id,
|
||||||
|
label: node.name,
|
||||||
|
children: node.children
|
||||||
|
};
|
||||||
|
},
|
||||||
|
/** 查询type下拉树结构 */
|
||||||
|
getTreeselect() {
|
||||||
|
listType().then(response => {
|
||||||
|
this.typeOptions = [];
|
||||||
|
const data = { id: 0, name: '顶级节点', children: [] };
|
||||||
|
data.children = this.handleTree(response.data, "id", "pId");
|
||||||
|
this.typeOptions.push(data);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
// 取消按钮
|
||||||
|
cancel() {
|
||||||
|
this.open = false;
|
||||||
|
this.reset();
|
||||||
|
},
|
||||||
|
// 表单重置
|
||||||
|
reset() {
|
||||||
|
this.form = {
|
||||||
|
id: null,
|
||||||
|
pId: null,
|
||||||
|
name: null,
|
||||||
|
imgUrl: null,
|
||||||
|
isP: null,
|
||||||
|
isFlag: null,
|
||||||
|
extend: null,
|
||||||
|
richText: 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.pId = row.id;
|
||||||
|
} else {
|
||||||
|
this.form.pId = 0;
|
||||||
|
}
|
||||||
|
this.open = true;
|
||||||
|
this.title = "添加type";
|
||||||
|
},
|
||||||
|
/** 展开/折叠操作 */
|
||||||
|
toggleExpandAll() {
|
||||||
|
this.refreshTable = false;
|
||||||
|
this.isExpandAll = !this.isExpandAll;
|
||||||
|
this.$nextTick(() => {
|
||||||
|
this.refreshTable = true;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
/** 修改按钮操作 */
|
||||||
|
handleUpdate(row) {
|
||||||
|
this.reset();
|
||||||
|
this.getTreeselect();
|
||||||
|
if (row != null) {
|
||||||
|
this.form.pId = row.id;
|
||||||
|
}
|
||||||
|
getType(row.id).then(response => {
|
||||||
|
this.form = response.data;
|
||||||
|
this.open = true;
|
||||||
|
this.title = "修改type";
|
||||||
|
});
|
||||||
|
},
|
||||||
|
/** 提交按钮 */
|
||||||
|
submitForm() {
|
||||||
|
this.$refs["form"].validate(valid => {
|
||||||
|
if (valid) {
|
||||||
|
if (this.form.id != null) {
|
||||||
|
updateType(this.form).then(response => {
|
||||||
|
this.$modal.msgSuccess("修改成功");
|
||||||
|
this.open = false;
|
||||||
|
this.getList();
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
addType(this.form).then(response => {
|
||||||
|
this.$modal.msgSuccess("新增成功");
|
||||||
|
this.open = false;
|
||||||
|
this.getList();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
/** 删除按钮操作 */
|
||||||
|
handleDelete(row) {
|
||||||
|
this.$modal.confirm('是否确认删除type编号为"' + row.id + '"的数据项?').then(function() {
|
||||||
|
return delType(row.id);
|
||||||
|
}).then(() => {
|
||||||
|
this.getList();
|
||||||
|
this.$modal.msgSuccess("删除成功");
|
||||||
|
}).catch(() => {});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
</script>
|
Loading…
Reference in New Issue