Commit e4a19f4929c83f6310d1da0d9c7c6068681fb68e
1 parent
172c06b6
初始化短信日志的前端
Showing
2 changed files
with
218 additions
and
0 deletions
ruoyi-ui/src/api/system/sms/smsLog.js
0 → 100644
| 1 | +import request from '@/utils/request' | ||
| 2 | + | ||
| 3 | +// 获得短信日志分页 | ||
| 4 | +export function getSmsLogPage(query) { | ||
| 5 | + return request({ | ||
| 6 | + url: '/system/sms-log/page', | ||
| 7 | + method: 'get', | ||
| 8 | + params: query | ||
| 9 | + }) | ||
| 10 | +} | ||
| 11 | + | ||
| 12 | +// 导出短信日志 Excel | ||
| 13 | +export function exportSmsLogExcel(query) { | ||
| 14 | + return request({ | ||
| 15 | + url: '/system/sms-log/export-excel', | ||
| 16 | + method: 'get', | ||
| 17 | + params: query, | ||
| 18 | + responseType: 'blob' | ||
| 19 | + }) | ||
| 20 | +} |
ruoyi-ui/src/views/system/sms/smsLog.vue
0 → 100644
| 1 | +<template> | ||
| 2 | + <div class="app-container"> | ||
| 3 | + | ||
| 4 | + <!-- 搜索工作栏 --> | ||
| 5 | + <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px"> | ||
| 6 | + <el-form-item label="短信渠道编号" prop="channelId"> | ||
| 7 | + <el-input v-model="queryParams.channelId" placeholder="请输入短信渠道编号" clearable size="small" @keyup.enter.native="handleQuery"/> | ||
| 8 | + </el-form-item> | ||
| 9 | + <el-form-item label="模板编号" prop="templateId"> | ||
| 10 | + <el-input v-model="queryParams.templateId" placeholder="请输入模板编号" clearable size="small" @keyup.enter.native="handleQuery"/> | ||
| 11 | + </el-form-item> | ||
| 12 | + <el-form-item label="手机号" prop="mobile"> | ||
| 13 | + <el-input v-model="queryParams.mobile" placeholder="请输入手机号" clearable size="small" @keyup.enter.native="handleQuery"/> | ||
| 14 | + </el-form-item> | ||
| 15 | + <el-form-item label="发送状态" prop="sendStatus"> | ||
| 16 | + <el-select v-model="queryParams.sendStatus" placeholder="请选择发送状态" clearable size="small"> | ||
| 17 | + <el-option label="请选择字典生成" value="" /> | ||
| 18 | + </el-select> | ||
| 19 | + </el-form-item> | ||
| 20 | + <el-form-item label="发送时间"> | ||
| 21 | + <el-date-picker v-model="dateRangeSendTime" size="small" style="width: 240px" value-format="yyyy-MM-dd" | ||
| 22 | + type="daterange" range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期" /> | ||
| 23 | + </el-form-item> | ||
| 24 | + <el-form-item label="接收状态" prop="receiveStatus"> | ||
| 25 | + <el-select v-model="queryParams.receiveStatus" placeholder="请选择接收状态" clearable size="small"> | ||
| 26 | + <el-option label="请选择字典生成" value="" /> | ||
| 27 | + </el-select> | ||
| 28 | + </el-form-item> | ||
| 29 | + <el-form-item label="接收时间"> | ||
| 30 | + <el-date-picker v-model="dateRangeReceiveTime" size="small" style="width: 240px" value-format="yyyy-MM-dd" | ||
| 31 | + type="daterange" range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期" /> | ||
| 32 | + </el-form-item> | ||
| 33 | + <el-form-item> | ||
| 34 | + <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button> | ||
| 35 | + <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button> | ||
| 36 | + </el-form-item> | ||
| 37 | + </el-form> | ||
| 38 | + | ||
| 39 | + <!-- 操作工具栏 --> | ||
| 40 | + <el-row :gutter="10" class="mb8"> | ||
| 41 | + <el-col :span="1.5"> | ||
| 42 | + <el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd" | ||
| 43 | + v-hasPermi="['system:sms-log:create']">新增</el-button> | ||
| 44 | + </el-col> | ||
| 45 | + <el-col :span="1.5"> | ||
| 46 | + <el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport" | ||
| 47 | + v-hasPermi="['system:sms-log:export']">导出</el-button> | ||
| 48 | + </el-col> | ||
| 49 | + <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> | ||
| 50 | + </el-row> | ||
| 51 | + | ||
| 52 | + <!-- 列表 --> | ||
| 53 | + <el-table v-loading="loading" :data="list"> | ||
| 54 | + <el-table-column label="编号" align="center" prop="id" /> | ||
| 55 | + <el-table-column label="短信渠道编号" align="center" prop="channelId" /> | ||
| 56 | + <el-table-column label="短信渠道编码" align="center" prop="channelCode" /> | ||
| 57 | + <el-table-column label="模板编号" align="center" prop="templateId" /> | ||
| 58 | + <el-table-column label="模板编码" align="center" prop="templateCode" /> | ||
| 59 | + <el-table-column label="短信类型" align="center" prop="templateType" /> | ||
| 60 | + <el-table-column label="短信内容" align="center" prop="templateContent" /> | ||
| 61 | + <el-table-column label="短信参数" align="center" prop="templateParams" /> | ||
| 62 | + <el-table-column label="短信 API 的模板编号" align="center" prop="apiTemplateId" /> | ||
| 63 | + <el-table-column label="手机号" align="center" prop="mobile" /> | ||
| 64 | + <el-table-column label="用户编号" align="center" prop="userId" /> | ||
| 65 | + <el-table-column label="用户类型" align="center" prop="userType" /> | ||
| 66 | + <el-table-column label="发送状态" align="center" prop="sendStatus" /> | ||
| 67 | + <el-table-column label="发送时间" align="center" prop="sendTime" width="180"> | ||
| 68 | + <template slot-scope="scope"> | ||
| 69 | + <span>{{ parseTime(scope.row.sendTime) }}</span> | ||
| 70 | + </template> | ||
| 71 | + </el-table-column> | ||
| 72 | + <el-table-column label="发送结果的编码" align="center" prop="sendCode" /> | ||
| 73 | + <el-table-column label="发送结果的提示" align="center" prop="sendMsg" /> | ||
| 74 | + <el-table-column label="短信 API 发送结果的编码" align="center" prop="apiSendCode" /> | ||
| 75 | + <el-table-column label="短信 API 发送失败的提示" align="center" prop="apiSendMsg" /> | ||
| 76 | + <el-table-column label="短信 API 发送返回的唯一请求 ID" align="center" prop="apiRequestId" /> | ||
| 77 | + <el-table-column label="短信 API 发送返回的序号" align="center" prop="apiSerialNo" /> | ||
| 78 | + <el-table-column label="接收状态" align="center" prop="receiveStatus" /> | ||
| 79 | + <el-table-column label="接收时间" align="center" prop="receiveTime" width="180"> | ||
| 80 | + <template slot-scope="scope"> | ||
| 81 | + <span>{{ parseTime(scope.row.receiveTime) }}</span> | ||
| 82 | + </template> | ||
| 83 | + </el-table-column> | ||
| 84 | + <el-table-column label="API 接收结果的编码" align="center" prop="apiReceiveCode" /> | ||
| 85 | + <el-table-column label="API 接收结果的说明" align="center" prop="apiReceiveMsg" /> | ||
| 86 | + <el-table-column label="创建时间" align="center" prop="createTime" width="180"> | ||
| 87 | + <template slot-scope="scope"> | ||
| 88 | + <span>{{ parseTime(scope.row.createTime) }}</span> | ||
| 89 | + </template> | ||
| 90 | + </el-table-column> | ||
| 91 | + <el-table-column label="操作" align="center" class-name="small-padding fixed-width"> | ||
| 92 | + <template slot-scope="scope"> | ||
| 93 | + <el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)" | ||
| 94 | + v-hasPermi="['system:sms-log:update']">修改</el-button> | ||
| 95 | + </template> | ||
| 96 | + </el-table-column> | ||
| 97 | + </el-table> | ||
| 98 | + <!-- 分页组件 --> | ||
| 99 | + <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize" | ||
| 100 | + @pagination="getList"/> | ||
| 101 | + | ||
| 102 | + <!-- 对话框(添加 / 修改) --> | ||
| 103 | + | ||
| 104 | + </div> | ||
| 105 | +</template> | ||
| 106 | + | ||
| 107 | +<script> | ||
| 108 | +import { getSmsLogPage, exportSmsLogExcel } from "@/api/system/sms/smsLog"; | ||
| 109 | + | ||
| 110 | +export default { | ||
| 111 | + name: "SmsLog", | ||
| 112 | + components: { | ||
| 113 | + }, | ||
| 114 | + data() { | ||
| 115 | + return { | ||
| 116 | + // 遮罩层 | ||
| 117 | + loading: true, | ||
| 118 | + // 显示搜索条件 | ||
| 119 | + showSearch: true, | ||
| 120 | + // 总条数 | ||
| 121 | + total: 0, | ||
| 122 | + // 短信日志列表 | ||
| 123 | + list: [], | ||
| 124 | + // 弹出层标题 | ||
| 125 | + title: "", | ||
| 126 | + // 是否显示弹出层 | ||
| 127 | + open: false, | ||
| 128 | + dateRangeSendTime: [], | ||
| 129 | + dateRangeReceiveTime: [], | ||
| 130 | + // 查询参数 | ||
| 131 | + queryParams: { | ||
| 132 | + pageNo: 1, | ||
| 133 | + pageSize: 10, | ||
| 134 | + channelId: null, | ||
| 135 | + templateId: null, | ||
| 136 | + mobile: null, | ||
| 137 | + sendStatus: null, | ||
| 138 | + receiveStatus: null, | ||
| 139 | + }, | ||
| 140 | + }; | ||
| 141 | + }, | ||
| 142 | + created() { | ||
| 143 | + this.getList(); | ||
| 144 | + }, | ||
| 145 | + methods: { | ||
| 146 | + /** 查询列表 */ | ||
| 147 | + getList() { | ||
| 148 | + this.loading = true; | ||
| 149 | + // 处理查询参数 | ||
| 150 | + let params = {...this.queryParams}; | ||
| 151 | + this.addBeginAndEndTime(params, this.dateRangeSendTime, 'sendTime'); | ||
| 152 | + this.addBeginAndEndTime(params, this.dateRangeReceiveTime, 'receiveTime'); | ||
| 153 | + // 执行查询 | ||
| 154 | + getSmsLogPage(params).then(response => { | ||
| 155 | + this.list = response.data.list; | ||
| 156 | + this.total = response.data.total; | ||
| 157 | + this.loading = false; | ||
| 158 | + }); | ||
| 159 | + }, | ||
| 160 | + /** 取消按钮 */ | ||
| 161 | + cancel() { | ||
| 162 | + this.open = false; | ||
| 163 | + this.reset(); | ||
| 164 | + }, | ||
| 165 | + /** 搜索按钮操作 */ | ||
| 166 | + handleQuery() { | ||
| 167 | + this.queryParams.pageNo = 1; | ||
| 168 | + this.getList(); | ||
| 169 | + }, | ||
| 170 | + /** 重置按钮操作 */ | ||
| 171 | + resetQuery() { | ||
| 172 | + this.dateRangeSendTime = []; | ||
| 173 | + this.dateRangeReceiveTime = []; | ||
| 174 | + this.resetForm("queryForm"); | ||
| 175 | + this.handleQuery(); | ||
| 176 | + }, | ||
| 177 | + /** 导出按钮操作 */ | ||
| 178 | + handleExport() { | ||
| 179 | + // 处理查询参数 | ||
| 180 | + let params = {...this.queryParams}; | ||
| 181 | + params.pageNo = undefined; | ||
| 182 | + params.pageSize = undefined; | ||
| 183 | + this.addBeginAndEndTime(params, this.dateRangeSendTime, 'sendTime'); | ||
| 184 | + this.addBeginAndEndTime(params, this.dateRangeReceiveTime, 'receiveTime'); | ||
| 185 | + // 执行导出 | ||
| 186 | + this.$confirm('是否确认导出所有短信日志数据项?', "警告", { | ||
| 187 | + confirmButtonText: "确定", | ||
| 188 | + cancelButtonText: "取消", | ||
| 189 | + type: "warning" | ||
| 190 | + }).then(function() { | ||
| 191 | + return exportSmsLogExcel(params); | ||
| 192 | + }).then(response => { | ||
| 193 | + this.downloadExcel(response, '短信日志.xls'); | ||
| 194 | + }) | ||
| 195 | + } | ||
| 196 | + } | ||
| 197 | +}; | ||
| 198 | +</script> |