日志
This commit is contained in:
parent
4526daa998
commit
16e11a2b1e
40
src/api/logger/emailLog.ts
Normal file
40
src/api/logger/emailLog.ts
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
import { http } from '@/utils/http/axios';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description: 登录日志列表
|
||||||
|
*/
|
||||||
|
export function getEmailLogList(params?) {
|
||||||
|
return http.request({
|
||||||
|
url: '/email/log/page',
|
||||||
|
method: 'GET',
|
||||||
|
params,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @description: 根据ID获取详情
|
||||||
|
*/
|
||||||
|
export function getEmailLogDetail(id) {
|
||||||
|
return http.request({
|
||||||
|
url: '/email/log/detail/'+id,
|
||||||
|
method: 'get',
|
||||||
|
});
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @description: 删除登录日志
|
||||||
|
*/
|
||||||
|
export function emailLogDelete(id) {
|
||||||
|
return http.request({
|
||||||
|
url: '/email/log/delete/'+id,
|
||||||
|
method: 'DELETE',
|
||||||
|
});
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @description: 批量删除登录日志
|
||||||
|
*/
|
||||||
|
export function emailLogBatchDelete(data:any) {
|
||||||
|
return http.request({
|
||||||
|
url: '/email/log/batchDelete',
|
||||||
|
method: 'DELETE',
|
||||||
|
data
|
||||||
|
});
|
||||||
|
}
|
40
src/api/logger/fileLog.ts
Normal file
40
src/api/logger/fileLog.ts
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
import { http } from '@/utils/http/axios';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description: 登录日志列表
|
||||||
|
*/
|
||||||
|
export function getFileLogList(params?) {
|
||||||
|
return http.request({
|
||||||
|
url: '/file/log/page',
|
||||||
|
method: 'GET',
|
||||||
|
params,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @description: 根据ID获取详情
|
||||||
|
*/
|
||||||
|
export function getFileLogDetail(id) {
|
||||||
|
return http.request({
|
||||||
|
url: '/file/log/detail/'+id,
|
||||||
|
method: 'get',
|
||||||
|
});
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @description: 删除登录日志
|
||||||
|
*/
|
||||||
|
export function fileLogDelete(id) {
|
||||||
|
return http.request({
|
||||||
|
url: '/file/log/delete/'+id,
|
||||||
|
method: 'DELETE',
|
||||||
|
});
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @description: 批量删除登录日志
|
||||||
|
*/
|
||||||
|
export function fileLogBatchDelete(data:any) {
|
||||||
|
return http.request({
|
||||||
|
url: '/file/log/batchDelete',
|
||||||
|
method: 'DELETE',
|
||||||
|
data
|
||||||
|
});
|
||||||
|
}
|
40
src/api/logger/smsLog.ts
Normal file
40
src/api/logger/smsLog.ts
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
import { http } from '@/utils/http/axios';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description: 短信日志列表
|
||||||
|
*/
|
||||||
|
export function getSmsLogList(params?) {
|
||||||
|
return http.request({
|
||||||
|
url: '/sms/log/page',
|
||||||
|
method: 'GET',
|
||||||
|
params,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @description: 根据ID获取详情
|
||||||
|
*/
|
||||||
|
export function getSmsLogDetail(id) {
|
||||||
|
return http.request({
|
||||||
|
url: '/sms/log/detail/'+id,
|
||||||
|
method: 'get',
|
||||||
|
});
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @description: 删除登录日志
|
||||||
|
*/
|
||||||
|
export function smsLogDelete(id) {
|
||||||
|
return http.request({
|
||||||
|
url: '/sms/log/delete/'+id,
|
||||||
|
method: 'DELETE',
|
||||||
|
});
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @description: 批量删除登录日志
|
||||||
|
*/
|
||||||
|
export function smsLogBatchDelete(data:any) {
|
||||||
|
return http.request({
|
||||||
|
url: '/sms/log/batchDelete',
|
||||||
|
method: 'DELETE',
|
||||||
|
data
|
||||||
|
});
|
||||||
|
}
|
87
src/views/logger/emailLog/columns.ts
Normal file
87
src/views/logger/emailLog/columns.ts
Normal file
@ -0,0 +1,87 @@
|
|||||||
|
import { h } from 'vue';
|
||||||
|
import { ElTag } from 'element-plus';
|
||||||
|
|
||||||
|
export const columns = [
|
||||||
|
{
|
||||||
|
type: 'selection',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '日志标题',
|
||||||
|
prop: 'title',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '日志类型',
|
||||||
|
prop: 'type',
|
||||||
|
render(record) {
|
||||||
|
let typeText = ''
|
||||||
|
switch (record.row.type) {
|
||||||
|
case 1:
|
||||||
|
typeText='登录'
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
typeText='注册'
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
typeText='找回密码'
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
typeText='业务'
|
||||||
|
break;
|
||||||
|
case 5:
|
||||||
|
typeText='其他'
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return h('span', typeText || '-');
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '模板编号',
|
||||||
|
prop: 'number',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '接收人手机',
|
||||||
|
prop: 'receiveMobile',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '接收人类型',
|
||||||
|
prop: 'receiveType',
|
||||||
|
render(record) {
|
||||||
|
let typeText = ''
|
||||||
|
switch (record.row.receiveType) {
|
||||||
|
case 1:
|
||||||
|
typeText='系统用户'
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
typeText='会员用户'
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
typeText='其他'
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return h('span', typeText || '-');
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '请求耗时',
|
||||||
|
prop: 'consumeTime',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '日志状态',
|
||||||
|
prop: 'status',
|
||||||
|
render(record) {
|
||||||
|
return h('span', record.row.status === 1 ? '已读' : '未读')
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '创建人',
|
||||||
|
prop: 'createUser',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '创建时间',
|
||||||
|
prop: 'createTime',
|
||||||
|
},
|
||||||
|
];
|
120
src/views/logger/emailLog/edit.vue
Normal file
120
src/views/logger/emailLog/edit.vue
Normal file
@ -0,0 +1,120 @@
|
|||||||
|
<template>
|
||||||
|
<el-dialog
|
||||||
|
v-model="props.visible"
|
||||||
|
title="日志详情"
|
||||||
|
|
||||||
|
width="700"
|
||||||
|
:close-on-click-modal="false"
|
||||||
|
:before-close="dialogClose"
|
||||||
|
>
|
||||||
|
<el-descriptions column="2">
|
||||||
|
<el-descriptions-item label="日志标题:">{{formData.title}}</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="日志类型:">{{getTyepText(formData.type)}}</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="模板编号:">{{formData.number}}</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="接收人手机:">{{formData.receiveMobile}}</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="接收人类型:">{{getReviceType(formData.receiveType)}}</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="请求耗时:">{{formData.consumeTime}}</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="日志状态:">{{formData.status==1?'已读':'未读'}}</el-descriptions-item>
|
||||||
|
</el-descriptions>
|
||||||
|
<template #footer>
|
||||||
|
<span class="dialog-footer">
|
||||||
|
<el-button @click="dialogClose">关闭</el-button>
|
||||||
|
</span>
|
||||||
|
</template>
|
||||||
|
</el-dialog>
|
||||||
|
</template>
|
||||||
|
<script lang="ts" setup>
|
||||||
|
import type {FormInstance} from "element-plus";
|
||||||
|
import {getEmailLogDetail} from "@/api/logger/emailLog";
|
||||||
|
import {onMounted, reactive, shallowRef} from "vue";
|
||||||
|
import {message} from "@/utils/auth";
|
||||||
|
import {useLockFn} from "@/utils/useLockFn";
|
||||||
|
|
||||||
|
const emit = defineEmits(["success", "update:visible"]);
|
||||||
|
const formRef = shallowRef<FormInstance>();
|
||||||
|
const formData = reactive({
|
||||||
|
id: "",
|
||||||
|
title: "",
|
||||||
|
type:'',
|
||||||
|
number:'',
|
||||||
|
receiveMobile:'',
|
||||||
|
receiveType:'',
|
||||||
|
consumeTime:'',
|
||||||
|
status:''
|
||||||
|
});
|
||||||
|
|
||||||
|
const props = defineProps({
|
||||||
|
visible: {
|
||||||
|
type: Boolean,
|
||||||
|
required: true,
|
||||||
|
default: false
|
||||||
|
},
|
||||||
|
emailId: {
|
||||||
|
type: Number,
|
||||||
|
required: true,
|
||||||
|
default: 0
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
const dialogClose = () => {
|
||||||
|
emit("update:visible", false);
|
||||||
|
};
|
||||||
|
|
||||||
|
const setFormData = async () => {
|
||||||
|
const data = await getEmailLogDetail(props.emailId);
|
||||||
|
for (const key in formData) {
|
||||||
|
if (data[key] != null && data[key] != undefined) {
|
||||||
|
//@ts-ignore
|
||||||
|
formData[key] = data[key];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
const getReviceType =(type)=>{
|
||||||
|
let typeText = ''
|
||||||
|
switch (type) {
|
||||||
|
case 1:
|
||||||
|
typeText='系统用户'
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
typeText='会员用户'
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
typeText='其他'
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break
|
||||||
|
}
|
||||||
|
return typeText
|
||||||
|
}
|
||||||
|
const getTyepText =(type)=>{
|
||||||
|
let typeText = ''
|
||||||
|
switch (type) {
|
||||||
|
case 1:
|
||||||
|
typeText='登录'
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
typeText='注册'
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
typeText='找回密码'
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
typeText='业务'
|
||||||
|
break;
|
||||||
|
case 5:
|
||||||
|
typeText='其他'
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break
|
||||||
|
}
|
||||||
|
return typeText
|
||||||
|
}
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
if (props.emailId) {
|
||||||
|
setFormData();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
</script>
|
148
src/views/logger/emailLog/index.vue
Normal file
148
src/views/logger/emailLog/index.vue
Normal file
@ -0,0 +1,148 @@
|
|||||||
|
<template>
|
||||||
|
<PageWrapper>
|
||||||
|
<el-card :bordered="false" class="pt-3 mb-3 proCard">
|
||||||
|
<BasicForm @register="register" @submit="handleSubmit" @reset="handleReset"></BasicForm>
|
||||||
|
</el-card>
|
||||||
|
<el-card :bordered="false" class="proCard">
|
||||||
|
<BasicTable
|
||||||
|
:columns="columns"
|
||||||
|
:request="loadDataTable"
|
||||||
|
:row-key="(row) => row.id"
|
||||||
|
ref="tableRef"
|
||||||
|
:actionColumn="actionColumn"
|
||||||
|
@selection-change="onSelectionChange"
|
||||||
|
>
|
||||||
|
<template #tableTitle>
|
||||||
|
<el-button type="danger" @click="handleDelete()" :disabled="!selectionData.length">
|
||||||
|
<template #icon>
|
||||||
|
<el-icon class="el-input__icon">
|
||||||
|
<Delete />
|
||||||
|
</el-icon>
|
||||||
|
</template>
|
||||||
|
删除
|
||||||
|
</el-button>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<template #action>
|
||||||
|
<TableAction />
|
||||||
|
</template>
|
||||||
|
</BasicTable>
|
||||||
|
</el-card>
|
||||||
|
|
||||||
|
<editDialog
|
||||||
|
v-if="editVisible"
|
||||||
|
:emailId="emailId"
|
||||||
|
v-model:visible="editVisible"
|
||||||
|
@success="reloadTable"
|
||||||
|
>
|
||||||
|
</editDialog>
|
||||||
|
</PageWrapper>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts" setup>
|
||||||
|
import { reactive, ref, h,nextTick,defineAsyncComponent } from 'vue';
|
||||||
|
import { ColProps } from 'element-plus';
|
||||||
|
import { schemas } from './querySchemas';
|
||||||
|
import { useForm } from '@/components/Form/index';
|
||||||
|
import { TableAction } from '@/components/Table';
|
||||||
|
import { getEmailLogList,emailLogDelete,emailLogBatchDelete } from '@/api/logger/emailLog';
|
||||||
|
import { columns } from './columns';
|
||||||
|
import {message,confirm} from "@/utils/auth";
|
||||||
|
const editDialog = defineAsyncComponent(() =>
|
||||||
|
import('./edit.vue')
|
||||||
|
)
|
||||||
|
const emailId =ref(0)
|
||||||
|
const editVisible=ref(false)
|
||||||
|
const selectionData = ref([])
|
||||||
|
const tableRef = ref();
|
||||||
|
const formParams = reactive({
|
||||||
|
title:'',
|
||||||
|
receiveType:'',
|
||||||
|
bizType:'',
|
||||||
|
status:''
|
||||||
|
});
|
||||||
|
const actionColumn = reactive({
|
||||||
|
width: 250,
|
||||||
|
label: '操作',
|
||||||
|
prop: 'action',
|
||||||
|
fixed: 'right',
|
||||||
|
render(record) {
|
||||||
|
return h(TableAction, {
|
||||||
|
style: 'button',
|
||||||
|
actions: [
|
||||||
|
{
|
||||||
|
label: '详情',
|
||||||
|
type: 'warning',
|
||||||
|
onClick: handleDetail.bind(null, record),
|
||||||
|
ifShow: () => {
|
||||||
|
return true;
|
||||||
|
},
|
||||||
|
// auth: ['sys:emailLog:detail'],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '删除',
|
||||||
|
type: 'danger',
|
||||||
|
onClick: handleDelete.bind(null, record),
|
||||||
|
// 根据业务控制是否显示 isShow 和 auth 是并且关系
|
||||||
|
ifShow: () => {
|
||||||
|
return true;
|
||||||
|
},
|
||||||
|
// 根据权限控制是否显示: 有权限,会显示,支持多个
|
||||||
|
// auth: ['basic_list'],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
});
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
const loadDataTable = async (res: any) => {
|
||||||
|
const result = await getEmailLogList({ ...formParams, ...res });
|
||||||
|
return result;
|
||||||
|
};
|
||||||
|
|
||||||
|
function reloadTable() {
|
||||||
|
tableRef.value.reload({pageNo:1});
|
||||||
|
}
|
||||||
|
const [register, {}] = useForm({
|
||||||
|
labelWidth: 80,
|
||||||
|
layout: 'horizontal',
|
||||||
|
colProps: { span: 6 } as ColProps,
|
||||||
|
submitOnReset:true,
|
||||||
|
schemas
|
||||||
|
});
|
||||||
|
function handleSubmit(values: Recordable) {
|
||||||
|
for (const key in formParams) {
|
||||||
|
if (values[key] != null && values[key] != undefined) {
|
||||||
|
formParams[key] = values[key];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
reloadTable();
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleReset() {
|
||||||
|
for (const key in formParams) {
|
||||||
|
formParams[key] ='';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const handleDetail = async (record: Recordable) => {
|
||||||
|
emailId.value=record.row.id
|
||||||
|
await nextTick();
|
||||||
|
editVisible.value=true
|
||||||
|
};
|
||||||
|
|
||||||
|
async function handleDelete(record: Recordable) {
|
||||||
|
let ids = []
|
||||||
|
if(!record){
|
||||||
|
ids = selectionData.value.map(({id}) => id);
|
||||||
|
}
|
||||||
|
await confirm('确定要删除?');
|
||||||
|
record? await emailLogDelete(record.row.id):await emailLogBatchDelete(ids);
|
||||||
|
message("删除成功");
|
||||||
|
reloadTable()
|
||||||
|
}
|
||||||
|
function onSelectionChange(value){
|
||||||
|
selectionData.value = value
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped></style>
|
69
src/views/logger/emailLog/querySchemas.ts
Normal file
69
src/views/logger/emailLog/querySchemas.ts
Normal file
@ -0,0 +1,69 @@
|
|||||||
|
import { FormSchema } from '@/components/Form/index';
|
||||||
|
export const schemas: FormSchema[] = [
|
||||||
|
{
|
||||||
|
field: 'title',
|
||||||
|
component: 'Input',
|
||||||
|
label: '邮件标题',
|
||||||
|
componentProps: {
|
||||||
|
placeholder: '请输入邮件标题',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'receiveType',
|
||||||
|
component: 'Select',
|
||||||
|
label: '接收类型',
|
||||||
|
componentProps: {
|
||||||
|
placeholder: '请选择接收类型',
|
||||||
|
options: [
|
||||||
|
{
|
||||||
|
label: '系统用户',
|
||||||
|
value: '1',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '会员用户',
|
||||||
|
value: '2',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '其他',
|
||||||
|
value: '3',
|
||||||
|
}
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'bizType',
|
||||||
|
component: 'Select',
|
||||||
|
label: '业务类型',
|
||||||
|
componentProps: {
|
||||||
|
placeholder: '请选择业务类型',
|
||||||
|
options: [
|
||||||
|
{
|
||||||
|
label: '订单',
|
||||||
|
value: '1',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '其他',
|
||||||
|
value: '2',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'status',
|
||||||
|
component: 'Select',
|
||||||
|
label: '状态',
|
||||||
|
componentProps: {
|
||||||
|
placeholder: '请选择状态',
|
||||||
|
options: [
|
||||||
|
{
|
||||||
|
label: '已读',
|
||||||
|
value: '1',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '未读',
|
||||||
|
value: '0',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
];
|
87
src/views/logger/smsLog/columns.ts
Normal file
87
src/views/logger/smsLog/columns.ts
Normal file
@ -0,0 +1,87 @@
|
|||||||
|
import { h } from 'vue';
|
||||||
|
import { ElTag } from 'element-plus';
|
||||||
|
|
||||||
|
export const columns = [
|
||||||
|
{
|
||||||
|
type: 'selection',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '日志标题',
|
||||||
|
prop: 'title',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '日志类型',
|
||||||
|
prop: 'type',
|
||||||
|
render(record) {
|
||||||
|
let typeText = ''
|
||||||
|
switch (record.row.type) {
|
||||||
|
case 1:
|
||||||
|
typeText='登录'
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
typeText='注册'
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
typeText='找回密码'
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
typeText='业务'
|
||||||
|
break;
|
||||||
|
case 5:
|
||||||
|
typeText='其他'
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return h('span', typeText || '-');
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '模板编号',
|
||||||
|
prop: 'number',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '接收人手机',
|
||||||
|
prop: 'receiveMobile',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '接收人类型',
|
||||||
|
prop: 'receiveType',
|
||||||
|
render(record) {
|
||||||
|
let typeText = ''
|
||||||
|
switch (record.row.receiveType) {
|
||||||
|
case 1:
|
||||||
|
typeText='系统用户'
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
typeText='会员用户'
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
typeText='其他'
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return h('span', typeText || '-');
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '请求耗时',
|
||||||
|
prop: 'consumeTime',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '日志状态',
|
||||||
|
prop: 'status',
|
||||||
|
render(record) {
|
||||||
|
return h('span', record.row.status === 1 ? '已读' : '未读')
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '创建人',
|
||||||
|
prop: 'createUser',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '创建时间',
|
||||||
|
prop: 'createTime',
|
||||||
|
},
|
||||||
|
];
|
120
src/views/logger/smsLog/edit.vue
Normal file
120
src/views/logger/smsLog/edit.vue
Normal file
@ -0,0 +1,120 @@
|
|||||||
|
<template>
|
||||||
|
<el-dialog
|
||||||
|
v-model="props.visible"
|
||||||
|
title="日志详情"
|
||||||
|
|
||||||
|
width="700"
|
||||||
|
:close-on-click-modal="false"
|
||||||
|
:before-close="dialogClose"
|
||||||
|
>
|
||||||
|
<el-descriptions column="2">
|
||||||
|
<el-descriptions-item label="日志标题:">{{formData.title}}</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="日志类型:">{{getTyepText(formData.type)}}</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="模板编号:">{{formData.number}}</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="接收人手机:">{{formData.receiveMobile}}</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="接收人类型:">{{getReviceType(formData.receiveType)}}</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="请求耗时:">{{formData.consumeTime}}</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="日志状态:">{{formData.status==1?'已读':'未读'}}</el-descriptions-item>
|
||||||
|
</el-descriptions>
|
||||||
|
<template #footer>
|
||||||
|
<span class="dialog-footer">
|
||||||
|
<el-button @click="dialogClose">关闭</el-button>
|
||||||
|
</span>
|
||||||
|
</template>
|
||||||
|
</el-dialog>
|
||||||
|
</template>
|
||||||
|
<script lang="ts" setup>
|
||||||
|
import type {FormInstance} from "element-plus";
|
||||||
|
import {getSmsLogDetail} from "@/api/logger/smsLog";
|
||||||
|
import {onMounted, reactive, shallowRef} from "vue";
|
||||||
|
import {message} from "@/utils/auth";
|
||||||
|
import {useLockFn} from "@/utils/useLockFn";
|
||||||
|
|
||||||
|
const emit = defineEmits(["success", "update:visible"]);
|
||||||
|
const formRef = shallowRef<FormInstance>();
|
||||||
|
const formData = reactive({
|
||||||
|
id: "",
|
||||||
|
title: "",
|
||||||
|
type:'',
|
||||||
|
number:'',
|
||||||
|
receiveMobile:'',
|
||||||
|
receiveType:'',
|
||||||
|
consumeTime:'',
|
||||||
|
status:''
|
||||||
|
});
|
||||||
|
|
||||||
|
const props = defineProps({
|
||||||
|
visible: {
|
||||||
|
type: Boolean,
|
||||||
|
required: true,
|
||||||
|
default: false
|
||||||
|
},
|
||||||
|
smsId: {
|
||||||
|
type: Number,
|
||||||
|
required: true,
|
||||||
|
default: 0
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
const dialogClose = () => {
|
||||||
|
emit("update:visible", false);
|
||||||
|
};
|
||||||
|
|
||||||
|
const setFormData = async () => {
|
||||||
|
const data = await getSmsLogDetail(props.smsId);
|
||||||
|
for (const key in formData) {
|
||||||
|
if (data[key] != null && data[key] != undefined) {
|
||||||
|
//@ts-ignore
|
||||||
|
formData[key] = data[key];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
const getReviceType =(type)=>{
|
||||||
|
let typeText = ''
|
||||||
|
switch (type) {
|
||||||
|
case 1:
|
||||||
|
typeText='系统用户'
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
typeText='会员用户'
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
typeText='其他'
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break
|
||||||
|
}
|
||||||
|
return typeText
|
||||||
|
}
|
||||||
|
const getTyepText =(type)=>{
|
||||||
|
let typeText = ''
|
||||||
|
switch (type) {
|
||||||
|
case 1:
|
||||||
|
typeText='登录'
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
typeText='注册'
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
typeText='找回密码'
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
typeText='业务'
|
||||||
|
break;
|
||||||
|
case 5:
|
||||||
|
typeText='其他'
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break
|
||||||
|
}
|
||||||
|
return typeText
|
||||||
|
}
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
if (props.smsId) {
|
||||||
|
setFormData();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
</script>
|
148
src/views/logger/smsLog/index.vue
Normal file
148
src/views/logger/smsLog/index.vue
Normal file
@ -0,0 +1,148 @@
|
|||||||
|
<template>
|
||||||
|
<PageWrapper>
|
||||||
|
<el-card :bordered="false" class="pt-3 mb-3 proCard">
|
||||||
|
<BasicForm @register="register" @submit="handleSubmit" @reset="handleReset"></BasicForm>
|
||||||
|
</el-card>
|
||||||
|
<el-card :bordered="false" class="proCard">
|
||||||
|
<BasicTable
|
||||||
|
:columns="columns"
|
||||||
|
:request="loadDataTable"
|
||||||
|
:row-key="(row) => row.id"
|
||||||
|
ref="tableRef"
|
||||||
|
:actionColumn="actionColumn"
|
||||||
|
@selection-change="onSelectionChange"
|
||||||
|
>
|
||||||
|
<template #tableTitle>
|
||||||
|
<el-button type="danger" @click="handleDelete()" :disabled="!selectionData.length">
|
||||||
|
<template #icon>
|
||||||
|
<el-icon class="el-input__icon">
|
||||||
|
<Delete />
|
||||||
|
</el-icon>
|
||||||
|
</template>
|
||||||
|
删除
|
||||||
|
</el-button>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<template #action>
|
||||||
|
<TableAction />
|
||||||
|
</template>
|
||||||
|
</BasicTable>
|
||||||
|
</el-card>
|
||||||
|
|
||||||
|
<editDialog
|
||||||
|
v-if="editVisible"
|
||||||
|
:smsId="smsId"
|
||||||
|
v-model:visible="editVisible"
|
||||||
|
@success="reloadTable"
|
||||||
|
>
|
||||||
|
</editDialog>
|
||||||
|
</PageWrapper>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts" setup>
|
||||||
|
import { reactive, ref, h,nextTick,defineAsyncComponent } from 'vue';
|
||||||
|
import { ColProps } from 'element-plus';
|
||||||
|
import { schemas } from './querySchemas';
|
||||||
|
import { useForm } from '@/components/Form/index';
|
||||||
|
import { TableAction } from '@/components/Table';
|
||||||
|
import { getSmsLogList,smsLogDelete,smsLogBatchDelete } from '@/api/logger/smsLog';
|
||||||
|
import { columns } from './columns';
|
||||||
|
import {message,confirm} from "@/utils/auth";
|
||||||
|
const editDialog = defineAsyncComponent(() =>
|
||||||
|
import('./edit.vue')
|
||||||
|
)
|
||||||
|
const smsId =ref(0)
|
||||||
|
const editVisible=ref(false)
|
||||||
|
const selectionData = ref([])
|
||||||
|
const tableRef = ref();
|
||||||
|
const formParams = reactive({
|
||||||
|
title:'',
|
||||||
|
receiveType:'',
|
||||||
|
bizType:'',
|
||||||
|
status:''
|
||||||
|
});
|
||||||
|
const actionColumn = reactive({
|
||||||
|
width: 250,
|
||||||
|
label: '操作',
|
||||||
|
prop: 'action',
|
||||||
|
fixed: 'right',
|
||||||
|
render(record) {
|
||||||
|
return h(TableAction, {
|
||||||
|
style: 'button',
|
||||||
|
actions: [
|
||||||
|
{
|
||||||
|
label: '详情',
|
||||||
|
type: 'warning',
|
||||||
|
onClick: handleDetail.bind(null, record),
|
||||||
|
ifShow: () => {
|
||||||
|
return true;
|
||||||
|
},
|
||||||
|
// auth: ['sys:smsLog:detail'],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '删除',
|
||||||
|
type: 'danger',
|
||||||
|
onClick: handleDelete.bind(null, record),
|
||||||
|
// 根据业务控制是否显示 isShow 和 auth 是并且关系
|
||||||
|
ifShow: () => {
|
||||||
|
return true;
|
||||||
|
},
|
||||||
|
// 根据权限控制是否显示: 有权限,会显示,支持多个
|
||||||
|
// auth: ['basic_list'],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
});
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
const loadDataTable = async (res: any) => {
|
||||||
|
const result = await getSmsLogList({ ...formParams, ...res });
|
||||||
|
return result;
|
||||||
|
};
|
||||||
|
|
||||||
|
function reloadTable() {
|
||||||
|
tableRef.value.reload({pageNo:1});
|
||||||
|
}
|
||||||
|
const [register, {}] = useForm({
|
||||||
|
labelWidth: 80,
|
||||||
|
layout: 'horizontal',
|
||||||
|
colProps: { span: 6 } as ColProps,
|
||||||
|
submitOnReset:true,
|
||||||
|
schemas
|
||||||
|
});
|
||||||
|
function handleSubmit(values: Recordable) {
|
||||||
|
for (const key in formParams) {
|
||||||
|
if (values[key] != null && values[key] != undefined) {
|
||||||
|
formParams[key] = values[key];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
reloadTable();
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleReset() {
|
||||||
|
for (const key in formParams) {
|
||||||
|
formParams[key] ='';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const handleDetail = async (record: Recordable) => {
|
||||||
|
smsId.value=record.row.id
|
||||||
|
await nextTick();
|
||||||
|
editVisible.value=true
|
||||||
|
};
|
||||||
|
|
||||||
|
async function handleDelete(record: Recordable) {
|
||||||
|
let ids = []
|
||||||
|
if(!record){
|
||||||
|
ids = selectionData.value.map(({id}) => id);
|
||||||
|
}
|
||||||
|
await confirm('确定要删除?');
|
||||||
|
record? await smsLogDelete(record.row.id):await smsLogBatchDelete(ids);
|
||||||
|
message("删除成功");
|
||||||
|
reloadTable()
|
||||||
|
}
|
||||||
|
function onSelectionChange(value){
|
||||||
|
selectionData.value = value
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped></style>
|
69
src/views/logger/smsLog/querySchemas.ts
Normal file
69
src/views/logger/smsLog/querySchemas.ts
Normal file
@ -0,0 +1,69 @@
|
|||||||
|
import { FormSchema } from '@/components/Form/index';
|
||||||
|
export const schemas: FormSchema[] = [
|
||||||
|
{
|
||||||
|
field: 'title',
|
||||||
|
component: 'Input',
|
||||||
|
label: '短信标题',
|
||||||
|
componentProps: {
|
||||||
|
placeholder: '请输入短信标题',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'receiveType',
|
||||||
|
component: 'Select',
|
||||||
|
label: '接收类型',
|
||||||
|
componentProps: {
|
||||||
|
placeholder: '请选择接收类型',
|
||||||
|
options: [
|
||||||
|
{
|
||||||
|
label: '系统用户',
|
||||||
|
value: '1',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '会员用户',
|
||||||
|
value: '2',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '其他',
|
||||||
|
value: '3',
|
||||||
|
}
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'bizType',
|
||||||
|
component: 'Select',
|
||||||
|
label: '业务类型',
|
||||||
|
componentProps: {
|
||||||
|
placeholder: '请选择业务类型',
|
||||||
|
options: [
|
||||||
|
{
|
||||||
|
label: '订单',
|
||||||
|
value: '1',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '其他',
|
||||||
|
value: '2',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'status',
|
||||||
|
component: 'Select',
|
||||||
|
label: '状态',
|
||||||
|
componentProps: {
|
||||||
|
placeholder: '请选择状态',
|
||||||
|
options: [
|
||||||
|
{
|
||||||
|
label: '已读',
|
||||||
|
value: '1',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '未读',
|
||||||
|
value: '0',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
];
|
Loading…
Reference in New Issue
Block a user