refactor: sms
parent
12ac097b47
commit
09e61f7ef3
|
@ -1,8 +1,23 @@
|
||||||
import request from '@/config/axios'
|
import request from '@/config/axios'
|
||||||
import type { SmsChannelVO } from './types'
|
export type SmsChannelVO = {
|
||||||
|
id: number
|
||||||
|
status: number
|
||||||
|
signature: string
|
||||||
|
remark: string
|
||||||
|
apiKey: string
|
||||||
|
apiSecret: string
|
||||||
|
callbackUrl: string
|
||||||
|
createTime: string
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface SmsChannelPageReqVO extends PageParam {
|
||||||
|
signature?: string
|
||||||
|
code?: string
|
||||||
|
status?: number
|
||||||
|
}
|
||||||
|
|
||||||
// 查询短信渠道列表
|
// 查询短信渠道列表
|
||||||
export const getSmsChannelPageApi = (params) => {
|
export const getSmsChannelPageApi = (params: SmsChannelPageReqVO) => {
|
||||||
return request.get({ url: '/system/sms-channel/page', params })
|
return request.get({ url: '/system/sms-channel/page', params })
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,10 +0,0 @@
|
||||||
export type SmsChannelVO = {
|
|
||||||
id: number
|
|
||||||
status: number
|
|
||||||
signature: string
|
|
||||||
remark: string
|
|
||||||
apiKey: string
|
|
||||||
apiSecret: string
|
|
||||||
callbackUrl: string
|
|
||||||
createTime: string
|
|
||||||
}
|
|
|
@ -1,11 +1,38 @@
|
||||||
import request from '@/config/axios'
|
import request from '@/config/axios'
|
||||||
|
export type SmsLogVO = {
|
||||||
|
id: number
|
||||||
|
idchannelId: number
|
||||||
|
templateId: number
|
||||||
|
mobile: string
|
||||||
|
userId: number
|
||||||
|
userType: number
|
||||||
|
sendStatus: number
|
||||||
|
receiveStatus: number
|
||||||
|
templateType: number
|
||||||
|
templateContent: string
|
||||||
|
templateParams: Map<string, object>
|
||||||
|
apiTemplateId: string
|
||||||
|
sendTime: string
|
||||||
|
createTime: string
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface SmsLogPageReqVO extends PageParam {
|
||||||
|
signature?: string
|
||||||
|
code?: string
|
||||||
|
status?: number
|
||||||
|
}
|
||||||
|
export interface SmsLogExportReqVO {
|
||||||
|
code?: string
|
||||||
|
name?: string
|
||||||
|
status?: number
|
||||||
|
}
|
||||||
|
|
||||||
// 查询短信日志列表
|
// 查询短信日志列表
|
||||||
export const getSmsLogPageApi = (params) => {
|
export const getSmsLogPageApi = (params: SmsLogPageReqVO) => {
|
||||||
return request.get({ url: '/system/sms-log/page', params })
|
return request.get({ url: '/system/sms-log/page', params })
|
||||||
}
|
}
|
||||||
|
|
||||||
// 导出短信日志
|
// 导出短信日志
|
||||||
export const exportSmsLogApi = (params) => {
|
export const exportSmsLogApi = (params: SmsLogExportReqVO) => {
|
||||||
return request.download({ url: '/system/sms-log/export', params })
|
return request.download({ url: '/system/sms-log/export', params })
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +0,0 @@
|
||||||
export type SmsLogVO = {
|
|
||||||
id: number
|
|
||||||
idchannelId: number
|
|
||||||
templateId: number
|
|
||||||
mobile: string
|
|
||||||
sendStatus: number
|
|
||||||
receiveStatus: number
|
|
||||||
createTime: string
|
|
||||||
}
|
|
|
@ -1,5 +1,23 @@
|
||||||
import request from '@/config/axios'
|
import request from '@/config/axios'
|
||||||
import type { SmsTemplateVO } from './types'
|
export type SmsTemplateVO = {
|
||||||
|
id: number
|
||||||
|
type: number
|
||||||
|
status: number
|
||||||
|
code: string
|
||||||
|
name: string
|
||||||
|
content: string
|
||||||
|
remark: string
|
||||||
|
apiTemplateId: string
|
||||||
|
channelId: number
|
||||||
|
channelCode: string
|
||||||
|
createTime: string
|
||||||
|
}
|
||||||
|
|
||||||
|
export type SmsSendVO = {
|
||||||
|
mobile: string
|
||||||
|
templateCode: string
|
||||||
|
templateParams: string
|
||||||
|
}
|
||||||
|
|
||||||
// 查询短信模板列表
|
// 查询短信模板列表
|
||||||
export const getSmsTemplatePageApi = (params) => {
|
export const getSmsTemplatePageApi = (params) => {
|
||||||
|
|
|
@ -1,19 +0,0 @@
|
||||||
export type SmsTemplateVO = {
|
|
||||||
id: number
|
|
||||||
type: number
|
|
||||||
status: number
|
|
||||||
code: string
|
|
||||||
name: string
|
|
||||||
content: string
|
|
||||||
remark: string
|
|
||||||
apiTemplateId: string
|
|
||||||
channelId: number
|
|
||||||
channelCode: string
|
|
||||||
createTime: string
|
|
||||||
}
|
|
||||||
|
|
||||||
export type SmsSendVO = {
|
|
||||||
mobile: string
|
|
||||||
templateCode: string
|
|
||||||
templateParams: string
|
|
||||||
}
|
|
|
@ -1,11 +1,9 @@
|
||||||
<template>
|
<template>
|
||||||
<!-- 搜索工作区 -->
|
|
||||||
<ContentWrap>
|
<ContentWrap>
|
||||||
<Search :schema="allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" />
|
<!-- 列表 -->
|
||||||
</ContentWrap>
|
<vxe-grid ref="xGrid" v-bind="gridOptions" class="xtable-scrollbar">
|
||||||
<ContentWrap>
|
<!-- 操作:新增 -->
|
||||||
<!-- 操作工具栏 -->
|
<template #toolbar_buttons>
|
||||||
<div class="mb-10px">
|
|
||||||
<XButton
|
<XButton
|
||||||
type="primary"
|
type="primary"
|
||||||
preIcon="ep:zoom-in"
|
preIcon="ep:zoom-in"
|
||||||
|
@ -13,30 +11,8 @@
|
||||||
v-hasPermi="['system:sms-channel:create']"
|
v-hasPermi="['system:sms-channel:create']"
|
||||||
@click="handleCreate()"
|
@click="handleCreate()"
|
||||||
/>
|
/>
|
||||||
</div>
|
|
||||||
<!-- 列表 -->
|
|
||||||
<Table
|
|
||||||
:columns="allSchemas.tableColumns"
|
|
||||||
:selection="false"
|
|
||||||
:data="tableObject.tableList"
|
|
||||||
:loading="tableObject.loading"
|
|
||||||
:pagination="{
|
|
||||||
total: tableObject.total
|
|
||||||
}"
|
|
||||||
v-model:pageSize="tableObject.pageSize"
|
|
||||||
v-model:currentPage="tableObject.currentPage"
|
|
||||||
@register="register"
|
|
||||||
>
|
|
||||||
<template #code="{ row }">
|
|
||||||
<DictTag :type="DICT_TYPE.SYSTEM_SMS_CHANNEL_CODE" :value="row.code" />
|
|
||||||
</template>
|
</template>
|
||||||
<template #status="{ row }">
|
<template #actionbtns_default="{ row }">
|
||||||
<DictTag :type="DICT_TYPE.COMMON_STATUS" :value="row.status" />
|
|
||||||
</template>
|
|
||||||
<template #createTime="{ row }">
|
|
||||||
<span>{{ dayjs(row.createTime).format('YYYY-MM-DD HH:mm:ss') }}</span>
|
|
||||||
</template>
|
|
||||||
<template #action="{ row }">
|
|
||||||
<!-- 操作:修改 -->
|
<!-- 操作:修改 -->
|
||||||
<XTextButton
|
<XTextButton
|
||||||
preIcon="ep:edit"
|
preIcon="ep:edit"
|
||||||
|
@ -49,20 +25,20 @@
|
||||||
preIcon="ep:view"
|
preIcon="ep:view"
|
||||||
:title="t('action.detail')"
|
:title="t('action.detail')"
|
||||||
v-hasPermi="['system:sms-channel:update']"
|
v-hasPermi="['system:sms-channel:update']"
|
||||||
@click="handleDetail(row)"
|
@click="handleDetail(row.id)"
|
||||||
/>
|
/>
|
||||||
<!-- 操作:删除 -->
|
<!-- 操作:删除 -->
|
||||||
<XTextButton
|
<XTextButton
|
||||||
preIcon="ep:delete"
|
preIcon="ep:delete"
|
||||||
:title="t('action.del')"
|
:title="t('action.del')"
|
||||||
v-hasPermi="['system:sms-channel:delete']"
|
v-hasPermi="['system:sms-channel:delete']"
|
||||||
@click="delList(row.id, false)"
|
@click="handleDelete(row.id)"
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
</Table>
|
</vxe-grid>
|
||||||
</ContentWrap>
|
</ContentWrap>
|
||||||
|
|
||||||
<XModal v-model="dialogVisible" :title="dialogTitle">
|
<XModal id="smsChannel" v-model="dialogVisible" :title="dialogTitle">
|
||||||
<!-- 对话框(添加 / 修改) -->
|
<!-- 对话框(添加 / 修改) -->
|
||||||
<Form
|
<Form
|
||||||
v-if="['create', 'update'].includes(actionType)"
|
v-if="['create', 'update'].includes(actionType)"
|
||||||
|
@ -74,7 +50,7 @@
|
||||||
<Descriptions
|
<Descriptions
|
||||||
v-if="actionType === 'detail'"
|
v-if="actionType === 'detail'"
|
||||||
:schema="allSchemas.detailSchema"
|
:schema="allSchemas.detailSchema"
|
||||||
:data="detailRef"
|
:data="detailData"
|
||||||
/>
|
/>
|
||||||
<!-- 操作按钮 -->
|
<!-- 操作按钮 -->
|
||||||
<template #footer>
|
<template #footer>
|
||||||
|
@ -83,41 +59,45 @@
|
||||||
v-if="['create', 'update'].includes(actionType)"
|
v-if="['create', 'update'].includes(actionType)"
|
||||||
type="primary"
|
type="primary"
|
||||||
:title="t('action.save')"
|
:title="t('action.save')"
|
||||||
:loading="loading"
|
:loading="actionLoading"
|
||||||
@click="submitForm()"
|
@click="submitForm()"
|
||||||
/>
|
/>
|
||||||
<!-- 按钮:关闭 -->
|
<!-- 按钮:关闭 -->
|
||||||
<XButton :loading="loading" :title="t('dialog.close')" @click="dialogVisible = false" />
|
<XButton :loading="actionLoading" :title="t('dialog.close')" @click="dialogVisible = false" />
|
||||||
</template>
|
</template>
|
||||||
</XModal>
|
</XModal>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
|
// 全局相关的 import
|
||||||
import { ref, unref } from 'vue'
|
import { ref, unref } from 'vue'
|
||||||
import dayjs from 'dayjs'
|
|
||||||
import { ElMessage } from 'element-plus'
|
|
||||||
import { DICT_TYPE } from '@/utils/dict'
|
|
||||||
import { useTable } from '@/hooks/web/useTable'
|
|
||||||
import { useI18n } from '@/hooks/web/useI18n'
|
import { useI18n } from '@/hooks/web/useI18n'
|
||||||
|
import { useMessage } from '@/hooks/web/useMessage'
|
||||||
|
import { useVxeGrid } from '@/hooks/web/useVxeGrid'
|
||||||
|
import { VxeGridInstance } from 'vxe-table'
|
||||||
import { FormExpose } from '@/components/Form'
|
import { FormExpose } from '@/components/Form'
|
||||||
import type { SmsChannelVO } from '@/api/system/sms/smsChannel/types'
|
// 业务相关的 import
|
||||||
import { rules, allSchemas } from './sms.channel.data'
|
|
||||||
import * as SmsChannelApi from '@/api/system/sms/smsChannel'
|
import * as SmsChannelApi from '@/api/system/sms/smsChannel'
|
||||||
const { t } = useI18n() // 国际化
|
import { rules, allSchemas } from './sms.channel.data'
|
||||||
|
|
||||||
// ========== 列表相关 ==========
|
const { t } = useI18n() // 国际化
|
||||||
const { register, tableObject, methods } = useTable<SmsChannelVO>({
|
const message = useMessage() // 消息弹窗
|
||||||
|
|
||||||
|
// 列表相关的变量
|
||||||
|
const xGrid = ref<VxeGridInstance>() // 列表 Grid Ref
|
||||||
|
const { gridOptions, reloadList, delList } = useVxeGrid<SmsChannelApi.SmsChannelVO>({
|
||||||
|
allSchemas: allSchemas,
|
||||||
getListApi: SmsChannelApi.getSmsChannelPageApi,
|
getListApi: SmsChannelApi.getSmsChannelPageApi,
|
||||||
delListApi: SmsChannelApi.deleteSmsChannelApi
|
delListApi: SmsChannelApi.deleteSmsChannelApi
|
||||||
})
|
})
|
||||||
const { getList, setSearchParams, delList } = methods
|
|
||||||
|
|
||||||
// ========== CRUD 相关 ==========
|
// 弹窗相关的变量
|
||||||
const loading = ref(false) // 遮罩层
|
|
||||||
const actionType = ref('') // 操作按钮的类型
|
|
||||||
const dialogVisible = ref(false) // 是否显示弹出层
|
const dialogVisible = ref(false) // 是否显示弹出层
|
||||||
const dialogTitle = ref('edit') // 弹出层标题
|
const dialogTitle = ref('edit') // 弹出层标题
|
||||||
|
const actionType = ref('') // 操作按钮的类型
|
||||||
|
const actionLoading = ref(false) // 按钮 Loading
|
||||||
const formRef = ref<FormExpose>() // 表单 Ref
|
const formRef = ref<FormExpose>() // 表单 Ref
|
||||||
|
const detailData = ref() // 详情 Ref
|
||||||
|
|
||||||
// 设置标题
|
// 设置标题
|
||||||
const setDialogTile = (type: string) => {
|
const setDialogTile = (type: string) => {
|
||||||
|
@ -139,43 +119,42 @@ const handleUpdate = async (rowId: number) => {
|
||||||
unref(formRef)?.setValues(res)
|
unref(formRef)?.setValues(res)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 详情操作
|
||||||
|
const handleDetail = async (rowId: number) => {
|
||||||
|
setDialogTile('detail')
|
||||||
|
const res = await SmsChannelApi.getSmsChannelApi(rowId)
|
||||||
|
detailData.value = res
|
||||||
|
}
|
||||||
|
|
||||||
|
// 删除操作
|
||||||
|
const handleDelete = async (rowId: number) => {
|
||||||
|
await delList(xGrid, rowId)
|
||||||
|
}
|
||||||
|
|
||||||
// 提交按钮
|
// 提交按钮
|
||||||
const submitForm = async () => {
|
const submitForm = async () => {
|
||||||
const elForm = unref(formRef)?.getElFormRef()
|
const elForm = unref(formRef)?.getElFormRef()
|
||||||
if (!elForm) return
|
if (!elForm) return
|
||||||
elForm.validate(async (valid) => {
|
elForm.validate(async (valid) => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
loading.value = true
|
actionLoading.value = true
|
||||||
// 提交请求
|
// 提交请求
|
||||||
try {
|
try {
|
||||||
const data = unref(formRef)?.formModel as SmsChannelVO
|
const data = unref(formRef)?.formModel as SmsChannelApi.SmsChannelVO
|
||||||
if (actionType.value === 'create') {
|
if (actionType.value === 'create') {
|
||||||
await SmsChannelApi.createSmsChannelApi(data)
|
await SmsChannelApi.createSmsChannelApi(data)
|
||||||
ElMessage.success(t('common.createSuccess'))
|
message.success(t('common.createSuccess'))
|
||||||
} else {
|
} else {
|
||||||
await SmsChannelApi.updateSmsChannelApi(data)
|
await SmsChannelApi.updateSmsChannelApi(data)
|
||||||
ElMessage.success(t('common.updateSuccess'))
|
message.success(t('common.updateSuccess'))
|
||||||
}
|
}
|
||||||
// 操作成功,重新加载列表
|
|
||||||
dialogVisible.value = false
|
dialogVisible.value = false
|
||||||
await getList()
|
|
||||||
} finally {
|
} finally {
|
||||||
loading.value = false
|
actionLoading.value = false
|
||||||
|
// 刷新列表
|
||||||
|
reloadList(xGrid)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// ========== 详情相关 ==========
|
|
||||||
const detailRef = ref() // 详情 Ref
|
|
||||||
|
|
||||||
// 详情操作
|
|
||||||
const handleDetail = async (row: SmsChannelVO) => {
|
|
||||||
// 设置数据
|
|
||||||
detailRef.value = row
|
|
||||||
setDialogTile('detail')
|
|
||||||
}
|
|
||||||
|
|
||||||
// ========== 初始化 ==========
|
|
||||||
getList()
|
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
import { reactive } from 'vue'
|
import { reactive } from 'vue'
|
||||||
import { useI18n } from '@/hooks/web/useI18n'
|
import { useI18n } from '@/hooks/web/useI18n'
|
||||||
import { required } from '@/utils/formRules'
|
import { required } from '@/utils/formRules'
|
||||||
import { CrudSchema, useCrudSchemas } from '@/hooks/web/useCrudSchemas'
|
|
||||||
import { DICT_TYPE } from '@/utils/dict'
|
import { DICT_TYPE } from '@/utils/dict'
|
||||||
|
import { VxeCrudSchema, useVxeCrudSchemas } from '@/hooks/web/useVxeCrudSchemas'
|
||||||
const { t } = useI18n() // 国际化
|
const { t } = useI18n() // 国际化
|
||||||
|
|
||||||
// 表单校验
|
// 表单校验
|
||||||
|
@ -14,79 +14,46 @@ export const rules = reactive({
|
||||||
})
|
})
|
||||||
|
|
||||||
// CrudSchema
|
// CrudSchema
|
||||||
const crudSchemas = reactive<CrudSchema[]>([
|
const crudSchemas = reactive<VxeCrudSchema>({
|
||||||
|
primaryKey: 'id',
|
||||||
|
primaryType: 'seq',
|
||||||
|
action: true,
|
||||||
|
columns: [
|
||||||
{
|
{
|
||||||
label: t('common.index'),
|
title: '短信签名',
|
||||||
field: 'id',
|
|
||||||
type: 'index',
|
|
||||||
form: {
|
|
||||||
show: false
|
|
||||||
},
|
|
||||||
detail: {
|
|
||||||
show: false
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: '短信签名',
|
|
||||||
field: 'signature',
|
field: 'signature',
|
||||||
search: {
|
isSearch: true
|
||||||
show: true
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: '渠道编码',
|
title: '渠道编码',
|
||||||
field: 'code',
|
field: 'code',
|
||||||
dictType: DICT_TYPE.SYSTEM_SMS_CHANNEL_CODE,
|
dictType: DICT_TYPE.SYSTEM_SMS_CHANNEL_CODE,
|
||||||
search: {
|
isSearch: true
|
||||||
show: true
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: t('common.status'),
|
title: t('common.status'),
|
||||||
field: 'status',
|
field: 'status',
|
||||||
dictType: DICT_TYPE.COMMON_STATUS,
|
dictType: DICT_TYPE.COMMON_STATUS,
|
||||||
search: {
|
isSearch: true
|
||||||
show: true
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: '短信 API 的账号',
|
title: '短信 API 的账号',
|
||||||
field: 'apiKey'
|
field: 'apiKey'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: '短信 API 的密钥',
|
title: '短信 API 的密钥',
|
||||||
field: 'apiSecret'
|
field: 'apiSecret'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: '短信发送回调 URL',
|
title: '短信发送回调 URL',
|
||||||
field: 'callbackUrl'
|
field: 'callbackUrl'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: t('common.createTime'),
|
title: t('common.createTime'),
|
||||||
field: 'createTime',
|
field: 'createTime',
|
||||||
form: {
|
formatter: 'formatDate',
|
||||||
show: false
|
isForm: false
|
||||||
},
|
|
||||||
search: {
|
|
||||||
show: true,
|
|
||||||
component: 'DatePicker',
|
|
||||||
componentProps: {
|
|
||||||
type: 'daterange',
|
|
||||||
valueFormat: 'YYYY-MM-DD HH:mm:ss',
|
|
||||||
defaultTime: [new Date(2000, 1, 1, 0, 0, 0), new Date(2000, 2, 1, 23, 59, 59)]
|
|
||||||
}
|
}
|
||||||
}
|
]
|
||||||
},
|
})
|
||||||
{
|
export const { allSchemas } = useVxeCrudSchemas(crudSchemas)
|
||||||
label: t('table.action'),
|
|
||||||
field: 'action',
|
|
||||||
width: '240px',
|
|
||||||
form: {
|
|
||||||
show: false
|
|
||||||
},
|
|
||||||
detail: {
|
|
||||||
show: false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
])
|
|
||||||
export const { allSchemas } = useCrudSchemas(crudSchemas)
|
|
||||||
|
|
|
@ -1,41 +1,23 @@
|
||||||
<template>
|
<template>
|
||||||
<!-- 搜索工作区 -->
|
|
||||||
<ContentWrap>
|
|
||||||
<Search :schema="allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" />
|
|
||||||
</ContentWrap>
|
|
||||||
<ContentWrap>
|
<ContentWrap>
|
||||||
<!-- 列表 -->
|
<!-- 列表 -->
|
||||||
<Table
|
<vxe-grid ref="xGrid" v-bind="gridOptions" class="xtable-scrollbar">
|
||||||
:columns="allSchemas.tableColumns"
|
<!-- 操作:导出 -->
|
||||||
:selection="false"
|
<template #toolbar_buttons>
|
||||||
:data="tableObject.tableList"
|
<XButton
|
||||||
:loading="tableObject.loading"
|
type="warning"
|
||||||
:pagination="{
|
preIcon="ep:download"
|
||||||
total: tableObject.total
|
:title="t('action.export')"
|
||||||
}"
|
@click="handleExport()"
|
||||||
v-model:pageSize="tableObject.pageSize"
|
/>
|
||||||
v-model:currentPage="tableObject.currentPage"
|
|
||||||
@register="register"
|
|
||||||
>
|
|
||||||
<template #code="{ row }">
|
|
||||||
<DictTag :type="DICT_TYPE.SYSTEM_SMS_CHANNEL_CODE" :value="row.code" />
|
|
||||||
</template>
|
</template>
|
||||||
<template #status="{ row }">
|
<template #actionbtns_default="{ row }">
|
||||||
<DictTag :type="DICT_TYPE.COMMON_STATUS" :value="row.status" />
|
|
||||||
</template>
|
|
||||||
<template #createTime="{ row }">
|
|
||||||
<span>{{ dayjs(row.createTime).format('YYYY-MM-DD HH:mm:ss') }}</span>
|
|
||||||
</template>
|
|
||||||
<template #receiveTime="{ row }">
|
|
||||||
<span>{{ dayjs(row.receiveTime).format('YYYY-MM-DD HH:mm:ss') }}</span>
|
|
||||||
</template>
|
|
||||||
<template #action="{ row }">
|
|
||||||
<XTextButton preIcon="ep:view" :title="t('action.detail')" @click="handleDetail(row)" />
|
<XTextButton preIcon="ep:view" :title="t('action.detail')" @click="handleDetail(row)" />
|
||||||
</template>
|
</template>
|
||||||
</Table>
|
</vxe-grid>
|
||||||
</ContentWrap>
|
</ContentWrap>
|
||||||
|
|
||||||
<XModal v-model="dialogVisible" :title="dialogTitle">
|
<XModal id="smsLog" v-model="dialogVisible" :title="dialogTitle">
|
||||||
<!-- 对话框(详情) -->
|
<!-- 对话框(详情) -->
|
||||||
<Descriptions
|
<Descriptions
|
||||||
v-if="actionType === 'detail'"
|
v-if="actionType === 'detail'"
|
||||||
|
@ -50,33 +32,37 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
|
// 全局相关的 import
|
||||||
import { ref } from 'vue'
|
import { ref } from 'vue'
|
||||||
import dayjs from 'dayjs'
|
|
||||||
import { DICT_TYPE } from '@/utils/dict'
|
|
||||||
import { useTable } from '@/hooks/web/useTable'
|
|
||||||
import { useI18n } from '@/hooks/web/useI18n'
|
import { useI18n } from '@/hooks/web/useI18n'
|
||||||
import type { SmsLogVO } from '@/api/system/sms/smsLog/types'
|
import { useVxeGrid } from '@/hooks/web/useVxeGrid'
|
||||||
|
import { VxeGridInstance } from 'vxe-table'
|
||||||
import { allSchemas } from './sms.log.data'
|
import { allSchemas } from './sms.log.data'
|
||||||
import * as SmsLoglApi from '@/api/system/sms/smsLog'
|
import * as SmsLoglApi from '@/api/system/sms/smsLog'
|
||||||
const { t } = useI18n() // 国际化
|
const { t } = useI18n() // 国际化
|
||||||
|
|
||||||
// ========== 列表相关 ==========
|
// 列表相关的变量
|
||||||
const { register, tableObject, methods } = useTable<SmsLogVO>({
|
const xGrid = ref<VxeGridInstance>() // 列表 Grid Ref
|
||||||
getListApi: SmsLoglApi.getSmsLogPageApi
|
const { gridOptions, exportList } = useVxeGrid<SmsLoglApi.SmsLogVO>({
|
||||||
|
allSchemas: allSchemas,
|
||||||
|
getListApi: SmsLoglApi.getSmsLogPageApi,
|
||||||
|
exportListApi: SmsLoglApi.exportSmsLogApi
|
||||||
})
|
})
|
||||||
const { getList, setSearchParams } = methods
|
|
||||||
|
|
||||||
// ========== CRUD 相关 ==========
|
// 弹窗相关的变量
|
||||||
const actionType = ref('') // 操作按钮的类型
|
|
||||||
const dialogVisible = ref(false) // 是否显示弹出层
|
const dialogVisible = ref(false) // 是否显示弹出层
|
||||||
const dialogTitle = ref(t('action.detail')) // 弹出层标题
|
const dialogTitle = ref('edit') // 弹出层标题
|
||||||
|
const actionType = ref('') // 操作按钮的类型
|
||||||
// ========== 详情相关 ==========
|
// ========== 详情相关 ==========
|
||||||
const detailRef = ref() // 详情 Ref
|
const detailRef = ref() // 详情 Ref
|
||||||
const handleDetail = (row: SmsLogVO) => {
|
const handleDetail = (row: SmsLoglApi.SmsLogVO) => {
|
||||||
// 设置数据
|
// 设置数据
|
||||||
detailRef.value = row
|
detailRef.value = row
|
||||||
dialogVisible.value = true
|
dialogVisible.value = true
|
||||||
}
|
}
|
||||||
// ========== 初始化 ==========
|
|
||||||
getList()
|
// 导出操作
|
||||||
|
const handleExport = async () => {
|
||||||
|
await exportList(xGrid, '短信日志.xls')
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -1,105 +1,68 @@
|
||||||
import { reactive } from 'vue'
|
import { reactive } from 'vue'
|
||||||
import { useI18n } from '@/hooks/web/useI18n'
|
import { useI18n } from '@/hooks/web/useI18n'
|
||||||
import { CrudSchema, useCrudSchemas } from '@/hooks/web/useCrudSchemas'
|
|
||||||
import { DICT_TYPE } from '@/utils/dict'
|
import { DICT_TYPE } from '@/utils/dict'
|
||||||
|
import { VxeCrudSchema, useVxeCrudSchemas } from '@/hooks/web/useVxeCrudSchemas'
|
||||||
const { t } = useI18n() // 国际化
|
const { t } = useI18n() // 国际化
|
||||||
|
|
||||||
// CrudSchema
|
// CrudSchema
|
||||||
const crudSchemas = reactive<CrudSchema[]>([
|
const crudSchemas = reactive<VxeCrudSchema>({
|
||||||
|
primaryKey: 'id',
|
||||||
|
primaryType: 'seq',
|
||||||
|
action: true,
|
||||||
|
columns: [
|
||||||
{
|
{
|
||||||
label: t('common.index'),
|
title: '手机号',
|
||||||
field: 'id',
|
|
||||||
type: 'index',
|
|
||||||
form: {
|
|
||||||
show: false
|
|
||||||
},
|
|
||||||
detail: {
|
|
||||||
show: false
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: '手机号',
|
|
||||||
field: 'mobile',
|
field: 'mobile',
|
||||||
search: {
|
isSearch: true
|
||||||
show: true
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: '短信内容',
|
title: '短信内容',
|
||||||
field: 'templateContent'
|
field: 'templateContent'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: '短信渠道',
|
title: '短信渠道',
|
||||||
field: 'channelId',
|
field: 'channelId',
|
||||||
dictType: DICT_TYPE.SYSTEM_SMS_CHANNEL_CODE,
|
dictType: DICT_TYPE.SYSTEM_SMS_CHANNEL_CODE,
|
||||||
search: {
|
isSearch: true
|
||||||
show: true
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: '发送状态',
|
title: '发送状态',
|
||||||
field: 'sendStatus',
|
field: 'sendStatus',
|
||||||
dictType: DICT_TYPE.SYSTEM_SMS_SEND_STATUS,
|
dictType: DICT_TYPE.SYSTEM_SMS_SEND_STATUS,
|
||||||
search: {
|
isSearch: true
|
||||||
show: true
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: '接收状态',
|
title: '接收状态',
|
||||||
field: 'receiveTime',
|
field: 'receiveStatus',
|
||||||
dictType: DICT_TYPE.SYSTEM_SMS_RECEIVE_STATUS,
|
dictType: DICT_TYPE.SYSTEM_SMS_RECEIVE_STATUS,
|
||||||
search: {
|
isSearch: true
|
||||||
show: true
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: '模板编号',
|
title: '模板编号',
|
||||||
field: 'templateId',
|
field: 'templateId',
|
||||||
search: {
|
isSearch: true
|
||||||
show: true
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: '短信类型',
|
title: '短信类型',
|
||||||
field: 'channelId',
|
field: 'templateType',
|
||||||
dictType: DICT_TYPE.SYSTEM_SMS_TEMPLATE_TYPE,
|
dictType: DICT_TYPE.SYSTEM_SMS_TEMPLATE_TYPE,
|
||||||
search: {
|
isSearch: true
|
||||||
show: true
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: '接收时间',
|
title: '接收时间',
|
||||||
field: 'receiveTime',
|
field: 'receiveTime'
|
||||||
form: {
|
|
||||||
show: false
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: t('common.createTime'),
|
title: t('common.createTime'),
|
||||||
field: 'createTime',
|
field: 'createTime',
|
||||||
form: {
|
formatter: 'formatDate',
|
||||||
show: false
|
|
||||||
},
|
|
||||||
search: {
|
search: {
|
||||||
show: true,
|
show: true,
|
||||||
component: 'DatePicker',
|
itemRender: {
|
||||||
componentProps: {
|
name: 'XDataTimePicker'
|
||||||
type: 'daterange',
|
|
||||||
valueFormat: 'YYYY-MM-DD HH:mm:ss',
|
|
||||||
defaultTime: [new Date(2000, 1, 1, 0, 0, 0), new Date(2000, 2, 1, 23, 59, 59)]
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
|
||||||
{
|
|
||||||
label: t('table.action'),
|
|
||||||
field: 'action',
|
|
||||||
width: '80px',
|
|
||||||
form: {
|
|
||||||
show: false
|
|
||||||
},
|
|
||||||
detail: {
|
|
||||||
show: false
|
|
||||||
}
|
}
|
||||||
}
|
]
|
||||||
])
|
})
|
||||||
export const { allSchemas } = useCrudSchemas(crudSchemas)
|
export const { allSchemas } = useVxeCrudSchemas(crudSchemas)
|
||||||
|
|
|
@ -1,11 +1,9 @@
|
||||||
<template>
|
<template>
|
||||||
<!-- 搜索工作区 -->
|
|
||||||
<ContentWrap>
|
<ContentWrap>
|
||||||
<Search :schema="allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" />
|
<!-- 列表 -->
|
||||||
</ContentWrap>
|
<vxe-grid ref="xGrid" v-bind="gridOptions" class="xtable-scrollbar">
|
||||||
<ContentWrap>
|
<!-- 操作:新增 -->
|
||||||
<!-- 操作工具栏 -->
|
<template #toolbar_buttons>
|
||||||
<div class="mb-10px">
|
|
||||||
<XButton
|
<XButton
|
||||||
type="primary"
|
type="primary"
|
||||||
preIcon="ep:zoom-in"
|
preIcon="ep:zoom-in"
|
||||||
|
@ -13,30 +11,8 @@
|
||||||
v-hasPermi="['system:sms-channel:create']"
|
v-hasPermi="['system:sms-channel:create']"
|
||||||
@click="handleCreate()"
|
@click="handleCreate()"
|
||||||
/>
|
/>
|
||||||
</div>
|
|
||||||
<!-- 列表 -->
|
|
||||||
<Table
|
|
||||||
:columns="allSchemas.tableColumns"
|
|
||||||
:selection="false"
|
|
||||||
:data="tableObject.tableList"
|
|
||||||
:loading="tableObject.loading"
|
|
||||||
:pagination="{
|
|
||||||
total: tableObject.total
|
|
||||||
}"
|
|
||||||
v-model:pageSize="tableObject.pageSize"
|
|
||||||
v-model:currentPage="tableObject.currentPage"
|
|
||||||
@register="register"
|
|
||||||
>
|
|
||||||
<template #type="{ row }">
|
|
||||||
<DictTag :type="DICT_TYPE.SYSTEM_SMS_TEMPLATE_TYPE" :value="row.type" />
|
|
||||||
</template>
|
</template>
|
||||||
<template #status="{ row }">
|
<template #actionbtns_default="{ row }">
|
||||||
<DictTag :type="DICT_TYPE.COMMON_STATUS" :value="row.status" />
|
|
||||||
</template>
|
|
||||||
<template #createTime="{ row }">
|
|
||||||
<span>{{ dayjs(row.createTime).format('YYYY-MM-DD HH:mm:ss') }}</span>
|
|
||||||
</template>
|
|
||||||
<template #action="{ row }">
|
|
||||||
<XTextButton
|
<XTextButton
|
||||||
preIcon="ep:cpu"
|
preIcon="ep:cpu"
|
||||||
:title="t('action.test')"
|
:title="t('action.test')"
|
||||||
|
@ -55,20 +31,20 @@
|
||||||
preIcon="ep:view"
|
preIcon="ep:view"
|
||||||
:title="t('action.detail')"
|
:title="t('action.detail')"
|
||||||
v-hasPermi="['system:sms-template:update']"
|
v-hasPermi="['system:sms-template:update']"
|
||||||
@click="handleDetail(row)"
|
@click="handleDetail(row.id)"
|
||||||
/>
|
/>
|
||||||
<!-- 操作:删除 -->
|
<!-- 操作:删除 -->
|
||||||
<XTextButton
|
<XTextButton
|
||||||
preIcon="ep:delete"
|
preIcon="ep:delete"
|
||||||
:title="t('action.del')"
|
:title="t('action.del')"
|
||||||
v-hasPermi="['system:sms-template:delete']"
|
v-hasPermi="['system:sms-template:delete']"
|
||||||
@click="delList(row.id, false)"
|
@click="handleDelete(row.id)"
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
</Table>
|
</vxe-grid>
|
||||||
</ContentWrap>
|
</ContentWrap>
|
||||||
|
|
||||||
<XModal v-model="dialogVisible" :title="dialogTitle">
|
<XModal id="smsTemplate" v-model="dialogVisible" :title="dialogTitle">
|
||||||
<!-- 对话框(添加 / 修改) -->
|
<!-- 对话框(添加 / 修改) -->
|
||||||
<Form
|
<Form
|
||||||
v-if="['create', 'update'].includes(actionType)"
|
v-if="['create', 'update'].includes(actionType)"
|
||||||
|
@ -80,7 +56,7 @@
|
||||||
<Descriptions
|
<Descriptions
|
||||||
v-if="actionType === 'detail'"
|
v-if="actionType === 'detail'"
|
||||||
:schema="allSchemas.detailSchema"
|
:schema="allSchemas.detailSchema"
|
||||||
:data="detailRef"
|
:data="detailData"
|
||||||
/>
|
/>
|
||||||
<!-- 操作按钮 -->
|
<!-- 操作按钮 -->
|
||||||
<template #footer>
|
<template #footer>
|
||||||
|
@ -89,14 +65,14 @@
|
||||||
v-if="['create', 'update'].includes(actionType)"
|
v-if="['create', 'update'].includes(actionType)"
|
||||||
type="primary"
|
type="primary"
|
||||||
:title="t('action.save')"
|
:title="t('action.save')"
|
||||||
:loading="loading"
|
:loading="actionLoading"
|
||||||
@click="submitForm()"
|
@click="submitForm()"
|
||||||
/>
|
/>
|
||||||
<!-- 按钮:关闭 -->
|
<!-- 按钮:关闭 -->
|
||||||
<XButton :loading="loading" :title="t('dialog.close')" @click="dialogVisible = false" />
|
<XButton :loading="actionLoading" :title="t('dialog.close')" @click="dialogVisible = false" />
|
||||||
</template>
|
</template>
|
||||||
</XModal>
|
</XModal>
|
||||||
<XModal v-model="sendVisible" title="测试">
|
<XModal id="sendTest" v-model="sendVisible" title="测试">
|
||||||
<el-form :model="sendSmsForm" :rules="sendSmsRules" label-width="140px">
|
<el-form :model="sendSmsForm" :rules="sendSmsRules" label-width="140px">
|
||||||
<el-form-item label="模板内容" prop="content">
|
<el-form-item label="模板内容" prop="content">
|
||||||
<el-input
|
<el-input
|
||||||
|
@ -123,38 +99,47 @@
|
||||||
</el-form>
|
</el-form>
|
||||||
<!-- 操作按钮 -->
|
<!-- 操作按钮 -->
|
||||||
<template #footer>
|
<template #footer>
|
||||||
<XButton type="primary" :title="t('action.test')" :loading="loading" @click="sendSmsTest()" />
|
<XButton
|
||||||
|
type="primary"
|
||||||
|
:title="t('action.test')"
|
||||||
|
:loading="actionLoading"
|
||||||
|
@click="sendSmsTest()"
|
||||||
|
/>
|
||||||
<XButton :title="t('dialog.close')" @click="dialogVisible = false" />
|
<XButton :title="t('dialog.close')" @click="dialogVisible = false" />
|
||||||
</template>
|
</template>
|
||||||
</XModal>
|
</XModal>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
|
// 全局相关的 import
|
||||||
import { ref, unref } from 'vue'
|
import { ref, unref } from 'vue'
|
||||||
import dayjs from 'dayjs'
|
|
||||||
import { ElMessage, ElForm, ElFormItem, ElInput } from 'element-plus'
|
|
||||||
import { DICT_TYPE } from '@/utils/dict'
|
|
||||||
import { useTable } from '@/hooks/web/useTable'
|
|
||||||
import { useI18n } from '@/hooks/web/useI18n'
|
import { useI18n } from '@/hooks/web/useI18n'
|
||||||
|
import { useMessage } from '@/hooks/web/useMessage'
|
||||||
|
import { useVxeGrid } from '@/hooks/web/useVxeGrid'
|
||||||
|
import { VxeGridInstance } from 'vxe-table'
|
||||||
import { FormExpose } from '@/components/Form'
|
import { FormExpose } from '@/components/Form'
|
||||||
import type { SmsTemplateVO } from '@/api/system/sms/smsTemplate/types'
|
// 业务相关的 import
|
||||||
import { rules, allSchemas } from './sms.template.data'
|
|
||||||
import * as SmsTemplateApi from '@/api/system/sms/smsTemplate'
|
import * as SmsTemplateApi from '@/api/system/sms/smsTemplate'
|
||||||
const { t } = useI18n() // 国际化
|
import { rules, allSchemas } from './sms.template.data'
|
||||||
|
|
||||||
// ========== 列表相关 ==========
|
const { t } = useI18n() // 国际化
|
||||||
const { register, tableObject, methods } = useTable<SmsTemplateVO>({
|
const message = useMessage() // 消息弹窗
|
||||||
|
|
||||||
|
// 列表相关的变量
|
||||||
|
const xGrid = ref<VxeGridInstance>() // 列表 Grid Ref
|
||||||
|
const { gridOptions, reloadList, delList } = useVxeGrid<SmsTemplateApi.SmsTemplateVO>({
|
||||||
|
allSchemas: allSchemas,
|
||||||
getListApi: SmsTemplateApi.getSmsTemplatePageApi,
|
getListApi: SmsTemplateApi.getSmsTemplatePageApi,
|
||||||
delListApi: SmsTemplateApi.deleteSmsTemplateApi
|
delListApi: SmsTemplateApi.deleteSmsTemplateApi
|
||||||
})
|
})
|
||||||
const { getList, setSearchParams, delList } = methods
|
|
||||||
|
|
||||||
// ========== CRUD 相关 ==========
|
// 弹窗相关的变量
|
||||||
const loading = ref(false) // 遮罩层
|
|
||||||
const actionType = ref('') // 操作按钮的类型
|
|
||||||
const dialogVisible = ref(false) // 是否显示弹出层
|
const dialogVisible = ref(false) // 是否显示弹出层
|
||||||
const dialogTitle = ref('edit') // 弹出层标题
|
const dialogTitle = ref('edit') // 弹出层标题
|
||||||
|
const actionType = ref('') // 操作按钮的类型
|
||||||
|
const actionLoading = ref(false) // 按钮 Loading
|
||||||
const formRef = ref<FormExpose>() // 表单 Ref
|
const formRef = ref<FormExpose>() // 表单 Ref
|
||||||
|
const detailData = ref() // 详情 Ref
|
||||||
|
|
||||||
// 设置标题
|
// 设置标题
|
||||||
const setDialogTile = (type: string) => {
|
const setDialogTile = (type: string) => {
|
||||||
|
@ -176,42 +161,46 @@ const handleUpdate = async (rowId: number) => {
|
||||||
unref(formRef)?.setValues(res)
|
unref(formRef)?.setValues(res)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 详情操作
|
||||||
|
const handleDetail = async (rowId: number) => {
|
||||||
|
setDialogTile('detail')
|
||||||
|
// 设置数据
|
||||||
|
const res = await SmsTemplateApi.getSmsTemplateApi(rowId)
|
||||||
|
detailData.value = res
|
||||||
|
}
|
||||||
|
|
||||||
|
// 删除操作
|
||||||
|
const handleDelete = async (rowId: number) => {
|
||||||
|
await delList(xGrid, rowId)
|
||||||
|
}
|
||||||
|
|
||||||
// 提交按钮
|
// 提交按钮
|
||||||
const submitForm = async () => {
|
const submitForm = async () => {
|
||||||
const elForm = unref(formRef)?.getElFormRef()
|
const elForm = unref(formRef)?.getElFormRef()
|
||||||
if (!elForm) return
|
if (!elForm) return
|
||||||
elForm.validate(async (valid) => {
|
elForm.validate(async (valid) => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
loading.value = true
|
actionLoading.value = true
|
||||||
// 提交请求
|
// 提交请求
|
||||||
try {
|
try {
|
||||||
const data = unref(formRef)?.formModel as SmsTemplateVO
|
const data = unref(formRef)?.formModel as SmsTemplateApi.SmsTemplateVO
|
||||||
if (actionType.value === 'create') {
|
if (actionType.value === 'create') {
|
||||||
await SmsTemplateApi.createSmsTemplateApi(data)
|
await SmsTemplateApi.createSmsTemplateApi(data)
|
||||||
ElMessage.success(t('common.createSuccess'))
|
message.success(t('common.createSuccess'))
|
||||||
} else {
|
} else {
|
||||||
await SmsTemplateApi.updateSmsTemplateApi(data)
|
await SmsTemplateApi.updateSmsTemplateApi(data)
|
||||||
ElMessage.success(t('common.updateSuccess'))
|
message.success(t('common.updateSuccess'))
|
||||||
}
|
}
|
||||||
// 操作成功,重新加载列表
|
|
||||||
dialogVisible.value = false
|
dialogVisible.value = false
|
||||||
await getList()
|
|
||||||
} finally {
|
} finally {
|
||||||
loading.value = false
|
actionLoading.value = false
|
||||||
|
// 刷新列表
|
||||||
|
reloadList(xGrid)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// ========== 详情相关 ==========
|
|
||||||
const detailRef = ref() // 详情 Ref
|
|
||||||
|
|
||||||
// 详情操作
|
|
||||||
const handleDetail = async (row: SmsTemplateVO) => {
|
|
||||||
// 设置数据
|
|
||||||
detailRef.value = row
|
|
||||||
setDialogTile('detail')
|
|
||||||
}
|
|
||||||
// ========== 测试相关 ==========
|
// ========== 测试相关 ==========
|
||||||
const sendSmsForm = ref({
|
const sendSmsForm = ref({
|
||||||
content: '',
|
content: '',
|
||||||
|
@ -249,10 +238,7 @@ const sendSmsTest = () => {
|
||||||
templateParams: sendSmsForm.value.templateParams
|
templateParams: sendSmsForm.value.templateParams
|
||||||
}
|
}
|
||||||
SmsTemplateApi.sendSmsApi(data)
|
SmsTemplateApi.sendSmsApi(data)
|
||||||
ElMessage.info('发送成功')
|
message.info('发送成功')
|
||||||
sendVisible.value = false
|
sendVisible.value = false
|
||||||
}
|
}
|
||||||
|
|
||||||
// ========== 初始化 ==========
|
|
||||||
getList()
|
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
import { reactive } from 'vue'
|
import { reactive } from 'vue'
|
||||||
import { useI18n } from '@/hooks/web/useI18n'
|
import { useI18n } from '@/hooks/web/useI18n'
|
||||||
import { required } from '@/utils/formRules'
|
import { required } from '@/utils/formRules'
|
||||||
import { CrudSchema, useCrudSchemas } from '@/hooks/web/useCrudSchemas'
|
|
||||||
import { DICT_TYPE } from '@/utils/dict'
|
import { DICT_TYPE } from '@/utils/dict'
|
||||||
|
import { VxeCrudSchema, useVxeCrudSchemas } from '@/hooks/web/useVxeCrudSchemas'
|
||||||
const { t } = useI18n() // 国际化
|
const { t } = useI18n() // 国际化
|
||||||
|
|
||||||
// 表单校验
|
// 表单校验
|
||||||
|
@ -17,31 +17,20 @@ export const rules = reactive({
|
||||||
})
|
})
|
||||||
|
|
||||||
// CrudSchema
|
// CrudSchema
|
||||||
const crudSchemas = reactive<CrudSchema[]>([
|
const crudSchemas = reactive<VxeCrudSchema>({
|
||||||
{
|
primaryKey: 'id',
|
||||||
label: t('common.index'),
|
primaryType: 'seq',
|
||||||
field: 'id',
|
action: true,
|
||||||
type: 'index',
|
columns: [
|
||||||
form: {
|
|
||||||
show: false
|
|
||||||
},
|
|
||||||
detail: {
|
|
||||||
show: false
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
label: '模板编码',
|
label: '模板编码',
|
||||||
field: 'code',
|
field: 'code',
|
||||||
search: {
|
isSearch: true
|
||||||
show: true
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: '模板名称',
|
label: '模板名称',
|
||||||
field: 'name',
|
field: 'name',
|
||||||
search: {
|
isSearch: true
|
||||||
show: true
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: '模板内容',
|
label: '模板内容',
|
||||||
|
@ -50,9 +39,7 @@ const crudSchemas = reactive<CrudSchema[]>([
|
||||||
{
|
{
|
||||||
label: '短信 API 的模板编号',
|
label: '短信 API 的模板编号',
|
||||||
field: 'apiTemplateId',
|
field: 'apiTemplateId',
|
||||||
search: {
|
isSearch: true
|
||||||
show: true
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: '短信类型',
|
label: '短信类型',
|
||||||
|
@ -67,36 +54,20 @@ const crudSchemas = reactive<CrudSchema[]>([
|
||||||
{
|
{
|
||||||
label: t('form.remark'),
|
label: t('form.remark'),
|
||||||
field: 'remark',
|
field: 'remark',
|
||||||
table: {
|
isTable: false
|
||||||
show: false
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: t('common.createTime'),
|
title: t('common.createTime'),
|
||||||
field: 'createTime',
|
field: 'createTime',
|
||||||
form: {
|
formatter: 'formatDate',
|
||||||
show: false
|
isForm: false,
|
||||||
},
|
|
||||||
search: {
|
search: {
|
||||||
show: true,
|
show: true,
|
||||||
component: 'DatePicker',
|
itemRender: {
|
||||||
componentProps: {
|
name: 'XDataTimePicker'
|
||||||
type: 'daterange',
|
|
||||||
valueFormat: 'YYYY-MM-DD HH:mm:ss',
|
|
||||||
defaultTime: [new Date(2000, 1, 1, 0, 0, 0), new Date(2000, 2, 1, 23, 59, 59)]
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
|
||||||
{
|
|
||||||
label: t('table.action'),
|
|
||||||
field: 'action',
|
|
||||||
width: '320px',
|
|
||||||
form: {
|
|
||||||
show: false
|
|
||||||
},
|
|
||||||
detail: {
|
|
||||||
show: false
|
|
||||||
}
|
}
|
||||||
}
|
]
|
||||||
])
|
})
|
||||||
export const { allSchemas } = useCrudSchemas(crudSchemas)
|
export const { allSchemas } = useVxeCrudSchemas(crudSchemas)
|
||||||
|
|
Loading…
Reference in New Issue