mirror of
https://gitee.com/dromara/RuoYi-Vue-Plus.git
synced 2026-09-20 02:08:15 +08:00
图片筛选业务基本完成
This commit is contained in:
parent
78a0d8429a
commit
e937894891
@ -0,0 +1,48 @@
|
||||
package com.ruoyi.common.utils;
|
||||
|
||||
import cn.hutool.core.util.RandomUtil;
|
||||
import cn.hutool.http.HttpUtil;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Slf4j
|
||||
public class HttpRequestUtils {
|
||||
public static List<Object[]> testHutoolGet(String url, String param) {
|
||||
String getResult = HttpUtil
|
||||
.createGet(url + param)
|
||||
.execute()
|
||||
.charset("utf-8")
|
||||
.body();
|
||||
|
||||
JSONObject jsonObject = JSONObject.parseObject(getResult);
|
||||
JSONObject data = jsonObject.getJSONObject("data");
|
||||
JSONArray avp = data.getJSONArray("avp");
|
||||
log.info("data" + data);
|
||||
log.info("jsonarr" + avp);
|
||||
List<Object[]> list = new ArrayList<>();
|
||||
for (int i = 0; i < avp.size(); i++) {
|
||||
JSONArray subArr = avp.getJSONArray(i);
|
||||
list.add(subArr.toArray());
|
||||
}
|
||||
//Object[] array = avp.stream().toArray();
|
||||
//List<Object> list = avp.stream().collect(Collectors.toList());
|
||||
return list;
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
||||
List<Object[]> list = testHutoolGet("https://api.ownthink.com/kg/knowledge?entity=", "周杰伦");
|
||||
for (Object[] objects : list) {
|
||||
for (Object object : objects) {
|
||||
System.out.println(object);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,111 @@
|
||||
package com.ruoyi.demo.controller;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Arrays;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import javax.validation.constraints.*;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import com.ruoyi.common.annotation.RepeatSubmit;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.core.validate.AddGroup;
|
||||
import com.ruoyi.common.core.validate.EditGroup;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.demo.domain.vo.HjcSelectionVo;
|
||||
import com.ruoyi.demo.domain.bo.HjcSelectionBo;
|
||||
import com.ruoyi.demo.service.IHjcSelectionService;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
|
||||
/**
|
||||
* 图片选择参数Controller
|
||||
*
|
||||
* @author qianlan
|
||||
* @date 2021-10-12
|
||||
*/
|
||||
@Validated
|
||||
@Api(value = "图片选择参数控制器", tags = {"图片选择参数管理"})
|
||||
@RequiredArgsConstructor(onConstructor_ = @Autowired)
|
||||
@RestController
|
||||
@RequestMapping("/demo/selection")
|
||||
public class HjcSelectionController extends BaseController {
|
||||
|
||||
private final IHjcSelectionService iHjcSelectionService;
|
||||
|
||||
/**
|
||||
* 查询图片选择参数列表
|
||||
*/
|
||||
@ApiOperation("查询图片选择参数列表")
|
||||
@PreAuthorize("@ss.hasPermi('demo:selection:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo<HjcSelectionVo> list(@Validated HjcSelectionBo bo) {
|
||||
return iHjcSelectionService.queryPageList(bo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出图片选择参数列表
|
||||
*/
|
||||
@ApiOperation("导出图片选择参数列表")
|
||||
@PreAuthorize("@ss.hasPermi('demo:selection:export')")
|
||||
@Log(title = "图片选择参数", businessType = BusinessType.EXPORT)
|
||||
@GetMapping("/export")
|
||||
public AjaxResult<HjcSelectionVo> export(@Validated HjcSelectionBo bo) {
|
||||
List<HjcSelectionVo> list = iHjcSelectionService.queryList(bo);
|
||||
ExcelUtil<HjcSelectionVo> util = new ExcelUtil<HjcSelectionVo>(HjcSelectionVo.class);
|
||||
return util.exportExcel(list, "图片选择参数");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取图片选择参数详细信息
|
||||
*/
|
||||
@ApiOperation("获取图片选择参数详细信息")
|
||||
@PreAuthorize("@ss.hasPermi('demo:selection:query')")
|
||||
@GetMapping("/{sid}")
|
||||
public AjaxResult<HjcSelectionVo> getInfo(@NotNull(message = "主键不能为空")
|
||||
@PathVariable("sid") Long sid) {
|
||||
return AjaxResult.success(iHjcSelectionService.queryById(sid));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增图片选择参数
|
||||
*/
|
||||
@ApiOperation("新增图片选择参数")
|
||||
@PreAuthorize("@ss.hasPermi('demo:selection:add')")
|
||||
@Log(title = "图片选择参数", businessType = BusinessType.INSERT)
|
||||
@RepeatSubmit
|
||||
@PostMapping()
|
||||
public AjaxResult<Void> add(@Validated(AddGroup.class) @RequestBody HjcSelectionBo bo) {
|
||||
return toAjax(iHjcSelectionService.insertByBo(bo) ? 1 : 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改图片选择参数
|
||||
*/
|
||||
@ApiOperation("修改图片选择参数")
|
||||
@PreAuthorize("@ss.hasPermi('demo:selection:edit')")
|
||||
@Log(title = "图片选择参数", businessType = BusinessType.UPDATE)
|
||||
@RepeatSubmit
|
||||
@PutMapping()
|
||||
public AjaxResult<Void> edit(@Validated(EditGroup.class) @RequestBody HjcSelectionBo bo) {
|
||||
return toAjax(iHjcSelectionService.updateByBo(bo) ? 1 : 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除图片选择参数
|
||||
*/
|
||||
@ApiOperation("删除图片选择参数")
|
||||
@PreAuthorize("@ss.hasPermi('demo:selection:remove')")
|
||||
@Log(title = "图片选择参数" , businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{sids}")
|
||||
public AjaxResult<Void> remove(@NotEmpty(message = "主键不能为空")
|
||||
@PathVariable Long[] sids) {
|
||||
return toAjax(iHjcSelectionService.deleteWithValidByIds(Arrays.asList(sids), true) ? 1 : 0);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,132 @@
|
||||
package com.ruoyi.demo.controller;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Arrays;
|
||||
|
||||
import com.ruoyi.demo.domain.vo.PictureListVo;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import javax.validation.constraints.*;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import com.ruoyi.common.annotation.RepeatSubmit;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.core.validate.AddGroup;
|
||||
import com.ruoyi.common.core.validate.EditGroup;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.demo.domain.vo.PictureDisplayVo;
|
||||
import com.ruoyi.demo.domain.bo.PictureDisplayBo;
|
||||
import com.ruoyi.demo.service.IPictureDisplayService;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
|
||||
/**
|
||||
* 图片展示Controller
|
||||
*
|
||||
* @author qianlan
|
||||
* @date 2021-10-10
|
||||
*/
|
||||
@Validated
|
||||
@Api(value = "图片展示控制器", tags = {"图片展示管理"})
|
||||
@RequiredArgsConstructor(onConstructor_ = @Autowired)
|
||||
@RestController
|
||||
@RequestMapping("/demo/picture")
|
||||
public class PictureDisplayController extends BaseController {
|
||||
|
||||
private final IPictureDisplayService iPictureDisplayService;
|
||||
|
||||
/**
|
||||
* 查询没有被选中的图片,一次显示十条
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation("查询没有被选中的图片,一次显示十条")
|
||||
@GetMapping("/picList")
|
||||
public List<PictureListVo> pictureList(){
|
||||
return iPictureDisplayService.queryListWithCondition();
|
||||
}
|
||||
|
||||
/**
|
||||
* 提交要修改的图片选项
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation("提交要修改的图片选项")
|
||||
@PostMapping("/commitPic")
|
||||
public AjaxResult commitPic(@RequestBody List<PictureDisplayVo> lists){
|
||||
return iPictureDisplayService.commitPic(lists);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询图片展示列表
|
||||
*/
|
||||
@ApiOperation("查询图片展示列表")
|
||||
@PreAuthorize("@ss.hasPermi('demo:picture:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo<PictureDisplayVo> list(@Validated PictureDisplayBo bo) {
|
||||
return iPictureDisplayService.queryPageList(bo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出图片展示列表
|
||||
*/
|
||||
@ApiOperation("导出图片展示列表")
|
||||
@PreAuthorize("@ss.hasPermi('demo:picture:export')")
|
||||
@Log(title = "图片展示", businessType = BusinessType.EXPORT)
|
||||
@GetMapping("/export")
|
||||
public AjaxResult<PictureDisplayVo> export(@Validated PictureDisplayBo bo) {
|
||||
List<PictureDisplayVo> list = iPictureDisplayService.queryList(bo);
|
||||
ExcelUtil<PictureDisplayVo> util = new ExcelUtil<PictureDisplayVo>(PictureDisplayVo.class);
|
||||
return util.exportExcel(list, "图片展示");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取图片展示详细信息
|
||||
*/
|
||||
@ApiOperation("获取图片展示详细信息")
|
||||
@PreAuthorize("@ss.hasPermi('demo:picture:query')")
|
||||
@GetMapping("/{picId}")
|
||||
public AjaxResult<PictureDisplayVo> getInfo(@NotNull(message = "主键不能为空")
|
||||
@PathVariable("picId") Long picId) {
|
||||
return AjaxResult.success(iPictureDisplayService.queryById(picId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增图片展示
|
||||
*/
|
||||
@ApiOperation("新增图片展示")
|
||||
@PreAuthorize("@ss.hasPermi('demo:picture:add')")
|
||||
@Log(title = "图片展示", businessType = BusinessType.INSERT)
|
||||
@RepeatSubmit
|
||||
@PostMapping()
|
||||
public AjaxResult<Void> add(@Validated(AddGroup.class) @RequestBody PictureDisplayBo bo) {
|
||||
return toAjax(iPictureDisplayService.insertByBo(bo) ? 1 : 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改图片展示
|
||||
*/
|
||||
@ApiOperation("修改图片展示")
|
||||
@PreAuthorize("@ss.hasPermi('demo:picture:edit')")
|
||||
@Log(title = "图片展示", businessType = BusinessType.UPDATE)
|
||||
@RepeatSubmit
|
||||
@PutMapping()
|
||||
public AjaxResult<Void> edit(@Validated(EditGroup.class) @RequestBody PictureDisplayBo bo) {
|
||||
return toAjax(iPictureDisplayService.updateByBo(bo) ? 1 : 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除图片展示
|
||||
*/
|
||||
@ApiOperation("删除图片展示")
|
||||
@PreAuthorize("@ss.hasPermi('demo:picture:remove')")
|
||||
@Log(title = "图片展示" , businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{picIds}")
|
||||
public AjaxResult<Void> remove(@NotEmpty(message = "主键不能为空")
|
||||
@PathVariable Long[] picIds) {
|
||||
return toAjax(iPictureDisplayService.deleteWithValidByIds(Arrays.asList(picIds), true) ? 1 : 0);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,42 @@
|
||||
package com.ruoyi.demo.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.Accessors;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 图片选择参数对象 hjc_selection
|
||||
*
|
||||
* @author qianlan
|
||||
* @date 2021-10-12
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@Accessors(chain = true)
|
||||
@TableName("hjc_selection")
|
||||
public class HjcSelection implements Serializable {
|
||||
|
||||
private static final long serialVersionUID=1L;
|
||||
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@TableId(value = "sid")
|
||||
private Long sid;
|
||||
|
||||
/**
|
||||
* hjc_pic表的主键
|
||||
*/
|
||||
private Long pid;
|
||||
|
||||
/**
|
||||
* 选择
|
||||
*/
|
||||
private Integer selection;
|
||||
|
||||
}
|
||||
@ -0,0 +1,47 @@
|
||||
package com.ruoyi.demo.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.Accessors;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 图片展示对象 hjc_pic
|
||||
*
|
||||
* @author qianlan
|
||||
* @date 2021-10-10
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@Accessors(chain = true)
|
||||
@TableName("hjc_pic")
|
||||
public class PictureDisplay implements Serializable {
|
||||
|
||||
private static final long serialVersionUID=1L;
|
||||
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@TableId(value = "pic_id")
|
||||
private Long picId;
|
||||
|
||||
/**
|
||||
* url地址
|
||||
*/
|
||||
private String picUrl;
|
||||
|
||||
/**
|
||||
* 图片选择
|
||||
*/
|
||||
private Integer picSelection;
|
||||
|
||||
/**
|
||||
* 是否被选
|
||||
*/
|
||||
private Integer picBool;
|
||||
|
||||
}
|
||||
@ -0,0 +1,64 @@
|
||||
package com.ruoyi.demo.domain.bo;
|
||||
|
||||
import com.ruoyi.common.core.validate.AddGroup;
|
||||
import com.ruoyi.common.core.validate.EditGroup;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import javax.validation.constraints.*;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import com.ruoyi.common.core.domain.BaseEntity;
|
||||
|
||||
/**
|
||||
* 图片选择参数业务对象 hjc_selection
|
||||
*
|
||||
* @author qianlan
|
||||
* @date 2021-10-12
|
||||
*/
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ApiModel("图片选择参数业务对象")
|
||||
public class HjcSelectionBo extends BaseEntity {
|
||||
|
||||
/**
|
||||
* hjc_pic表的主键
|
||||
*/
|
||||
@ApiModelProperty("hjc_pic表的主键")
|
||||
private Long pid;
|
||||
|
||||
/**
|
||||
* 选择
|
||||
*/
|
||||
@ApiModelProperty("选择")
|
||||
private Integer selection;
|
||||
|
||||
|
||||
/**
|
||||
* 分页大小
|
||||
*/
|
||||
@ApiModelProperty("分页大小")
|
||||
private Integer pageSize;
|
||||
|
||||
/**
|
||||
* 当前页数
|
||||
*/
|
||||
@ApiModelProperty("当前页数")
|
||||
private Integer pageNum;
|
||||
|
||||
/**
|
||||
* 排序列
|
||||
*/
|
||||
@ApiModelProperty("排序列")
|
||||
private String orderByColumn;
|
||||
|
||||
/**
|
||||
* 排序的方向desc或者asc
|
||||
*/
|
||||
@ApiModelProperty(value = "排序的方向", example = "asc,desc")
|
||||
private String isAsc;
|
||||
|
||||
}
|
||||
@ -0,0 +1,76 @@
|
||||
package com.ruoyi.demo.domain.bo;
|
||||
|
||||
import com.ruoyi.common.core.validate.AddGroup;
|
||||
import com.ruoyi.common.core.validate.EditGroup;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import javax.validation.constraints.*;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import com.ruoyi.common.core.domain.BaseEntity;
|
||||
|
||||
/**
|
||||
* 图片展示业务对象 hjc_pic
|
||||
*
|
||||
* @author qianlan
|
||||
* @date 2021-10-10
|
||||
*/
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ApiModel("图片展示业务对象")
|
||||
public class PictureDisplayBo extends BaseEntity {
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@ApiModelProperty("主键")
|
||||
private Long picId;
|
||||
|
||||
/**
|
||||
* url地址
|
||||
*/
|
||||
@ApiModelProperty("url地址")
|
||||
private String picUrl;
|
||||
|
||||
/**
|
||||
* 图片选择
|
||||
*/
|
||||
@ApiModelProperty("图片选择")
|
||||
private Long picSelection;
|
||||
|
||||
/**
|
||||
* 是否被选
|
||||
*/
|
||||
@ApiModelProperty("是否被选")
|
||||
private Long picBool;
|
||||
|
||||
|
||||
/**
|
||||
* 分页大小
|
||||
*/
|
||||
@ApiModelProperty("分页大小")
|
||||
private Integer pageSize;
|
||||
|
||||
/**
|
||||
* 当前页数
|
||||
*/
|
||||
@ApiModelProperty("当前页数")
|
||||
private Integer pageNum;
|
||||
|
||||
/**
|
||||
* 排序列
|
||||
*/
|
||||
@ApiModelProperty("排序列")
|
||||
private String orderByColumn;
|
||||
|
||||
/**
|
||||
* 排序的方向desc或者asc
|
||||
*/
|
||||
@ApiModelProperty(value = "排序的方向", example = "asc,desc")
|
||||
private String isAsc;
|
||||
|
||||
}
|
||||
@ -0,0 +1,44 @@
|
||||
package com.ruoyi.demo.domain.vo;
|
||||
|
||||
import com.ruoyi.common.annotation.Excel;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import java.util.Date;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 图片选择参数视图对象 hjc_selection
|
||||
*
|
||||
* @author qianlan
|
||||
* @date 2021-10-12
|
||||
*/
|
||||
@Data
|
||||
@ApiModel("图片选择参数视图对象")
|
||||
public class HjcSelectionVo {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@ApiModelProperty("主键")
|
||||
private Long sid;
|
||||
|
||||
/**
|
||||
* hjc_pic表的主键
|
||||
*/
|
||||
@Excel(name = "hjc_pic表的主键")
|
||||
@ApiModelProperty("hjc_pic表的主键")
|
||||
private Long pid;
|
||||
|
||||
/**
|
||||
* 选择
|
||||
*/
|
||||
@Excel(name = "选择")
|
||||
@ApiModelProperty("选择")
|
||||
private Integer selection;
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,51 @@
|
||||
package com.ruoyi.demo.domain.vo;
|
||||
|
||||
import com.ruoyi.common.annotation.Excel;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import java.util.Date;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 图片展示视图对象 hjc_pic
|
||||
*
|
||||
* @author qianlan
|
||||
* @date 2021-10-10
|
||||
*/
|
||||
@Data
|
||||
@ApiModel("图片展示视图对象")
|
||||
public class PictureDisplayVo {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@ApiModelProperty("主键")
|
||||
private Long picId;
|
||||
|
||||
/**
|
||||
* url地址
|
||||
*/
|
||||
@Excel(name = "url地址")
|
||||
@ApiModelProperty("url地址")
|
||||
private String picUrl;
|
||||
|
||||
/**
|
||||
* 图片选择
|
||||
*/
|
||||
@Excel(name = "图片选择")
|
||||
@ApiModelProperty("图片选择")
|
||||
private Integer picSelection;
|
||||
|
||||
/**
|
||||
* 是否被选
|
||||
*/
|
||||
@Excel(name = "是否被选")
|
||||
@ApiModelProperty("是否被选")
|
||||
private Integer picBool;
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,26 @@
|
||||
package com.ruoyi.demo.domain.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author qianlan
|
||||
* @version 1.0
|
||||
* @date 2021/10/11 19:16
|
||||
*/
|
||||
@Data
|
||||
public class PictureListVo {
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
private Long picId;
|
||||
|
||||
/**
|
||||
* url地址
|
||||
*/
|
||||
private String picUrl;
|
||||
|
||||
/**
|
||||
* 图片选择
|
||||
*/
|
||||
private Long picSelection;
|
||||
}
|
||||
@ -0,0 +1,16 @@
|
||||
package com.ruoyi.demo.mapper;
|
||||
|
||||
import com.ruoyi.demo.domain.HjcSelection;
|
||||
import com.ruoyi.common.core.mybatisplus.core.BaseMapperPlus;
|
||||
import com.ruoyi.common.core.mybatisplus.cache.MybatisPlusRedisCache;
|
||||
import org.apache.ibatis.annotations.CacheNamespace;
|
||||
|
||||
/**
|
||||
* 图片选择参数Mapper接口
|
||||
*
|
||||
* @author qianlan
|
||||
* @date 2021-10-12
|
||||
*/
|
||||
public interface HjcSelectionMapper extends BaseMapperPlus<HjcSelection> {
|
||||
|
||||
}
|
||||
@ -0,0 +1,16 @@
|
||||
package com.ruoyi.demo.mapper;
|
||||
|
||||
import com.ruoyi.demo.domain.PictureDisplay;
|
||||
import com.ruoyi.common.core.mybatisplus.core.BaseMapperPlus;
|
||||
import com.ruoyi.common.core.mybatisplus.cache.MybatisPlusRedisCache;
|
||||
import org.apache.ibatis.annotations.CacheNamespace;
|
||||
|
||||
/**
|
||||
* 图片展示Mapper接口
|
||||
*
|
||||
* @author qianlan
|
||||
* @date 2021-10-10
|
||||
*/
|
||||
public interface PictureDisplayMapper extends BaseMapperPlus<PictureDisplay> {
|
||||
|
||||
}
|
||||
@ -0,0 +1,56 @@
|
||||
package com.ruoyi.demo.service;
|
||||
|
||||
import com.ruoyi.demo.domain.HjcSelection;
|
||||
import com.ruoyi.demo.domain.vo.HjcSelectionVo;
|
||||
import com.ruoyi.demo.domain.bo.HjcSelectionBo;
|
||||
import com.ruoyi.common.core.mybatisplus.core.IServicePlus;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 图片选择参数Service接口
|
||||
*
|
||||
* @author qianlan
|
||||
* @date 2021-10-12
|
||||
*/
|
||||
public interface IHjcSelectionService extends IServicePlus<HjcSelection, HjcSelectionVo> {
|
||||
/**
|
||||
* 查询单个
|
||||
* @return
|
||||
*/
|
||||
HjcSelectionVo queryById(Long sid);
|
||||
|
||||
/**
|
||||
* 查询列表
|
||||
*/
|
||||
TableDataInfo<HjcSelectionVo> queryPageList(HjcSelectionBo bo);
|
||||
|
||||
/**
|
||||
* 查询列表
|
||||
*/
|
||||
List<HjcSelectionVo> queryList(HjcSelectionBo bo);
|
||||
|
||||
/**
|
||||
* 根据新增业务对象插入图片选择参数
|
||||
* @param bo 图片选择参数新增业务对象
|
||||
* @return
|
||||
*/
|
||||
Boolean insertByBo(HjcSelectionBo bo);
|
||||
|
||||
/**
|
||||
* 根据编辑业务对象修改图片选择参数
|
||||
* @param bo 图片选择参数编辑业务对象
|
||||
* @return
|
||||
*/
|
||||
Boolean updateByBo(HjcSelectionBo bo);
|
||||
|
||||
/**
|
||||
* 校验并删除数据
|
||||
* @param ids 主键集合
|
||||
* @param isValid 是否校验,true-删除前校验,false-不校验
|
||||
* @return
|
||||
*/
|
||||
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
|
||||
}
|
||||
@ -0,0 +1,77 @@
|
||||
package com.ruoyi.demo.service;
|
||||
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.demo.domain.PictureDisplay;
|
||||
import com.ruoyi.demo.domain.vo.PictureDisplayVo;
|
||||
import com.ruoyi.demo.domain.bo.PictureDisplayBo;
|
||||
import com.ruoyi.common.core.mybatisplus.core.IServicePlus;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.demo.domain.vo.PictureListVo;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 图片展示Service接口
|
||||
*
|
||||
* @author qianlan
|
||||
* @date 2021-10-10
|
||||
*/
|
||||
public interface IPictureDisplayService extends IServicePlus<PictureDisplay, PictureDisplayVo> {
|
||||
/**
|
||||
* 查询单个
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
PictureDisplayVo queryById(Long picId);
|
||||
|
||||
/**
|
||||
* 查询列表
|
||||
*/
|
||||
TableDataInfo<PictureDisplayVo> queryPageList(PictureDisplayBo bo);
|
||||
|
||||
/**
|
||||
* 查询列表
|
||||
*/
|
||||
List<PictureDisplayVo> queryList(PictureDisplayBo bo);
|
||||
|
||||
/**
|
||||
* 根据新增业务对象插入图片展示
|
||||
*
|
||||
* @param bo 图片展示新增业务对象
|
||||
* @return
|
||||
*/
|
||||
Boolean insertByBo(PictureDisplayBo bo);
|
||||
|
||||
/**
|
||||
* 根据编辑业务对象修改图片展示
|
||||
*
|
||||
* @param bo 图片展示编辑业务对象
|
||||
* @return
|
||||
*/
|
||||
Boolean updateByBo(PictureDisplayBo bo);
|
||||
|
||||
/**
|
||||
* 校验并删除数据
|
||||
*
|
||||
* @param ids 主键集合
|
||||
* @param isValid 是否校验,true-删除前校验,false-不校验
|
||||
* @return
|
||||
*/
|
||||
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
|
||||
|
||||
/**
|
||||
* 获取图片,每十个为一组
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
List<PictureListVo> queryListWithCondition();
|
||||
|
||||
|
||||
/**
|
||||
* 提交要修改的图片选项
|
||||
* @return
|
||||
*/
|
||||
AjaxResult commitPic(List<PictureDisplayVo> lists);
|
||||
|
||||
}
|
||||
@ -0,0 +1,85 @@
|
||||
package com.ruoyi.demo.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.ruoyi.common.utils.PageUtils;
|
||||
import com.ruoyi.common.core.page.PagePlus;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.ruoyi.common.core.mybatisplus.core.ServicePlusImpl;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.ruoyi.demo.domain.bo.HjcSelectionBo;
|
||||
import com.ruoyi.demo.domain.vo.HjcSelectionVo;
|
||||
import com.ruoyi.demo.domain.HjcSelection;
|
||||
import com.ruoyi.demo.mapper.HjcSelectionMapper;
|
||||
import com.ruoyi.demo.service.IHjcSelectionService;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Collection;
|
||||
|
||||
/**
|
||||
* 图片选择参数Service业务层处理
|
||||
*
|
||||
* @author qianlan
|
||||
* @date 2021-10-12
|
||||
*/
|
||||
@Service
|
||||
public class HjcSelectionServiceImpl extends ServicePlusImpl<HjcSelectionMapper, HjcSelection, HjcSelectionVo> implements IHjcSelectionService {
|
||||
|
||||
@Override
|
||||
public HjcSelectionVo queryById(Long sid){
|
||||
return getVoById(sid);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TableDataInfo<HjcSelectionVo> queryPageList(HjcSelectionBo bo) {
|
||||
PagePlus<HjcSelection, HjcSelectionVo> result = pageVo(PageUtils.buildPagePlus(), buildQueryWrapper(bo));
|
||||
return PageUtils.buildDataInfo(result);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<HjcSelectionVo> queryList(HjcSelectionBo bo) {
|
||||
return listVo(buildQueryWrapper(bo));
|
||||
}
|
||||
|
||||
private LambdaQueryWrapper<HjcSelection> buildQueryWrapper(HjcSelectionBo bo) {
|
||||
Map<String, Object> params = bo.getParams();
|
||||
LambdaQueryWrapper<HjcSelection> lqw = Wrappers.lambdaQuery();
|
||||
lqw.eq(bo.getPid() != null, HjcSelection::getPid, bo.getPid());
|
||||
lqw.eq(bo.getSelection() != null, HjcSelection::getSelection, bo.getSelection());
|
||||
return lqw;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean insertByBo(HjcSelectionBo bo) {
|
||||
HjcSelection add = BeanUtil.toBean(bo, HjcSelection.class);
|
||||
validEntityBeforeSave(add);
|
||||
return save(add);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean updateByBo(HjcSelectionBo bo) {
|
||||
HjcSelection update = BeanUtil.toBean(bo, HjcSelection.class);
|
||||
validEntityBeforeSave(update);
|
||||
return updateById(update);
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存前的数据校验
|
||||
*
|
||||
* @param entity 实体类数据
|
||||
*/
|
||||
private void validEntityBeforeSave(HjcSelection entity){
|
||||
//TODO 做一些数据校验,如唯一约束
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
|
||||
if(isValid){
|
||||
//TODO 做一些业务上的校验,判断是否需要校验
|
||||
}
|
||||
return removeByIds(ids);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,141 @@
|
||||
package com.ruoyi.demo.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.utils.PageUtils;
|
||||
import com.ruoyi.common.core.page.PagePlus;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.demo.domain.HjcSelection;
|
||||
import com.ruoyi.demo.domain.vo.PictureListVo;
|
||||
import com.ruoyi.demo.service.IHjcSelectionService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.ruoyi.common.core.mybatisplus.core.ServicePlusImpl;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.ruoyi.demo.domain.bo.PictureDisplayBo;
|
||||
import com.ruoyi.demo.domain.vo.PictureDisplayVo;
|
||||
import com.ruoyi.demo.domain.PictureDisplay;
|
||||
import com.ruoyi.demo.mapper.PictureDisplayMapper;
|
||||
import com.ruoyi.demo.service.IPictureDisplayService;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 图片展示Service业务层处理
|
||||
*
|
||||
* @author qianlan
|
||||
* @date 2021-10-10
|
||||
*/
|
||||
@Service
|
||||
@Transactional
|
||||
public class PictureDisplayServiceImpl extends ServicePlusImpl<PictureDisplayMapper, PictureDisplay, PictureDisplayVo> implements IPictureDisplayService {
|
||||
|
||||
|
||||
@Autowired
|
||||
private IPictureDisplayService pictureDisplayService;
|
||||
|
||||
@Autowired
|
||||
private IHjcSelectionService selectionService;
|
||||
|
||||
@Override
|
||||
public PictureDisplayVo queryById(Long picId) {
|
||||
return getVoById(picId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TableDataInfo<PictureDisplayVo> queryPageList(PictureDisplayBo bo) {
|
||||
PagePlus<PictureDisplay, PictureDisplayVo> result = pageVo(PageUtils.buildPagePlus(), buildQueryWrapper(bo));
|
||||
return PageUtils.buildDataInfo(result);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PictureDisplayVo> queryList(PictureDisplayBo bo) {
|
||||
return listVo(buildQueryWrapper(bo));
|
||||
}
|
||||
|
||||
private LambdaQueryWrapper<PictureDisplay> buildQueryWrapper(PictureDisplayBo bo) {
|
||||
Map<String, Object> params = bo.getParams();
|
||||
LambdaQueryWrapper<PictureDisplay> lqw = Wrappers.lambdaQuery();
|
||||
lqw.eq(bo.getPicId() != null, PictureDisplay::getPicId, bo.getPicId());
|
||||
lqw.eq(StrUtil.isNotBlank(bo.getPicUrl()), PictureDisplay::getPicUrl, bo.getPicUrl());
|
||||
lqw.eq(bo.getPicSelection() != null, PictureDisplay::getPicSelection, bo.getPicSelection());
|
||||
lqw.eq(bo.getPicBool() != null, PictureDisplay::getPicBool, bo.getPicBool());
|
||||
return lqw;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean insertByBo(PictureDisplayBo bo) {
|
||||
PictureDisplay add = BeanUtil.toBean(bo, PictureDisplay.class);
|
||||
validEntityBeforeSave(add);
|
||||
return save(add);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean updateByBo(PictureDisplayBo bo) {
|
||||
PictureDisplay update = BeanUtil.toBean(bo, PictureDisplay.class);
|
||||
validEntityBeforeSave(update);
|
||||
return updateById(update);
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存前的数据校验
|
||||
*
|
||||
* @param entity 实体类数据
|
||||
*/
|
||||
private void validEntityBeforeSave(PictureDisplay entity) {
|
||||
//TODO 做一些数据校验,如唯一约束
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
|
||||
if (isValid) {
|
||||
//TODO 做一些业务上的校验,判断是否需要校验
|
||||
}
|
||||
return removeByIds(ids);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PictureListVo> queryListWithCondition() {
|
||||
QueryWrapper<PictureDisplay> wrapper = new QueryWrapper<>();
|
||||
wrapper.last(" ORDER BY RAND() LIMIT 20");
|
||||
List<PictureDisplay> pictureDisplays = baseMapper.selectList(wrapper);
|
||||
List<PictureListVo> lists = pictureDisplays.stream().map((list) -> {
|
||||
PictureListVo listVo = new PictureListVo();
|
||||
BeanUtil.copyProperties(list, listVo);
|
||||
return listVo;
|
||||
}).collect(Collectors.toList());
|
||||
return lists;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult commitPic(List<PictureDisplayVo> lists) {
|
||||
int len = lists.size();
|
||||
HashSet<Long> ids = new HashSet<>();
|
||||
for (int i = len - 1; i >= 0; i--) {
|
||||
Long picId = lists.get(i).getPicId();
|
||||
int selection = lists.get(i).getPicSelection();
|
||||
if (!ids.contains(picId)) {
|
||||
|
||||
PictureDisplay pictureDisplay = new PictureDisplay();
|
||||
Integer picBool = pictureDisplayService.getOne(new QueryWrapper<PictureDisplay>().eq("pic_id", picId)).getPicBool();
|
||||
pictureDisplay.setPicId(picId);
|
||||
pictureDisplay.setPicBool(picBool + 1);
|
||||
pictureDisplayService.updateById(pictureDisplay);
|
||||
|
||||
HjcSelection hjcSelection = new HjcSelection();
|
||||
hjcSelection.setPid(picId);
|
||||
hjcSelection.setSelection(selection);
|
||||
selectionService.save(hjcSelection);
|
||||
|
||||
}
|
||||
ids.add(picId);
|
||||
}
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,14 @@
|
||||
<?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.ruoyi.demo.mapper.HjcSelectionMapper">
|
||||
|
||||
<resultMap type="com.ruoyi.demo.domain.HjcSelection" id="HjcSelectionResult">
|
||||
<result property="sid" column="sid"/>
|
||||
<result property="pid" column="pid"/>
|
||||
<result property="selection" column="selection"/>
|
||||
</resultMap>
|
||||
|
||||
|
||||
</mapper>
|
||||
@ -0,0 +1,15 @@
|
||||
<?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.ruoyi.demo.mapper.PictureDisplayMapper">
|
||||
|
||||
<resultMap type="com.ruoyi.demo.domain.PictureDisplay" id="PictureDisplayResult">
|
||||
<result property="picId" column="pic_id"/>
|
||||
<result property="picUrl" column="pic_url"/>
|
||||
<result property="picSelection" column="pic_selection"/>
|
||||
<result property="picBool" column="pic_bool"/>
|
||||
</resultMap>
|
||||
|
||||
|
||||
</mapper>
|
||||
71
ruoyi-ui/src/api/demo/picture.js
Normal file
71
ruoyi-ui/src/api/demo/picture.js
Normal file
@ -0,0 +1,71 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
// 查询图片展示列表
|
||||
export function listPicture(query) {
|
||||
return request({
|
||||
url: '/demo/picture/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
// 查询没有被选中的图片,一次显示十条
|
||||
export function listPictureWithCondition(query) {
|
||||
return request({
|
||||
url: '/demo/picture/picList',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
// 提交到后端
|
||||
export function commitPic(data) {
|
||||
return request({
|
||||
url: '/demo/picture/commitPic',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 查询图片展示详细
|
||||
export function getPicture(picId) {
|
||||
return request({
|
||||
url: '/demo/picture/' + picId,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 新增图片展示
|
||||
export function addPicture(data) {
|
||||
return request({
|
||||
url: '/demo/picture',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 修改图片展示
|
||||
export function updatePicture(data) {
|
||||
return request({
|
||||
url: '/demo/picture',
|
||||
method: 'put',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 删除图片展示
|
||||
export function delPicture(picId) {
|
||||
return request({
|
||||
url: '/demo/picture/' + picId,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
||||
|
||||
// 导出图片展示
|
||||
export function exportPicture(query) {
|
||||
return request({
|
||||
url: '/demo/picture/export',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
53
ruoyi-ui/src/api/demo/selection.js
Normal file
53
ruoyi-ui/src/api/demo/selection.js
Normal file
@ -0,0 +1,53 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
// 查询图片选择参数列表
|
||||
export function listSelection(query) {
|
||||
return request({
|
||||
url: '/demo/selection/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
// 查询图片选择参数详细
|
||||
export function getSelection(sid) {
|
||||
return request({
|
||||
url: '/demo/selection/' + sid,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 新增图片选择参数
|
||||
export function addSelection(data) {
|
||||
return request({
|
||||
url: '/demo/selection',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 修改图片选择参数
|
||||
export function updateSelection(data) {
|
||||
return request({
|
||||
url: '/demo/selection',
|
||||
method: 'put',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 删除图片选择参数
|
||||
export function delSelection(sid) {
|
||||
return request({
|
||||
url: '/demo/selection/' + sid,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
||||
|
||||
// 导出图片选择参数
|
||||
export function exportSelection(query) {
|
||||
return request({
|
||||
url: '/demo/selection/export',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
BIN
ruoyi-ui/src/assets/images/loading.gif
Normal file
BIN
ruoyi-ui/src/assets/images/loading.gif
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 9.2 KiB |
176
ruoyi-ui/src/views/demo/data/index.vue
Normal file
176
ruoyi-ui/src/views/demo/data/index.vue
Normal file
@ -0,0 +1,176 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="80px">
|
||||
<el-form-item label="节点名" prop="name">
|
||||
<el-input
|
||||
v-model="queryParams.name"
|
||||
placeholder="请输入节点名"
|
||||
clearable
|
||||
size="small"
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="关系" prop="categary">
|
||||
<el-input
|
||||
v-model="queryParams.categary"
|
||||
placeholder="请输入关系"
|
||||
clearable
|
||||
size="small"
|
||||
@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="['demo:data:add']"
|
||||
>新增
|
||||
</el-button>
|
||||
</el-col>
|
||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
<el-table
|
||||
v-loading="loading"
|
||||
:data="nodeList"
|
||||
row-key="id"
|
||||
:tree-props="{children: 'children', hasChildren: 'hasChildren'}"
|
||||
>
|
||||
<el-table-column label="节点名" prop="name"/>
|
||||
<el-table-column label="id" prop="id"/>
|
||||
<el-table-column label="分类" align="center" prop="categary"/>
|
||||
<el-table-column label="父id" align="center" prop="pid"/>
|
||||
<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="['system:node:edit']"
|
||||
>修改
|
||||
</el-button>
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-plus"
|
||||
@click="handleAdd(scope.row)"
|
||||
v-hasPermi="['system:node:add']"
|
||||
>新增
|
||||
</el-button>
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-plus"
|
||||
@click="handleAddMultiple(scope.row)"
|
||||
v-hasPermi="['system:node:add']"
|
||||
>新增多个
|
||||
</el-button>
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-delete"
|
||||
@click="handleDelete(scope.row)"
|
||||
v-hasPermi="['system:node: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="name">
|
||||
<el-input v-model="form.name" placeholder="请输入节点名"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="分类" prop="categary">
|
||||
<el-input v-model="form.categary" placeholder="请输入分类"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="父id" prop="pid">
|
||||
<treeselect v-model="form.pid" :options="nodeOptions" :normalizer="normalizer" placeholder="请选择父id"/>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button :loading="buttonLoading" type="primary" @click="submitForm">确 定</el-button>
|
||||
<el-button @click="cancel">取 消</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
|
||||
<!-- 添加多个节点维护对话框 -->
|
||||
<el-dialog :title="title" :visible.sync="addMultiple" width="500px" append-to-body>
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
||||
<el-form-item label="节点名" prop="name">
|
||||
<el-input v-model="form.name" placeholder="请输入节点名,多个节点名以#隔开"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="分类" prop="categary">
|
||||
<el-input v-model="form.categary" placeholder="多个分类名以#隔开,若分类为空以空格代替"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="父id" prop="pid">
|
||||
<treeselect v-model="form.pid" :options="nodeOptions" :normalizer="normalizer" placeholder="请选择父id"/>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button :loading="buttonLoading" type="primary" @click="submitNewForm">确 定</el-button>
|
||||
<el-button @click="cancel">取 消</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: "index",
|
||||
data() {
|
||||
return {
|
||||
// 按钮loading
|
||||
buttonLoading: false,
|
||||
// 遮罩层
|
||||
loading: true,
|
||||
// 显示搜索条件
|
||||
showSearch: true,
|
||||
// 节点维护表格数据
|
||||
nodeList: [],
|
||||
// 节点维护树选项
|
||||
nodeOptions: [],
|
||||
// 弹出层标题
|
||||
title: "",
|
||||
// 是否显示弹出层
|
||||
open: false,
|
||||
// 是否弹出添加多个对话框
|
||||
addMultiple: false,
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
name: null,
|
||||
categary: null,
|
||||
pid: null
|
||||
},
|
||||
// 表单参数
|
||||
form: {},
|
||||
// 表单校验
|
||||
rules: {}
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
/** 重置按钮操作 */
|
||||
resetQuery() {
|
||||
this.resetForm("queryForm");
|
||||
this.handleQuery();
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
||||
320
ruoyi-ui/src/views/demo/picture/index.vue
Normal file
320
ruoyi-ui/src/views/demo/picture/index.vue
Normal file
@ -0,0 +1,320 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
|
||||
<el-form-item label="主键" prop="picId">
|
||||
<el-input
|
||||
v-model="queryParams.picId"
|
||||
placeholder="请输入主键"
|
||||
clearable
|
||||
size="small"
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="url地址" prop="picUrl">
|
||||
<el-input
|
||||
v-model="queryParams.picUrl"
|
||||
placeholder="请输入url地址"
|
||||
clearable
|
||||
size="small"
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="图片选择" prop="picSelection">
|
||||
<el-input
|
||||
v-model="queryParams.picSelection"
|
||||
placeholder="请输入图片选择"
|
||||
clearable
|
||||
size="small"
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="是否被选" prop="picBool">
|
||||
<el-input
|
||||
v-model="queryParams.picBool"
|
||||
placeholder="请输入是否被选"
|
||||
clearable
|
||||
size="small"
|
||||
@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="['demo:picture: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="['demo:picture: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="['demo:picture:remove']"
|
||||
>删除
|
||||
</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="warning"
|
||||
plain
|
||||
icon="el-icon-download"
|
||||
size="mini"
|
||||
:loading="exportLoading"
|
||||
@click="handleExport"
|
||||
v-hasPermi="['demo:picture:export']"
|
||||
>导出
|
||||
</el-button>
|
||||
</el-col>
|
||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
<el-table v-loading="loading" :data="pictureList" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" align="center"/>
|
||||
<el-table-column label="主键" align="center" prop="picId" v-if="true"/>
|
||||
<el-table-column label="url地址" align="center" prop="picUrl"/>
|
||||
<el-table-column label="图片选择" align="center" prop="picSelection"/>
|
||||
<el-table-column label="是否被选" align="center" prop="picBool"/>
|
||||
<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="['demo:picture:edit']"
|
||||
>修改
|
||||
</el-button>
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-delete"
|
||||
@click="handleDelete(scope.row)"
|
||||
v-hasPermi="['demo:picture:remove']"
|
||||
>删除
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<pagination
|
||||
v-show="total>0"
|
||||
:total="total"
|
||||
:page.sync="queryParams.pageNum"
|
||||
:limit.sync="queryParams.pageSize"
|
||||
@pagination="getList"
|
||||
/>
|
||||
|
||||
<!-- 添加或修改图片展示对话框 -->
|
||||
<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="url地址" prop="picUrl">
|
||||
<el-input v-model="form.picUrl" placeholder="请输入url地址"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="图片选择" prop="picSelection">
|
||||
<el-input v-model="form.picSelection" placeholder="请输入图片选择"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="是否被选" prop="picBool">
|
||||
<el-input v-model="form.picBool" placeholder="请输入是否被选"/>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button :loading="buttonLoading" type="primary" @click="submitForm">确 定</el-button>
|
||||
<el-button @click="cancel">取 消</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {listPicture, getPicture, delPicture, addPicture, updatePicture, exportPicture} from "@/api/demo/picture";
|
||||
|
||||
export default {
|
||||
name: "Picture",
|
||||
data() {
|
||||
return {
|
||||
// 按钮loading
|
||||
buttonLoading: false,
|
||||
// 遮罩层
|
||||
loading: true,
|
||||
// 导出遮罩层
|
||||
exportLoading: false,
|
||||
// 选中数组
|
||||
ids: [],
|
||||
// 非单个禁用
|
||||
single: true,
|
||||
// 非多个禁用
|
||||
multiple: true,
|
||||
// 显示搜索条件
|
||||
showSearch: true,
|
||||
// 总条数
|
||||
total: 0,
|
||||
// 图片展示表格数据
|
||||
pictureList: [],
|
||||
// 弹出层标题
|
||||
title: "",
|
||||
// 是否显示弹出层
|
||||
open: false,
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
picId: undefined,
|
||||
picUrl: undefined,
|
||||
picSelection: undefined,
|
||||
picBool: undefined
|
||||
},
|
||||
// 表单参数
|
||||
form: {},
|
||||
// 表单校验
|
||||
rules: {}
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.getList();
|
||||
},
|
||||
methods: {
|
||||
/** 查询图片展示列表 */
|
||||
getList() {
|
||||
this.loading = true;
|
||||
listPicture(this.queryParams).then(response => {
|
||||
this.pictureList = response.rows;
|
||||
this.total = response.total;
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
// 取消按钮
|
||||
cancel() {
|
||||
this.open = false;
|
||||
this.reset();
|
||||
},
|
||||
// 表单重置
|
||||
reset() {
|
||||
this.form = {
|
||||
picId: undefined,
|
||||
picUrl: undefined,
|
||||
picSelection: undefined,
|
||||
picBool: undefined
|
||||
};
|
||||
this.resetForm("form");
|
||||
},
|
||||
/** 搜索按钮操作 */
|
||||
handleQuery() {
|
||||
this.queryParams.pageNum = 1;
|
||||
this.getList();
|
||||
},
|
||||
/** 重置按钮操作 */
|
||||
resetQuery() {
|
||||
this.resetForm("queryForm");
|
||||
this.handleQuery();
|
||||
},
|
||||
// 多选框选中数据
|
||||
handleSelectionChange(selection) {
|
||||
this.ids = selection.map(item => item.picId)
|
||||
this.single = selection.length !== 1
|
||||
this.multiple = !selection.length
|
||||
},
|
||||
/** 新增按钮操作 */
|
||||
handleAdd() {
|
||||
this.reset();
|
||||
this.open = true;
|
||||
this.title = "添加图片展示";
|
||||
},
|
||||
/** 修改按钮操作 */
|
||||
handleUpdate(row) {
|
||||
this.loading = true;
|
||||
this.reset();
|
||||
const picId = row.picId || this.ids
|
||||
getPicture(picId).then(response => {
|
||||
this.loading = false;
|
||||
this.form = response.data;
|
||||
this.open = true;
|
||||
this.title = "修改图片展示";
|
||||
});
|
||||
},
|
||||
/** 提交按钮 */
|
||||
submitForm() {
|
||||
this.$refs["form"].validate(valid => {
|
||||
if (valid) {
|
||||
this.buttonLoading = true;
|
||||
if (this.form.picId != null) {
|
||||
updatePicture(this.form).then(response => {
|
||||
this.msgSuccess("修改成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
}).finally(() => {
|
||||
this.buttonLoading = false;
|
||||
});
|
||||
} else {
|
||||
addPicture(this.form).then(response => {
|
||||
this.msgSuccess("新增成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
}).finally(() => {
|
||||
this.buttonLoading = false;
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
/** 删除按钮操作 */
|
||||
handleDelete(row) {
|
||||
const picIds = row.picId || this.ids;
|
||||
this.$confirm('是否确认删除图片展示编号为"' + picIds + '"的数据项?', "警告", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning"
|
||||
}).then(() => {
|
||||
this.loading = true;
|
||||
return delPicture(picIds);9
|
||||
}).then(() => {
|
||||
this.loading = false;
|
||||
this.getList();
|
||||
this.msgSuccess("删除成功");
|
||||
}).catch(() => {
|
||||
});
|
||||
},
|
||||
/** 导出按钮操作 */
|
||||
handleExport() {
|
||||
const queryParams = this.queryParams;
|
||||
this.$confirm('是否确认导出所有图片展示数据项?', "警告", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning"
|
||||
}).then(() => {
|
||||
this.exportLoading = true;
|
||||
return exportPicture(queryParams);
|
||||
}).then(response => {
|
||||
this.download(response.msg);
|
||||
this.exportLoading = false;
|
||||
}).catch(() => {
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
288
ruoyi-ui/src/views/demo/selection/index.vue
Normal file
288
ruoyi-ui/src/views/demo/selection/index.vue
Normal file
@ -0,0 +1,288 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
|
||||
<el-form-item label="图片id" prop="pid">
|
||||
<el-input
|
||||
v-model="queryParams.pid"
|
||||
placeholder="请输入选择"
|
||||
clearable
|
||||
size="small"
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="选择值" prop="selection">
|
||||
<el-input
|
||||
v-model="queryParams.selection"
|
||||
placeholder="请输入选择"
|
||||
clearable
|
||||
size="small"
|
||||
@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="['demo:selection: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="['demo:selection: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="['demo:selection:remove']"
|
||||
>删除</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="warning"
|
||||
plain
|
||||
icon="el-icon-download"
|
||||
size="mini"
|
||||
:loading="exportLoading"
|
||||
@click="handleExport"
|
||||
v-hasPermi="['demo:selection:export']"
|
||||
>导出</el-button>
|
||||
</el-col>
|
||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
<el-table v-loading="loading" :data="selectionList" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<el-table-column label="序号" align="center" prop="sid" v-if="true"/>
|
||||
<el-table-column label="图片id" align="center" prop="pid" />
|
||||
<el-table-column label="选择" align="center" prop="selection" />
|
||||
<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="['demo:selection:edit']"
|
||||
>修改</el-button>
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-delete"
|
||||
@click="handleDelete(scope.row)"
|
||||
v-hasPermi="['demo:selection:remove']"
|
||||
>删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<pagination
|
||||
v-show="total>0"
|
||||
:total="total"
|
||||
:page.sync="queryParams.pageNum"
|
||||
:limit.sync="queryParams.pageSize"
|
||||
@pagination="getList"
|
||||
/>
|
||||
|
||||
<!-- 添加或修改图片选择参数对话框 -->
|
||||
<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">
|
||||
<el-input v-model="form.pid" placeholder="请输入图片id" />
|
||||
</el-form-item>
|
||||
<el-form-item label="选择" prop="selection">
|
||||
<el-input v-model="form.selection" placeholder="请输入选择" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button :loading="buttonLoading" type="primary" @click="submitForm">确 定</el-button>
|
||||
<el-button @click="cancel">取 消</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { listSelection, getSelection, delSelection, addSelection, updateSelection, exportSelection } from "@/api/demo/selection";
|
||||
|
||||
export default {
|
||||
name: "Selection",
|
||||
data() {
|
||||
return {
|
||||
// 按钮loading
|
||||
buttonLoading: false,
|
||||
// 遮罩层
|
||||
loading: true,
|
||||
// 导出遮罩层
|
||||
exportLoading: false,
|
||||
// 选中数组
|
||||
ids: [],
|
||||
// 非单个禁用
|
||||
single: true,
|
||||
// 非多个禁用
|
||||
multiple: true,
|
||||
// 显示搜索条件
|
||||
showSearch: true,
|
||||
// 总条数
|
||||
total: 0,
|
||||
// 图片选择参数表格数据
|
||||
selectionList: [],
|
||||
// 弹出层标题
|
||||
title: "",
|
||||
// 是否显示弹出层
|
||||
open: false,
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
pid: undefined,
|
||||
selection: undefined
|
||||
},
|
||||
// 表单参数
|
||||
form: {},
|
||||
// 表单校验
|
||||
rules: {
|
||||
}
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.getList();
|
||||
},
|
||||
methods: {
|
||||
/** 查询图片选择参数列表 */
|
||||
getList() {
|
||||
this.loading = true;
|
||||
listSelection(this.queryParams).then(response => {
|
||||
this.selectionList = response.rows;
|
||||
this.total = response.total;
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
// 取消按钮
|
||||
cancel() {
|
||||
this.open = false;
|
||||
this.reset();
|
||||
},
|
||||
// 表单重置
|
||||
reset() {
|
||||
this.form = {
|
||||
sid: undefined,
|
||||
pid: undefined,
|
||||
selection: undefined
|
||||
};
|
||||
this.resetForm("form");
|
||||
},
|
||||
/** 搜索按钮操作 */
|
||||
handleQuery() {
|
||||
this.queryParams.pageNum = 1;
|
||||
this.getList();
|
||||
},
|
||||
/** 重置按钮操作 */
|
||||
resetQuery() {
|
||||
this.resetForm("queryForm");
|
||||
this.handleQuery();
|
||||
},
|
||||
// 多选框选中数据
|
||||
handleSelectionChange(selection) {
|
||||
this.ids = selection.map(item => item.sid)
|
||||
this.single = selection.length!==1
|
||||
this.multiple = !selection.length
|
||||
},
|
||||
/** 新增按钮操作 */
|
||||
handleAdd() {
|
||||
this.reset();
|
||||
this.open = true;
|
||||
this.title = "添加图片选择参数";
|
||||
},
|
||||
/** 修改按钮操作 */
|
||||
handleUpdate(row) {
|
||||
this.loading = true;
|
||||
this.reset();
|
||||
const sid = row.sid || this.ids
|
||||
getSelection(sid).then(response => {
|
||||
this.loading = false;
|
||||
this.form = response.data;
|
||||
this.open = true;
|
||||
this.title = "修改图片选择参数";
|
||||
});
|
||||
},
|
||||
/** 提交按钮 */
|
||||
submitForm() {
|
||||
this.$refs["form"].validate(valid => {
|
||||
if (valid) {
|
||||
this.buttonLoading = true;
|
||||
if (this.form.sid != null) {
|
||||
updateSelection(this.form).then(response => {
|
||||
this.msgSuccess("修改成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
}).finally(() => {
|
||||
this.buttonLoading = false;
|
||||
});
|
||||
} else {
|
||||
addSelection(this.form).then(response => {
|
||||
this.msgSuccess("新增成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
}).finally(() => {
|
||||
this.buttonLoading = false;
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
/** 删除按钮操作 */
|
||||
handleDelete(row) {
|
||||
const sids = row.sid || this.ids;
|
||||
this.$confirm('是否确认删除图片选择参数编号为"' + sids + '"的数据项?', "警告", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning"
|
||||
}).then(() => {
|
||||
this.loading = true;
|
||||
return delSelection(sids);
|
||||
}).then(() => {
|
||||
this.loading = false;
|
||||
this.getList();
|
||||
this.msgSuccess("删除成功");
|
||||
}).catch(() => {});
|
||||
},
|
||||
/** 导出按钮操作 */
|
||||
handleExport() {
|
||||
const queryParams = this.queryParams;
|
||||
this.$confirm('是否确认导出所有图片选择参数数据项?', "警告", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning"
|
||||
}).then(() => {
|
||||
this.exportLoading = true;
|
||||
return exportSelection(queryParams);
|
||||
}).then(response => {
|
||||
this.download(response.msg);
|
||||
this.exportLoading = false;
|
||||
}).catch(() => {});
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
175
ruoyi-ui/src/views/picture/index.vue
Normal file
175
ruoyi-ui/src/views/picture/index.vue
Normal file
@ -0,0 +1,175 @@
|
||||
<template>
|
||||
<div>
|
||||
<div class="tips">请根据姿势来判断人物的情绪为积极的还是消极情绪,麻烦认真选择,这很重要,十分感谢!!!</div>
|
||||
<div class="tips">若图片重复出现,直接舍弃掉即可</div>
|
||||
<div class="border">
|
||||
<el-carousel
|
||||
:interval="0"
|
||||
trigger="click"
|
||||
type="card"
|
||||
arrow="always"
|
||||
indicator-position="none"
|
||||
height="400px"
|
||||
:loop="false"
|
||||
@change="changeClick"
|
||||
>
|
||||
<el-carousel-item v-for="item in pic" :key="item.picId" class="img-box">
|
||||
<img v-lazy="item.picUrl"/>
|
||||
</el-carousel-item>
|
||||
</el-carousel>
|
||||
</div>
|
||||
|
||||
<div class="selection">
|
||||
<el-radio-group v-model="radio" @change="clickRadio">
|
||||
<el-radio :label="0">积极</el-radio>
|
||||
<el-radio :label="1">消极</el-radio>
|
||||
<el-radio :label="2">无法确定</el-radio>
|
||||
</el-radio-group>
|
||||
</div>
|
||||
|
||||
<div class="button">
|
||||
<span class="button-left"><el-button size="mini" type="primary" @click="clickCommitButton">提交</el-button></span>
|
||||
<el-button size="mini" type="danger" icon="el-icon-delete" @click="clickDrop">舍弃</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
||||
<script>
|
||||
import {listPictureWithCondition, commitPic} from '@/api/demo/picture'
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
pic: [],
|
||||
selectionArr: [],
|
||||
radio: -1,
|
||||
cur: 0
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
// 点击丢弃按钮
|
||||
clickDrop() {
|
||||
this.resetPic();
|
||||
this.getPictureList();
|
||||
},
|
||||
resetPic() {
|
||||
this.pic = []
|
||||
this.radio = 3;
|
||||
this.selectionArr = [];
|
||||
this.cur = 0;
|
||||
},
|
||||
getPictureList() {
|
||||
listPictureWithCondition().then(res => {
|
||||
this.pic = res;
|
||||
console.log("图片集是", res)
|
||||
})
|
||||
},
|
||||
//点击提交按钮
|
||||
clickCommitButton() {
|
||||
if (this.selectionArr.length != 0) {
|
||||
this.$confirm('十分感谢您的帮助,麻烦确认你的选择是否为认真选择,确定完成请按确定!', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
console.log(this.selectionArr)
|
||||
commitPic(this.selectionArr).then(res => {
|
||||
console.log(res)
|
||||
this.msgSuccess("修改成功");
|
||||
this.resetPic();
|
||||
this.getPictureList();
|
||||
});
|
||||
}).catch(() => {
|
||||
this.$message({
|
||||
type: 'info',
|
||||
message: '已取消提交'
|
||||
});
|
||||
});
|
||||
} else {
|
||||
this.$message.error('您还未选择任何图片,无法提交');
|
||||
}
|
||||
},
|
||||
|
||||
//点击选项按钮
|
||||
clickRadio() {
|
||||
let commit = {
|
||||
picId: this.pic[this.cur].picId,
|
||||
picSelection: this.radio
|
||||
}
|
||||
console.log(commit)
|
||||
this.pic[this.cur].picSelection = this.radio
|
||||
this.selectionArr.push(commit)
|
||||
},
|
||||
|
||||
//更换图片
|
||||
changeClick(cur) {
|
||||
this.radio = 3
|
||||
console.log("当前cur是:" + cur)
|
||||
this.cur = cur
|
||||
this.radio = this.pic[cur].picSelection
|
||||
},
|
||||
},
|
||||
created() {
|
||||
this.getPictureList();
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
|
||||
<style>
|
||||
.el-carousel__item:nth-child(2n) {
|
||||
background-color: #99a9bf;
|
||||
}
|
||||
|
||||
.el-carousel__item:nth-child(2n + 1) {
|
||||
background-color: #d3dce6;
|
||||
}
|
||||
|
||||
.border {
|
||||
text-align: center;
|
||||
margin: 0 auto;
|
||||
width: 1200px;
|
||||
}
|
||||
|
||||
.border img {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
/* margin:auto; */
|
||||
}
|
||||
|
||||
.border img[lazy="loading"] {
|
||||
display: block;
|
||||
width: 50px;
|
||||
height: 50px;
|
||||
margin: auto auto;
|
||||
}
|
||||
|
||||
.selection {
|
||||
margin-top: 60px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.button {
|
||||
margin-top: 50px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.button-left {
|
||||
margin-right: 30px;
|
||||
}
|
||||
|
||||
.tips {
|
||||
text-align: center;
|
||||
margin-top: 20px;
|
||||
margin-bottom: 20px;
|
||||
color: #e52241;
|
||||
font-size: 22px;
|
||||
}
|
||||
|
||||
</style>
|
||||
Loading…
Reference in New Issue
Block a user