Merge remote-tracking branch 'origin/feature-20240104' into feature-20240104

master
elliott 2 years ago
commit f441055b92

@ -72,6 +72,11 @@ public class WxInstrument extends BaseEntity {
*/
private Long isExtraClock;
/**
*
*/
private Integer bindingCredit;
/**
*
*/
@ -104,16 +109,6 @@ public class WxInstrument extends BaseEntity {
*/
private String wecomTagNames;
/**
* ID(xxxx,xxxx,xxx)
*/
private String sceneIds;
/**
* (xxx,xxx,xxx)
*/
private String sceneNames;
/**
*
*/
@ -313,22 +308,6 @@ public class WxInstrument extends BaseEntity {
return wecomTagNames;
}
public void setSceneIds(String sceneIds) {
this.sceneIds = sceneIds;
}
public String getSceneIds() {
return sceneIds;
}
public void setSceneNames(String sceneNames) {
this.sceneNames = sceneNames;
}
public String getSceneNames() {
return sceneNames;
}
public void setNursingTime(LocalTime nursingTime) {
this.nursingTime = nursingTime;
}
@ -449,6 +428,14 @@ public class WxInstrument extends BaseEntity {
this.isExtraClock = isExtraClock;
}
public Integer getBindingCredit() {
return bindingCredit;
}
public void setBindingCredit(Integer bindingCredit) {
this.bindingCredit = bindingCredit;
}
@Override
public String toString() {
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
@ -468,8 +455,6 @@ public class WxInstrument extends BaseEntity {
.append("miniTagNames", getMiniTagNames())
.append("wecomTagIds", getWecomTagIds())
.append("wecomTagNames", getWecomTagNames())
.append("sceneIds", getSceneIds())
.append("sceneNames", getSceneNames())
.append("nursingTime", getNursingTime())
.append("iotVersion", getIotVersion())
.append("iotUpgradeData", getIotUpgradeData())

@ -0,0 +1,98 @@
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_instructions
*
* @author flossom
* @date 2024-01-16
*/
public class WxInstrumentInstructions extends BaseEntity {
private static final long serialVersionUID = 1L;
/**
* $column.columnComment
*/
private Long id;
/**
* id
*/
@Excel(name = "设备id")
private Long instrumentId;
/**
*
*/
@Excel(name = "说明书名称")
private String name;
/**
*
*/
@Excel(name = "说明书链接")
private String link;
/**
* 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 setInstrumentId(Long instrumentId) {
this.instrumentId = instrumentId;
}
public Long getInstrumentId() {
return instrumentId;
}
public void setName(String name) {
this.name = name;
}
public String getName() {
return name;
}
public void setLink(String link) {
this.link = link;
}
public String getLink() {
return link;
}
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("instrumentId", getInstrumentId())
.append("name", getName())
.append("link", getLink())
.append("status", getStatus())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.toString();
}
}

@ -88,6 +88,10 @@ public class WxInstrumentSaveReq {
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private List<LocalDateTime> extraClockTimeRange;
/**
*
*/
private Integer bindingCredit;
/**
* ID(xxxx,xxxx,xxx)
@ -99,16 +103,6 @@ public class WxInstrumentSaveReq {
*/
private String wecomTagIds;
/**
* ID(xxxx,xxxx,xxx)
*/
private String sceneIds;
/**
* (xxx,xxx,xxx)
*/
private String sceneNames;
/**
*
*/
@ -285,22 +279,6 @@ public class WxInstrumentSaveReq {
this.extraClockTimeRange = extraClockTimeRange;
}
public String getSceneIds() {
return sceneIds;
}
public void setSceneIds(String sceneIds) {
this.sceneIds = sceneIds;
}
public String getSceneNames() {
return sceneNames;
}
public void setSceneNames(String sceneNames) {
this.sceneNames = sceneNames;
}
public LocalTime getNursingTime() {
return nursingTime;
}
@ -436,4 +414,12 @@ public class WxInstrumentSaveReq {
public void setWecomTagIds(String wecomTagIds) {
this.wecomTagIds = wecomTagIds;
}
public Integer getBindingCredit() {
return bindingCredit;
}
public void setBindingCredit(Integer bindingCredit) {
this.bindingCredit = bindingCredit;
}
}

@ -0,0 +1,62 @@
package com.flossom.common.core.mapper;
import com.flossom.common.core.domain.entity.WxInstrumentInstructions;
import java.util.List;
/**
* Mapper
*
* @author flossom
* @date 2024-01-16
*/
public interface WxInstrumentInstructionsMapper {
/**
*
*
* @param id
* @return
*/
public WxInstrumentInstructions selectWxInstrumentInstructionsById(Long id);
/**
*
*
* @param wxInstrumentInstructions
* @return
*/
public List<WxInstrumentInstructions> selectWxInstrumentInstructionsList(WxInstrumentInstructions wxInstrumentInstructions);
/**
*
*
* @param wxInstrumentInstructions
* @return
*/
public int insertWxInstrumentInstructions(WxInstrumentInstructions wxInstrumentInstructions);
/**
*
*
* @param wxInstrumentInstructions
* @return
*/
public int updateWxInstrumentInstructions(WxInstrumentInstructions wxInstrumentInstructions);
/**
*
*
* @param id
* @return
*/
public int deleteWxInstrumentInstructionsById(Long id);
/**
*
*
* @param ids
* @return
*/
public int deleteWxInstrumentInstructionsByIds(Long[] ids);
}

@ -0,0 +1,79 @@
<?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.WxInstrumentInstructionsMapper">
<resultMap type="WxInstrumentInstructions" id="WxInstrumentInstructionsResult">
<result property="id" column="id" />
<result property="instrumentId" column="instrument_id" />
<result property="name" column="name" />
<result property="link" column="link" />
<result property="status" column="status" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
</resultMap>
<sql id="selectWxInstrumentInstructionsVo">
select id, instrument_id, name, link, status, create_by, create_time from wx_instrument_instructions
</sql>
<select id="selectWxInstrumentInstructionsList" parameterType="WxInstrumentInstructions" resultMap="WxInstrumentInstructionsResult">
<include refid="selectWxInstrumentInstructionsVo"/>
<where>
<if test="instrumentId != null "> and instrument_id = #{instrumentId}</if>
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
<if test="link != null and link != ''"> and link = #{link}</if>
<if test="status != null "> and status = #{status}</if>
</where>
</select>
<select id="selectWxInstrumentInstructionsById" parameterType="Long" resultMap="WxInstrumentInstructionsResult">
<include refid="selectWxInstrumentInstructionsVo"/>
where id = #{id}
</select>
<insert id="insertWxInstrumentInstructions" parameterType="WxInstrumentInstructions" useGeneratedKeys="true" keyProperty="id">
insert into wx_instrument_instructions
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="instrumentId != null">instrument_id,</if>
<if test="name != null and name != ''">name,</if>
<if test="link != null and link != ''">link,</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="name != null and name != ''">#{name},</if>
<if test="link != null and link != ''">#{link},</if>
<if test="status != null">#{status},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
</trim>
</insert>
<update id="updateWxInstrumentInstructions" parameterType="WxInstrumentInstructions">
update wx_instrument_instructions
<trim prefix="SET" suffixOverrides=",">
<if test="instrumentId != null">instrument_id = #{instrumentId},</if>
<if test="name != null and name != ''">name = #{name},</if>
<if test="link != null and link != ''">link = #{link},</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="deleteWxInstrumentInstructionsById" parameterType="Long">
delete from wx_instrument_instructions where id = #{id}
</delete>
<delete id="deleteWxInstrumentInstructionsByIds" parameterType="String">
delete from wx_instrument_instructions where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

@ -16,14 +16,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="dailyClockCredit" column="daily_clock_credit" />
<result property="isExtraClock" column="is_extra_clock" />
<result property="extraClockCredit" column="extra_clock_credit" />
<result property="bindingCredit" column="binding_credit" />
<result property="startTime" column="start_time" />
<result property="endTime" column="end_time" />
<result property="miniTagIds" column="mini_tag_ids" />
<result property="miniTagNames" column="mini_tag_names" />
<result property="wecomTagIds" column="wecom_tag_ids" />
<result property="wecomTagNames" column="wecom_tag_names" />
<result property="sceneIds" column="scene_ids" />
<result property="sceneNames" column="scene_names" />
<result property="nursingTime" column="nursing_time" />
<result property="iotVersion" column="iot_version" />
<result property="iotUpgradeData" column="iot_upgrade_data" />
@ -46,7 +45,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap>
<sql id="selectWxInstrumentVo">
select id, name, type, model, banner, logo, serial, guarantee, daily_clock_credit, is_extra_clock, extra_clock_credit, start_time, end_time, mini_tag_ids, mini_tag_names, wecom_tag_ids, wecom_tag_names, scene_ids, scene_names, nursing_time, iot_version, iot_upgrade_data, is_scan_code, is_purchase, shopping_appid, shopping_path, bluetooth_connecting, bluetooth_closed, iot_version_upgrade, sort_no, status, manual_code_binding, scan_code_binding, create_by, create_time, update_by, update_time, remark from wx_instrument
select id, name, type, model, banner, logo, serial, guarantee, daily_clock_credit, is_extra_clock, binding_credit, extra_clock_credit, start_time, end_time, mini_tag_ids, mini_tag_names, wecom_tag_ids, wecom_tag_names, nursing_time, iot_version, iot_upgrade_data, is_scan_code, is_purchase, shopping_appid, shopping_path, bluetooth_connecting, bluetooth_closed, iot_version_upgrade, sort_no, status, manual_code_binding, scan_code_binding, create_by, create_time, update_by, update_time, remark from wx_instrument
</sql>
<select id="selectWxInstrumentList" parameterType="WxInstrument" resultMap="WxInstrumentResult">
@ -64,12 +63,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="extraClockCredit != null "> and extra_clock_credit = #{extraClockCredit}</if>
<if test="startTime != null "> and start_time = #{startTime}</if>
<if test="endTime != null "> and end_time = #{endTime}</if>
<if test="bindingCredit != null "> and binding_credit = #{bindingCredit}</if>
<if test="miniTagIds != null and miniTagIds != ''"> and mini_tag_ids = #{miniTagIds}</if>
<if test="miniTagNames != null and miniTagNames != ''"> and mini_tag_names = #{miniTagNames}</if>
<if test="wecomTagIds != null and wecomTagIds != ''"> and wecom_tag_ids = #{wecomTagIds}</if>
<if test="wecomTagNames != null and wecomTagNames != ''"> and wecom_tag_names = #{wecomTagNames}</if>
<if test="sceneIds != null and sceneIds != ''"> and scene_ids = #{sceneIds}</if>
<if test="sceneNames != null and sceneNames != ''"> and scene_names = #{sceneNames}</if>
<if test="nursingTime != null "> and nursing_time = #{nursingTime}</if>
<if test="iotVersion != null and iotVersion != ''"> and iot_version = #{iotVersion}</if>
<if test="iotUpgradeData != null and iotUpgradeData != ''"> and iot_upgrade_data = #{iotUpgradeData}</if>
@ -120,13 +118,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="isExtraClock != null">is_extra_clock,</if>
<if test="extraClockCredit != null">extra_clock_credit,</if>
<if test="startTime != null">start_time,</if>
<if test="bindingCredit != null">binding_credit,</if>
<if test="endTime != null">end_time,</if>
<if test="miniTagIds != null">mini_tag_ids,</if>
<if test="miniTagNames != null">mini_tag_names,</if>
<if test="wecomTagIds != null">wecom_tag_ids,</if>
<if test="wecomTagNames != null">wecom_tag_names,</if>
<if test="sceneIds != null and sceneIds != ''">scene_ids,</if>
<if test="sceneNames != null">scene_names,</if>
<if test="nursingTime != null">nursing_time,</if>
<if test="iotVersion != null">iot_version,</if>
<if test="iotUpgradeData != null">iot_upgrade_data,</if>
@ -158,13 +155,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="dailyClockCredit != null">#{dailyClockCredit},</if>
<if test="isExtraClock != null">#{isExtraClock},</if>
<if test="extraClockCredit != null">#{extraClockCredit},</if>
<if test="bindingCredit != null">#{bindingCredit},</if>
<if test="startTime != null">#{startTime},</if>
<if test="endTime != null">#{endTime},</if>
<if test="miniTagIds != null">#{miniTagIds},</if>
<if test="miniTagNames != null">#{miniTagNames},</if>
<if test="wecomTagIds != null">#{wecomTagIds},</if>
<if test="wecomTagNames != null">#{wecomTagNames},</if>
<if test="sceneIds != null and sceneIds != ''">#{sceneIds},</if>
<if test="sceneNames != null">#{sceneNames},</if>
<if test="nursingTime != null">#{nursingTime},</if>
<if test="iotVersion != null">#{iotVersion},</if>
@ -201,14 +198,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="dailyClockCredit != null">daily_clock_credit = #{dailyClockCredit},</if>
<if test="isExtraClock != null">is_extra_clock = #{isExtraClock},</if>
<if test="extraClockCredit != null">extra_clock_credit = #{extraClockCredit},</if>
<if test="bindingCredit != null">binding_credit = #{bindingCredit},</if>
<if test="startTime != null">start_time = #{startTime},</if>
<if test="endTime != null">end_time = #{endTime},</if>
<if test="miniTagIds != null">mini_tag_ids = #{miniTagIds},</if>
<if test="miniTagNames != null">mini_tag_names = #{miniTagNames},</if>
<if test="wecomTagIds != null">wecom_tag_ids = #{wecomTagIds},</if>
<if test="wecomTagNames != null">wecom_tag_names = #{wecomTagNames},</if>
<if test="sceneIds != null and sceneIds != ''">scene_ids = #{sceneIds},</if>
<if test="sceneNames != null">scene_names = #{sceneNames},</if>
<if test="nursingTime != null">nursing_time = #{nursingTime},</if>
<if test="iotVersion != null">iot_version = #{iotVersion},</if>
<if test="iotUpgradeData != null">iot_upgrade_data = #{iotUpgradeData},</if>

@ -5,6 +5,7 @@ import com.flossom.system.utils.QrCodeUtil;
import org.apache.commons.lang3.StringUtils;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@ -14,6 +15,7 @@ import java.io.IOException;
@RestController
@RequestMapping("/qrcode")
@RefreshScope
public class QrCodeController {
@Value("${qrcode.url}")

@ -0,0 +1,106 @@
package com.flossom.system.controller;
import java.io.*;
import java.util.List;
import javax.servlet.ServletException;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse;
import com.flossom.common.core.domain.R;
import com.flossom.common.core.domain.entity.WxInstrumentInstructions;
import com.flossom.common.core.utils.StringUtils;
import com.flossom.common.core.web.controller.BaseController;
import com.flossom.common.core.web.domain.AjaxResult;
import org.apache.commons.io.IOUtils;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import com.flossom.system.service.IWxInstrumentInstructionsService;
/**
* Controller
*
* @author flossom
* @date 2024-01-16
*/
@RestController
@RequestMapping("/instructions")
public class WxInstrumentInstructionsController extends BaseController {
@Autowired
private IWxInstrumentInstructionsService wxInstrumentInstructionsService;
/**
*
*/
@GetMapping("/list")
public R list(WxInstrumentInstructions wxInstrumentInstructions) {
return R.ok(wxInstrumentInstructionsService.selectWxInstrumentInstructionsList(wxInstrumentInstructions));
}
/**
*
*/
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id) {
return success(wxInstrumentInstructionsService.selectWxInstrumentInstructionsById(id));
}
/**
*
*/
@PostMapping
public AjaxResult add(@RequestBody WxInstrumentInstructions wxInstrumentInstructions) {
return toAjax(wxInstrumentInstructionsService.insertWxInstrumentInstructions(wxInstrumentInstructions));
}
/**
*
*/
@PutMapping
public AjaxResult edit(@RequestBody WxInstrumentInstructions wxInstrumentInstructions) {
return toAjax(wxInstrumentInstructionsService.updateWxInstrumentInstructions(wxInstrumentInstructions));
}
/**
*
*/
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids) {
return toAjax(wxInstrumentInstructionsService.deleteWxInstrumentInstructionsByIds(ids));
}
/**
* TODO
*
*
* @param id id
* @param type
* <p>
*
* {@link utilsTest.pdfPreview.PdfPreviewTest#method1(HttpServletResponse, String)}
*/
@GetMapping("/book")
public void book(HttpServletResponse response, @RequestParam("type") String type, @RequestParam("id") Integer id) throws IOException, ServletException {
WxInstrumentInstructions query = new WxInstrumentInstructions();
query.setInstrumentId(id.longValue());
query.setName(type);
List<WxInstrumentInstructions> instructionList = wxInstrumentInstructionsService.selectWxInstrumentInstructionsList(query);
if (instructionList != null && instructionList.size() > 0 && StringUtils.isNotBlank(instructionList.get(0).getLink())) {
CloseableHttpClient httpClient = HttpClients.createDefault();
HttpGet httpGet = new HttpGet(instructionList.get(0).getLink());
try (CloseableHttpResponse resp = httpClient.execute(httpGet)) {
InputStream inputStream = resp.getEntity().getContent();
ServletOutputStream outputStream = response.getOutputStream();
IOUtils.copy(inputStream, outputStream);
} catch (Exception e) {
e.printStackTrace();
}
}
}
}

@ -0,0 +1,61 @@
package com.flossom.system.service;
import com.flossom.common.core.domain.entity.WxInstrumentInstructions;
import java.util.List;
/**
* Service
*
* @author flossom
* @date 2024-01-16
*/
public interface IWxInstrumentInstructionsService {
/**
*
*
* @param id
* @return
*/
public WxInstrumentInstructions selectWxInstrumentInstructionsById(Long id);
/**
*
*
* @param wxInstrumentInstructions
* @return
*/
public List<WxInstrumentInstructions> selectWxInstrumentInstructionsList(WxInstrumentInstructions wxInstrumentInstructions);
/**
*
*
* @param wxInstrumentInstructions
* @return
*/
public int insertWxInstrumentInstructions(WxInstrumentInstructions wxInstrumentInstructions);
/**
*
*
* @param wxInstrumentInstructions
* @return
*/
public int updateWxInstrumentInstructions(WxInstrumentInstructions wxInstrumentInstructions);
/**
*
*
* @param ids
* @return
*/
public int deleteWxInstrumentInstructionsByIds(Long[] ids);
/**
*
*
* @param id
* @return
*/
public int deleteWxInstrumentInstructionsById(Long id);
}

@ -0,0 +1,90 @@
package com.flossom.system.service.impl;
import java.util.List;
import com.flossom.common.core.domain.entity.WxInstrumentInstructions;
import com.flossom.common.core.mapper.WxInstrumentInstructionsMapper;
import com.flossom.common.core.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.flossom.system.service.IWxInstrumentInstructionsService;
/**
* Service
*
* @author flossom
* @date 2024-01-16
*/
@Service
public class WxInstrumentInstructionsServiceImpl implements IWxInstrumentInstructionsService {
@Autowired
private WxInstrumentInstructionsMapper wxInstrumentInstructionsMapper;
/**
*
*
* @param id
* @return
*/
@Override
public WxInstrumentInstructions selectWxInstrumentInstructionsById(Long id) {
return wxInstrumentInstructionsMapper.selectWxInstrumentInstructionsById(id);
}
/**
*
*
* @param wxInstrumentInstructions
* @return
*/
@Override
public List<WxInstrumentInstructions> selectWxInstrumentInstructionsList(WxInstrumentInstructions wxInstrumentInstructions) {
return wxInstrumentInstructionsMapper.selectWxInstrumentInstructionsList(wxInstrumentInstructions);
}
/**
*
*
* @param wxInstrumentInstructions
* @return
*/
@Override
public int insertWxInstrumentInstructions(WxInstrumentInstructions wxInstrumentInstructions) {
wxInstrumentInstructions.setCreateTime(DateUtils.getNowDate());
return wxInstrumentInstructionsMapper.insertWxInstrumentInstructions(wxInstrumentInstructions);
}
/**
*
*
* @param wxInstrumentInstructions
* @return
*/
@Override
public int updateWxInstrumentInstructions(WxInstrumentInstructions wxInstrumentInstructions) {
return wxInstrumentInstructionsMapper.updateWxInstrumentInstructions(wxInstrumentInstructions);
}
/**
*
*
* @param ids
* @return
*/
@Override
public int deleteWxInstrumentInstructionsByIds(Long[] ids) {
return wxInstrumentInstructionsMapper.deleteWxInstrumentInstructionsByIds(ids);
}
/**
*
*
* @param id
* @return
*/
@Override
public int deleteWxInstrumentInstructionsById(Long id) {
return wxInstrumentInstructionsMapper.deleteWxInstrumentInstructionsById(id);
}
}

@ -60,7 +60,7 @@
"vue-meta": "2.4.0",
"vue-router": "3.4.9",
"vue-video-player": "^4.0.6",
"vuedraggable": "2.24.3",
"vuedraggable": "^2.24.3",
"vuex": "3.6.0"
},
"devDependencies": {

@ -99,3 +99,42 @@ export function delRelate(id) {
method: 'delete'
})
}
// 查询仪器说明书列表
export function listInstructions(query) {
return request({
url: '/system/instructions/list',
method: 'get',
params: query
})
}
// 新增仪器说明书
export function addInstructions(data) {
return request({
url: '/system/instructions',
method: 'post',
data: data
})
}
// 修改仪器说明书
export function updateInstructions(data) {
return request({
url: '/system/instructions',
method: 'put',
data: data
})
}
// 删除仪器说明书
export function delInstructions(id) {
return request({
url: '/system/instructions/' + id,
method: 'delete'
})
}

@ -172,48 +172,25 @@
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:instrument:edit']"
>编辑
<el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)"
v-hasPermi="['system:instrument:edit']">编辑
</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="editMiniProgramTags(scope.row)"
>设置小程序可见标签
<el-button size="mini" type="text" icon="el-icon-edit" @click="editMiniProgramTags(scope.row)">
设置小程序可见标签
</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="editWecomTags(scope.row)"
>设置企微可见标签
<el-button size="mini" type="text" icon="el-icon-edit" @click="editWecomTags(scope.row)">
</el-button>
<el-button size="mini" type="text" icon="el-icon-edit" @click="editInstrumentNameVisible(scope.row)">
<el-button size="mini" type="text" icon="el-icon-edit" @click="editInstrumentNameVisible(scope.row)">
正品控名称配置
</el-button>
<el-button size="mini" type="text" icon="el-icon-edit">配置说明书</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['system:instrument:remove']"
v-if="scope.row.status == 0"
>隐藏
<el-button size="mini" type="text" icon="el-icon-edit" @click="editInstrumentInstructionVisible(scope.row)">
配置说明书
</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['system:instrument:remove']"
v-if="scope.row.status == 1"
>解除隐藏
<el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)"
v-hasPermi="['system:instrument:remove']" v-if="scope.row.status == 0">隐藏
</el-button>
<el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)"
v-hasPermi="['system:instrument:remove']" v-if="scope.row.status == 1">解除隐藏
</el-button>
</template>
</el-table-column>
@ -469,6 +446,9 @@
>
</el-date-picker>
</el-form-item>
<el-form-item label="仪器绑定积分" prop="bindingCredit">
<el-input-number :min="0" :precision="0" v-model="form.bindingCredit" />
</el-form-item>
<el-form-item label="仪器类型" prop="type">
<el-select
v-model="form.type"
@ -489,7 +469,16 @@
</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-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="请输入模式名称"/>
@ -835,12 +824,74 @@
</el-table-column>
<el-table-column>
<template slot-scope="scope">
<el-button size="mini" type="text" icon="el-icon-save" @click="saveInstrumentName(scope.row)"></el-button>
<el-button size="mini" type="text" icon="el-icon-save" @click="saveInstrumentName(scope.row)">
</el-button>
<el-button size="mini" type="text" icon="el-icon-delete" @click="delInstrumentName(scope)"></el-button>
</template>
</el-table-column>
</el-table>
</el-dialog>
<el-dialog title="产品说明书配置" :visible.sync="instrumentInstructions.visible" width="50%">
<el-button size="mini" type="primary" icon="el-icon-add" @click="addInstrumentInstructionLine()">
</el-button>
<el-table v-loading="loading" :data="instrumentInstructions.instructionList">
<el-table-column align="center" prop="name" width="200" label="说明书类型">
<template slot-scope="scope">
<el-input placeholder="请输入说明书类型" v-model="scope.row.name" clearable/>
</template>
</el-table-column>
<el-table-column align="center" prop="link" width="250" label="说明书(每个类型只能上传一个说明书)">
<!-- scope.row.link -->
<template slot-scope="scope">
<el-upload
class="upload-demo"
:action="uploadUrl"
:headers="headers"
:limit="1"
:on-exceed="instructionUploadExceed"
:on-success="(response, file, fileList) => {
return instructionUploadSuccess(response, file, fileList, scope.$index);
}"
:on-error="uploadError"
:file-list="scope.row.fileList"
accept=".pdf,.PDF"
>
<el-button size="small" type="primary">点击上传</el-button>
</el-upload>
</template>
</el-table-column>
<el-table-column label="操作">
<template slot-scope="scope">
<el-button size="mini" type="text" icon="el-icon-save" @click="viewInstrumentInstruction(scope.row)">
</el-button>
<el-button size="mini" type="text" icon="el-icon-save" @click="saveInstrumentInstruction(scope.row)">
</el-button>
<el-button size="mini" type="text" icon="el-icon-delete" @click="delInstrumentInstruction(scope)">
</el-button>
</template>
</el-table-column>
</el-table>
</el-dialog>
<el-dialog
title="排序"
:visible.sync="isSceneIdsVisible"
width="50%"
:close-on-click-modal="false"
:before-close="handleCloseScene">
<div>
<draggable v-model="sceneIdsValue" draggable=".itemTag">
<template v-for="element in sceneIdsValue">
<el-tag :key="element" class="itemTag"> {{element}}</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>
</span>
</el-dialog>
</div>
</template>
@ -852,7 +903,15 @@ import {
addInstrument,
updateInstrument,
getMiniProgramTagTree,
getWecomTagTree, listRelate, delRelate, updateRelate, addRelate,
getWecomTagTree,
listRelate,
delRelate,
updateRelate,
addRelate,
listInstructions,
delInstructions,
addInstructions,
updateInstructions,
} from '@/api/system/instrument'
import {getToken} from '@/utils/auth'
import Treeselect from '@riophae/vue-treeselect'
@ -860,9 +919,11 @@ import '@riophae/vue-treeselect/dist/vue-treeselect.css'
import {upload} from "@/api/upload";
import draggable from 'vuedraggable'
export default {
name: 'Instrument',
components: {Treeselect},
components: {Treeselect,draggable},
data() {
return {
//
@ -983,6 +1044,13 @@ export default {
isExtraClock: [
{required: true, message: '请选择是否开启额外打卡奖励'},
],
bindingCredit: [
{
required: true,
message: '仪器绑定奖励积分',
trigger: 'blur',
},
],
extraClockCredit: [
{
required: true,
@ -1046,6 +1114,36 @@ export default {
//
previewSrc: '', //
isPreviewVideo: true, //
/* 仪器说明书 */
instrumentInstructions: {
visible: false,
instrumentId: null,
instructionList: [{
id: null,
fileList: [],
instrumentId: null,
name: null,
link: null,
}
]
},
isSceneIdsVisible: false,
sceneIdsValue: [], // value
sceneIdsValueTemp: [],
sceneIdsOptions: [
{
value: '黄金糕',
label: '黄金糕'
}, {
value: '双皮奶',
label: '双皮奶'
}, {
value: '蚵仔煎',
label: '蚵仔煎'
}
]
}
},
created() {
@ -1098,6 +1196,7 @@ export default {
extraClockCredit: 0,
/* 额外打卡时间范围 */
extraClockTimeRange: [],
bindingCredit: 0,
miniTagIds: null,
miniTagNames: null,
wecomTagIds: null,
@ -1180,6 +1279,13 @@ export default {
},
/** 重置按钮操作 */
resetQuery() {
this.queryParams = {
pageNum: 1,
pageSize: 10,
id: null,
name: null,
type: null,
};
this.resetForm('queryForm')
this.handleQuery()
},
@ -1313,7 +1419,7 @@ export default {
})
.then(() => {
this.getList()
this.$modal.msgSuccess('隐藏成功')
this.$modal.msgSuccess('操作成功');
})
.catch(() => {
})
@ -1645,6 +1751,104 @@ export default {
})
}
},
/* 仪器说明书 */
addInstrumentInstructionLine() {
this.instrumentInstructions.instructionList.push({
id: null,
fileList: [],
instrumentId: this.instrumentInstructions.instrumentId,
name: null,
link: null,
})
},
editInstrumentInstructionVisible(row) {
this.instrumentInstructions.instrumentId = row.id;
//
listInstructions({
instrumentId: row.id
}).then((response) => {
if (response.data != null && response.data.length > 0) {
this.instrumentInstructions.instructionList = response.data;
for (let i = 0; i < response.data.length; i++) {
this.instrumentInstructions.instructionList[i].fileList = [{
name: response.data[i].name + ".pdf",
url: response.data[i].url,
}];
}
} else {
this.instrumentInstructions.instructionList = [{
id: null,
fileList: [],
instrumentId: this.instrumentInstructions.instrumentId,
name: null,
link: null,
}];
}
this.instrumentInstructions.visible = true;
})
},
delInstrumentInstruction(item) {
// id
if (item.row.id != null) {
//
delInstructions(item.row.id).then((response) => {
this.$modal.msgSuccess('删除成功');
})
}
this.instrumentInstructions.instructionList.splice(item.$index, 1)
if (this.instrumentInstructions.instructionList.length == 0) {
this.addInstrumentInstructionLine();
}
},
saveInstrumentInstruction(item) {
if (item.instrumentId == null) {
this.$modal.msgError('参数异常');
return;
}
if (item.name == null) {
this.$modal.msgError('请输入说明书名称');
return;
}
if (item.link == null) {
this.$modal.msgError('请上传说明书');
return;
}
if (item.id != null) {
updateInstructions(item).then((response) => {
this.$modal.msgSuccess('修改成功');
})
} else {
addInstructions(item).then((response) => {
this.$modal.msgSuccess('新增成功');
})
}
},
instructionUploadExceed(files, fileList) {
this.$message.warning(`您已上传了文件,如需更换,请先删除原上传的文件`)
},
instructionUploadSuccess(response, file, fileList, index) {
if (response.code == 200) {
this.instrumentInstructions.instructionList[index].link = response.data.url;
} else {
this.$message.error('图片插入失败')
}
},
viewInstrumentInstruction(item) {
window.open(item.link, '_blank');
},
openSceneDialog() {
this.sceneIdsValueTemp = JSON.parse(JSON.stringify(this.sceneIdsValue))
this.isSceneIdsVisible = true;
},
handleCloseScene() {
this.isSceneIdsVisible = false;
},
handleSaveScene() {
this.sceneIdsValue = JSON.parse(JSON.stringify(this.sceneIdsValueTemp))
this.handleCloseScene()
},
},
}
</script>
@ -1665,4 +1869,10 @@ export default {
video {
object-fit: fill;
}
.itemTag {
margin-top: 20px;
margin-right: 10px;
cursor: pointer;
}
</style>

Loading…
Cancel
Save