仪器的新增和编辑

master
382696293@qq.com 2 years ago
parent 2e834acce8
commit dffd37aa06

@ -2,7 +2,6 @@ package com.flossom.common.core.domain.entity;
import java.time.LocalDateTime;
import java.time.LocalTime;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.flossom.common.core.web.domain.BaseEntity;

@ -0,0 +1,128 @@
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_file_relate
*
* @author flossom
* @date 2024-01-10
*/
public class WxInstrumentFileRelate extends BaseEntity {
private static final long serialVersionUID = 1L;
/**
* $column.columnComment
*/
private Long id;
/**
* 12
*/
@Excel(name = "分类", readConverterExp = "1=、初次护理、2、仪器介绍规则")
private Integer classify;
/**
* id
*/
@Excel(name = "仪器id")
private Long instrumentId;
/**
*
*/
@Excel(name = "文件地址")
private String file;
/**
*
*/
@Excel(name = "文件类型")
private String fileType;
/**
*
*/
@Excel(name = "内容")
private String message;
/**
* 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 setClassify(Integer classify) {
this.classify = classify;
}
public Integer getClassify() {
return classify;
}
public void setInstrumentId(Long instrumentId) {
this.instrumentId = instrumentId;
}
public Long getInstrumentId() {
return instrumentId;
}
public void setFile(String file) {
this.file = file;
}
public String getFile() {
return file;
}
public void setFileType(String fileType) {
this.fileType = fileType;
}
public String getFileType() {
return fileType;
}
public void setMessage(String message) {
this.message = message;
}
public String getMessage() {
return message;
}
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("classify", getClassify())
.append("instrumentId", getInstrumentId())
.append("file", getFile())
.append("fileType", getFileType())
.append("message", getMessage())
.append("status", getStatus())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.toString();
}
}

@ -1,16 +1,13 @@
package com.flossom.common.core.domain.req;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.flossom.common.core.web.domain.BaseEntity;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.flossom.common.core.domain.entity.WxInstrumentFileRelate;
import org.hibernate.validator.constraints.Length;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.time.LocalDateTime;
import java.time.LocalTime;
import java.util.Date;
import java.util.List;
/**
@ -91,6 +88,17 @@ public class WxInstrumentSaveReq {
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private List<LocalDateTime> extraClockTimeRange;
/**
* ID(xxxx,xxxx,xxx)
*/
private String miniTagIds;
/**
* ID(xxxx,xxxx,xxx)
*/
private String wecomTagIds;
/**
* ID(xxxx,xxxx,xxx)
*/
@ -170,6 +178,17 @@ public class WxInstrumentSaveReq {
*/
private String scanCodeBinding;
/**
* /
*/
private List<WxInstrumentFileRelate> nurseList;
/**
*
*/
private List<WxInstrumentFileRelate> introduceList;
public Long getId() {
return id;
}
@ -385,4 +404,36 @@ public class WxInstrumentSaveReq {
public void setScanCodeBinding(String scanCodeBinding) {
this.scanCodeBinding = scanCodeBinding;
}
public List<WxInstrumentFileRelate> getNurseList() {
return nurseList;
}
public void setNurseList(List<WxInstrumentFileRelate> nurseList) {
this.nurseList = nurseList;
}
public List<WxInstrumentFileRelate> getIntroduceList() {
return introduceList;
}
public void setIntroduceList(List<WxInstrumentFileRelate> introduceList) {
this.introduceList = introduceList;
}
public String getMiniTagIds() {
return miniTagIds;
}
public void setMiniTagIds(String miniTagIds) {
this.miniTagIds = miniTagIds;
}
public String getWecomTagIds() {
return wecomTagIds;
}
public void setWecomTagIds(String wecomTagIds) {
this.wecomTagIds = wecomTagIds;
}
}

@ -0,0 +1,27 @@
package com.flossom.common.core.enums;
/**
* wx_instrument_file_relate: classify
* 12
*
* @author flossom
*/
public enum InstrumentFileClassify {
FIRST_NURSE(1, "初次护理"), INSTRUMENT_INSTRUCTION(2, "仪器介绍");
private final Integer code;
private final String info;
InstrumentFileClassify(Integer code, String info) {
this.code = code;
this.info = info;
}
public Integer getCode() {
return code;
}
public String getInfo() {
return info;
}
}

@ -0,0 +1,72 @@
package com.flossom.common.core.mapper;
import com.flossom.common.core.domain.entity.WxInstrumentFileRelate;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* Mapper
*
* @author flossom
* @date 2024-01-10
*/
public interface WxInstrumentFileRelateMapper {
/**
*
*
* @param id
* @return
*/
public WxInstrumentFileRelate selectWxInstrumentFileRelateById(Long id);
/**
*
*
* @param wxInstrumentFileRelate
* @return
*/
public List<WxInstrumentFileRelate> selectWxInstrumentFileRelateList(WxInstrumentFileRelate wxInstrumentFileRelate);
/**
*
*
* @param wxInstrumentFileRelate
* @return
*/
public int insertWxInstrumentFileRelate(WxInstrumentFileRelate wxInstrumentFileRelate);
/**
*
*
* @param wxInstrumentFileRelate
* @return
*/
public int updateWxInstrumentFileRelate(WxInstrumentFileRelate wxInstrumentFileRelate);
/**
*
*
* @param id
* @return
*/
public int deleteWxInstrumentFileRelateById(Long id);
/**
*
*
* @param ids
* @return
*/
public int deleteWxInstrumentFileRelateByIds(Long[] ids);
/**
*
*
* @return
*/
public int deleteByInstrumentIdAndClassify(@Param("instrumentId") Long instrumentId, @Param("classify") Integer classify);
public List<WxInstrumentFileRelate> selectByInstrumentIdAndClassify(@Param("instrumentId") Long instrumentId, @Param("classify") Integer classify);
}

@ -0,0 +1,98 @@
<?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.WxInstrumentFileRelateMapper">
<resultMap type="WxInstrumentFileRelate" id="WxInstrumentFileRelateResult">
<result property="id" column="id" />
<result property="classify" column="classify" />
<result property="instrumentId" column="instrument_id" />
<result property="file" column="file" />
<result property="fileType" column="file_type" />
<result property="message" column="message" />
<result property="status" column="status" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
</resultMap>
<sql id="selectWxInstrumentFileRelateVo">
select id, classify, instrument_id, file, file_type, message, status, create_by, create_time from wx_instrument_file_relate
</sql>
<select id="selectWxInstrumentFileRelateList" parameterType="WxInstrumentFileRelate" resultMap="WxInstrumentFileRelateResult">
<include refid="selectWxInstrumentFileRelateVo"/>
<where>
<if test="classify != null "> and classify = #{classify}</if>
<if test="instrumentId != null "> and instrument_id = #{instrumentId}</if>
<if test="file != null and file != ''"> and file = #{file}</if>
<if test="fileType != null and fileType != ''"> and file_type = #{fileType}</if>
<if test="message != null and message != ''"> and message = #{message}</if>
<if test="status != null "> and status = #{status}</if>
</where>
</select>
<select id="selectWxInstrumentFileRelateById" parameterType="Long" resultMap="WxInstrumentFileRelateResult">
<include refid="selectWxInstrumentFileRelateVo"/>
where id = #{id}
</select>
<select id="selectByInstrumentIdAndClassify" resultMap="WxInstrumentFileRelateResult">
<include refid="selectWxInstrumentFileRelateVo"/>
where instrument_id = #{instrumentId} and classify = #{classify}
</select>
<insert id="insertWxInstrumentFileRelate" parameterType="WxInstrumentFileRelate" useGeneratedKeys="true" keyProperty="id">
insert into wx_instrument_file_relate
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="classify != null">classify,</if>
<if test="instrumentId != null">instrument_id,</if>
<if test="file != null and file != ''">file,</if>
<if test="fileType != null and fileType != ''">file_type,</if>
<if test="message != null and message != ''">message,</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="classify != null">#{classify},</if>
<if test="instrumentId != null">#{instrumentId},</if>
<if test="file != null and file != ''">#{file},</if>
<if test="fileType != null and fileType != ''">#{fileType},</if>
<if test="message != null and message != ''">#{message},</if>
<if test="status != null">#{status},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
</trim>
</insert>
<update id="updateWxInstrumentFileRelate" parameterType="WxInstrumentFileRelate">
update wx_instrument_file_relate
<trim prefix="SET" suffixOverrides=",">
<if test="classify != null">classify = #{classify},</if>
<if test="instrumentId != null">instrument_id = #{instrumentId},</if>
<if test="file != null and file != ''">file = #{file},</if>
<if test="fileType != null and fileType != ''">file_type = #{fileType},</if>
<if test="message != null and message != ''">message = #{message},</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="deleteWxInstrumentFileRelateById" parameterType="Long">
delete from wx_instrument_file_relate where id = #{id}
</delete>
<delete id="deleteWxInstrumentFileRelateByIds" parameterType="String">
delete from wx_instrument_file_relate where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<delete id="deleteByInstrumentIdAndClassify">
delete from wx_instrument_file_relate where instrument_id = #{instrumentId} and classify = #{classify}
</delete>
</mapper>

@ -104,6 +104,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</select>
<insert id="insertWxInstrument" parameterType="WxInstrument" useGeneratedKeys="true" keyProperty="id">
<selectKey keyProperty="id" resultType="Long" order="AFTER">
SELECT LAST_INSERT_ID()
</selectKey>
insert into wx_instrument
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="name != null and name != ''">name,</if>

@ -56,7 +56,7 @@ public class WxInstrumentController extends BaseController {
@RequiresPermissions("system:instrument:query")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id) {
return success(wxInstrumentService.selectWxInstrumentById(id));
return success(wxInstrumentService.selectWxInstrumentReqById(id));
}
/**
@ -97,12 +97,7 @@ public class WxInstrumentController extends BaseController {
wxInstrumentSaveReq.setShoppingAppid(null);
wxInstrumentSaveReq.setShoppingPath(null);
}
WxInstrument wxInstrument = new WxInstrument();
BeanUtils.copyProperties(wxInstrumentSaveReq, wxInstrument);
wxInstrument.setStartTime(wxInstrumentSaveReq.getExtraClockTimeRange().get(0));
wxInstrument.setEndTime(wxInstrumentSaveReq.getExtraClockTimeRange().get(1));
wxInstrument.setCreateBy(SecurityUtils.getUsername());
return toAjax(wxInstrumentService.insertWxInstrument(wxInstrument));
return toAjax(wxInstrumentService.addWxInstrument(wxInstrumentSaveReq));
}
/**
@ -111,8 +106,8 @@ public class WxInstrumentController extends BaseController {
@RequiresPermissions("system:instrument:edit")
@Log(title = "仪器列", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody WxInstrument wxInstrument) {
return toAjax(wxInstrumentService.updateWxInstrument(wxInstrument));
public AjaxResult edit(@RequestBody WxInstrumentSaveReq wxInstrumentSaveReq) {
return toAjax(wxInstrumentService.updateWxInstrument(wxInstrumentSaveReq));
}
/**

@ -2,6 +2,7 @@ package com.flossom.system.service;
import com.flossom.common.core.domain.entity.WxInstrument;
import com.flossom.common.core.domain.req.WxInstrumentReq;
import com.flossom.common.core.domain.req.WxInstrumentSaveReq;
import java.util.List;
@ -44,14 +45,6 @@ public interface IWxInstrumentService {
*/
public int insertWxInstrument(WxInstrument wxInstrument);
/**
*
*
* @param wxInstrument
* @return
*/
public int updateWxInstrument(WxInstrument wxInstrument);
/**
*
*
@ -67,4 +60,15 @@ public interface IWxInstrumentService {
* @return
*/
public int deleteWxInstrumentById(Long id);
int addWxInstrument(WxInstrumentSaveReq wxInstrumentSaveReq);
/**
*
*
* @return
*/
int updateWxInstrument(WxInstrumentSaveReq wxInstrumentSaveReq);
WxInstrumentSaveReq selectWxInstrumentReqById(Long id);
}

@ -1,17 +1,26 @@
package com.flossom.system.service.impl;
import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
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.req.WxInstrumentReq;
import com.flossom.common.core.domain.req.WxInstrumentSaveReq;
import com.flossom.common.core.enums.InstrumentFileClassify;
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.utils.DateUtils;
import com.flossom.common.core.utils.StringUtils;
import com.flossom.common.security.utils.SecurityUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.flossom.system.service.IWxInstrumentService;
import org.springframework.transaction.annotation.Transactional;
/**
* Service
@ -28,6 +37,9 @@ public class WxInstrumentServiceImpl implements IWxInstrumentService {
@Autowired
private SysTagMapper sysTagMapper;
@Autowired
private WxInstrumentFileRelateMapper wxInstrumentFileRelateMapper;
/**
*
*
@ -39,6 +51,32 @@ public class WxInstrumentServiceImpl implements IWxInstrumentService {
return wxInstrumentMapper.selectWxInstrumentById(id);
}
/**
*
*
* @param id
* @return
*/
@Override
public WxInstrumentSaveReq selectWxInstrumentReqById(Long id) {
WxInstrument wxInstrument = wxInstrumentMapper.selectWxInstrumentById(id);
WxInstrumentSaveReq wxInstrumentSaveReq = new WxInstrumentSaveReq();
BeanUtils.copyProperties(wxInstrument, wxInstrumentSaveReq);
// 时间范围
if (wxInstrument.getStartTime() != null && wxInstrument.getEndTime() != null) {
wxInstrumentSaveReq.setExtraClockTimeRange(Arrays.asList(wxInstrument.getStartTime(), wxInstrument.getEndTime()));
}
// 获取护理弹窗关联
List<WxInstrumentFileRelate> firstNurseRelate = wxInstrumentFileRelateMapper.
selectByInstrumentIdAndClassify(wxInstrument.getId(), InstrumentFileClassify.FIRST_NURSE.getCode());
wxInstrumentSaveReq.setNurseList(firstNurseRelate);
// 获取护理弹窗关联
List<WxInstrumentFileRelate> instructionRelate = wxInstrumentFileRelateMapper.
selectByInstrumentIdAndClassify(wxInstrument.getId(), InstrumentFileClassify.INSTRUMENT_INSTRUCTION.getCode());
wxInstrumentSaveReq.setIntroduceList(instructionRelate);
return wxInstrumentSaveReq;
}
/**
*
*
@ -67,17 +105,72 @@ public class WxInstrumentServiceImpl implements IWxInstrumentService {
return wxInstrumentMapper.insertWxInstrument(wxInstrument);
}
/**
*
*
* @return
*/
@Override
@Transactional
public int addWxInstrument(WxInstrumentSaveReq wxInstrumentSaveReq) {
WxInstrument wxInstrument = new WxInstrument();
BeanUtils.copyProperties(wxInstrumentSaveReq, wxInstrument);
// 打卡时间处理
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);
// 保存初次护理规则
List<WxInstrumentFileRelate> nurseList = wxInstrumentSaveReq.getNurseList();
if (nurseList != null && nurseList.size() > 0) {
Iterator<WxInstrumentFileRelate> nurseIterator = nurseList.iterator();
while (nurseIterator.hasNext()) {
WxInstrumentFileRelate next = nurseIterator.next();
if (StringUtils.isBlank(next.getFile())) {
nurseIterator.remove();
continue;
}
next.setInstrumentId(wxInstrument.getId());
next.setClassify(InstrumentFileClassify.FIRST_NURSE.getCode());
wxInstrumentFileRelateMapper.insertWxInstrumentFileRelate(next);
}
}
// 保存仪器介绍规则
List<WxInstrumentFileRelate> introduceList = wxInstrumentSaveReq.getIntroduceList();
if (introduceList != null && introduceList.size() > 0) {
Iterator<WxInstrumentFileRelate> introduceIterator = introduceList.iterator();
while (introduceIterator.hasNext()) {
WxInstrumentFileRelate next = introduceIterator.next();
if (StringUtils.isBlank(next.getFile())) {
introduceIterator.remove();
continue;
}
next.setInstrumentId(wxInstrument.getId());
next.setClassify(InstrumentFileClassify.INSTRUMENT_INSTRUCTION.getCode());
wxInstrumentFileRelateMapper.insertWxInstrumentFileRelate(next);
}
}
return i;
}
/**
*
*
* @param wxInstrument
* @param wxInstrumentSaveReq
* @return
*/
@Override
public int updateWxInstrument(WxInstrument wxInstrument) {
public int updateWxInstrument(WxInstrumentSaveReq wxInstrumentSaveReq) {
WxInstrument wxInstrument = new WxInstrument();
BeanUtils.copyProperties(wxInstrumentSaveReq, wxInstrument);
// 处理小程序标签和企微标签
if (wxInstrument.getMiniTagIds() != null) {
List<String> tagIdList = Arrays.asList(wxInstrument.getMiniTagIds().split(","));
if (wxInstrumentSaveReq.getMiniTagIds() != null) {
List<String> tagIdList = Arrays.asList(wxInstrumentSaveReq.getMiniTagIds().split(","));
StringBuilder tagNames = new StringBuilder();
for (int i = 0; i < tagIdList.size(); i++) {
SysTag sysTag = sysTagMapper.selectDeptById(Long.valueOf(tagIdList.get(i)));
@ -87,9 +180,12 @@ public class WxInstrumentServiceImpl implements IWxInstrumentService {
}
}
wxInstrument.setMiniTagNames(tagNames.toString());
} else {
wxInstrument.setMiniTagNames(null);
}
if (wxInstrument.getWecomTagIds() != null) {
List<String> tagIdList = Arrays.asList(wxInstrument.getWecomTagIds().split(","));
if (wxInstrumentSaveReq.getWecomTagIds() != null) {
List<String> tagIdList = Arrays.asList(wxInstrumentSaveReq.getWecomTagIds().split(","));
StringBuilder tagNames = new StringBuilder();
for (int i = 0; i < tagIdList.size(); i++) {
SysTag sysTag = sysTagMapper.selectDeptById(Long.valueOf(tagIdList.get(i)));
@ -99,15 +195,55 @@ public class WxInstrumentServiceImpl implements IWxInstrumentService {
}
}
wxInstrument.setWecomTagNames(tagNames.toString());
} else {
wxInstrument.setWecomTagNames(null);
}
wxInstrument.setUpdateTime(DateUtils.getNowDate());
// 打卡时间处理
wxInstrument.setStartTime(wxInstrumentSaveReq.getExtraClockTimeRange().get(0));
wxInstrument.setEndTime(wxInstrumentSaveReq.getExtraClockTimeRange().get(1));
// 保存初次护理规则
List<WxInstrumentFileRelate> nurseList = wxInstrumentSaveReq.getNurseList();
wxInstrumentFileRelateMapper.deleteByInstrumentIdAndClassify(wxInstrumentSaveReq.getId(),
InstrumentFileClassify.FIRST_NURSE.getCode());
if (nurseList != null && nurseList.size() > 0) {
Iterator<WxInstrumentFileRelate> nurseIterator = nurseList.iterator();
while (nurseIterator.hasNext()) {
WxInstrumentFileRelate next = nurseIterator.next();
if (StringUtils.isBlank(next.getFile())) {
nurseIterator.remove();
continue;
}
next.setInstrumentId(wxInstrument.getId());
next.setClassify(InstrumentFileClassify.FIRST_NURSE.getCode());
wxInstrumentFileRelateMapper.insertWxInstrumentFileRelate(next);
}
}
// 保存仪器介绍规则
wxInstrumentFileRelateMapper.deleteByInstrumentIdAndClassify(wxInstrumentSaveReq.getId(),
InstrumentFileClassify.INSTRUMENT_INSTRUCTION.getCode());
List<WxInstrumentFileRelate> introduceList = wxInstrumentSaveReq.getIntroduceList();
Iterator<WxInstrumentFileRelate> introduceIterator = introduceList.iterator();
while (introduceIterator.hasNext()) {
WxInstrumentFileRelate next = introduceIterator.next();
if (StringUtils.isBlank(next.getFile())) {
introduceIterator.remove();
continue;
}
next.setInstrumentId(wxInstrument.getId());
next.setClassify(InstrumentFileClassify.INSTRUMENT_INSTRUCTION.getCode());
wxInstrumentFileRelateMapper.insertWxInstrumentFileRelate(next);
}
return wxInstrumentMapper.updateWxInstrument(wxInstrument);
}
/**
*
*
* @param ids
* @return
*/
@Override

@ -41,10 +41,12 @@
icon="el-icon-search"
size="mini"
@click="handleQuery"
>搜索</el-button
>搜索
</el-button
>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery"
>重置</el-button
>重置
</el-button
>
</el-form-item>
</el-form>
@ -78,8 +80,8 @@
width="55"
align="center"
/>
<el-table-column label="升序排序" align="center" prop="sortNo" />
<el-table-column label="仪器ID" align="center" prop="id" />
<el-table-column label="升序排序" align="center" prop="sortNo"/>
<el-table-column label="仪器ID" align="center" prop="id"/>
<el-table-column label="仪器类型" align="center" prop="type">
<template slot-scope="scope">
<span v-show="scope.row.type == 1"></span>
@ -120,7 +122,7 @@
prop="name"
width="150px"
/>
<el-table-column label="仪器型号" align="center" prop="model" />
<el-table-column label="仪器型号" align="center" prop="model"/>
<el-table-column label="保修日期" align="center" prop="guarantee">
<template slot-scope="scope">
<span v-show="scope.row.guarantee != null"
@ -283,7 +285,7 @@
</el-upload>
<!-- 预览窗口 -->
<el-dialog :visible.sync="bannerFile.dialogVisible" append-to-body>
<img width="100%" :src="bannerFile.dialogImageUrl" alt="" />
<img width="100%" :src="bannerFile.dialogImageUrl" alt=""/>
</el-dialog>
</template>
</el-form-item>
@ -330,7 +332,7 @@
</el-upload>
<!-- 预览窗口 -->
<el-dialog :visible.sync="logoFile.dialogVisible" append-to-body>
<img width="100%" :src="logoFile.dialogImageUrl" alt="" />
<img width="100%" :src="logoFile.dialogImageUrl" alt=""/>
</el-dialog>
</template>
</el-form-item>
@ -377,7 +379,7 @@
</el-upload>
<!-- 预览窗口 -->
<el-dialog :visible.sync="serialFile.dialogVisible" append-to-body>
<img width="100%" :src="serialFile.dialogImageUrl" alt="" />
<img width="100%" :src="serialFile.dialogImageUrl" alt=""/>
</el-dialog>
</template>
</el-form-item>
@ -416,7 +418,7 @@
</el-upload>
</el-form-item>
<el-form-item label="仪器名称" prop="name">
<el-input v-model="form.name" placeholder="请输入仪器名称" />
<el-input v-model="form.name" placeholder="请输入仪器名称"/>
</el-form-item>
<el-form-item label="保修日期" prop="guarantee">
<el-input-number
@ -490,10 +492,10 @@
</el-select>
</el-form-item>
<el-form-item label="模式ID" prop="sceneIds">
<el-input v-model="form.sceneIds" placeholder="请输入模式ID" />
<el-input v-model="form.sceneIds" placeholder="请输入模式ID"/>
</el-form-item>
<el-form-item label="模式名称" prop="sceneNames">
<el-input v-model="form.sceneNames" placeholder="请输入模式名称" />
<el-input v-model="form.sceneNames" placeholder="请输入模式名称"/>
</el-form-item>
<el-form-item label="生成护理记录最短时间" prop="nursingTime">
<el-time-picker
@ -504,7 +506,7 @@
</el-time-picker>
</el-form-item>
<el-form-item label="iot版本" prop="iotVersion">
<el-input v-model="form.iotVersion" placeholder="请输入iot版本" />
<el-input v-model="form.iotVersion" placeholder="请输入iot版本"/>
</el-form-item>
<el-form-item label="iot升级数据文件" prop="iotUpgradeData">
<el-upload
@ -564,7 +566,8 @@
<el-form-item label="初次护理弹窗">
<el-button size="small" type="primary" @click="addNurse()"
>添加规则</el-button
>添加规则
</el-button
>
<input
ref="nurseFile"
@ -588,12 +591,13 @@
size="small"
type="primary"
@click="addNurseFile(scope.$index)"
>上传文件</el-button
>上传文件
</el-button
>
</template>
<template v-else>
<template v-if="scope.row.fileType === 'image'">
<ImagePreview :src="scope.row.file" />
<ImagePreview :src="scope.row.file"/>
</template>
<template v-else>
<div style="width: 80px; height: 80px">
@ -626,7 +630,8 @@
title="确定删除吗?"
>
<el-button slot="reference" type="text" size="small"
>删除</el-button
>删除
</el-button
>
</el-popconfirm>
</template>
@ -636,7 +641,8 @@
<el-form-item label="仪器介绍">
<el-button size="small" type="primary" @click="addIntroduce()"
>添加介绍</el-button
>添加介绍
</el-button
>
<input
ref="introduceFile"
@ -660,12 +666,13 @@
size="small"
type="primary"
@click="addIntroduceFile(scope.$index)"
>上传文件</el-button
>上传文件
</el-button
>
</template>
<template v-else>
<template v-if="scope.row.fileType === 'image'">
<ImagePreview :src="scope.row.file" />
<ImagePreview :src="scope.row.file"/>
</template>
<template v-else>
<div style="width: 80px; height: 80px">
@ -698,7 +705,8 @@
title="确定删除吗?"
>
<el-button slot="reference" type="text" size="small"
>删除</el-button
>删除
</el-button
>
</el-popconfirm>
</template>
@ -781,7 +789,8 @@
<div slot="footer" class="dialog-footer">
<el-button @click="miniProgramTag.visible = false"> </el-button>
<el-button type="primary" @click="submitMiniProgramTagList"
> </el-button
>
</el-button
>
</div>
</el-dialog>
@ -830,15 +839,15 @@ import {
getMiniProgramTagTree,
getWecomTagTree,
} from '@/api/system/instrument'
import { getToken } from '@/utils/auth'
import {getToken} from '@/utils/auth'
import Treeselect from '@riophae/vue-treeselect'
import '@riophae/vue-treeselect/dist/vue-treeselect.css'
import { upload } from "@/api/upload";
import {upload} from "@/api/upload";
export default {
name: 'Instrument',
components: { Treeselect },
components: {Treeselect},
data() {
return {
//
@ -939,15 +948,15 @@ export default {
form: {},
//
rules: {
sortNo: [{ required: true, message: '排序不能为空', trigger: 'blur' }],
banner: [{ required: true, message: '仪器封面不能为空' }],
logo: [{ required: true, message: '仪器logo不能为空' }],
serial: [{ required: true, message: '序列号图片不能为空' }],
sortNo: [{required: true, message: '排序不能为空', trigger: 'blur'}],
banner: [{required: true, message: '仪器封面不能为空'}],
logo: [{required: true, message: '仪器logo不能为空'}],
serial: [{required: true, message: '序列号图片不能为空'}],
name: [
{ required: true, message: '仪器名称不能为空', trigger: 'blur' },
{required: true, message: '仪器名称不能为空', trigger: 'blur'},
],
guarantee: [
{ required: true, message: '请选择保修日期', trigger: 'blur' },
{required: true, message: '请选择保修日期', trigger: 'blur'},
],
dailyClockCredit: [
{
@ -957,7 +966,7 @@ export default {
},
],
isExtraClock: [
{ required: true, message: '请选择是否开启额外打卡奖励' },
{required: true, message: '请选择是否开启额外打卡奖励'},
],
extraClockCredit: [
{
@ -974,10 +983,10 @@ export default {
},
],
type: [
{ required: true, message: '仪器类型不能为空', trigger: 'change' },
{required: true, message: '仪器类型不能为空', trigger: 'change'},
],
model: [
{ required: true, message: '仪器型号不能为空', trigger: 'change' },
{required: true, message: '仪器型号不能为空', trigger: 'change'},
],
nursingTime: [
{
@ -986,12 +995,12 @@ export default {
trigger: 'change',
},
],
isPurchase: [{ required: true, message: '是否支持购买' }],
isPurchase: [{required: true, message: '是否支持购买'}],
shoppingAppid: [
{ required: true, message: '购买商城APPID不能为空', trigger: 'blur' },
{required: true, message: '购买商城APPID不能为空', trigger: 'blur'},
],
shoppingPath: [
{ required: true, message: '购买商城PATH不能为空', trigger: 'blur' },
{required: true, message: '购买商城PATH不能为空', trigger: 'blur'},
],
},
/** 初次护理规则 */
@ -1039,6 +1048,22 @@ export default {
},
//
reset() {
this.nurseIndex = 0;
this.nurseList = [
{
file: '',
fileType: '',
message: '',
}
];
this.introduceIndex = 0;
this.introduceList = [
{
file: '',
fileType: '',
message: '',
},
];
this.form = {
id: null,
name: null,
@ -1073,6 +1098,8 @@ export default {
status: null,
manualCodeBinding: null,
scanCodeBinding: null,
nurseList: null,
introduceList: null,
}
/* 仪器封面 */
this.bannerFile = {
@ -1160,7 +1187,7 @@ export default {
dialogImageUrl: this.form.banner,
dialogVisible: false,
disabled: false,
fileList: [{ name: '', url: this.form.banner }],
fileList: [{name: '', url: this.form.banner}],
}
/* 仪器logo */
this.logoFile = {
@ -1168,7 +1195,7 @@ export default {
dialogImageUrl: this.form.logo,
dialogVisible: false,
disabled: false,
fileList: [{ name: '', url: this.form.logo }],
fileList: [{name: '', url: this.form.logo}],
}
/* 序列号图片 */
this.serialFile = {
@ -1176,56 +1203,68 @@ export default {
dialogImageUrl: this.form.serial,
dialogVisible: false,
disabled: false,
fileList: [{ name: '', url: this.form.serial }],
fileList: [{name: '', url: this.form.serial}],
}
/* 手写绑定介绍视频/图片 */
this.manualFile = {
uploadHide: true,
fileList: [
{ name: '手写绑定介绍视频/图片', url: this.form.manualCodeBinding },
{name: '手写绑定介绍视频/图片', url: this.form.manualCodeBinding},
],
}
/* 扫码绑定介绍视频/图片 */
this.scanFile = {
uploadHide: true,
fileList: [
{ name: '扫码绑定介绍视频/图片', url: this.form.scanCodeBinding },
{name: '扫码绑定介绍视频/图片', url: this.form.scanCodeBinding},
],
}
/* iot升级数据文件 */
this.iotUpgradeFile = {
uploadHide: true,
fileList: [
{ name: 'iot升级数据文件', url: this.form.iotUpgradeData },
{name: 'iot升级数据文件', url: this.form.iotUpgradeData},
],
}
/* 蓝牙连接文件 */
this.bluetoothConnectFile = {
uploadHide: true,
fileList: [
{ name: '蓝牙连接文件', url: this.form.bluetoothConnecting },
{name: '蓝牙连接文件', url: this.form.bluetoothConnecting},
],
}
/* 蓝牙断开连接文件 */
this.bluetoothClosedFile = {
uploadHide: false,
fileList: [
{ name: '蓝牙断开连接文件', url: this.form.bluetoothClosed },
{name: '蓝牙断开连接文件', url: this.form.bluetoothClosed},
],
}
//
if (this.form.isExtraClock == 1) {
this.form.extraClockTimeRange = [
response.data.startTime,
response.data.endTime,
]
this.form.extraClockTimeRange = response.data.extraClockTimeRange;
}
this.open = true
this.title = '修改仪器列'
/* 首次护理管理视频 */
if (response.data.nurseList != null) {
this.nurseIndex = response.data.nurseList.length;
this.nurseList = response.data.nurseList;
}
/* 仪器介绍视频 */
if (response.data.introduceList != null) {
this.introduceIndex = response.data.introduceList.length;
this.introduceList = response.data.introduceList;
}
})
},
/** 提交按钮 */
submitForm() {
console.log(this.nurseList);
this.form.nurseList = this.nurseList;
this.form.introduceList = this.introduceList;
this.$refs['form'].validate((valid) => {
if (valid) {
if (this.form.id != null) {
@ -1256,7 +1295,8 @@ export default {
this.getList()
this.$modal.msgSuccess('隐藏成功')
})
.catch(() => {})
.catch(() => {
})
},
/* 文件上传失败 */
uploadError() {
@ -1497,6 +1537,7 @@ export default {
this.$refs.introduceFile.click()
},
async introduceFileChange(e) {
let files = e.target.files
//
if (files.length) {
let data = await this.commonFileUpload(files[0])
@ -1537,7 +1578,7 @@ export default {
</script>
<style lang="scss" scoped>
v-deep .hide .el-upload--picture-card {
::v-deep .hide .el-upload--picture-card {
display: none;
}
@ -1548,6 +1589,7 @@ v-deep .hide .el-upload--picture-card {
height: 1px;
left: -100px;
}
video {
object-fit: fill;
}

Loading…
Cancel
Save