mp:梳理 message 的前端和后端代码

This commit is contained in:
YunaiV 2023-01-08 18:57:36 +08:00
parent 2ac2af64d4
commit 9ec2f8b60f
14 changed files with 457 additions and 1983 deletions

View File

@ -0,0 +1,5 @@
### 请求 /mp/message/page 接口 => 成功
GET {{baseUrl}}/mp/message/page?accountId=1&pageNo=1&pageSize=10
Content-Type: application/json
Authorization: Bearer {{token}}
tenant-id: {{adminTenentId}}

View File

@ -1,25 +1,25 @@
package cn.iocoder.yudao.module.mp.controller.admin.message; package cn.iocoder.yudao.module.mp.controller.admin.message;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.mp.controller.admin.message.vo.MpMessagePageReqVO;
import cn.iocoder.yudao.module.mp.controller.admin.message.vo.MpMessageRespVO;
import cn.iocoder.yudao.module.mp.convert.message.MpMessageConvert;
import cn.iocoder.yudao.module.mp.dal.dataobject.message.MpMessageDO; import cn.iocoder.yudao.module.mp.dal.dataobject.message.MpMessageDO;
import org.springframework.web.bind.annotation.*; import cn.iocoder.yudao.module.mp.service.message.MpMessageService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource; import javax.annotation.Resource;
import javax.validation.Valid;
import org.springframework.validation.annotation.Validated;
import org.springframework.security.access.prepost.PreAuthorize;
import io.swagger.annotations.*;
import javax.validation.*;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
import cn.iocoder.yudao.module.mp.controller.admin.message.vo.*;
import cn.iocoder.yudao.module.mp.convert.message.MpMessageConvert;
import cn.iocoder.yudao.module.mp.service.message.MpMessageService;
@Api(tags = "管理后台 - 粉丝消息表") @Api(tags = "管理后台 - 粉丝消息表")
@RestController @RestController
@RequestMapping("/mp/message") @RequestMapping("/mp/message")
@ -31,7 +31,7 @@ public class MpMessageController {
@GetMapping("/page") @GetMapping("/page")
@ApiOperation("获得粉丝消息表分页") @ApiOperation("获得粉丝消息表分页")
@PreAuthorize("@ss.hasPermission('wechatMp:wx-fans-msg:query')") @PreAuthorize("@ss.hasPermission('mp:message:query')")
public CommonResult<PageResult<MpMessageRespVO>> getWxFansMsgPage(@Valid MpMessagePageReqVO pageVO) { public CommonResult<PageResult<MpMessageRespVO>> getWxFansMsgPage(@Valid MpMessagePageReqVO pageVO) {
PageResult<MpMessageDO> pageResult = mpMessageService.getWxFansMsgPage(pageVO); PageResult<MpMessageDO> pageResult = mpMessageService.getWxFansMsgPage(pageVO);
return success(MpMessageConvert.INSTANCE.convertPage(pageResult)); return success(MpMessageConvert.INSTANCE.convertPage(pageResult));

View File

@ -1,7 +1,14 @@
package cn.iocoder.yudao.module.mp.controller.admin.message.vo; package cn.iocoder.yudao.module.mp.controller.admin.message.vo;
import lombok.*; import cn.iocoder.yudao.module.mp.dal.dataobject.account.MpAccountDO;
import io.swagger.annotations.*; import cn.iocoder.yudao.module.mp.dal.dataobject.message.MpMessageDO;
import cn.iocoder.yudao.module.mp.dal.dataobject.user.MpUserDO;
import cn.iocoder.yudao.module.mp.enums.message.MpMessageSendFromEnum;
import com.baomidou.mybatisplus.annotation.TableField;
import lombok.Data;
import me.chanjar.weixin.common.api.WxConsts;
import java.util.List;
/** /**
* 粉丝消息表 Base VO提供给添加修改详细的子 VO 使用 * 粉丝消息表 Base VO提供给添加修改详细的子 VO 使用
@ -10,37 +17,161 @@ import io.swagger.annotations.*;
@Data @Data
public class MpMessageBaseVO { public class MpMessageBaseVO {
@ApiModelProperty(value = "用户标识") /**
* 微信公众号消息 id
*/
private Long msgId;
/**
* 微信公众号 ID
*
* 关联 {@link MpAccountDO#getId()}
*/
private Long accountId;
/**
* 微信公众号 appid
*
* 冗余 {@link MpAccountDO#getAppId()}
*/
private String appId;
/**
* 微信用户编号
*
* 关联 {@link MpUserDO#getId()}
*/
private Long userId;
/**
* 用户标识
*
* 冗余 {@link MpUserDO#getOpenid()}
*/
private String openid; private String openid;
@ApiModelProperty(value = "昵称") /**
private byte[] nickname; * 消息类型
*
* 枚举 {@link WxConsts.XmlMsgType}
*/
private String type;
/**
* 消息来源
*
* 枚举 {@link MpMessageSendFromEnum}
*/
private Integer sendFrom;
@ApiModelProperty(value = "头像地址") // ========= 普通消息内容 https://developers.weixin.qq.com/doc/offiaccount/Message_Management/Receiving_standard_messages.html
private String headimgUrl;
@ApiModelProperty(value = "微信账号ID") /**
private String wxAccountId; * 消息内容
*
@ApiModelProperty(value = "消息类型") * 消息类型为 {@link WxConsts.XmlMsgType} TEXT
private String msgType; */
@ApiModelProperty(value = "内容")
private String content; private String content;
@ApiModelProperty(value = "最近一条回复内容") /**
private String resContent; * 通过素材管理中的接口上传多媒体文件得到的 id
*
@ApiModelProperty(value = "是否已回复") * 消息类型为 {@link WxConsts.XmlMsgType} IMAGEVOICEVIDEO
private String isRes; */
@ApiModelProperty(value = "微信素材ID")
private String mediaId; private String mediaId;
/**
* 媒体文件的 URL
*/
private String mediaUrl;
/**
* 语音识别后文本
*
* 消息类型为 {@link WxConsts.XmlMsgType} VOICE
*/
private String recognition;
/**
* 语音格式 amrspeex
*
* 消息类型为 {@link WxConsts.XmlMsgType} VOICE
*/
private String format;
/**
* 标题
*
* 消息类型为 {@link WxConsts.XmlMsgType} VIDEOMUSICLINK
*/
private String title;
/**
* 描述
*
* 消息类型为 {@link WxConsts.XmlMsgType} VIDEOMUSIC
*/
private String description;
@ApiModelProperty(value = "微信图片URL") /**
private String picUrl; * 缩略图的媒体 id通过素材管理中的接口上传多媒体文件得到的 id
*
* 消息类型为 {@link WxConsts.XmlMsgType} VIDEO
*/
private String thumbMediaId;
/**
* 缩略图的媒体 URL
*
* 消息类型为 {@link WxConsts.XmlMsgType} VIDEO
*/
private String thumbMediaUrl;
@ApiModelProperty(value = "本地图片路径") /**
private String picPath; * 点击图文消息跳转链接
*
* 消息类型为 {@link WxConsts.XmlMsgType} LINK
*/
private String url;
/**
* 地理位置维度
*
* 消息类型为 {@link WxConsts.XmlMsgType} LOCATION
*/
private Double locationX;
/**
* 地理位置经度
*
* 消息类型为 {@link WxConsts.XmlMsgType} LOCATION
*/
private Double locationY;
/**
* 地图缩放大小
*
* 消息类型为 {@link WxConsts.XmlMsgType} LOCATION
*/
private Double scale;
/**
* 详细地址
*
* 消息类型为 {@link WxConsts.XmlMsgType} LOCATION
*
* 例如说杨浦区黄兴路 221-4 号临
*/
private String label;
/**
* 图文消息数组
*
* 消息类型为 {@link WxConsts.XmlMsgType} NEWS
*/
@TableField(typeHandler = MpMessageDO.ArticleTypeHandler.class)
private List<MpMessageDO.Article> articles;
// ========= 事件推送 https://developers.weixin.qq.com/doc/offiaccount/Message_Management/Receiving_event_pushes.html
/**
* 事件类型
*
* 枚举 {@link WxConsts.EventType}
*/
private String event;
/**
* 事件 Key
*
* 1. {@link WxConsts.EventType} SCANqrscene_ 为前缀后面为二维码的参数值
* 2. {@link WxConsts.EventType} CLICK与自定义菜单接口中 KEY 值对应
*/
private String eventKey;
} }

View File

@ -0,0 +1,27 @@
import request from '@/utils/request'
// 创建粉丝消息表
export function createMessage(data) {
return request({
url: '/mp/message/create',
method: 'post',
data: data
})
}
// 获得粉丝消息表
export function getMessage(id) {
return request({
url: '/mp/message/get?id=' + id,
method: 'get'
})
}
// 获得粉丝消息表 分页
export function getMessagePage(query) {
return request({
url: '/mp/message/page',
method: 'get',
params: query
})
}

View File

@ -1,54 +0,0 @@
import request from '@/utils/request'
// 创建粉丝消息表
export function createWxFansMsg(data) {
return request({
url: '/wechatMp/wx-fans-msg/create',
method: 'post',
data: data
})
}
// 更新粉丝消息表
export function updateWxFansMsg(data) {
return request({
url: '/wechatMp/wx-fans-msg/update',
method: 'put',
data: data
})
}
// 删除粉丝消息表
export function deleteWxFansMsg(id) {
return request({
url: '/wechatMp/wx-fans-msg/delete?id=' + id,
method: 'delete'
})
}
// 获得粉丝消息表
export function getWxFansMsg(id) {
return request({
url: '/wechatMp/wx-fans-msg/get?id=' + id,
method: 'get'
})
}
// 获得粉丝消息表 分页
export function getWxFansMsgPage(query) {
return request({
url: '/wechatMp/wx-fans-msg/page',
method: 'get',
params: query
})
}
// 导出粉丝消息表 Excel
export function exportWxFansMsgExcel(query) {
return request({
url: '/wechatMp/wx-fans-msg/export-excel',
method: 'get',
params: query,
responseType: 'blob'
})
}

View File

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2021 JooLun
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@ -0,0 +1,233 @@
<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="accountId">
<el-select v-model="queryParams.accountId" placeholder="请选择公众号">
<el-option v-for="item in accounts" :key="parseInt(item.id)" :label="item.name" :value="parseInt(item.id)" />
</el-select>
</el-form-item>
<!-- 等待处理 -->
<el-form-item label="消息类型" prop="msgType">
<el-select v-model="queryParams.msgType" placeholder="请选择消息类型" clearable size="small">
<el-option label="请选择字典生成" value=""/>
</el-select>
</el-form-item>
<el-form-item label="用户标识" prop="openid">
<el-input v-model="queryParams.openid" placeholder="请输入用户标识" clearable @keyup.enter.native="handleQuery"/>
</el-form-item>
<el-form-item label="创建时间">
<el-date-picker v-model="dateRangeCreateTime" style="width: 240px" value-format="yyyy-MM-dd"
type="daterange" range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期"/>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" @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="['mp:message:create']">新增
</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<!-- 列表 -->
<el-table v-loading="loading" :data="list">
<el-table-column label="发送时间" align="center" prop="createTime" width="180">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.createTime) }}</span>
</template>
</el-table-column>
<el-table-column label="消息类型" align="center" prop="type"/>
<el-table-column label="用户标识" align="center" prop="openid"/>
<el-table-column label="内容" align="center" prop="content"/>
<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="['mp:message:update']">修改-->
<!-- </el-button>-->
</template>
</el-table-column>
</el-table>
<!-- 分页组件 -->
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize"
@pagination="getList"/>
<!-- 对话框(添加 / 修改) -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="用户标识" prop="openid">
<el-input v-model="form.openid" placeholder="请输入用户标识"/>
</el-form-item>
<el-form-item label="昵称" prop="nickname">
<el-input v-model="form.nickname" placeholder="请输入昵称"/>
</el-form-item>
<el-form-item label="头像地址" prop="headimgUrl">
<el-input v-model="form.headimgUrl" placeholder="请输入头像地址"/>
</el-form-item>
<el-form-item label="微信账号ID" prop="wxAccountId">
<el-input v-model="form.wxAccountId" placeholder="请输入微信账号ID"/>
</el-form-item>
<el-form-item label="消息类型" prop="msgType">
<el-select v-model="form.msgType" placeholder="请选择消息类型">
<el-option label="请选择字典生成" value=""/>
</el-select>
</el-form-item>
<el-form-item label="内容">
<editor v-model="form.content" :min-height="192"/>
</el-form-item>
<el-form-item label="最近一条回复内容">
<editor v-model="form.resContent" :min-height="192"/>
</el-form-item>
<el-form-item label="是否已回复" prop="isRes">
<el-input v-model="form.isRes" placeholder="请输入是否已回复"/>
</el-form-item>
<el-form-item label="微信素材ID" prop="mediaId">
<el-input v-model="form.mediaId" placeholder="请输入微信素材ID"/>
</el-form-item>
<el-form-item label="微信图片URL" prop="picUrl">
<el-input v-model="form.picUrl" placeholder="请输入微信图片URL"/>
</el-form-item>
<el-form-item label="本地图片路径" prop="picPath">
<el-input v-model="form.picPath" placeholder="请输入本地图片路径"/>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import {
createWxFansMsg,
getMessagePage,
} from "@/api/mp/message";
import Editor from '@/components/Editor/index.vue';
export default {
name: "WxFansMsg",
components: {
Editor,
},
data() {
return {
//
loading: true,
//
exportLoading: false,
//
showSearch: true,
//
total: 0,
//
list: [],
//
title: "",
//
open: false,
dateRangeCreateTime: [],
//
queryParams: {
pageNo: 1,
pageSize: 10,
openid: null,
nickname: null,
headimgUrl: null,
wxAccountId: null,
msgType: null,
content: null,
resContent: null,
isRes: null,
mediaId: null,
picUrl: null,
picPath: null,
},
//
form: {},
//
rules: {}
};
},
created() {
this.getList();
},
methods: {
/** 查询列表 */
getList() {
this.loading = true;
//
let params = {...this.queryParams};
this.addBeginAndEndTime(params, this.dateRangeCreateTime, 'createTime');
//
getMessagePage(params).then(response => {
this.list = response.data.list;
this.total = response.data.total;
this.loading = false;
});
},
/** 取消按钮 */
cancel() {
this.open = false;
this.reset();
},
/** 表单重置 */
reset() {
this.form = {
id: undefined,
openid: undefined,
nickname: undefined,
headimgUrl: undefined,
wxAccountId: undefined,
msgType: undefined,
content: undefined,
resContent: undefined,
isRes: undefined,
mediaId: undefined,
picUrl: undefined,
picPath: undefined,
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNo = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.dateRangeCreateTime = [];
this.resetForm("queryForm");
this.handleQuery();
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = "添加粉丝消息表 ";
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (!valid) {
return;
}
//
createWxFansMsg(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
});
},
}
};
</script>

View File

@ -1,318 +0,0 @@
<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="openid">
<el-input v-model="queryParams.openid" placeholder="请输入用户标识" clearable @keyup.enter.native="handleQuery"/>
</el-form-item>
<el-form-item label="昵称" prop="nickname">
<el-input v-model="queryParams.nickname" placeholder="请输入昵称" clearable @keyup.enter.native="handleQuery"/>
</el-form-item>
<el-form-item label="头像地址" prop="headimgUrl">
<el-input v-model="queryParams.headimgUrl" placeholder="请输入头像地址" clearable @keyup.enter.native="handleQuery"/>
</el-form-item>
<el-form-item label="微信账号ID" prop="wxAccountId">
<el-input v-model="queryParams.wxAccountId" placeholder="请输入微信账号ID" clearable
@keyup.enter.native="handleQuery"/>
</el-form-item>
<el-form-item label="消息类型" prop="msgType">
<el-select v-model="queryParams.msgType" placeholder="请选择消息类型" clearable size="small">
<el-option label="请选择字典生成" value=""/>
</el-select>
</el-form-item>
<el-form-item label="是否已回复" prop="isRes">
<el-input v-model="queryParams.isRes" placeholder="请输入是否已回复" clearable @keyup.enter.native="handleQuery"/>
</el-form-item>
<el-form-item label="微信素材ID" prop="mediaId">
<el-input v-model="queryParams.mediaId" placeholder="请输入微信素材ID" clearable @keyup.enter.native="handleQuery"/>
</el-form-item>
<el-form-item label="微信图片URL" prop="picUrl">
<el-input v-model="queryParams.picUrl" placeholder="请输入微信图片URL" clearable @keyup.enter.native="handleQuery"/>
</el-form-item>
<el-form-item label="本地图片路径" prop="picPath">
<el-input v-model="queryParams.picPath" placeholder="请输入本地图片路径" clearable @keyup.enter.native="handleQuery"/>
</el-form-item>
<el-form-item label="创建时间">
<el-date-picker v-model="dateRangeCreateTime" style="width: 240px" value-format="yyyy-MM-dd"
type="daterange" range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期"/>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" @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="['wechatMp:wx-fans-msg:create']">新增
</el-button>
</el-col>
<el-col :span="1.5">
<el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport"
:loading="exportLoading"
v-hasPermi="['wechatMp:wx-fans-msg:export']">导出
</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<!-- 列表 -->
<el-table v-loading="loading" :data="list">
<el-table-column label="主键" align="center" prop="id"/>
<el-table-column label="用户标识" align="center" prop="openid"/>
<el-table-column label="昵称" align="center" prop="nickname"/>
<el-table-column label="头像地址" align="center" prop="headimgUrl"/>
<el-table-column label="微信账号ID" align="center" prop="wxAccountId"/>
<el-table-column label="消息类型" align="center" prop="msgType"/>
<el-table-column label="内容" align="center" prop="content"/>
<el-table-column label="最近一条回复内容" align="center" prop="resContent"/>
<el-table-column label="是否已回复" align="center" prop="isRes"/>
<el-table-column label="微信素材ID" align="center" prop="mediaId"/>
<el-table-column label="微信图片URL" align="center" prop="picUrl"/>
<el-table-column label="本地图片路径" align="center" prop="picPath"/>
<el-table-column label="创建时间" align="center" prop="createTime" width="180">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.createTime) }}</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="['wechatMp:wx-fans-msg:update']">修改
</el-button>
<el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)"
v-hasPermi="['wechatMp:wx-fans-msg:delete']">删除
</el-button>
</template>
</el-table-column>
</el-table>
<!-- 分页组件 -->
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize"
@pagination="getList"/>
<!-- 对话框(添加 / 修改) -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="用户标识" prop="openid">
<el-input v-model="form.openid" placeholder="请输入用户标识"/>
</el-form-item>
<el-form-item label="昵称" prop="nickname">
<el-input v-model="form.nickname" placeholder="请输入昵称"/>
</el-form-item>
<el-form-item label="头像地址" prop="headimgUrl">
<el-input v-model="form.headimgUrl" placeholder="请输入头像地址"/>
</el-form-item>
<el-form-item label="微信账号ID" prop="wxAccountId">
<el-input v-model="form.wxAccountId" placeholder="请输入微信账号ID"/>
</el-form-item>
<el-form-item label="消息类型" prop="msgType">
<el-select v-model="form.msgType" placeholder="请选择消息类型">
<el-option label="请选择字典生成" value=""/>
</el-select>
</el-form-item>
<el-form-item label="内容">
<editor v-model="form.content" :min-height="192"/>
</el-form-item>
<el-form-item label="最近一条回复内容">
<editor v-model="form.resContent" :min-height="192"/>
</el-form-item>
<el-form-item label="是否已回复" prop="isRes">
<el-input v-model="form.isRes" placeholder="请输入是否已回复"/>
</el-form-item>
<el-form-item label="微信素材ID" prop="mediaId">
<el-input v-model="form.mediaId" placeholder="请输入微信素材ID"/>
</el-form-item>
<el-form-item label="微信图片URL" prop="picUrl">
<el-input v-model="form.picUrl" placeholder="请输入微信图片URL"/>
</el-form-item>
<el-form-item label="本地图片路径" prop="picPath">
<el-input v-model="form.picPath" placeholder="请输入本地图片路径"/>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import {
createWxFansMsg,
updateWxFansMsg,
deleteWxFansMsg,
getWxFansMsg,
getWxFansMsgPage,
exportWxFansMsgExcel
} from "@/api/wechatMp/wxFansMsg";
import Editor from '@/components/Editor';
export default {
name: "WxFansMsg",
components: {
Editor,
},
data() {
return {
//
loading: true,
//
exportLoading: false,
//
showSearch: true,
//
total: 0,
//
list: [],
//
title: "",
//
open: false,
dateRangeCreateTime: [],
//
queryParams: {
pageNo: 1,
pageSize: 10,
openid: null,
nickname: null,
headimgUrl: null,
wxAccountId: null,
msgType: null,
content: null,
resContent: null,
isRes: null,
mediaId: null,
picUrl: null,
picPath: null,
},
//
form: {},
//
rules: {}
};
},
created() {
this.getList();
},
methods: {
/** 查询列表 */
getList() {
this.loading = true;
//
let params = {...this.queryParams};
this.addBeginAndEndTime(params, this.dateRangeCreateTime, 'createTime');
//
getWxFansMsgPage(params).then(response => {
this.list = response.data.list;
this.total = response.data.total;
this.loading = false;
});
},
/** 取消按钮 */
cancel() {
this.open = false;
this.reset();
},
/** 表单重置 */
reset() {
this.form = {
id: undefined,
openid: undefined,
nickname: undefined,
headimgUrl: undefined,
wxAccountId: undefined,
msgType: undefined,
content: undefined,
resContent: undefined,
isRes: undefined,
mediaId: undefined,
picUrl: undefined,
picPath: undefined,
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNo = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.dateRangeCreateTime = [];
this.resetForm("queryForm");
this.handleQuery();
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = "添加粉丝消息表 ";
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const id = row.id;
getWxFansMsg(id).then(response => {
this.form = response.data;
this.open = true;
this.title = "修改粉丝消息表 ";
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (!valid) {
return;
}
//
if (this.form.id != null) {
updateWxFansMsg(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
return;
}
//
createWxFansMsg(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
});
},
/** 删除按钮操作 */
handleDelete(row) {
const id = row.id;
this.$modal.confirm('是否确认删除粉丝消息表 编号为"' + id + '"的数据项?').then(function () {
return deleteWxFansMsg(id);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {
});
},
/** 导出按钮操作 */
handleExport() {
//
let params = {...this.queryParams};
params.pageNo = undefined;
params.pageSize = undefined;
this.addBeginAndEndTime(params, this.dateRangeCreateTime, 'createTime');
//
this.$modal.confirm('是否确认导出所有粉丝消息表 数据项?').then(() => {
this.exportLoading = true;
return exportWxFansMsgExcel(params);
}).then(response => {
this.$download.excel(response, '粉丝消息表 .xls');
this.exportLoading = false;
}).catch(() => {
});
}
}
};
</script>

View File

@ -1,235 +0,0 @@
<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="粉丝消息ID" prop="fansMsgId">
<el-input v-model="queryParams.fansMsgId" placeholder="请输入粉丝消息ID" clearable @keyup.enter.native="handleQuery"/>
</el-form-item>
<el-form-item label="创建时间">
<el-date-picker v-model="dateRangeCreateTime" style="width: 240px" value-format="yyyy-MM-dd"
type="daterange" range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期"/>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" @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="['wechatMp:wx-fans-msg-res:create']">新增
</el-button>
</el-col>
<el-col :span="1.5">
<el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport"
:loading="exportLoading"
v-hasPermi="['wechatMp:wx-fans-msg-res:export']">导出
</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<!-- 列表 -->
<el-table v-loading="loading" :data="list">
<el-table-column label="主键" align="center" prop="id"/>
<el-table-column label="粉丝消息ID" align="center" prop="fansMsgId"/>
<el-table-column label="回复内容" align="center" prop="resContent"/>
<el-table-column label="创建时间" align="center" prop="createTime" width="180">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.createTime) }}</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="['wechatMp:wx-fans-msg-res:update']">修改
</el-button>
<el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)"
v-hasPermi="['wechatMp:wx-fans-msg-res:delete']">删除
</el-button>
</template>
</el-table-column>
</el-table>
<!-- 分页组件 -->
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize"
@pagination="getList"/>
<!-- 对话框(添加 / 修改) -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="粉丝消息ID" prop="fansMsgId">
<el-input v-model="form.fansMsgId" placeholder="请输入粉丝消息ID"/>
</el-form-item>
<el-form-item label="回复内容">
<editor v-model="form.resContent" :min-height="192"/>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import {
createWxFansMsgRes,
updateWxFansMsgRes,
deleteWxFansMsgRes,
getWxFansMsgRes,
getWxFansMsgResPage,
exportWxFansMsgResExcel
} from "@/api/wechatMp/wxFansMsgRes";
import Editor from '@/components/Editor';
export default {
name: "WxFansMsgRes",
components: {
Editor,
},
data() {
return {
//
loading: true,
//
exportLoading: false,
//
showSearch: true,
//
total: 0,
//
list: [],
//
title: "",
//
open: false,
dateRangeCreateTime: [],
//
queryParams: {
pageNo: 1,
pageSize: 10,
fansMsgId: null,
resContent: null,
},
//
form: {},
//
rules: {}
};
},
created() {
this.getList();
},
methods: {
/** 查询列表 */
getList() {
this.loading = true;
//
let params = {...this.queryParams};
this.addBeginAndEndTime(params, this.dateRangeCreateTime, 'createTime');
//
getWxFansMsgResPage(params).then(response => {
this.list = response.data.list;
this.total = response.data.total;
this.loading = false;
});
},
/** 取消按钮 */
cancel() {
this.open = false;
this.reset();
},
/** 表单重置 */
reset() {
this.form = {
id: undefined,
fansMsgId: undefined,
resContent: undefined,
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNo = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.dateRangeCreateTime = [];
this.resetForm("queryForm");
this.handleQuery();
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = "添加回复粉丝消息历史表 ";
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const id = row.id;
getWxFansMsgRes(id).then(response => {
this.form = response.data;
this.open = true;
this.title = "修改回复粉丝消息历史表 ";
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (!valid) {
return;
}
//
if (this.form.id != null) {
updateWxFansMsgRes(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
return;
}
//
createWxFansMsgRes(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
});
},
/** 删除按钮操作 */
handleDelete(row) {
const id = row.id;
this.$modal.confirm('是否确认删除回复粉丝消息历史表 编号为"' + id + '"的数据项?').then(function () {
return deleteWxFansMsgRes(id);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {
});
},
/** 导出按钮操作 */
handleExport() {
//
let params = {...this.queryParams};
params.pageNo = undefined;
params.pageSize = undefined;
this.addBeginAndEndTime(params, this.dateRangeCreateTime, 'createTime');
//
this.$modal.confirm('是否确认导出所有回复粉丝消息历史表 数据项?').then(() => {
this.exportLoading = true;
return exportWxFansMsgResExcel(params);
}).then(response => {
this.$download.excel(response, '回复粉丝消息历史表 .xls');
this.exportLoading = false;
}).catch(() => {
});
}
}
};
</script>

View File

@ -1,340 +0,0 @@
<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="title">
<el-input v-model="queryParams.title" placeholder="请输入标题" clearable @keyup.enter.native="handleQuery"/>
</el-form-item>
<el-form-item label="摘要" prop="digest">
<el-input v-model="queryParams.digest" placeholder="请输入摘要" clearable @keyup.enter.native="handleQuery"/>
</el-form-item>
<el-form-item label="作者" prop="author">
<el-input v-model="queryParams.author" placeholder="请输入作者" clearable @keyup.enter.native="handleQuery"/>
</el-form-item>
<el-form-item label="是否展示封面图片0/1" prop="showCoverPic">
<el-input v-model="queryParams.showCoverPic" placeholder="请输入是否展示封面图片0/1" clearable
@keyup.enter.native="handleQuery"/>
</el-form-item>
<el-form-item label="上传微信,封面图片标识" prop="thumbMediaId">
<el-input v-model="queryParams.thumbMediaId" placeholder="请输入上传微信,封面图片标识" clearable
@keyup.enter.native="handleQuery"/>
</el-form-item>
<el-form-item label="内容链接" prop="contentSourceUrl">
<el-input v-model="queryParams.contentSourceUrl" placeholder="请输入内容链接" clearable
@keyup.enter.native="handleQuery"/>
</el-form-item>
<el-form-item label="文章排序" prop="orderNo">
<el-input v-model="queryParams.orderNo" placeholder="请输入文章排序" clearable @keyup.enter.native="handleQuery"/>
</el-form-item>
<el-form-item label="图片路径" prop="picPath">
<el-input v-model="queryParams.picPath" placeholder="请输入图片路径" clearable @keyup.enter.native="handleQuery"/>
</el-form-item>
<el-form-item label="是否可以留言" prop="needOpenComment">
<el-input v-model="queryParams.needOpenComment" placeholder="请输入是否可以留言" clearable
@keyup.enter.native="handleQuery"/>
</el-form-item>
<el-form-item label="是否仅粉丝可以留言" prop="onlyFansCanComment">
<el-input v-model="queryParams.onlyFansCanComment" placeholder="请输入是否仅粉丝可以留言" clearable
@keyup.enter.native="handleQuery"/>
</el-form-item>
<el-form-item label="图文ID" prop="newsId">
<el-input v-model="queryParams.newsId" placeholder="请输入图文ID" clearable @keyup.enter.native="handleQuery"/>
</el-form-item>
<el-form-item label="微信账号ID" prop="wxAccountId">
<el-input v-model="queryParams.wxAccountId" placeholder="请输入微信账号ID" clearable
@keyup.enter.native="handleQuery"/>
</el-form-item>
<el-form-item label="创建时间">
<el-date-picker v-model="dateRangeCreateTime" style="width: 240px" value-format="yyyy-MM-dd"
type="daterange" range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期"/>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" @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="['wechatMp:wx-news-article-item:create']">新增
</el-button>
</el-col>
<el-col :span="1.5">
<el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport"
:loading="exportLoading"
v-hasPermi="['wechatMp:wx-news-article-item:export']">导出
</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<!-- 列表 -->
<el-table v-loading="loading" :data="list">
<el-table-column label="主键" align="center" prop="id"/>
<el-table-column label="标题" align="center" prop="title"/>
<el-table-column label="摘要" align="center" prop="digest"/>
<el-table-column label="作者" align="center" prop="author"/>
<el-table-column label="是否展示封面图片0/1" align="center" prop="showCoverPic"/>
<el-table-column label="上传微信,封面图片标识" align="center" prop="thumbMediaId"/>
<el-table-column label="内容" align="center" prop="content"/>
<el-table-column label="内容链接" align="center" prop="contentSourceUrl"/>
<el-table-column label="文章排序" align="center" prop="orderNo"/>
<el-table-column label="图片路径" align="center" prop="picPath"/>
<el-table-column label="是否可以留言" align="center" prop="needOpenComment"/>
<el-table-column label="是否仅粉丝可以留言" align="center" prop="onlyFansCanComment"/>
<el-table-column label="图文ID" align="center" prop="newsId"/>
<el-table-column label="微信账号ID" align="center" prop="wxAccountId"/>
<el-table-column label="创建时间" align="center" prop="createTime" width="180">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.createTime) }}</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="['wechatMp:wx-news-article-item:update']">修改
</el-button>
<el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)"
v-hasPermi="['wechatMp:wx-news-article-item:delete']">删除
</el-button>
</template>
</el-table-column>
</el-table>
<!-- 分页组件 -->
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize"
@pagination="getList"/>
<!-- 对话框(添加 / 修改) -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="标题" prop="title">
<el-input v-model="form.title" placeholder="请输入标题"/>
</el-form-item>
<el-form-item label="摘要" prop="digest">
<el-input v-model="form.digest" placeholder="请输入摘要"/>
</el-form-item>
<el-form-item label="作者" prop="author">
<el-input v-model="form.author" placeholder="请输入作者"/>
</el-form-item>
<el-form-item label="是否展示封面图片0/1" prop="showCoverPic">
<el-input v-model="form.showCoverPic" placeholder="请输入是否展示封面图片0/1"/>
</el-form-item>
<el-form-item label="上传微信,封面图片标识" prop="thumbMediaId">
<el-input v-model="form.thumbMediaId" placeholder="请输入上传微信,封面图片标识"/>
</el-form-item>
<el-form-item label="内容">
<editor v-model="form.content" :min-height="192"/>
</el-form-item>
<el-form-item label="内容链接" prop="contentSourceUrl">
<el-input v-model="form.contentSourceUrl" placeholder="请输入内容链接"/>
</el-form-item>
<el-form-item label="文章排序" prop="orderNo">
<el-input v-model="form.orderNo" placeholder="请输入文章排序"/>
</el-form-item>
<el-form-item label="图片路径" prop="picPath">
<el-input v-model="form.picPath" placeholder="请输入图片路径"/>
</el-form-item>
<el-form-item label="是否可以留言" prop="needOpenComment">
<el-input v-model="form.needOpenComment" placeholder="请输入是否可以留言"/>
</el-form-item>
<el-form-item label="是否仅粉丝可以留言" prop="onlyFansCanComment">
<el-input v-model="form.onlyFansCanComment" placeholder="请输入是否仅粉丝可以留言"/>
</el-form-item>
<el-form-item label="图文ID" prop="newsId">
<el-input v-model="form.newsId" placeholder="请输入图文ID"/>
</el-form-item>
<el-form-item label="微信账号ID" prop="wxAccountId">
<el-input v-model="form.wxAccountId" placeholder="请输入微信账号ID"/>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import {
createWxNewsArticleItem,
updateWxNewsArticleItem,
deleteWxNewsArticleItem,
getWxNewsArticleItem,
getWxNewsArticleItemPage,
exportWxNewsArticleItemExcel
} from "@/api/wechatMp/wxNewsArticleItem";
import Editor from '@/components/Editor';
export default {
name: "WxNewsArticleItem",
components: {
Editor,
},
data() {
return {
//
loading: true,
//
exportLoading: false,
//
showSearch: true,
//
total: 0,
//
list: [],
//
title: "",
//
open: false,
dateRangeCreateTime: [],
//
queryParams: {
pageNo: 1,
pageSize: 10,
title: null,
digest: null,
author: null,
showCoverPic: null,
thumbMediaId: null,
content: null,
contentSourceUrl: null,
orderNo: null,
picPath: null,
needOpenComment: null,
onlyFansCanComment: null,
newsId: null,
wxAccountId: null,
},
//
form: {},
//
rules: {}
};
},
created() {
this.getList();
},
methods: {
/** 查询列表 */
getList() {
this.loading = true;
//
let params = {...this.queryParams};
this.addBeginAndEndTime(params, this.dateRangeCreateTime, 'createTime');
//
getWxNewsArticleItemPage(params).then(response => {
this.list = response.data.list;
this.total = response.data.total;
this.loading = false;
});
},
/** 取消按钮 */
cancel() {
this.open = false;
this.reset();
},
/** 表单重置 */
reset() {
this.form = {
id: undefined,
title: undefined,
digest: undefined,
author: undefined,
showCoverPic: undefined,
thumbMediaId: undefined,
content: undefined,
contentSourceUrl: undefined,
orderNo: undefined,
picPath: undefined,
needOpenComment: undefined,
onlyFansCanComment: undefined,
newsId: undefined,
wxAccountId: undefined,
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNo = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.dateRangeCreateTime = [];
this.resetForm("queryForm");
this.handleQuery();
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = "添加图文消息文章列表表 ";
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const id = row.id;
getWxNewsArticleItem(id).then(response => {
this.form = response.data;
this.open = true;
this.title = "修改图文消息文章列表表 ";
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (!valid) {
return;
}
//
if (this.form.id != null) {
updateWxNewsArticleItem(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
return;
}
//
createWxNewsArticleItem(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
});
},
/** 删除按钮操作 */
handleDelete(row) {
const id = row.id;
this.$modal.confirm('是否确认删除图文消息文章列表表 编号为"' + id + '"的数据项?').then(function () {
return deleteWxNewsArticleItem(id);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {
});
},
/** 导出按钮操作 */
handleExport() {
//
let params = {...this.queryParams};
params.pageNo = undefined;
params.pageSize = undefined;
this.addBeginAndEndTime(params, this.dateRangeCreateTime, 'createTime');
//
this.$modal.confirm('是否确认导出所有图文消息文章列表表 数据项?').then(() => {
this.exportLoading = true;
return exportWxNewsArticleItemExcel(params);
}).then(response => {
this.$download.excel(response, '图文消息文章列表表 .xls');
this.exportLoading = false;
}).catch(() => {
});
}
}
};
</script>

View File

@ -1,254 +0,0 @@
<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="tplName">
<el-input v-model="queryParams.tplName" placeholder="请输入模板名称" clearable @keyup.enter.native="handleQuery"/>
</el-form-item>
<el-form-item label="是否已上传微信" prop="isUpload">
<el-input v-model="queryParams.isUpload" placeholder="请输入是否已上传微信" clearable @keyup.enter.native="handleQuery"/>
</el-form-item>
<el-form-item label="素材ID" prop="mediaId">
<el-input v-model="queryParams.mediaId" placeholder="请输入素材ID" clearable @keyup.enter.native="handleQuery"/>
</el-form-item>
<el-form-item label="微信账号ID" prop="wxAccountId">
<el-input v-model="queryParams.wxAccountId" placeholder="请输入微信账号ID" clearable
@keyup.enter.native="handleQuery"/>
</el-form-item>
<el-form-item label="创建时间">
<el-date-picker v-model="dateRangeCreateTime" style="width: 240px" value-format="yyyy-MM-dd"
type="daterange" range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期"/>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" @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="['wechatMp:wx-news-template:create']">新增
</el-button>
</el-col>
<el-col :span="1.5">
<el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport"
:loading="exportLoading"
v-hasPermi="['wechatMp:wx-news-template:export']">导出
</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<!-- 列表 -->
<el-table v-loading="loading" :data="list">
<el-table-column label="主键 主键ID" align="center" prop="id"/>
<el-table-column label="模板名称" align="center" prop="tplName"/>
<el-table-column label="是否已上传微信" align="center" prop="isUpload"/>
<el-table-column label="素材ID" align="center" prop="mediaId"/>
<el-table-column label="微信账号ID" align="center" prop="wxAccountId"/>
<el-table-column label="创建时间" align="center" prop="createTime" width="180">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.createTime) }}</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="['wechatMp:wx-news-template:update']">修改
</el-button>
<el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)"
v-hasPermi="['wechatMp:wx-news-template:delete']">删除
</el-button>
</template>
</el-table-column>
</el-table>
<!-- 分页组件 -->
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize"
@pagination="getList"/>
<!-- 对话框(添加 / 修改) -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="模板名称" prop="tplName">
<el-input v-model="form.tplName" placeholder="请输入模板名称"/>
</el-form-item>
<el-form-item label="是否已上传微信" prop="isUpload">
<el-input v-model="form.isUpload" placeholder="请输入是否已上传微信"/>
</el-form-item>
<el-form-item label="素材ID" prop="mediaId">
<el-input v-model="form.mediaId" placeholder="请输入素材ID"/>
</el-form-item>
<el-form-item label="微信账号ID" prop="wxAccountId">
<el-input v-model="form.wxAccountId" placeholder="请输入微信账号ID"/>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import {
createWxNewsTemplate,
updateWxNewsTemplate,
deleteWxNewsTemplate,
getWxNewsTemplate,
getWxNewsTemplatePage,
exportWxNewsTemplateExcel
} from "@/api/wechatMp/wxNewsTemplate";
export default {
name: "WxNewsTemplate",
components: {},
data() {
return {
//
loading: true,
//
exportLoading: false,
//
showSearch: true,
//
total: 0,
//
list: [],
//
title: "",
//
open: false,
dateRangeCreateTime: [],
//
queryParams: {
pageNo: 1,
pageSize: 10,
tplName: null,
isUpload: null,
mediaId: null,
wxAccountId: null,
},
//
form: {},
//
rules: {}
};
},
created() {
this.getList();
},
methods: {
/** 查询列表 */
getList() {
this.loading = true;
//
let params = {...this.queryParams};
this.addBeginAndEndTime(params, this.dateRangeCreateTime, 'createTime');
//
getWxNewsTemplatePage(params).then(response => {
this.list = response.data.list;
this.total = response.data.total;
this.loading = false;
});
},
/** 取消按钮 */
cancel() {
this.open = false;
this.reset();
},
/** 表单重置 */
reset() {
this.form = {
id: undefined,
tplName: undefined,
isUpload: undefined,
mediaId: undefined,
wxAccountId: undefined,
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNo = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.dateRangeCreateTime = [];
this.resetForm("queryForm");
this.handleQuery();
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = "添加图文消息模板";
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const id = row.id;
getWxNewsTemplate(id).then(response => {
this.form = response.data;
this.open = true;
this.title = "修改图文消息模板";
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (!valid) {
return;
}
//
if (this.form.id != null) {
updateWxNewsTemplate(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
return;
}
//
createWxNewsTemplate(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
});
},
/** 删除按钮操作 */
handleDelete(row) {
const id = row.id;
this.$modal.confirm('是否确认删除图文消息模板编号为"' + id + '"的数据项?').then(function () {
return deleteWxNewsTemplate(id);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {
});
},
/** 导出按钮操作 */
handleExport() {
//
let params = {...this.queryParams};
params.pageNo = undefined;
params.pageSize = undefined;
this.addBeginAndEndTime(params, this.dateRangeCreateTime, 'createTime');
//
this.$modal.confirm('是否确认导出所有图文消息模板数据项?').then(() => {
this.exportLoading = true;
return exportWxNewsTemplateExcel(params);
}).then(response => {
this.$download.excel(response, '图文消息模板.xls');
this.exportLoading = false;
}).catch(() => {
});
}
}
};
</script>

View File

@ -1,258 +0,0 @@
<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="receiveText">
<el-input v-model="queryParams.receiveText" placeholder="请输入关键字" clearable @keyup.enter.native="handleQuery"/>
</el-form-item>
<el-form-item label="消息类型 1文本消息2图文消息" prop="msgType">
<el-select v-model="queryParams.msgType" placeholder="请选择消息类型 1文本消息2图文消息" clearable size="small">
<el-option label="请选择字典生成" value=""/>
</el-select>
</el-form-item>
<el-form-item label="模板ID" prop="tplId">
<el-input v-model="queryParams.tplId" placeholder="请输入模板ID" clearable @keyup.enter.native="handleQuery"/>
</el-form-item>
<el-form-item label="微信账号ID" prop="wxAccountId">
<el-input v-model="queryParams.wxAccountId" placeholder="请输入微信账号ID" clearable
@keyup.enter.native="handleQuery"/>
</el-form-item>
<el-form-item label="创建时间">
<el-date-picker v-model="dateRangeCreateTime" style="width: 240px" value-format="yyyy-MM-dd"
type="daterange" range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期"/>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" @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="['wechatMp:wx-receive-text:create']">新增
</el-button>
</el-col>
<el-col :span="1.5">
<el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport"
:loading="exportLoading"
v-hasPermi="['wechatMp:wx-receive-text:export']">导出
</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<!-- 列表 -->
<el-table v-loading="loading" :data="list">
<el-table-column label="主键" align="center" prop="id"/>
<el-table-column label="关键字" align="center" prop="receiveText"/>
<el-table-column label="消息类型 1文本消息2图文消息" align="center" prop="msgType"/>
<el-table-column label="模板ID" align="center" prop="tplId"/>
<el-table-column label="微信账号ID" align="center" prop="wxAccountId"/>
<el-table-column label="创建时间" align="center" prop="createTime" width="180">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.createTime) }}</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="['wechatMp:wx-receive-text:update']">修改
</el-button>
<el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)"
v-hasPermi="['wechatMp:wx-receive-text:delete']">删除
</el-button>
</template>
</el-table-column>
</el-table>
<!-- 分页组件 -->
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize"
@pagination="getList"/>
<!-- 对话框(添加 / 修改) -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="关键字" prop="receiveText">
<el-input v-model="form.receiveText" placeholder="请输入关键字"/>
</el-form-item>
<el-form-item label="消息类型 1文本消息2图文消息" prop="msgType">
<el-select v-model="form.msgType" placeholder="请选择消息类型 1文本消息2图文消息">
<el-option label="请选择字典生成" value=""/>
</el-select>
</el-form-item>
<el-form-item label="模板ID" prop="tplId">
<el-input v-model="form.tplId" placeholder="请输入模板ID"/>
</el-form-item>
<el-form-item label="微信账号ID" prop="wxAccountId">
<el-input v-model="form.wxAccountId" placeholder="请输入微信账号ID"/>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import {
createWxReceiveText,
updateWxReceiveText,
deleteWxReceiveText,
getWxReceiveText,
getWxReceiveTextPage,
exportWxReceiveTextExcel
} from "@/api/wechatMp/wxReceiveText";
export default {
name: "WxReceiveText",
components: {},
data() {
return {
//
loading: true,
//
exportLoading: false,
//
showSearch: true,
//
total: 0,
//
list: [],
//
title: "",
//
open: false,
dateRangeCreateTime: [],
//
queryParams: {
pageNo: 1,
pageSize: 10,
receiveText: null,
msgType: null,
tplId: null,
wxAccountId: null,
},
//
form: {},
//
rules: {}
};
},
created() {
this.getList();
},
methods: {
/** 查询列表 */
getList() {
this.loading = true;
//
let params = {...this.queryParams};
this.addBeginAndEndTime(params, this.dateRangeCreateTime, 'createTime');
//
getWxReceiveTextPage(params).then(response => {
this.list = response.data.list;
this.total = response.data.total;
this.loading = false;
});
},
/** 取消按钮 */
cancel() {
this.open = false;
this.reset();
},
/** 表单重置 */
reset() {
this.form = {
id: undefined,
receiveText: undefined,
msgType: undefined,
tplId: undefined,
wxAccountId: undefined,
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNo = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.dateRangeCreateTime = [];
this.resetForm("queryForm");
this.handleQuery();
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = "添加回复关键字";
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const id = row.id;
getWxReceiveText(id).then(response => {
this.form = response.data;
this.open = true;
this.title = "修改回复关键字";
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (!valid) {
return;
}
//
if (this.form.id != null) {
updateWxReceiveText(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
return;
}
//
createWxReceiveText(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
});
},
/** 删除按钮操作 */
handleDelete(row) {
const id = row.id;
this.$modal.confirm('是否确认删除回复关键字编号为"' + id + '"的数据项?').then(function () {
return deleteWxReceiveText(id);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {
});
},
/** 导出按钮操作 */
handleExport() {
//
let params = {...this.queryParams};
params.pageNo = undefined;
params.pageSize = undefined;
this.addBeginAndEndTime(params, this.dateRangeCreateTime, 'createTime');
//
this.$modal.confirm('是否确认导出所有回复关键字数据项?').then(() => {
this.exportLoading = true;
return exportWxReceiveTextExcel(params);
}).then(response => {
this.$download.excel(response, '回复关键字.xls');
this.exportLoading = false;
}).catch(() => {
});
}
}
};
</script>

View File

@ -1,249 +0,0 @@
<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="消息类型 1文本消息2图文消息" prop="msgType">
<el-select v-model="queryParams.msgType" placeholder="请选择消息类型 1文本消息2图文消息" clearable size="small">
<el-option label="请选择字典生成" value=""/>
</el-select>
</el-form-item>
<el-form-item label="模板ID" prop="tplId">
<el-input v-model="queryParams.tplId" placeholder="请输入模板ID" clearable @keyup.enter.native="handleQuery"/>
</el-form-item>
<el-form-item label="微信账号ID" prop="wxAccountId">
<el-input v-model="queryParams.wxAccountId" placeholder="请输入微信账号ID" clearable
@keyup.enter.native="handleQuery"/>
</el-form-item>
<el-form-item label="创建时间">
<el-date-picker v-model="dateRangeCreateTime" style="width: 240px" value-format="yyyy-MM-dd"
type="daterange" range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期"/>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" @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="['wechatMp:wx-subscribe-text:create']">新增
</el-button>
</el-col>
<el-col :span="1.5">
<el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport"
:loading="exportLoading"
v-hasPermi="['wechatMp:wx-subscribe-text:export']">导出
</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<!-- 列表 -->
<el-table v-loading="loading" :data="list">
<el-table-column label="主键" align="center" prop="id"/>
<el-table-column label="消息类型 1文本消息2图文消息" align="center" prop="msgType"/>
<el-table-column label="模板ID" align="center" prop="tplId"/>
<el-table-column label="微信账号ID" align="center" prop="wxAccountId"/>
<el-table-column label="创建时间" align="center" prop="createTime" width="180">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.createTime) }}</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="['wechatMp:wx-subscribe-text:update']">修改
</el-button>
<el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)"
v-hasPermi="['wechatMp:wx-subscribe-text:delete']">删除
</el-button>
</template>
</el-table-column>
</el-table>
<!-- 分页组件 -->
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize"
@pagination="getList"/>
<!-- 对话框(添加 / 修改) -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="消息类型 1文本消息2图文消息" prop="msgType">
<el-select v-model="form.msgType" placeholder="请选择消息类型 1文本消息2图文消息">
<el-option label="请选择字典生成" value=""/>
</el-select>
</el-form-item>
<el-form-item label="模板ID" prop="tplId">
<el-input v-model="form.tplId" placeholder="请输入模板ID"/>
</el-form-item>
<el-form-item label="微信账号ID" prop="wxAccountId">
<el-input v-model="form.wxAccountId" placeholder="请输入微信账号ID"/>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import {
createWxSubscribeText,
updateWxSubscribeText,
deleteWxSubscribeText,
getWxSubscribeText,
getWxSubscribeTextPage,
exportWxSubscribeTextExcel
} from "@/api/wechatMp/wxSubscribeText";
export default {
name: "WxSubscribeText",
components: {},
data() {
return {
//
loading: true,
//
exportLoading: false,
//
showSearch: true,
//
total: 0,
//
list: [],
//
title: "",
//
open: false,
dateRangeCreateTime: [],
//
queryParams: {
pageNo: 1,
pageSize: 10,
msgType: null,
tplId: null,
wxAccountId: null,
},
//
form: {},
//
rules: {}
};
},
created() {
this.getList();
},
methods: {
/** 查询列表 */
getList() {
this.loading = true;
//
let params = {...this.queryParams};
this.addBeginAndEndTime(params, this.dateRangeCreateTime, 'createTime');
//
getWxSubscribeTextPage(params).then(response => {
this.list = response.data.list;
this.total = response.data.total;
this.loading = false;
});
},
/** 取消按钮 */
cancel() {
this.open = false;
this.reset();
},
/** 表单重置 */
reset() {
this.form = {
id: undefined,
msgType: undefined,
tplId: undefined,
wxAccountId: undefined,
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNo = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.dateRangeCreateTime = [];
this.resetForm("queryForm");
this.handleQuery();
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = "添加关注欢迎语";
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const id = row.id;
getWxSubscribeText(id).then(response => {
this.form = response.data;
this.open = true;
this.title = "修改关注欢迎语";
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (!valid) {
return;
}
//
if (this.form.id != null) {
updateWxSubscribeText(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
return;
}
//
createWxSubscribeText(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
});
},
/** 删除按钮操作 */
handleDelete(row) {
const id = row.id;
this.$modal.confirm('是否确认删除关注欢迎语编号为"' + id + '"的数据项?').then(function () {
return deleteWxSubscribeText(id);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {
});
},
/** 导出按钮操作 */
handleExport() {
//
let params = {...this.queryParams};
params.pageNo = undefined;
params.pageSize = undefined;
this.addBeginAndEndTime(params, this.dateRangeCreateTime, 'createTime');
//
this.$modal.confirm('是否确认导出所有关注欢迎语数据项?').then(() => {
this.exportLoading = true;
return exportWxSubscribeTextExcel(params);
}).then(response => {
this.$download.excel(response, '关注欢迎语.xls');
this.exportLoading = false;
}).catch(() => {
});
}
}
};
</script>

View File

@ -1,235 +0,0 @@
<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="tplName">
<el-input v-model="queryParams.tplName" placeholder="请输入模板名字" clearable @keyup.enter.native="handleQuery"/>
</el-form-item>
<el-form-item label="创建时间">
<el-date-picker v-model="dateRangeCreateTime" style="width: 240px" value-format="yyyy-MM-dd"
type="daterange" range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期"/>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" @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="['wechatMp:wx-text-template:create']">新增
</el-button>
</el-col>
<el-col :span="1.5">
<el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport"
:loading="exportLoading"
v-hasPermi="['wechatMp:wx-text-template:export']">导出
</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<!-- 列表 -->
<el-table v-loading="loading" :data="list">
<el-table-column label="主键" align="center" prop="id"/>
<el-table-column label="模板名字" align="center" prop="tplName"/>
<el-table-column label="模板内容" align="center" prop="content"/>
<el-table-column label="创建时间" align="center" prop="createTime" width="180">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.createTime) }}</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="['wechatMp:wx-text-template:update']">修改
</el-button>
<el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)"
v-hasPermi="['wechatMp:wx-text-template:delete']">删除
</el-button>
</template>
</el-table-column>
</el-table>
<!-- 分页组件 -->
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize"
@pagination="getList"/>
<!-- 对话框(添加 / 修改) -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="模板名字" prop="tplName">
<el-input v-model="form.tplName" placeholder="请输入模板名字"/>
</el-form-item>
<el-form-item label="模板内容">
<editor v-model="form.content" :min-height="192"/>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import {
createWxTextTemplate,
updateWxTextTemplate,
deleteWxTextTemplate,
getWxTextTemplate,
getWxTextTemplatePage,
exportWxTextTemplateExcel
} from "@/api/wechatMp/wxTextTemplate";
import Editor from '@/components/Editor';
export default {
name: "WxTextTemplate",
components: {
Editor,
},
data() {
return {
//
loading: true,
//
exportLoading: false,
//
showSearch: true,
//
total: 0,
//
list: [],
//
title: "",
//
open: false,
dateRangeCreateTime: [],
//
queryParams: {
pageNo: 1,
pageSize: 10,
tplName: null,
content: null,
},
//
form: {},
//
rules: {}
};
},
created() {
this.getList();
},
methods: {
/** 查询列表 */
getList() {
this.loading = true;
//
let params = {...this.queryParams};
this.addBeginAndEndTime(params, this.dateRangeCreateTime, 'createTime');
//
getWxTextTemplatePage(params).then(response => {
this.list = response.data.list;
this.total = response.data.total;
this.loading = false;
});
},
/** 取消按钮 */
cancel() {
this.open = false;
this.reset();
},
/** 表单重置 */
reset() {
this.form = {
id: undefined,
tplName: undefined,
content: undefined,
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNo = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.dateRangeCreateTime = [];
this.resetForm("queryForm");
this.handleQuery();
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = "添加文本模板";
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const id = row.id;
getWxTextTemplate(id).then(response => {
this.form = response.data;
this.open = true;
this.title = "修改文本模板";
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (!valid) {
return;
}
//
if (this.form.id != null) {
updateWxTextTemplate(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
return;
}
//
createWxTextTemplate(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
});
},
/** 删除按钮操作 */
handleDelete(row) {
const id = row.id;
this.$modal.confirm('是否确认删除文本模板编号为"' + id + '"的数据项?').then(function () {
return deleteWxTextTemplate(id);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {
});
},
/** 导出按钮操作 */
handleExport() {
//
let params = {...this.queryParams};
params.pageNo = undefined;
params.pageSize = undefined;
this.addBeginAndEndTime(params, this.dateRangeCreateTime, 'createTime');
//
this.$modal.confirm('是否确认导出所有文本模板数据项?').then(() => {
this.exportLoading = true;
return exportWxTextTemplateExcel(params);
}).then(response => {
this.$download.excel(response, '文本模板.xls');
this.exportLoading = false;
}).catch(() => {
});
}
}
};
</script>