话术管理-消息模块开发

master
elliott 2 years ago
parent 4aa93e0882
commit 3f1e1e6d44

@ -0,0 +1,223 @@
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_script_message
*
* @author flossom
* @date 2023-12-22
*/
public class WxScriptMessage extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 消息主键ID */
private Long id;
/** 消息类型 1-用户注册 2-提交留言 3-仪器绑定 */
@Excel(name = "消息类型 1-用户注册 2-提交留言 3-仪器绑定")
private Integer messageType;
/** 消息标题 */
@Excel(name = "消息标题")
private String messageTitle;
/** 仪器ID */
@Excel(name = "仪器ID")
private Long machineId;
/** 仪器名字 */
@Excel(name = "仪器名字")
private String machineName;
/** 消息内容 */
@Excel(name = "消息内容")
private String messageContent;
/** 0-开启 1-关闭 */
@Excel(name = "0-开启 1-关闭")
private Integer status;
/** 跳转类型0无跳转、1跳转内部链接、3跳转外部链接、4跳转小程序、5导向视频号、6导向视频号直播间 */
@Excel(name = "跳转类型0无跳转、1跳转内部链接、3跳转外部链接、4跳转小程序、5导向视频号、6导向视频号直播间")
private Integer type;
/** 跳转链接(跳转外部链接、跳转内部链接) */
@Excel(name = "跳转链接", readConverterExp = "跳=转外部链接、跳转内部链接")
private String link;
/** 跳转链接参数(跳转内部链接) */
@Excel(name = "跳转链接参数", readConverterExp = "跳=转内部链接")
private String linkParams;
/** 外链小程序appid跳转小程序 */
@Excel(name = "外链小程序appid", readConverterExp = "跳=转小程序")
private String redirectAppid;
/** 外链小程序url跳转小程序 */
@Excel(name = "外链小程序url", readConverterExp = "跳=转小程序")
private String redirectUrl;
/** 视频号(导向视频号、导向视频号直播间) */
@Excel(name = "视频号", readConverterExp = "导=向视频号、导向视频号直播间")
private String videoNo;
/** 视频号feedId导向视频号 */
@Excel(name = "视频号feedId", readConverterExp = "导=向视频号")
private String feedId;
public void setId(Long id)
{
this.id = id;
}
public Long getId()
{
return id;
}
public void setMessageType(Integer messageType)
{
this.messageType = messageType;
}
public Integer getMessageType()
{
return messageType;
}
public void setMessageTitle(String messageTitle)
{
this.messageTitle = messageTitle;
}
public String getMessageTitle()
{
return messageTitle;
}
public void setMachineId(Long machineId)
{
this.machineId = machineId;
}
public Long getMachineId()
{
return machineId;
}
public void setMachineName(String machineName)
{
this.machineName = machineName;
}
public String getMachineName()
{
return machineName;
}
public void setMessageContent(String messageContent)
{
this.messageContent = messageContent;
}
public String getMessageContent()
{
return messageContent;
}
public void setStatus(Integer status)
{
this.status = status;
}
public Integer getStatus()
{
return status;
}
public void setType(Integer type)
{
this.type = type;
}
public Integer getType()
{
return type;
}
public void setLink(String link)
{
this.link = link;
}
public String getLink()
{
return link;
}
public void setLinkParams(String linkParams)
{
this.linkParams = linkParams;
}
public String getLinkParams()
{
return linkParams;
}
public void setRedirectAppid(String redirectAppid)
{
this.redirectAppid = redirectAppid;
}
public String getRedirectAppid()
{
return redirectAppid;
}
public void setRedirectUrl(String redirectUrl)
{
this.redirectUrl = redirectUrl;
}
public String getRedirectUrl()
{
return redirectUrl;
}
public void setVideoNo(String videoNo)
{
this.videoNo = videoNo;
}
public String getVideoNo()
{
return videoNo;
}
public void setFeedId(String feedId)
{
this.feedId = feedId;
}
public String getFeedId()
{
return feedId;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("messageType", getMessageType())
.append("messageTitle", getMessageTitle())
.append("machineId", getMachineId())
.append("machineName", getMachineName())
.append("messageContent", getMessageContent())
.append("status", getStatus())
.append("type", getType())
.append("link", getLink())
.append("linkParams", getLinkParams())
.append("redirectAppid", getRedirectAppid())
.append("redirectUrl", getRedirectUrl())
.append("videoNo", getVideoNo())
.append("feedId", getFeedId())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.toString();
}
}

@ -0,0 +1,62 @@
package com.flossom.common.core.mapper;
import com.flossom.common.core.domain.entity.WxScriptMessage;
import java.util.List;
/**
* Mapper
*
* @author flossom
* @date 2023-12-22
*/
public interface WxScriptMessageMapper
{
/**
*
*
* @param id
* @return
*/
public WxScriptMessage selectWxScriptMessageById(Long id);
/**
*
*
* @param wxScriptMessage
* @return
*/
public List<WxScriptMessage> selectWxScriptMessageList(WxScriptMessage wxScriptMessage);
/**
*
*
* @param wxScriptMessage
* @return
*/
public int insertWxScriptMessage(WxScriptMessage wxScriptMessage);
/**
*
*
* @param wxScriptMessage
* @return
*/
public int updateWxScriptMessage(WxScriptMessage wxScriptMessage);
/**
*
*
* @param id
* @return
*/
public int deleteWxScriptMessageById(Long id);
/**
*
*
* @param ids
* @return
*/
public int deleteWxScriptMessageByIds(Long[] ids);
}

@ -0,0 +1,134 @@
<?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.WxScriptMessageMapper">
<resultMap type="WxScriptMessage" id="WxScriptMessageResult">
<result property="id" column="id" />
<result property="messageType" column="message_type" />
<result property="messageTitle" column="message_title" />
<result property="machineId" column="machine_id" />
<result property="machineName" column="machine_name" />
<result property="messageContent" column="message_content" />
<result property="status" column="status" />
<result property="type" column="type" />
<result property="link" column="link" />
<result property="linkParams" column="link_params" />
<result property="redirectAppid" column="redirect_appid" />
<result property="redirectUrl" column="redirect_url" />
<result property="videoNo" column="video_no" />
<result property="feedId" column="feed_id" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
</resultMap>
<sql id="selectWxScriptMessageVo">
select id, message_type, message_title, machine_id, machine_name, message_content, status, type, link, link_params, redirect_appid, redirect_url, video_no, feed_id, create_by, create_time, update_by, update_time from wx_script_message
</sql>
<select id="selectWxScriptMessageList" parameterType="WxScriptMessage" resultMap="WxScriptMessageResult">
<include refid="selectWxScriptMessageVo"/>
<where>
<if test="messageType != null "> and message_type = #{messageType}</if>
<if test="messageTitle != null and messageTitle != ''"> and message_title = #{messageTitle}</if>
<if test="machineId != null "> and machine_id = #{machineId}</if>
<if test="machineName != null and machineName != ''"> and machine_name like concat('%', #{machineName}, '%')</if>
<if test="messageContent != null and messageContent != ''"> and message_content = #{messageContent}</if>
<if test="status != null "> and status = #{status}</if>
<if test="type != null "> and type = #{type}</if>
<if test="link != null and link != ''"> and link = #{link}</if>
<if test="linkParams != null and linkParams != ''"> and link_params = #{linkParams}</if>
<if test="redirectAppid != null and redirectAppid != ''"> and redirect_appid = #{redirectAppid}</if>
<if test="redirectUrl != null and redirectUrl != ''"> and redirect_url = #{redirectUrl}</if>
<if test="videoNo != null and videoNo != ''"> and video_no = #{videoNo}</if>
<if test="feedId != null and feedId != ''"> and feed_id = #{feedId}</if>
</where>
</select>
<select id="selectWxScriptMessageById" parameterType="Long" resultMap="WxScriptMessageResult">
<include refid="selectWxScriptMessageVo"/>
where id = #{id}
</select>
<insert id="insertWxScriptMessage" parameterType="WxScriptMessage">
insert into wx_script_message
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if>
<if test="messageType != null">message_type,</if>
<if test="messageTitle != null">message_title,</if>
<if test="machineId != null">machine_id,</if>
<if test="machineName != null">machine_name,</if>
<if test="messageContent != null">message_content,</if>
<if test="status != null">status,</if>
<if test="type != null">type,</if>
<if test="link != null">link,</if>
<if test="linkParams != null">link_params,</if>
<if test="redirectAppid != null">redirect_appid,</if>
<if test="redirectUrl != null">redirect_url,</if>
<if test="videoNo != null">video_no,</if>
<if test="feedId != null">feed_id,</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>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if>
<if test="messageType != null">#{messageType},</if>
<if test="messageTitle != null">#{messageTitle},</if>
<if test="machineId != null">#{machineId},</if>
<if test="machineName != null">#{machineName},</if>
<if test="messageContent != null">#{messageContent},</if>
<if test="status != null">#{status},</if>
<if test="type != null">#{type},</if>
<if test="link != null">#{link},</if>
<if test="linkParams != null">#{linkParams},</if>
<if test="redirectAppid != null">#{redirectAppid},</if>
<if test="redirectUrl != null">#{redirectUrl},</if>
<if test="videoNo != null">#{videoNo},</if>
<if test="feedId != null">#{feedId},</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>
</trim>
</insert>
<update id="updateWxScriptMessage" parameterType="WxScriptMessage">
update wx_script_message
<trim prefix="SET" suffixOverrides=",">
<if test="messageType != null">message_type = #{messageType},</if>
<if test="messageTitle != null">message_title = #{messageTitle},</if>
<if test="machineId != null">machine_id = #{machineId},</if>
<if test="machineName != null">machine_name = #{machineName},</if>
<if test="messageContent != null">message_content = #{messageContent},</if>
<if test="status != null">status = #{status},</if>
<if test="type != null">type = #{type},</if>
<if test="link != null">link = #{link},</if>
<if test="linkParams != null">link_params = #{linkParams},</if>
<if test="redirectAppid != null">redirect_appid = #{redirectAppid},</if>
<if test="redirectUrl != null">redirect_url = #{redirectUrl},</if>
<if test="videoNo != null">video_no = #{videoNo},</if>
<if test="feedId != null">feed_id = #{feedId},</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>
</trim>
where id = #{id}
</update>
<delete id="deleteWxScriptMessageById" parameterType="Long">
delete from wx_script_message where id = #{id}
</delete>
<delete id="deleteWxScriptMessageByIds" parameterType="String">
delete from wx_script_message where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

@ -0,0 +1,106 @@
package com.flossom.system.controller;
import java.util.List;
import java.io.IOException;
import javax.servlet.http.HttpServletResponse;
import com.flossom.common.core.domain.entity.WxScriptMessage;
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.IWxScriptMessageService;
/**
* Controller
*
* @author flossom
* @date 2023-12-22
*/
@RestController
@RequestMapping("/scriptMessage")
public class WxScriptMessageController extends BaseController
{
@Autowired
private IWxScriptMessageService wxScriptMessageService;
/**
*
*/
@RequiresPermissions("system:scriptMessage:list")
@GetMapping("/list")
public TableDataInfo list(WxScriptMessage wxScriptMessage)
{
startPage();
List<WxScriptMessage> list = wxScriptMessageService.selectWxScriptMessageList(wxScriptMessage);
return getDataTable(list);
}
/**
*
*/
@RequiresPermissions("system:scriptMessage:export")
@Log(title = "消息模版", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, WxScriptMessage wxScriptMessage)
{
List<WxScriptMessage> list = wxScriptMessageService.selectWxScriptMessageList(wxScriptMessage);
ExcelUtil<WxScriptMessage> util = new ExcelUtil<WxScriptMessage>(WxScriptMessage.class);
util.exportExcel(response, list, "消息模版数据");
}
/**
*
*/
@RequiresPermissions("system:scriptMessage:query")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return success(wxScriptMessageService.selectWxScriptMessageById(id));
}
/**
*
*/
@RequiresPermissions("system:scriptMessage:add")
@Log(title = "消息模版", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody WxScriptMessage wxScriptMessage)
{
return toAjax(wxScriptMessageService.insertWxScriptMessage(wxScriptMessage));
}
/**
*
*/
@RequiresPermissions("system:scriptMessage:edit")
@Log(title = "消息模版", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody WxScriptMessage wxScriptMessage)
{
return toAjax(wxScriptMessageService.updateWxScriptMessage(wxScriptMessage));
}
/**
*
*/
@RequiresPermissions("system:scriptMessage:remove")
@Log(title = "消息模版", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(wxScriptMessageService.deleteWxScriptMessageByIds(ids));
}
}

@ -0,0 +1,62 @@
package com.flossom.system.service;
import com.flossom.common.core.domain.entity.WxScriptMessage;
import java.util.List;
/**
* Service
*
* @author flossom
* @date 2023-12-22
*/
public interface IWxScriptMessageService
{
/**
*
*
* @param id
* @return
*/
public WxScriptMessage selectWxScriptMessageById(Long id);
/**
*
*
* @param wxScriptMessage
* @return
*/
public List<WxScriptMessage> selectWxScriptMessageList(WxScriptMessage wxScriptMessage);
/**
*
*
* @param wxScriptMessage
* @return
*/
public int insertWxScriptMessage(WxScriptMessage wxScriptMessage);
/**
*
*
* @param wxScriptMessage
* @return
*/
public int updateWxScriptMessage(WxScriptMessage wxScriptMessage);
/**
*
*
* @param ids
* @return
*/
public int deleteWxScriptMessageByIds(Long[] ids);
/**
*
*
* @param id
* @return
*/
public int deleteWxScriptMessageById(Long id);
}

@ -0,0 +1,100 @@
package com.flossom.system.service.impl;
import java.util.List;
import com.flossom.common.core.domain.entity.WxScriptMessage;
import com.flossom.common.core.mapper.WxScriptMessageMapper;
import com.flossom.common.core.utils.DateUtils;
import com.flossom.common.security.utils.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.flossom.system.service.IWxScriptMessageService;
/**
* Service
*
* @author flossom
* @date 2023-12-22
*/
@Service
public class WxScriptMessageServiceImpl implements IWxScriptMessageService
{
@Autowired
private WxScriptMessageMapper wxScriptMessageMapper;
/**
*
*
* @param id
* @return
*/
@Override
public WxScriptMessage selectWxScriptMessageById(Long id)
{
return wxScriptMessageMapper.selectWxScriptMessageById(id);
}
/**
*
*
* @param wxScriptMessage
* @return
*/
@Override
public List<WxScriptMessage> selectWxScriptMessageList(WxScriptMessage wxScriptMessage)
{
return wxScriptMessageMapper.selectWxScriptMessageList(wxScriptMessage);
}
/**
*
*
* @param wxScriptMessage
* @return
*/
@Override
public int insertWxScriptMessage(WxScriptMessage wxScriptMessage)
{
wxScriptMessage.setCreateTime(DateUtils.getNowDate());
wxScriptMessage.setCreateBy(SecurityUtils.getUsername());
return wxScriptMessageMapper.insertWxScriptMessage(wxScriptMessage);
}
/**
*
*
* @param wxScriptMessage
* @return
*/
@Override
public int updateWxScriptMessage(WxScriptMessage wxScriptMessage)
{
wxScriptMessage.setUpdateTime(DateUtils.getNowDate());
wxScriptMessage.setUpdateBy(SecurityUtils.getUsername());
return wxScriptMessageMapper.updateWxScriptMessage(wxScriptMessage);
}
/**
*
*
* @param ids
* @return
*/
@Override
public int deleteWxScriptMessageByIds(Long[] ids)
{
return wxScriptMessageMapper.deleteWxScriptMessageByIds(ids);
}
/**
*
*
* @param id
* @return
*/
@Override
public int deleteWxScriptMessageById(Long id)
{
return wxScriptMessageMapper.deleteWxScriptMessageById(id);
}
}

@ -0,0 +1,44 @@
import request from '@/utils/request'
// 查询消息模版列表
export function listMessage(query) {
return request({
url: '/system/scriptMessage/list',
method: 'get',
params: query
})
}
// 查询消息模版详细
export function getMessage(id) {
return request({
url: '/system/scriptMessage/' + id,
method: 'get'
})
}
// 新增消息模版
export function addMessage(data) {
return request({
url: '/system/scriptMessage',
method: 'post',
data: data
})
}
// 修改消息模版
export function updateMessage(data) {
return request({
url: '/system/scriptMessage',
method: 'put',
data: data
})
}
// 删除消息模版
export function delMessage(id) {
return request({
url: '/system/scriptMessage/' + id,
method: 'delete'
})
}

@ -0,0 +1,477 @@
<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="messageTitle">
<el-input
v-model="queryParams.messageTitle"
placeholder="请输入消息标题"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<!-- <el-form-item label="仪器ID" prop="machineId">-->
<!-- <el-input-->
<!-- v-model="queryParams.machineId"-->
<!-- placeholder="请输入仪器ID"-->
<!-- clearable-->
<!-- @keyup.enter.native="handleQuery"-->
<!-- />-->
<!-- </el-form-item>-->
<!-- <el-form-item label="仪器名字" prop="machineName">-->
<!-- <el-input-->
<!-- v-model="queryParams.machineName"-->
<!-- placeholder="请输入仪器名字"-->
<!-- clearable-->
<!-- @keyup.enter.native="handleQuery"-->
<!-- />-->
<!-- </el-form-item>-->
<!-- <el-form-item label="跳转链接" prop="link">-->
<!-- <el-input-->
<!-- v-model="queryParams.link"-->
<!-- placeholder="请输入跳转链接"-->
<!-- clearable-->
<!-- @keyup.enter.native="handleQuery"-->
<!-- />-->
<!-- </el-form-item>-->
<!-- <el-form-item label="跳转链接参数" prop="linkParams">-->
<!-- <el-input-->
<!-- v-model="queryParams.linkParams"-->
<!-- placeholder="请输入跳转链接参数"-->
<!-- clearable-->
<!-- @keyup.enter.native="handleQuery"-->
<!-- />-->
<!-- </el-form-item>-->
<!-- <el-form-item label="外链小程序appid" prop="redirectAppid">-->
<!-- <el-input-->
<!-- v-model="queryParams.redirectAppid"-->
<!-- placeholder="请输入外链小程序appid"-->
<!-- clearable-->
<!-- @keyup.enter.native="handleQuery"-->
<!-- />-->
<!-- </el-form-item>-->
<!-- <el-form-item label="外链小程序url" prop="redirectUrl">-->
<!-- <el-input-->
<!-- v-model="queryParams.redirectUrl"-->
<!-- placeholder="请输入外链小程序url"-->
<!-- clearable-->
<!-- @keyup.enter.native="handleQuery"-->
<!-- />-->
<!-- </el-form-item>-->
<!-- <el-form-item label="视频号" prop="videoNo">-->
<!-- <el-input-->
<!-- v-model="queryParams.videoNo"-->
<!-- placeholder="请输入视频号"-->
<!-- clearable-->
<!-- @keyup.enter.native="handleQuery"-->
<!-- />-->
<!-- </el-form-item>-->
<!-- <el-form-item label="视频号feedId" prop="feedId">-->
<!-- <el-input-->
<!-- v-model="queryParams.feedId"-->
<!-- placeholder="请输入视频号feedId"-->
<!-- 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:scriptMessage: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:scriptMessage: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:scriptMessage: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:scriptMessage:export']"
>导出</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="messageList" @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="messageType" >
<template slot-scope="scope">
<span v-show="scope.row.messageType == 1"></span>
<span v-show="scope.row.messageType == 2"></span>
<span v-show="scope.row.messageType == 3"></span>
</template>
</el-table-column>
<el-table-column label="消息标题" align="center" prop="messageTitle" />
<el-table-column label="状态" align="center" prop="status" >
<template slot-scope="scope">
<span v-show="scope.row.status == 1"></span>
<span v-show="scope.row.status == 0"></span>
</template>
</el-table-column>
<el-table-column label="消息内容" align="center" prop="messageContent" />
<el-table-column label="更新人" align="center" prop="updateBy" />
<el-table-column label="更新时间" align="center" prop="createTime" width="160">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.updateTime,'{y}-{m}-{d} {h}:{i}') }}</span>
</template>
</el-table-column>
<el-table-column label="创建人" align="center" prop="createBy" />
<el-table-column label="创建时间" align="center" prop="createTime" width="160">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.createTime,'{y}-{m}-{d} {h}:{i}') }}</span>
</template>
</el-table-column>
<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:scriptMessage:edit']"
>修改</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['system:scriptMessage:remove']"
>删除</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-s-tools"
@click="closeStatus(scope.row, 0)"
v-if="scope.row.status==1"
v-hasPermi="['system:siteInfo:edit']"
>开启弹窗</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-s-tools"
v-if="scope.row.status==0"
@click="closeStatus(scope.row, 1)"
v-hasPermi="['system:siteInfo:edit']"
>关闭弹窗</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="600px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-row>
<el-col :span = "12">
<el-form-item label="消息类型" prop="messageType">
<el-select v-model="form.messageType">
<el-option label="用户注册" :value="1" :key="1"></el-option>
<el-option label="提交留言" :value="2" :key="2"></el-option>
<el-option label="仪器绑定" :value="3" :key="3"></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span = "12">
<el-form-item label="消息是否开启" prop="status" label-width="120px">
<el-switch
v-model="form.status"
>
</el-switch>
</el-form-item>
</el-col>
</el-row>
<el-form-item label="仪器信息" prop="userType" v-if="form.messageType == 3">
<el-select v-model="form.machineId">
<el-option label="仪器1" :value="0" :key="0"></el-option>
<el-option label="仪器2" :value="1" :key="1"></el-option>
<el-option label="仪器3" :value="2" :key="2"></el-option>
</el-select>
</el-form-item>
<el-form-item label="标题" prop="messageTitle">
<el-input v-model="form.messageTitle" placeholder="请输入消息标题" />
</el-form-item>
<el-form-item label="消息内容">
<editor v-model="form.messageContent" :min-height="192"/>
</el-form-item>
<el-row>
<el-col :span="24">
<el-form-item label="跳转类型" prop="type">
<el-select v-model="form.type">
<el-option label="无跳转" :value="0" :key="0"></el-option>
<el-option label="跳转内部链接" :value="1" :key="1"></el-option>
<el-option label="跳转小程序" :value="4" :key="4"></el-option>
<el-option label="跳转外部链接" :value="3" :key="3"></el-option>
<el-option label="导向视频号" :value="5" :key="5"></el-option>
<el-option label="导向视频号直播间" :value="6" :key="6"></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="24" v-if="form.type == 1">
<el-form-item label="内部链接" prop="link">
<el-input v-model="form.link" placeholder="请输入内部链接" />
</el-form-item>
</el-col>
<el-col :span="24" v-if="form.type == 1">
<el-form-item label="跳转参数" prop="linkParams">
<el-input v-model="form.linkParams" placeholder="请输入跳转参数" />
</el-form-item>
</el-col>
<el-col :span="24" v-if="form.type == 3">
<el-form-item label="外部链接" prop="link">
<el-input v-model="form.link" placeholder="请输入外部链接" />
</el-form-item>
</el-col>
<el-col :span="24" v-if="form.type == 4">
<el-form-item label="APPID" prop="redirectAppid">
<el-input v-model="form.redirectAppid" placeholder="请输入小程序APPID" />
</el-form-item>
</el-col>
<el-col :span="24" v-if="form.type == 4" label-width="90px">
<el-form-item label="页面链接" prop="redirectUrl">
<el-input v-model="form.redirectUrl" placeholder="请输入页面链接" />
</el-form-item>
</el-col>
<el-col :span="24" v-if="form.type == 5 || form.type == 6">
<el-form-item label="视频号ID" prop="videoNo">
<el-input v-model="form.videoNo" placeholder="请输入视频号ID" />
</el-form-item>
</el-col>
<el-col :span="24" v-if="form.type == 5" label-width="90px">
<el-form-item label="feedId" prop="feedId">
<el-input v-model="form.feedId" placeholder="请输入视频号feedId" />
</el-form-item>
</el-col>
</el-row>
</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 { listMessage, getMessage, delMessage, addMessage, updateMessage } from "@/api/system/scriptMessage";
export default {
name: "Message",
data() {
return {
//
loading: true,
//
ids: [],
//
single: true,
//
multiple: true,
//
showSearch: true,
//
total: 0,
//
messageList: [],
//
title: "",
//
open: false,
//
queryParams: {
pageNum: 1,
pageSize: 10,
messageType: null,
messageTitle: null,
machineId: null,
machineName: null,
messageContent: null,
status: null,
type: null,
link: null,
linkParams: null,
redirectAppid: null,
redirectUrl: null,
videoNo: null,
feedId: null,
},
//
form: {},
//
rules: {
}
};
},
created() {
this.getList();
},
methods: {
/** 查询消息模版列表 */
getList() {
this.loading = true;
listMessage(this.queryParams).then(response => {
this.messageList = response.rows;
this.total = response.total;
this.loading = false;
});
},
//
cancel() {
this.open = false;
this.reset();
},
//
reset() {
this.form = {
id: null,
messageType: null,
messageTitle: null,
machineId: null,
machineName: null,
messageContent: null,
status: null,
type: null,
link: null,
linkParams: null,
redirectAppid: null,
redirectUrl: null,
videoNo: null,
feedId: null,
createBy: null,
createTime: null,
updateBy: null,
updateTime: null
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
//
closeStatus(row, status){
row.status = status;
updateMessage(row).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
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
getMessage(id).then(response => {
this.form = response.data;
if(this.form.status == 1) {
this.form.status = false;
} else {
this.form.status = true;
}
this.open = true;
this.title = "修改消息模版";
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
if(this.form.status) {
this.form.status = 0;
} else {
this.form.status = 1;
}
if (this.form.id != null) {
updateMessage(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addMessage(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 delMessage(ids);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
},
/** 导出按钮操作 */
handleExport() {
this.download('system/message/export', {
...this.queryParams
}, `message_${new Date().getTime()}.xlsx`)
}
}
};
</script>
Loading…
Cancel
Save