index.vue 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235
  1. <template>
  2. <div class="app-container">
  3. <!-- 搜索工作栏 -->
  4. <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
  5. <el-form-item label="粉丝消息ID" prop="fansMsgId">
  6. <el-input v-model="queryParams.fansMsgId" placeholder="请输入粉丝消息ID" clearable @keyup.enter.native="handleQuery"/>
  7. </el-form-item>
  8. <el-form-item label="创建时间">
  9. <el-date-picker v-model="dateRangeCreateTime" style="width: 240px" value-format="yyyy-MM-dd"
  10. type="daterange" range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期"/>
  11. </el-form-item>
  12. <el-form-item>
  13. <el-button type="primary" icon="el-icon-search" @click="handleQuery">搜索</el-button>
  14. <el-button icon="el-icon-refresh" @click="resetQuery">重置</el-button>
  15. </el-form-item>
  16. </el-form>
  17. <!-- 操作工具栏 -->
  18. <el-row :gutter="10" class="mb8">
  19. <el-col :span="1.5">
  20. <el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd"
  21. v-hasPermi="['wechatMp:wx-fans-msg-res:create']">新增
  22. </el-button>
  23. </el-col>
  24. <el-col :span="1.5">
  25. <el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport"
  26. :loading="exportLoading"
  27. v-hasPermi="['wechatMp:wx-fans-msg-res:export']">导出
  28. </el-button>
  29. </el-col>
  30. <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
  31. </el-row>
  32. <!-- 列表 -->
  33. <el-table v-loading="loading" :data="list">
  34. <el-table-column label="主键" align="center" prop="id"/>
  35. <el-table-column label="粉丝消息ID" align="center" prop="fansMsgId"/>
  36. <el-table-column label="回复内容" align="center" prop="resContent"/>
  37. <el-table-column label="创建时间" align="center" prop="createTime" width="180">
  38. <template slot-scope="scope">
  39. <span>{{ parseTime(scope.row.createTime) }}</span>
  40. </template>
  41. </el-table-column>
  42. <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
  43. <template slot-scope="scope">
  44. <el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)"
  45. v-hasPermi="['wechatMp:wx-fans-msg-res:update']">修改
  46. </el-button>
  47. <el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)"
  48. v-hasPermi="['wechatMp:wx-fans-msg-res:delete']">删除
  49. </el-button>
  50. </template>
  51. </el-table-column>
  52. </el-table>
  53. <!-- 分页组件 -->
  54. <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize"
  55. @pagination="getList"/>
  56. <!-- 对话框(添加 / 修改) -->
  57. <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
  58. <el-form ref="form" :model="form" :rules="rules" label-width="80px">
  59. <el-form-item label="粉丝消息ID" prop="fansMsgId">
  60. <el-input v-model="form.fansMsgId" placeholder="请输入粉丝消息ID"/>
  61. </el-form-item>
  62. <el-form-item label="回复内容">
  63. <editor v-model="form.resContent" :min-height="192"/>
  64. </el-form-item>
  65. </el-form>
  66. <div slot="footer" class="dialog-footer">
  67. <el-button type="primary" @click="submitForm">确 定</el-button>
  68. <el-button @click="cancel">取 消</el-button>
  69. </div>
  70. </el-dialog>
  71. </div>
  72. </template>
  73. <script>
  74. import {
  75. createWxFansMsgRes,
  76. updateWxFansMsgRes,
  77. deleteWxFansMsgRes,
  78. getWxFansMsgRes,
  79. getWxFansMsgResPage,
  80. exportWxFansMsgResExcel
  81. } from "@/api/wechatMp/wxFansMsgRes";
  82. import Editor from '@/components/Editor';
  83. export default {
  84. name: "WxFansMsgRes",
  85. components: {
  86. Editor,
  87. },
  88. data() {
  89. return {
  90. // 遮罩层
  91. loading: true,
  92. // 导出遮罩层
  93. exportLoading: false,
  94. // 显示搜索条件
  95. showSearch: true,
  96. // 总条数
  97. total: 0,
  98. // 回复粉丝消息历史表 列表
  99. list: [],
  100. // 弹出层标题
  101. title: "",
  102. // 是否显示弹出层
  103. open: false,
  104. dateRangeCreateTime: [],
  105. // 查询参数
  106. queryParams: {
  107. pageNo: 1,
  108. pageSize: 10,
  109. fansMsgId: null,
  110. resContent: null,
  111. },
  112. // 表单参数
  113. form: {},
  114. // 表单校验
  115. rules: {}
  116. };
  117. },
  118. created() {
  119. this.getList();
  120. },
  121. methods: {
  122. /** 查询列表 */
  123. getList() {
  124. this.loading = true;
  125. // 处理查询参数
  126. let params = {...this.queryParams};
  127. this.addBeginAndEndTime(params, this.dateRangeCreateTime, 'createTime');
  128. // 执行查询
  129. getWxFansMsgResPage(params).then(response => {
  130. this.list = response.data.list;
  131. this.total = response.data.total;
  132. this.loading = false;
  133. });
  134. },
  135. /** 取消按钮 */
  136. cancel() {
  137. this.open = false;
  138. this.reset();
  139. },
  140. /** 表单重置 */
  141. reset() {
  142. this.form = {
  143. id: undefined,
  144. fansMsgId: undefined,
  145. resContent: undefined,
  146. };
  147. this.resetForm("form");
  148. },
  149. /** 搜索按钮操作 */
  150. handleQuery() {
  151. this.queryParams.pageNo = 1;
  152. this.getList();
  153. },
  154. /** 重置按钮操作 */
  155. resetQuery() {
  156. this.dateRangeCreateTime = [];
  157. this.resetForm("queryForm");
  158. this.handleQuery();
  159. },
  160. /** 新增按钮操作 */
  161. handleAdd() {
  162. this.reset();
  163. this.open = true;
  164. this.title = "添加回复粉丝消息历史表 ";
  165. },
  166. /** 修改按钮操作 */
  167. handleUpdate(row) {
  168. this.reset();
  169. const id = row.id;
  170. getWxFansMsgRes(id).then(response => {
  171. this.form = response.data;
  172. this.open = true;
  173. this.title = "修改回复粉丝消息历史表 ";
  174. });
  175. },
  176. /** 提交按钮 */
  177. submitForm() {
  178. this.$refs["form"].validate(valid => {
  179. if (!valid) {
  180. return;
  181. }
  182. // 修改的提交
  183. if (this.form.id != null) {
  184. updateWxFansMsgRes(this.form).then(response => {
  185. this.$modal.msgSuccess("修改成功");
  186. this.open = false;
  187. this.getList();
  188. });
  189. return;
  190. }
  191. // 添加的提交
  192. createWxFansMsgRes(this.form).then(response => {
  193. this.$modal.msgSuccess("新增成功");
  194. this.open = false;
  195. this.getList();
  196. });
  197. });
  198. },
  199. /** 删除按钮操作 */
  200. handleDelete(row) {
  201. const id = row.id;
  202. this.$modal.confirm('是否确认删除回复粉丝消息历史表 编号为"' + id + '"的数据项?').then(function () {
  203. return deleteWxFansMsgRes(id);
  204. }).then(() => {
  205. this.getList();
  206. this.$modal.msgSuccess("删除成功");
  207. }).catch(() => {
  208. });
  209. },
  210. /** 导出按钮操作 */
  211. handleExport() {
  212. // 处理查询参数
  213. let params = {...this.queryParams};
  214. params.pageNo = undefined;
  215. params.pageSize = undefined;
  216. this.addBeginAndEndTime(params, this.dateRangeCreateTime, 'createTime');
  217. // 执行导出
  218. this.$modal.confirm('是否确认导出所有回复粉丝消息历史表 数据项?').then(() => {
  219. this.exportLoading = true;
  220. return exportWxFansMsgResExcel(params);
  221. }).then(response => {
  222. this.$download.excel(response, '回复粉丝消息历史表 .xls');
  223. this.exportLoading = false;
  224. }).catch(() => {
  225. });
  226. }
  227. }
  228. };
  229. </script>