Merge branch 'feature-20240104' of https://gitee.com/yunqiang_technology/floatomcloud into feature-20240104

master
blak-kong 2 years ago
commit 644c645a72

@ -0,0 +1,97 @@
package com.flossom.common.core.domain.entity;
import com.flossom.common.core.annotation.Excel;
import com.flossom.common.core.web.domain.BaseEntity;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
/**
* wx_instrument_mode
*
* @author flossom
* @date 2024-01-17
*/
public class WxInstrumentMode extends BaseEntity {
private static final long serialVersionUID = 1L;
/**
* $column.columnComment
*/
private Long id;
/**
* id
*/
@Excel(name = "仪器id")
private Long instrumentId;
/**
* id
*/
@Excel(name = "模式id")
private Long modeId;
/**
*
*/
private Integer modeSort;
/**
* 0 1
*/
@Excel(name = "状态", readConverterExp = "0=正常,1=停用")
private Integer status;
public void setId(Long id) {
this.id = id;
}
public Long getId() {
return id;
}
public void setInstrumentId(Long instrumentId) {
this.instrumentId = instrumentId;
}
public Long getInstrumentId() {
return instrumentId;
}
public void setModeId(Long modeId) {
this.modeId = modeId;
}
public Long getModeId() {
return modeId;
}
public void setStatus(Integer status) {
this.status = status;
}
public Integer getStatus() {
return status;
}
public Integer getModeSort() {
return modeSort;
}
public void setModeSort(Integer modeSort) {
this.modeSort = modeSort;
}
@Override
public String toString() {
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("instrumentId", getInstrumentId())
.append("modeId", getModeId())
.append("status", getStatus())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.toString();
}
}

@ -0,0 +1,241 @@
package com.flossom.common.core.domain.entity;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.flossom.common.core.annotation.Excel;
import com.flossom.common.core.web.domain.BaseEntity;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
/**
* wx_mode
*
* @author flossom
* @date 2024-01-17
*/
public class WxMode extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** $column.columnComment */
private Long id;
/** 仪器类型1、非iot仪器 2、iot仪器 */
@Excel(name = "仪器类型1、非iot仪器 2、iot仪器")
private Integer instrumentType;
/** 仪器型号 */
@Excel(name = "仪器型号")
private String instrumentModel;
/** 模式名称 */
@Excel(name = "模式名称")
private String modeName;
/** 模式描述 */
@Excel(name = "模式描述")
private String modeDesc;
/** 模式封面图片 */
@Excel(name = "模式封面图片")
private String modeBanner;
/** 模式视频 */
@Excel(name = "模式视频")
private String modeVideo;
/** 模式类型(每个仪器有不一样的模式类型) */
@Excel(name = "模式类型(每个仪器有不一样的模式类型)")
private Long modeType;
/** 模式分类(每个仪器有不一样的模式分类) */
@Excel(name = "模式分类(每个仪器有不一样的模式分类)")
private Long modeClass;
/** 是否属于舱体模式0、不是 1、是 */
@Excel(name = "是否属于舱体模式0、不是 1、是")
private Integer isCabinMode;
/** 模式时长 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "模式时长", width = 30, dateFormat = "yyyy-MM-dd")
private Date modeTime;
/** 准备视频 */
@Excel(name = "准备视频")
private String preparationVideo;
/** 启动图片GIF */
@Excel(name = "启动图片GIF")
private String beganVideo;
/** 暂停图片GIF */
@Excel(name = "暂停图片GIF")
private String pauseVideo;
/** 状态0正常 1停用 */
@Excel(name = "状态", readConverterExp = "0=正常,1=停用")
private Long status;
public void setId(Long id)
{
this.id = id;
}
public Long getId()
{
return id;
}
public void setInstrumentType(Integer instrumentType)
{
this.instrumentType = instrumentType;
}
public Integer getInstrumentType()
{
return instrumentType;
}
public void setInstrumentModel(String instrumentModel)
{
this.instrumentModel = instrumentModel;
}
public String getInstrumentModel()
{
return instrumentModel;
}
public void setModeName(String modeName)
{
this.modeName = modeName;
}
public String getModeName()
{
return modeName;
}
public void setModeDesc(String modeDesc)
{
this.modeDesc = modeDesc;
}
public String getModeDesc()
{
return modeDesc;
}
public void setModeBanner(String modeBanner)
{
this.modeBanner = modeBanner;
}
public String getModeBanner()
{
return modeBanner;
}
public void setModeVideo(String modeVideo)
{
this.modeVideo = modeVideo;
}
public String getModeVideo()
{
return modeVideo;
}
public void setModeType(Long modeType)
{
this.modeType = modeType;
}
public Long getModeType()
{
return modeType;
}
public void setModeClass(Long modeClass)
{
this.modeClass = modeClass;
}
public Long getModeClass()
{
return modeClass;
}
public void setIsCabinMode(Integer isCabinMode)
{
this.isCabinMode = isCabinMode;
}
public Integer getIsCabinMode()
{
return isCabinMode;
}
public void setModeTime(Date modeTime)
{
this.modeTime = modeTime;
}
public Date getModeTime()
{
return modeTime;
}
public void setPreparationVideo(String preparationVideo)
{
this.preparationVideo = preparationVideo;
}
public String getPreparationVideo()
{
return preparationVideo;
}
public void setBeganVideo(String beganVideo)
{
this.beganVideo = beganVideo;
}
public String getBeganVideo()
{
return beganVideo;
}
public void setPauseVideo(String pauseVideo)
{
this.pauseVideo = pauseVideo;
}
public String getPauseVideo()
{
return pauseVideo;
}
public void setStatus(Long status)
{
this.status = status;
}
public Long getStatus()
{
return status;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("instrumentType", getInstrumentType())
.append("instrumentModel", getInstrumentModel())
.append("modeName", getModeName())
.append("modeDesc", getModeDesc())
.append("modeBanner", getModeBanner())
.append("modeVideo", getModeVideo())
.append("modeType", getModeType())
.append("modeClass", getModeClass())
.append("isCabinMode", getIsCabinMode())
.append("modeTime", getModeTime())
.append("preparationVideo", getPreparationVideo())
.append("beganVideo", getBeganVideo())
.append("pauseVideo", getPauseVideo())
.append("status", getStatus())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.append("remark", getRemark())
.toString();
}
}

@ -183,6 +183,12 @@ public class WxInstrumentSaveReq {
*/
private List<WxInstrumentFileRelate> introduceList;
/**
*
* @return
*/
private List<Integer> modeIdsValue;
public Long getId() {
return id;
}
@ -422,4 +428,12 @@ public class WxInstrumentSaveReq {
public void setBindingCredit(Integer bindingCredit) {
this.bindingCredit = bindingCredit;
}
public List<Integer> getModeIdsValue() {
return modeIdsValue;
}
public void setModeIdsValue(List<Integer> modeIdsValue) {
this.modeIdsValue = modeIdsValue;
}
}

@ -0,0 +1,64 @@
package com.flossom.common.core.mapper;
import com.flossom.common.core.domain.entity.WxInstrumentMode;
import java.util.List;
/**
* Mapper
*
* @author flossom
* @date 2024-01-17
*/
public interface WxInstrumentModeMapper {
/**
*
*
* @param id
* @return
*/
public WxInstrumentMode selectWxInstrumentModeById(Long id);
/**
*
*
* @param wxInstrumentMode
* @return
*/
public List<WxInstrumentMode> selectWxInstrumentModeList(WxInstrumentMode wxInstrumentMode);
/**
*
*
* @param wxInstrumentMode
* @return
*/
public int insertWxInstrumentMode(WxInstrumentMode wxInstrumentMode);
/**
*
*
* @param wxInstrumentMode
* @return
*/
public int updateWxInstrumentMode(WxInstrumentMode wxInstrumentMode);
/**
*
*
* @param id
* @return
*/
public int deleteWxInstrumentModeById(Long id);
/**
*
*
* @param ids
* @return
*/
public int deleteWxInstrumentModeByIds(Long[] ids);
public int deleteByInstrumentId(Long instrumentId);
}

@ -0,0 +1,62 @@
package com.flossom.common.core.mapper;
import com.flossom.common.core.domain.entity.WxMode;
import java.util.List;
/**
* Mapper
*
* @author flossom
* @date 2024-01-17
*/
public interface WxModeMapper
{
/**
*
*
* @param id
* @return
*/
public WxMode selectWxModeById(Long id);
/**
*
*
* @param wxMode
* @return
*/
public List<WxMode> selectWxModeList(WxMode wxMode);
/**
*
*
* @param wxMode
* @return
*/
public int insertWxMode(WxMode wxMode);
/**
*
*
* @param wxMode
* @return
*/
public int updateWxMode(WxMode wxMode);
/**
*
*
* @param id
* @return
*/
public int deleteWxModeById(Long id);
/**
*
*
* @param ids
* @return
*/
public int deleteWxModeByIds(Long[] ids);
}

@ -162,7 +162,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="miniTagNames != null">#{miniTagNames},</if>
<if test="wecomTagIds != null">#{wecomTagIds},</if>
<if test="wecomTagNames != null">#{wecomTagNames},</if>
<if test="sceneNames != null">#{sceneNames},</if>
<if test="nursingTime != null">#{nursingTime},</if>
<if test="iotVersion != null">#{iotVersion},</if>
<if test="iotUpgradeData != null">#{iotUpgradeData},</if>

@ -0,0 +1,83 @@
<?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.flossom.common.core.mapper.WxInstrumentModeMapper">
<resultMap type="WxInstrumentMode" id="WxInstrumentModeResult">
<result property="id" column="id" />
<result property="instrumentId" column="instrument_id" />
<result property="modeId" column="mode_id" />
<result property="modeSort" column="mode_sort" />
<result property="status" column="status" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
</resultMap>
<sql id="selectWxInstrumentModeVo">
select id, instrument_id, mode_id, mode_sort, status, create_by, create_time from wx_instrument_mode
</sql>
<select id="selectWxInstrumentModeList" parameterType="WxInstrumentMode" resultMap="WxInstrumentModeResult">
<include refid="selectWxInstrumentModeVo"/>
<where>
<if test="instrumentId != null "> and instrument_id = #{instrumentId}</if>
<if test="modeId != null "> and mode_id = #{modeId}</if>
<if test="status != null "> and status = #{status}</if>
</where>
order by mode_sort
</select>
<select id="selectWxInstrumentModeById" parameterType="Long" resultMap="WxInstrumentModeResult">
<include refid="selectWxInstrumentModeVo"/>
where id = #{id}
</select>
<insert id="insertWxInstrumentMode" parameterType="WxInstrumentMode" useGeneratedKeys="true" keyProperty="id">
insert into wx_instrument_mode
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="instrumentId != null">instrument_id,</if>
<if test="modeId != null">mode_id,</if>
<if test="modeSort != null">mode_sort,</if>
<if test="status != null">status,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="instrumentId != null">#{instrumentId},</if>
<if test="modeId != null">#{modeId},</if>
<if test="modeSort != null">#{modeSort},</if>
<if test="status != null">#{status},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
</trim>
</insert>
<update id="updateWxInstrumentMode" parameterType="WxInstrumentMode">
update wx_instrument_mode
<trim prefix="SET" suffixOverrides=",">
<if test="instrumentId != null">instrument_id = #{instrumentId},</if>
<if test="modeId != null">mode_id = #{modeId},</if>
<if test="modeSort != null">mode_sort = #{modeSort},</if>
<if test="status != null">status = #{status},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteWxInstrumentModeById" parameterType="Long">
delete from wx_instrument_mode where id = #{id}
</delete>
<delete id="deleteWxInstrumentModeByIds" parameterType="String">
delete from wx_instrument_mode where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<delete id="deleteByInstrumentId" parameterType="Long">
delete from wx_instrument_mode where instrument_id = #{instrumentId}
</delete>
</mapper>

@ -0,0 +1,141 @@
<?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.flossom.common.core.mapper.WxModeMapper">
<resultMap type="WxMode" id="WxModeResult">
<result property="id" column="id" />
<result property="instrumentType" column="instrument_type" />
<result property="instrumentModel" column="instrument_model" />
<result property="modeName" column="mode_name" />
<result property="modeDesc" column="mode_desc" />
<result property="modeBanner" column="mode_banner" />
<result property="modeVideo" column="mode_video" />
<result property="modeType" column="mode_type" />
<result property="modeClass" column="mode_class" />
<result property="isCabinMode" column="is_cabin_mode" />
<result property="modeTime" column="mode_time" />
<result property="preparationVideo" column="preparation_video" />
<result property="beganVideo" column="began_video" />
<result property="pauseVideo" column="pause_video" />
<result property="status" column="status" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="remark" column="remark" />
</resultMap>
<sql id="selectWxModeVo">
select id, instrument_type, instrument_model, mode_name, mode_desc, mode_banner, mode_video, mode_type, mode_class, is_cabin_mode, mode_time, preparation_video, began_video, pause_video, status, create_by, create_time, update_by, update_time, remark from wx_mode
</sql>
<select id="selectWxModeList" parameterType="WxMode" resultMap="WxModeResult">
<include refid="selectWxModeVo"/>
<where>
<if test="instrumentType != null "> and instrument_type = #{instrumentType}</if>
<if test="instrumentModel != null and instrumentModel != ''"> and instrument_model = #{instrumentModel}</if>
<if test="modeName != null and modeName != ''"> and mode_name like concat('%', #{modeName}, '%')</if>
<if test="modeDesc != null and modeDesc != ''"> and mode_desc = #{modeDesc}</if>
<if test="modeBanner != null and modeBanner != ''"> and mode_banner = #{modeBanner}</if>
<if test="modeVideo != null and modeVideo != ''"> and mode_video = #{modeVideo}</if>
<if test="modeType != null "> and mode_type = #{modeType}</if>
<if test="modeClass != null "> and mode_class = #{modeClass}</if>
<if test="isCabinMode != null "> and is_cabin_mode = #{isCabinMode}</if>
<if test="modeTime != null "> and mode_time = #{modeTime}</if>
<if test="preparationVideo != null and preparationVideo != ''"> and preparation_video = #{preparationVideo}</if>
<if test="beganVideo != null and beganVideo != ''"> and began_video = #{beganVideo}</if>
<if test="pauseVideo != null and pauseVideo != ''"> and pause_video = #{pauseVideo}</if>
<if test="status != null "> and status = #{status}</if>
</where>
</select>
<select id="selectWxModeById" parameterType="Long" resultMap="WxModeResult">
<include refid="selectWxModeVo"/>
where id = #{id}
</select>
<insert id="insertWxMode" parameterType="WxMode" useGeneratedKeys="true" keyProperty="id">
insert into wx_mode
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="instrumentType != null">instrument_type,</if>
<if test="instrumentModel != null">instrument_model,</if>
<if test="modeName != null">mode_name,</if>
<if test="modeDesc != null">mode_desc,</if>
<if test="modeBanner != null">mode_banner,</if>
<if test="modeVideo != null">mode_video,</if>
<if test="modeType != null">mode_type,</if>
<if test="modeClass != null">mode_class,</if>
<if test="isCabinMode != null">is_cabin_mode,</if>
<if test="modeTime != null">mode_time,</if>
<if test="preparationVideo != null">preparation_video,</if>
<if test="beganVideo != null">began_video,</if>
<if test="pauseVideo != null">pause_video,</if>
<if test="status != null">status,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="remark != null">remark,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="instrumentType != null">#{instrumentType},</if>
<if test="instrumentModel != null">#{instrumentModel},</if>
<if test="modeName != null">#{modeName},</if>
<if test="modeDesc != null">#{modeDesc},</if>
<if test="modeBanner != null">#{modeBanner},</if>
<if test="modeVideo != null">#{modeVideo},</if>
<if test="modeType != null">#{modeType},</if>
<if test="modeClass != null">#{modeClass},</if>
<if test="isCabinMode != null">#{isCabinMode},</if>
<if test="modeTime != null">#{modeTime},</if>
<if test="preparationVideo != null">#{preparationVideo},</if>
<if test="beganVideo != null">#{beganVideo},</if>
<if test="pauseVideo != null">#{pauseVideo},</if>
<if test="status != null">#{status},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="remark != null">#{remark},</if>
</trim>
</insert>
<update id="updateWxMode" parameterType="WxMode">
update wx_mode
<trim prefix="SET" suffixOverrides=",">
<if test="instrumentType != null">instrument_type = #{instrumentType},</if>
<if test="instrumentModel != null">instrument_model = #{instrumentModel},</if>
<if test="modeName != null">mode_name = #{modeName},</if>
<if test="modeDesc != null">mode_desc = #{modeDesc},</if>
<if test="modeBanner != null">mode_banner = #{modeBanner},</if>
<if test="modeVideo != null">mode_video = #{modeVideo},</if>
<if test="modeType != null">mode_type = #{modeType},</if>
<if test="modeClass != null">mode_class = #{modeClass},</if>
<if test="isCabinMode != null">is_cabin_mode = #{isCabinMode},</if>
<if test="modeTime != null">mode_time = #{modeTime},</if>
<if test="preparationVideo != null">preparation_video = #{preparationVideo},</if>
<if test="beganVideo != null">began_video = #{beganVideo},</if>
<if test="pauseVideo != null">pause_video = #{pauseVideo},</if>
<if test="status != null">status = #{status},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="remark != null">remark = #{remark},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteWxModeById" parameterType="Long">
delete from wx_mode where id = #{id}
</delete>
<delete id="deleteWxModeByIds" parameterType="String">
delete from wx_mode where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

@ -0,0 +1,117 @@
package com.flossom.system.controller;
import java.util.List;
import java.io.IOException;
import javax.servlet.http.HttpServletResponse;
import com.flossom.common.core.domain.R;
import com.flossom.common.core.domain.entity.WxMode;
import com.flossom.common.core.utils.poi.ExcelUtil;
import com.flossom.common.core.web.controller.BaseController;
import com.flossom.common.core.web.domain.AjaxResult;
import com.flossom.common.core.web.page.TableDataInfo;
import com.flossom.common.log.annotation.Log;
import com.flossom.common.log.enums.BusinessType;
import com.flossom.common.security.annotation.RequiresPermissions;
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.flossom.system.service.IWxModeService;
/**
* Controller
*
* @author flossom
* @date 2024-01-17
*/
@RestController
@RequestMapping("/mode")
public class WxModeController extends BaseController
{
@Autowired
private IWxModeService wxModeService;
/**
*
*/
@RequiresPermissions("system:mode:list")
@GetMapping("/list")
public TableDataInfo list(WxMode wxMode)
{
startPage();
List<WxMode> list = wxModeService.selectWxModeList(wxMode);
return getDataTable(list);
}
/**
*
*/
@RequiresPermissions("system:mode:list")
@GetMapping("/listAll")
public R listAll(WxMode wxMode)
{
return R.ok(wxModeService.selectWxModeList(wxMode));
}
/**
*
*/
@RequiresPermissions("system:mode:export")
@Log(title = "模式列", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, WxMode wxMode)
{
List<WxMode> list = wxModeService.selectWxModeList(wxMode);
ExcelUtil<WxMode> util = new ExcelUtil<WxMode>(WxMode.class);
util.exportExcel(response, list, "模式列数据");
}
/**
*
*/
@RequiresPermissions("system:mode:query")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return success(wxModeService.selectWxModeById(id));
}
/**
*
*/
@RequiresPermissions("system:mode:add")
@Log(title = "模式列", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody WxMode wxMode)
{
return toAjax(wxModeService.insertWxMode(wxMode));
}
/**
*
*/
@RequiresPermissions("system:mode:edit")
@Log(title = "模式列", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody WxMode wxMode)
{
return toAjax(wxModeService.updateWxMode(wxMode));
}
/**
*
*/
@RequiresPermissions("system:mode:remove")
@Log(title = "模式列", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(wxModeService.deleteWxModeByIds(ids));
}
}

@ -0,0 +1,62 @@
package com.flossom.system.service;
import com.flossom.common.core.domain.entity.WxInstrumentMode;
import java.util.List;
/**
* Service
*
* @author flossom
* @date 2024-01-17
*/
public interface IWxInstrumentModeService {
/**
*
*
* @param id
* @return
*/
public WxInstrumentMode selectWxInstrumentModeById(Long id);
/**
*
*
* @param wxInstrumentMode
* @return
*/
public List<WxInstrumentMode> selectWxInstrumentModeList(WxInstrumentMode wxInstrumentMode);
/**
*
*
* @param wxInstrumentMode
* @return
*/
public int insertWxInstrumentMode(WxInstrumentMode wxInstrumentMode);
/**
*
*
* @param wxInstrumentMode
* @return
*/
public int updateWxInstrumentMode(WxInstrumentMode wxInstrumentMode);
/**
*
*
* @param ids
* @return
*/
public int deleteWxInstrumentModeByIds(Long[] ids);
/**
*
*
* @param id
* @return
*/
public int deleteWxInstrumentModeById(Long id);
}

@ -0,0 +1,62 @@
package com.flossom.system.service;
import com.flossom.common.core.domain.entity.WxMode;
import java.util.List;
/**
* Service
*
* @author flossom
* @date 2024-01-17
*/
public interface IWxModeService
{
/**
*
*
* @param id
* @return
*/
public WxMode selectWxModeById(Long id);
/**
*
*
* @param wxMode
* @return
*/
public List<WxMode> selectWxModeList(WxMode wxMode);
/**
*
*
* @param wxMode
* @return
*/
public int insertWxMode(WxMode wxMode);
/**
*
*
* @param wxMode
* @return
*/
public int updateWxMode(WxMode wxMode);
/**
*
*
* @param ids
* @return
*/
public int deleteWxModeByIds(Long[] ids);
/**
*
*
* @param id
* @return
*/
public int deleteWxModeById(Long id);
}

@ -0,0 +1,90 @@
package com.flossom.system.service.impl;
import java.util.List;
import com.flossom.common.core.domain.entity.WxInstrumentMode;
import com.flossom.common.core.mapper.WxInstrumentModeMapper;
import com.flossom.common.core.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.flossom.system.service.IWxInstrumentModeService;
/**
* Service
*
* @author flossom
* @date 2024-01-17
*/
@Service
public class WxInstrumentModeServiceImpl implements IWxInstrumentModeService {
@Autowired
private WxInstrumentModeMapper wxInstrumentModeMapper;
/**
*
*
* @param id
* @return
*/
@Override
public WxInstrumentMode selectWxInstrumentModeById(Long id) {
return wxInstrumentModeMapper.selectWxInstrumentModeById(id);
}
/**
*
*
* @param wxInstrumentMode
* @return
*/
@Override
public List<WxInstrumentMode> selectWxInstrumentModeList(WxInstrumentMode wxInstrumentMode) {
return wxInstrumentModeMapper.selectWxInstrumentModeList(wxInstrumentMode);
}
/**
*
*
* @param wxInstrumentMode
* @return
*/
@Override
public int insertWxInstrumentMode(WxInstrumentMode wxInstrumentMode) {
wxInstrumentMode.setCreateTime(DateUtils.getNowDate());
return wxInstrumentModeMapper.insertWxInstrumentMode(wxInstrumentMode);
}
/**
*
*
* @param wxInstrumentMode
* @return
*/
@Override
public int updateWxInstrumentMode(WxInstrumentMode wxInstrumentMode) {
return wxInstrumentModeMapper.updateWxInstrumentMode(wxInstrumentMode);
}
/**
*
*
* @param ids
* @return
*/
@Override
public int deleteWxInstrumentModeByIds(Long[] ids) {
return wxInstrumentModeMapper.deleteWxInstrumentModeByIds(ids);
}
/**
*
*
* @param id
* @return
*/
@Override
public int deleteWxInstrumentModeById(Long id) {
return wxInstrumentModeMapper.deleteWxInstrumentModeById(id);
}
}

@ -3,16 +3,20 @@ package com.flossom.system.service.impl;
import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
import java.util.stream.Collectors;
import com.flossom.common.core.domain.entity.SysTag;
import com.flossom.common.core.domain.entity.WxInstrument;
import com.flossom.common.core.domain.entity.WxInstrumentFileRelate;
import com.flossom.common.core.domain.entity.WxInstrumentMode;
import com.flossom.common.core.domain.req.WxInstrumentReq;
import com.flossom.common.core.domain.req.WxInstrumentSaveReq;
import com.flossom.common.core.enums.InstrumentFileClassify;
import com.flossom.common.core.enums.Status;
import com.flossom.common.core.mapper.SysTagMapper;
import com.flossom.common.core.mapper.WxInstrumentFileRelateMapper;
import com.flossom.common.core.mapper.WxInstrumentMapper;
import com.flossom.common.core.mapper.WxInstrumentModeMapper;
import com.flossom.common.core.utils.DateUtils;
import com.flossom.common.core.utils.StringUtils;
import com.flossom.common.security.utils.SecurityUtils;
@ -40,6 +44,9 @@ public class WxInstrumentServiceImpl implements IWxInstrumentService {
@Autowired
private WxInstrumentFileRelateMapper wxInstrumentFileRelateMapper;
@Autowired
private WxInstrumentModeMapper wxInstrumentModeMapper;
/**
*
*
@ -74,6 +81,16 @@ public class WxInstrumentServiceImpl implements IWxInstrumentService {
List<WxInstrumentFileRelate> instructionRelate = wxInstrumentFileRelateMapper.
selectByInstrumentIdAndClassify(wxInstrument.getId(), InstrumentFileClassify.INSTRUMENT_INSTRUCTION.getCode());
wxInstrumentSaveReq.setIntroduceList(instructionRelate);
// 获取模式关联
WxInstrumentMode wxInstrumentMode = new WxInstrumentMode();
wxInstrumentMode.setInstrumentId(id);
List<WxInstrumentMode> wxInstrumentModes = wxInstrumentModeMapper.selectWxInstrumentModeList(wxInstrumentMode);
if (wxInstrumentModes != null && wxInstrumentModes.size() > 0) {
wxInstrumentSaveReq.setModeIdsValue(wxInstrumentModes.stream()
.map(WxInstrumentMode::getModeId)
.map(Long::intValue)
.collect(Collectors.toList()));
}
return wxInstrumentSaveReq;
}
@ -116,12 +133,14 @@ public class WxInstrumentServiceImpl implements IWxInstrumentService {
WxInstrument wxInstrument = new WxInstrument();
BeanUtils.copyProperties(wxInstrumentSaveReq, wxInstrument);
// 打卡时间处理
wxInstrument.setStartTime(wxInstrumentSaveReq.getExtraClockTimeRange().get(0));
wxInstrument.setEndTime(wxInstrumentSaveReq.getExtraClockTimeRange().get(1));
if (wxInstrumentSaveReq.getIsExtraClock() != null && wxInstrumentSaveReq.getIsExtraClock() == 1) {
wxInstrument.setStartTime(wxInstrumentSaveReq.getExtraClockTimeRange().get(0));
wxInstrument.setEndTime(wxInstrumentSaveReq.getExtraClockTimeRange().get(1));
}
wxInstrument.setCreateBy(SecurityUtils.getUsername());
wxInstrument.setCreateTime(DateUtils.getNowDate());
int i = wxInstrumentMapper.insertWxInstrument(wxInstrument);
int insertNum = wxInstrumentMapper.insertWxInstrument(wxInstrument);
// 保存初次护理规则
List<WxInstrumentFileRelate> nurseList = wxInstrumentSaveReq.getNurseList();
@ -154,7 +173,23 @@ public class WxInstrumentServiceImpl implements IWxInstrumentService {
wxInstrumentFileRelateMapper.insertWxInstrumentFileRelate(next);
}
}
return i;
// 模式关联
List<Integer> modeIdList = wxInstrumentSaveReq.getModeIdsValue();
if (modeIdList != null && modeIdList.size() > 0) {
wxInstrumentModeMapper.deleteByInstrumentId(wxInstrumentSaveReq.getId());
for (int i = 0; i < modeIdList.size(); i++) {
WxInstrumentMode wxInstrumentMode = new WxInstrumentMode();
wxInstrumentMode.setInstrumentId(wxInstrument.getId());
wxInstrumentMode.setModeId(modeIdList.get(i).longValue());
wxInstrumentMode.setModeSort(i);
wxInstrumentMode.setStatus(Status.OK.getCode());
wxInstrumentMode.setCreateBy(SecurityUtils.getUsername());
wxInstrumentMode.setCreateTime(DateUtils.getNowDate());
wxInstrumentModeMapper.insertWxInstrumentMode(wxInstrumentMode);
}
}
return insertNum;
}
/**
@ -201,8 +236,11 @@ public class WxInstrumentServiceImpl implements IWxInstrumentService {
wxInstrument.setUpdateTime(DateUtils.getNowDate());
// 打卡时间处理
wxInstrument.setStartTime(wxInstrumentSaveReq.getExtraClockTimeRange().get(0));
wxInstrument.setEndTime(wxInstrumentSaveReq.getExtraClockTimeRange().get(1));
// 打卡时间处理
if (wxInstrumentSaveReq.getIsExtraClock() != null && wxInstrumentSaveReq.getIsExtraClock() == 1) {
wxInstrument.setStartTime(wxInstrumentSaveReq.getExtraClockTimeRange().get(0));
wxInstrument.setEndTime(wxInstrumentSaveReq.getExtraClockTimeRange().get(1));
}
// 保存初次护理规则
List<WxInstrumentFileRelate> nurseList = wxInstrumentSaveReq.getNurseList();
@ -238,6 +276,21 @@ public class WxInstrumentServiceImpl implements IWxInstrumentService {
wxInstrumentFileRelateMapper.insertWxInstrumentFileRelate(next);
}
// 模式关联
List<Integer> modeIdList = wxInstrumentSaveReq.getModeIdsValue();
if (modeIdList != null && modeIdList.size() > 0) {
wxInstrumentModeMapper.deleteByInstrumentId(wxInstrumentSaveReq.getId());
for (int i = 0; i < modeIdList.size(); i++) {
WxInstrumentMode wxInstrumentMode = new WxInstrumentMode();
wxInstrumentMode.setInstrumentId(wxInstrumentSaveReq.getId());
wxInstrumentMode.setModeId(modeIdList.get(i).longValue());
wxInstrumentMode.setModeSort(i);
wxInstrumentMode.setStatus(Status.OK.getCode());
wxInstrumentMode.setCreateBy(SecurityUtils.getUsername());
wxInstrumentMode.setCreateTime(DateUtils.getNowDate());
wxInstrumentModeMapper.insertWxInstrumentMode(wxInstrumentMode);
}
}
return wxInstrumentMapper.updateWxInstrument(wxInstrument);
}

@ -0,0 +1,97 @@
package com.flossom.system.service.impl;
import java.util.List;
import com.flossom.common.core.domain.entity.WxMode;
import com.flossom.common.core.mapper.WxModeMapper;
import com.flossom.common.core.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.flossom.system.service.IWxModeService;
/**
* Service
*
* @author flossom
* @date 2024-01-17
*/
@Service
public class WxModeServiceImpl implements IWxModeService
{
@Autowired
private WxModeMapper wxModeMapper;
/**
*
*
* @param id
* @return
*/
@Override
public WxMode selectWxModeById(Long id)
{
return wxModeMapper.selectWxModeById(id);
}
/**
*
*
* @param wxMode
* @return
*/
@Override
public List<WxMode> selectWxModeList(WxMode wxMode)
{
return wxModeMapper.selectWxModeList(wxMode);
}
/**
*
*
* @param wxMode
* @return
*/
@Override
public int insertWxMode(WxMode wxMode)
{
wxMode.setCreateTime(DateUtils.getNowDate());
return wxModeMapper.insertWxMode(wxMode);
}
/**
*
*
* @param wxMode
* @return
*/
@Override
public int updateWxMode(WxMode wxMode)
{
wxMode.setUpdateTime(DateUtils.getNowDate());
return wxModeMapper.updateWxMode(wxMode);
}
/**
*
*
* @param ids
* @return
*/
@Override
public int deleteWxModeByIds(Long[] ids)
{
return wxModeMapper.deleteWxModeByIds(ids);
}
/**
*
*
* @param id
* @return
*/
@Override
public int deleteWxModeById(Long id)
{
return wxModeMapper.deleteWxModeById(id);
}
}

@ -135,6 +135,13 @@ export function delInstructions(id) {
})
}
export function listAllMode(query) {
return request({
url: '/system/mode/listAll',
method: 'get',
params: query
})
}

@ -0,0 +1,44 @@
import request from '@/utils/request'
// 查询模式列列表
export function listMode(query) {
return request({
url: '/system/mode/list',
method: 'get',
params: query
})
}
// 查询模式列详细
export function getMode(id) {
return request({
url: '/system/mode/' + id,
method: 'get'
})
}
// 新增模式列
export function addMode(data) {
return request({
url: '/system/mode',
method: 'post',
data: data
})
}
// 修改模式列
export function updateMode(data) {
return request({
url: '/system/mode',
method: 'put',
data: data
})
}
// 删除模式列
export function delMode(id) {
return request({
url: '/system/mode/' + id,
method: 'delete'
})
}

@ -447,7 +447,7 @@
</el-date-picker>
</el-form-item>
<el-form-item label="仪器绑定积分" prop="bindingCredit">
<el-input-number :min="0" :precision="0" v-model="form.bindingCredit" />
<el-input-number :min="0" :precision="0" v-model="form.bindingCredit"/>
</el-form-item>
<el-form-item label="仪器类型" prop="type">
<el-select
@ -468,20 +468,20 @@
<el-option label="M01" value="M01"></el-option>
</el-select>
</el-form-item>
<el-form-item label="模式ID" prop="sceneIds">
<!-- <el-input v-model="form.sceneIds" placeholder="请输入模式ID"/> -->
<el-select v-model="sceneIdsValue" multiple placeholder="请选择模式ID">
<el-option
v-for="item in sceneIdsOptions"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option>
</el-select>
<span v-if="sceneIdsValue.length > 1" style="cursor: pointer;color:#1890ff;margin-left:10px" @click="openSceneDialog()"></span>
</el-form-item>
<el-form-item label="模式名称" prop="sceneNames">
<el-input v-model="form.sceneNames" placeholder="请输入模式名称"/>
<el-form-item label="模式" prop="modeIds">
<template>
<el-select v-model="form.modeIdsValue" multiple placeholder="请选择模式">
<el-option
v-for="item in this.mode.modeIdsOptions"
:key="item.id"
:label="item.modeName"
:value="item.id">
</el-option>
</el-select>
<el-button v-if="form.modeIdsValue!=undefined && form.modeIdsValue!=null && form.modeIdsValue.length > 1"
@click="openModeIdDialog()" size="small" type="primary">排序
</el-button>
</template>
</el-form-item>
<el-form-item label="生成护理记录最短时间" prop="nursingTime">
<el-time-picker
@ -874,22 +874,18 @@
</el-table>
</el-dialog>
<el-dialog
title="排序"
:visible.sync="isSceneIdsVisible"
width="50%"
:close-on-click-modal="false"
:before-close="handleCloseScene">
<el-dialog title="排序" :visible.sync="mode.modeSortVisible" width="50%" :close-on-click-modal="false"
:before-close="handleCloseMode">
<div>
<draggable v-model="sceneIdsValue" draggable=".itemTag">
<template v-for="element in sceneIdsValue">
<el-tag :key="element" class="itemTag"> {{element}}</el-tag>
<draggable v-model="mode.modeIdsValueTemp" draggable=".itemTag">
<template v-for="element in this.mode.modeIdsValueTemp">
<el-tag :key="element.id" class="itemTag"> {{ element.modeName }}</el-tag>
</template>
</draggable>
</div>
<span slot="footer" class="dialog-footer">
<el-button @click="isSceneIdsVisible = false"> </el-button>
<el-button type="primary" @click="isSceneIdsVisible = false"> </el-button>
<el-button @click="handleCloseMode"> </el-button>
<el-button type="primary" @click="handleSaveMode"> </el-button>
</span>
</el-dialog>
</div>
@ -911,7 +907,7 @@ import {
listInstructions,
delInstructions,
addInstructions,
updateInstructions,
updateInstructions, listAllMode,
} from '@/api/system/instrument'
import {getToken} from '@/utils/auth'
import Treeselect from '@riophae/vue-treeselect'
@ -923,7 +919,7 @@ import draggable from 'vuedraggable'
export default {
name: 'Instrument',
components: {Treeselect,draggable},
components: {Treeselect, draggable},
data() {
return {
//
@ -1127,23 +1123,13 @@ export default {
}
]
},
isSceneIdsVisible: false,
sceneIdsValue: [], // value
sceneIdsValueTemp: [],
sceneIdsOptions: [
{
value: '黄金糕',
label: '黄金糕'
}, {
value: '双皮奶',
label: '双皮奶'
}, {
value: '蚵仔煎',
label: '蚵仔煎'
}
]
/* 模式 */
mode: {
modeSortVisible: false,
modeIdsValueTemp: [],
modeIdsOptions: [],
sortMode: [],
},
}
},
created() {
@ -1219,6 +1205,7 @@ export default {
scanCodeBinding: null,
nurseList: null,
introduceList: null,
modeIdsValue: [],
}
/* 仪器封面 */
this.bannerFile = {
@ -1269,7 +1256,13 @@ export default {
uploadHide: false,
fileList: [],
}
// this.form.iotVersionUpgrade = null,
/* 模式 */
this.mode = {
modeSortVisible: false,
modeIdsValueTemp: [],
modeIdsOptions: [],
sortMode: [],
};
this.resetForm('form')
},
/** 搜索按钮操作 */
@ -1300,6 +1293,14 @@ export default {
this.reset()
this.open = true
this.title = '添加仪器列'
/* 所有模式选项 */
this.mode.modeIdsOptions = [];
listAllMode().then((response) => {
if (response.code != 200) {
this.$message.error('模式获取失败')
}
this.mode.modeIdsOptions = response.data
})
},
/** 修改按钮操作 */
handleUpdate(row) {
@ -1384,6 +1385,15 @@ export default {
this.introduceIndex = response.data.introduceList.length;
this.introduceList = response.data.introduceList;
}
/* 所有模式选项 */
this.mode.modeIdsOptions = [];
listAllMode().then((response) => {
if (response.code != 200) {
this.$message.error('模式获取失败')
}
this.mode.modeIdsOptions = response.data
})
})
},
/** 提交按钮 */
@ -1837,17 +1847,33 @@ export default {
viewInstrumentInstruction(item) {
window.open(item.link, '_blank');
},
openSceneDialog() {
this.sceneIdsValueTemp = JSON.parse(JSON.stringify(this.sceneIdsValue))
this.isSceneIdsVisible = true;
/* 模式 */
openModeIdDialog() {
this.mode.modeIdsValueTemp = [];
this.mode.sortMode = [];
if (this.form.modeIdsValue.length > 1) {
for (let i = 0; i < this.form.modeIdsValue.length; i++) {
let filterModeArr = this.mode.modeIdsOptions.filter((item) => item.id == this.form.modeIdsValue[i])
this.mode.modeIdsValueTemp.push(filterModeArr[0]);
}
this.mode.modeSortVisible = true;
}
},
handleCloseScene() {
this.isSceneIdsVisible = false;
openModeIdDialog2() {
console.log(this.form.modeIdsValue);
},
handleSaveScene() {
this.sceneIdsValue = JSON.parse(JSON.stringify(this.sceneIdsValueTemp))
this.handleCloseScene()
handleCloseMode() {
this.mode.modeIdsValueTemp = [];
this.mode.sortMode = [];
this.mode.modeSortVisible = false;
},
handleSaveMode() {
let newSort = [];
for (let i = 0; i < this.mode.modeIdsValueTemp.length; i++) {
newSort.push(this.mode.modeIdsValueTemp[i].id)
}
this.form.modeIdsValue = newSort;
this.handleCloseMode()
},
},
}

@ -0,0 +1,484 @@
<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="instrumentModel">-->
<!-- <el-input-->
<!-- v-model="queryParams.instrumentModel"-->
<!-- placeholder="请输入仪器型号"-->
<!-- clearable-->
<!-- @keyup.enter.native="handleQuery"-->
<!-- />-->
<!-- </el-form-item>-->
<!-- <el-form-item label="模式名称" prop="modeName">-->
<!-- <el-input-->
<!-- v-model="queryParams.modeName"-->
<!-- placeholder="请输入模式名称"-->
<!-- clearable-->
<!-- @keyup.enter.native="handleQuery"-->
<!-- />-->
<!-- </el-form-item>-->
<!-- <el-form-item label="模式描述" prop="modeDesc">-->
<!-- <el-input-->
<!-- v-model="queryParams.modeDesc"-->
<!-- placeholder="请输入模式描述"-->
<!-- clearable-->
<!-- @keyup.enter.native="handleQuery"-->
<!-- />-->
<!-- </el-form-item>-->
<!-- <el-form-item label="模式封面图片" prop="modeBanner">-->
<!-- <el-input-->
<!-- v-model="queryParams.modeBanner"-->
<!-- placeholder="请输入模式封面图片"-->
<!-- clearable-->
<!-- @keyup.enter.native="handleQuery"-->
<!-- />-->
<!-- </el-form-item>-->
<!-- <el-form-item label="模式视频" prop="modeVideo">-->
<!-- <el-input-->
<!-- v-model="queryParams.modeVideo"-->
<!-- placeholder="请输入模式视频"-->
<!-- clearable-->
<!-- @keyup.enter.native="handleQuery"-->
<!-- />-->
<!-- </el-form-item>-->
<!-- <el-form-item label="模式分类(每个仪器有不一样的模式分类)" prop="modeClass">-->
<!-- <el-input-->
<!-- v-model="queryParams.modeClass"-->
<!-- placeholder="请输入模式分类(每个仪器有不一样的模式分类)"-->
<!-- clearable-->
<!-- @keyup.enter.native="handleQuery"-->
<!-- />-->
<!-- </el-form-item>-->
<!-- <el-form-item label="是否属于舱体模式0、不是 1、是" prop="isCabinMode">-->
<!-- <el-input-->
<!-- v-model="queryParams.isCabinMode"-->
<!-- placeholder="请输入是否属于舱体模式0、不是 1、是"-->
<!-- clearable-->
<!-- @keyup.enter.native="handleQuery"-->
<!-- />-->
<!-- </el-form-item>-->
<!-- <el-form-item label="模式时长" prop="modeTime">-->
<!-- <el-date-picker clearable-->
<!-- v-model="queryParams.modeTime"-->
<!-- type="date"-->
<!-- value-format="yyyy-MM-dd"-->
<!-- placeholder="请选择模式时长">-->
<!-- </el-date-picker>-->
<!-- </el-form-item>-->
<!-- <el-form-item label="准备视频" prop="preparationVideo">-->
<!-- <el-input-->
<!-- v-model="queryParams.preparationVideo"-->
<!-- placeholder="请输入准备视频"-->
<!-- clearable-->
<!-- @keyup.enter.native="handleQuery"-->
<!-- />-->
<!-- </el-form-item>-->
<!-- <el-form-item label="启动图片GIF" prop="beganVideo">-->
<!-- <el-input-->
<!-- v-model="queryParams.beganVideo"-->
<!-- placeholder="请输入启动图片GIF"-->
<!-- clearable-->
<!-- @keyup.enter.native="handleQuery"-->
<!-- />-->
<!-- </el-form-item>-->
<!-- <el-form-item label="暂停图片GIF" prop="pauseVideo">-->
<!-- <el-input-->
<!-- v-model="queryParams.pauseVideo"-->
<!-- placeholder="请输入暂停图片GIF"-->
<!-- 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="['system:mode: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="['system:mode: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="['system:mode:remove']"-->
<!-- >删除</el-button>-->
<!-- </el-col>-->
<!-- <el-col :span="1.5">-->
<!-- <el-button-->
<!-- type="warning"-->
<!-- plain-->
<!-- icon="el-icon-download"-->
<!-- size="mini"-->
<!-- @click="handleExport"-->
<!-- v-hasPermi="['system:mode:export']"-->
<!-- >导出</el-button>-->
<!-- </el-col>-->
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="modeList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="序号" align="center" prop="id" />
<el-table-column label="仪器类型" align="center" prop="instrumentType" >
<template slot-scope="scope">
<span v-show="scope.row.instrumentType == 1">iot</span>
<span v-show="scope.row.instrumentType == 2">iot</span>
</template>
</el-table-column>
<el-table-column label="仪器型号" align="center" prop="instrumentModel" />
<el-table-column label="模式类型" align="center" prop="modeType" />
<el-table-column label="模式分类" align="center" prop="modeClass" />
<el-table-column label="模式名称" align="center" prop="modeName" />
<el-table-column label="模式时长" align="center" prop="modeTime" width="180">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.modeTime, '{y}-{m}-{d}') }}</span>
</template>
</el-table-column>
<el-table-column label="模式封面图片" align="center" prop="modeBanner" >
<template slot-scope="scope">
<el-image :src="scope.row.modeBanner" style="width: 60px;height: 80px" :preview-src-list="[scope.row.modeBanner]">
<div slot="placeholder" class="image-slot"><span class="dot"></span>
</div>
</el-image>
</template>
</el-table-column>
<el-table-column label="解锁小程序标签" align="center" prop="modeDesc" />
<el-table-column label="解锁企微标签" align="center" prop="modeDesc" />
<el-table-column label="备注 " align="center" prop="remark" />
<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:mode:edit']"
>修改</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['system:mode: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="仪器类型" prop="instrumentType">
<el-select v-model="form.instrumentType">
<el-option label="非iot仪器" :value="1" :key="1"></el-option>
<el-option label="iot仪器" :value="2" :key="2"></el-option>
</el-select>
</el-form-item>
<el-form-item label="模式名称" prop="modeName">
<el-input v-model="form.modeName" placeholder="请输入模式名称" maxlength="10"/>
</el-form-item>
<el-form-item label="模式描述" prop="modeDesc">
<el-input v-model="form.modeDesc" placeholder="请输入模式描述" maxlength="10"/>
</el-form-item>
<el-form-item label="模式封面" prop="modeBanner">
<el-upload
:action="upload.url"
:headers="upload.headers"
list-type="picture-card"
:on-preview="handlePreviewFile"
:on-success="handleBannerFileSuccess"
:on-remove="handleRemove">
<i class="el-icon-plus"></i>
</el-upload>
<el-dialog :visible.sync="dialogVisible">
<img width="100%" :src="form.modeBanner" alt="">
</el-dialog>
</el-form-item>
<el-form-item label="模式视频" prop="modeVideo">
<el-upload
class="upload-demo"
:action="upload.url"
:on-preview="handlePreview"
:on-remove="handleRemove"
:on-success="handleFileSuccess"
:headers="upload.headers"
:file-list="fileList"
>
<el-button size="small" type="primary">点击上传</el-button>
<div slot="tip" class="el-upload__tip">只能上传视频文件且不超过50M</div>
</el-upload>
</el-form-item>
<el-form-item label="备注" prop="remark">
<el-input v-model="form.remark" type="textarea" placeholder="请输入内容" maxlength="50"></el-input>
</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 { listMode, getMode, delMode, addMode, updateMode } from "@/api/system/mode";
import {getToken} from "@/utils/auth";
export default {
name: "Mode",
data() {
return {
//
loading: true,
//
ids: [],
//
single: true,
//
multiple: true,
//
showSearch: true,
//
total: 0,
//
modeList: [],
dialogImageUrl: '',
dialogVisible: false,
//
title: "",
//
open: false,
// list
fileList: [],
bannerList:[],
//
upload: {
//
open: false,
//
title: "",
//
isUploading: false,
//
updateSupport: 0,
//
headers: { Authorization: "Bearer " + getToken() },
//
url: process.env.VUE_APP_BASE_API + "/file/upload"
},
//
queryParams: {
pageNum: 1,
pageSize: 10,
instrumentType: null,
instrumentModel: null,
modeName: null,
modeDesc: null,
modeBanner: null,
modeVideo: null,
modeType: null,
modeClass: null,
isCabinMode: null,
modeTime: null,
preparationVideo: null,
beganVideo: null,
pauseVideo: null,
status: null,
},
//
form: {},
//
rules: {
instrumentType: [
{ required: true, message: "模式类型不能为空", trigger: "blur" }
],
modeName: [
{ required: true, message: "模式名称不能为空", trigger: "blur" }
],
modeBanner: [
{ required: true, message: "封面图片不能为空", trigger: "blur" }
],
modeVideo: [
{ required: true, message: "模式视频不能为空", trigger: "blur" }
],
}
};
},
created() {
this.getList();
},
methods: {
/** 查询模式列表列表 */
getList() {
this.loading = true;
listMode(this.queryParams).then(response => {
this.modeList = response.rows;
this.total = response.total;
this.loading = false;
});
},
//
cancel() {
this.open = false;
this.reset();
},
//
reset() {
this.form = {
id: null,
instrumentType: null,
instrumentModel: null,
modeName: null,
modeDesc: null,
modeBanner: null,
modeVideo: null,
modeType: null,
modeClass: null,
isCabinMode: null,
modeTime: null,
preparationVideo: null,
beganVideo: null,
pauseVideo: null,
status: null,
createBy: null,
createTime: null,
updateBy: null,
updateTime: null,
remark: null
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
//
handleSelectionChange(selection) {
this.ids = selection.map(item => item.id)
this.single = selection.length!==1
this.multiple = !selection.length
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = "添加模式";
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const id = row.id || this.ids
getMode(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) {
updateMode(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addMode(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
}
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
const ids = row.id || this.ids;
this.$modal.confirm('是否确认删除模式列表编号为"' + ids + '"的数据项?').then(function() {
return delMode(ids);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
},
/** 导出按钮操作 */
handleExport() {
this.download('system/mode/export', {
...this.queryParams
}, `mode_${new Date().getTime()}.xlsx`)
},
handleRemove(file, fileList) {
console.log(file, fileList);
},
handlePreview(file) {
console.log(file);
},
//
handleFileSuccess(response, file, fileList, item) {
console.log('上传后的结果==>',JSON.stringify(response))
if(response.code == '200') {
this.fileList = [];
this.fileList.push({
name: response.data.name,
url: response.data.url,
})
}
},
//
handleBannerFileSuccess(response, file, fileList, item) {
console.log('上传后的结果==>',JSON.stringify(response))
if(response.code == '200') {
this.form.modeBanner = response.data.url;
this.bannerList.push(response.data.url);
}
},
handlePreviewFile(file){
this.dialogImageUrl = file.url;
this.dialogVisible = true;
},
}
};
</script>
Loading…
Cancel
Save