Commit 44a93a28 by YG8999

短信日志、扫呗日志

parent fa313fc7
import request from '@/utils/request'
// 查询短信日志列表
export function listLog(query) {
return request({
url: '/system/sms/log/list',
method: 'get',
params: query
})
}
// 查询短信日志详细
export function getLog(id) {
return request({
url: '/system/sms/log/' + id,
method: 'get'
})
}
// 新增短信日志
export function addLog(data) {
return request({
url: '/system/sms/log',
method: 'post',
data: data
})
}
// 修改短信日志
export function updateLog(data) {
return request({
url: '/system/sms/log',
method: 'put',
data: data
})
}
// 删除短信日志
export function delLog(id) {
return request({
url: '/system/sms/log/' + id,
method: 'delete'
})
}
<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="phone">
<el-input
v-model="queryParams.phone"
placeholder="请输入发送手机号码"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="发送结果" prop="result">
<el-select v-model="queryParams.result" placeholder="请选择">
<el-option
v-for="item in options"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option>
</el-select>
</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">
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="logList" >
<!-- <el-table-column type="selection" width="55" align="center" />-->
<!-- <el-table-column label="主键" align="center" prop="id" />-->
<el-table-column label="手机号码" align="center" prop="phone" />
<!-- <el-table-column label="短信模版" align="center" prop="templateId" />-->
<el-table-column label="签名" align="center" prop="signature" />
<el-table-column label="短信内容" align="center" prop="content" width="450"/>
<el-table-column label="短信类型" align="center" prop="smsType">
<template slot-scope="scope">
<dict-tag :options="dict.type.sms_type" :value="scope.row.smsType"/>
</template>
</el-table-column>
<!-- <el-table-column label="备注" align="center" prop="remark" />-->
<el-table-column label="发送结果" align="center" prop="result" :formatter="(row) => resultFormatter(row.result)"/>
<!-- <el-table-column label="返回内容" align="center" prop="resultParam" />-->
<el-table-column label="记录时间" align="center" prop="createTime" width="100">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d} {h}:{i}:{s}') }}</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)"
>详情</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="50%" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="100px">
<el-form-item label="发送手机号码" prop="phone">
<el-input v-model="form.phone" placeholder="请输入发送手机号码" />
</el-form-item>
<el-form-item label="签名" prop="signature">
<el-input v-model="form.signature" placeholder="请输入签名" />
</el-form-item>
<el-form-item label="短信内容">
<el-input type="textarea" v-model="form.content" :rows="4"/>
</el-form-item>
<!-- <el-form-item label="备注" prop="remark">-->
<!-- <el-input v-model="form.remark" placeholder="请输入备注" />-->
<!-- </el-form-item>-->
<el-form-item label="发送结果" prop="result">
<el-input v-model="form.result" placeholder="请输入结果:1-成功,2-失败" />
</el-form-item>
<el-form-item label="返回内容" prop="resultParam">
<el-input v-model="form.resultParam" type="textarea" :rows="3"/>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { listLog, getLog, delLog, addLog, updateLog } from "@/api/system/smsLog";
export default {
name: "SmsLog",
dicts: ['sms_type'],
data() {
return {
// 遮罩层
loading: true,
// 选中数组
ids: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
// 显示搜索条件
showSearch: true,
// 总条数
total: 0,
// 短信日志表格数据
logList: [],
// 弹出层标题
title: "",
// 是否显示弹出层
open: false,
// 查询参数
queryParams: {
pageNum: 1,
pageSize: 10,
phone: null,
templateId: null,
signature: null,
content: null,
smsType: null,
result: null,
resultParam: null
},
// 表单参数
form: {},
// 表单校验
rules: {
},
options: [{
value: '1',
label: '成功'
}, {
value: '0',
label: '失败'
}]
};
},
created() {
this.getList();
},
methods: {
/** 查询短信日志列表 */
getList() {
this.loading = true;
listLog(this.queryParams).then(response => {
this.logList = response.rows;
this.total = response.total;
this.loading = false;
});
},
// 取消按钮
cancel() {
this.open = false;
this.reset();
},
// 表单重置
reset() {
this.form = {
id: null,
phone: null,
templateId: null,
signature: null,
content: null,
smsType: null,
createBy: null,
createTime: null,
updateBy: null,
updateTime: null,
remark: null,
result: null,
resultParam: null
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const id = row.id || this.ids
getLog(id).then(response => {
this.form = response.data;
this.form.result = this.resultFormatter(response.data.result)
this.open = true;
this.title = "查看短信日志";
});
},
resultFormatter(value) {
return value === 1 ? '成功' : value === 0 ? '失败' : '';
}
}
};
</script>
...@@ -41,7 +41,7 @@ ...@@ -41,7 +41,7 @@
</el-row> </el-row>
<el-table v-loading="loading" :data="logList" > <el-table v-loading="loading" :data="logList" >
<el-table-column type="selection" width="55" align="center" /> <!-- <el-table-column type="selection" width="55" align="center" />-->
<el-table-column label="设备ID" align="center" prop="devId" /> <el-table-column label="设备ID" align="center" prop="devId" />
<el-table-column label="设备mac" align="center" prop="devMac" /> <el-table-column label="设备mac" align="center" prop="devMac" />
<el-table-column label="是否异常变更" align="center" prop="isAbnormal" :formatter="(row) => filedFormatter(row.isAbnormal)"/> <el-table-column label="是否异常变更" align="center" prop="isAbnormal" :formatter="(row) => filedFormatter(row.isAbnormal)"/>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment