diff --git a/src/api/system/sms/smsChannel/index.ts b/src/api/system/sms/smsChannel/index.ts index 176d075fe105dee208210fac874ae0032f4d8458..7c8ccea9eb56f2d7d895348ba145d7150497c47e 100644 --- a/src/api/system/sms/smsChannel/index.ts +++ b/src/api/system/sms/smsChannel/index.ts @@ -12,6 +12,12 @@ export interface SmsChannelVO { createTime: Date } +export interface SmsChannelListVO { + id: number + code: string + signature: string +} + export interface SmsChannelPageReqVO extends PageParam { signature?: string code?: string diff --git a/src/api/system/sms/smsLog/index.ts b/src/api/system/sms/smsLog/index.ts index 863eabb6bc9a89d219773fef205fe24019c01dce..269b609d88842b3f840434b08318c097de306303 100644 --- a/src/api/system/sms/smsLog/index.ts +++ b/src/api/system/sms/smsLog/index.ts @@ -1,39 +1,40 @@ import request from '@/config/axios' export interface SmsLogVO { - id: number - channelId: number + id: number | null + channelId: number | null channelCode: string - templateId: number + templateId: number | null templateCode: string - templateType: number + templateType: number | null templateContent: string - templateParams: Map + templateParams: Map | null + apiTemplateId: string mobile: string - userId: number - userType: number - sendStatus: number - sendTime: Date - sendCode: number + userId: number | null + userType: number | null + sendStatus: number | null + sendTime: Date | null + sendCode: number | null sendMsg: string apiSendCode: string apiSendMsg: string apiRequestId: string apiSerialNo: string - receiveStatus: number - receiveTime: Date + receiveStatus: number | null + receiveTime: Date | null apiReceiveCode: string apiReceiveMsg: string - createTime: Date + createTime: Date | null } export interface SmsLogPageReqVO extends PageParam { - channelId?: number - templateId?: number + channelId?: number | null + templateId?: number | null mobile?: string - sendStatus?: number + sendStatus?: number | null sendTime?: Date[] - receiveStatus?: number + receiveStatus?: number | null receiveTime?: Date[] } export interface SmsLogExportReqVO { diff --git a/src/api/system/sms/smsTemplate/index.ts b/src/api/system/sms/smsTemplate/index.ts index 0433fe3a4acd52335cdd27af629523300973f1d4..55a617627fc440e9a2f3335eca51f25ad284d761 100644 --- a/src/api/system/sms/smsTemplate/index.ts +++ b/src/api/system/sms/smsTemplate/index.ts @@ -1,18 +1,18 @@ import request from '@/config/axios' export interface SmsTemplateVO { - id: number - type: number - status: number + id: number | null + type: number | null + status: number | null code: string name: string content: string remark: string apiTemplateId: string - channelId: number - channelCode: string - params: string[] - createTime: Date + channelId: number | null + channelCode?: string + params?: string[] + createTime?: Date } export interface SendSmsReqVO { @@ -21,13 +21,13 @@ export interface SendSmsReqVO { templateParams: Map } -export interface SmsTemplatePageReqVO { - type?: number - status?: number +export interface SmsTemplatePageReqVO extends PageParam { + type?: number | null + status?: number | null code?: string content?: string apiTemplateId?: string - channelId?: number + channelId?: number | null createTime?: Date[] } diff --git a/src/components/RightToolbar/index.ts b/src/components/RightToolbar/index.ts new file mode 100644 index 0000000000000000000000000000000000000000..eb9d1112f7b138ee40c224140456f2ccf8907142 --- /dev/null +++ b/src/components/RightToolbar/index.ts @@ -0,0 +1,9 @@ +import RightToolbar from './src/index.vue' + +export interface columnsType { + key?: number + label?: string + visible?: boolean +} + +export { RightToolbar } diff --git a/src/components/RightToolbar/src/index.vue b/src/components/RightToolbar/src/index.vue new file mode 100644 index 0000000000000000000000000000000000000000..11e021dccc81a2fada991afe7deffc4b4086da4b --- /dev/null +++ b/src/components/RightToolbar/src/index.vue @@ -0,0 +1,104 @@ + + + diff --git a/src/components/index.ts b/src/components/index.ts index 19b2aac69c9c58953d6338c2895f213e97e8344c..97c2b4b00fb22a56caa7561a2dee48e7d345790a 100644 --- a/src/components/index.ts +++ b/src/components/index.ts @@ -9,6 +9,7 @@ import { XButton, XTextButton } from '@/components/XButton' import { DictTag } from '@/components/DictTag' import { ContentWrap } from '@/components/ContentWrap' import { Descriptions } from '@/components/Descriptions' +import { RightToolbar } from '@/components/RightToolbar' export const setupGlobCom = (app: App): void => { app.component('Icon', Icon) @@ -22,4 +23,5 @@ export const setupGlobCom = (app: App): void => { app.component('DictTag', DictTag) app.component('ContentWrap', ContentWrap) app.component('Descriptions', Descriptions) + app.component('RightToolbar', RightToolbar) } diff --git a/src/locales/zh-CN.ts b/src/locales/zh-CN.ts index 7c5742c426eec83160b1598d47026d250cbd632b..985ffb7c8d6d547a0828b3a118aeb21008731200 100644 --- a/src/locales/zh-CN.ts +++ b/src/locales/zh-CN.ts @@ -302,7 +302,14 @@ export default { dialog: { dialog: '弹窗', open: '打开', - close: '关闭' + close: '关闭', + sms: { + template: { + addTitle: '添加短信模板', + updtaeTitle: '修改短信模板', + sendSms: '发送短信' + } + } }, sys: { api: { diff --git a/src/types/auto-components.d.ts b/src/types/auto-components.d.ts index 7b10d6797c1c227c7e313ecddcab54b220145ebb..d6c922f8e2e53e79ec8faa57b0b771888435c18b 100644 --- a/src/types/auto-components.d.ts +++ b/src/types/auto-components.d.ts @@ -1,7 +1,5 @@ -/* eslint-disable */ -/* prettier-ignore */ -// @ts-nocheck -// Generated by unplugin-vue-components +// generated by unplugin-vue-components +// We suggest you to commit this file into source control // Read more: https://github.com/vuejs/core/pull/3399 import '@vue/runtime-core' @@ -23,8 +21,6 @@ declare module '@vue/runtime-core' { DictTag: typeof import('./../components/DictTag/src/DictTag.vue')['default'] Echart: typeof import('./../components/Echart/src/Echart.vue')['default'] Editor: typeof import('./../components/Editor/src/Editor.vue')['default'] - ElAutoResizer: typeof import('element-plus/es')['ElAutoResizer'] - ElAvatar: typeof import('element-plus/es')['ElAvatar'] ElBadge: typeof import('element-plus/es')['ElBadge'] ElButton: typeof import('element-plus/es')['ElButton'] ElButtonGroup: typeof import('element-plus/es')['ElButtonGroup'] @@ -54,7 +50,6 @@ declare module '@vue/runtime-core' { ElForm: typeof import('element-plus/es')['ElForm'] ElFormItem: typeof import('element-plus/es')['ElFormItem'] ElIcon: typeof import('element-plus/es')['ElIcon'] - ElImage: typeof import('element-plus/es')['ElImage'] ElImageViewer: typeof import('element-plus/es')['ElImageViewer'] ElInput: typeof import('element-plus/es')['ElInput'] ElInputNumber: typeof import('element-plus/es')['ElInputNumber'] @@ -69,15 +64,12 @@ declare module '@vue/runtime-core' { ElScrollbar: typeof import('element-plus/es')['ElScrollbar'] ElSelect: typeof import('element-plus/es')['ElSelect'] ElSkeleton: typeof import('element-plus/es')['ElSkeleton'] - ElSpace: typeof import('element-plus/es')['ElSpace'] ElSwitch: typeof import('element-plus/es')['ElSwitch'] ElTable: typeof import('element-plus/es')['ElTable'] ElTableColumn: typeof import('element-plus/es')['ElTableColumn'] ElTabPane: typeof import('element-plus/es')['ElTabPane'] ElTabs: typeof import('element-plus/es')['ElTabs'] ElTag: typeof import('element-plus/es')['ElTag'] - ElTimeline: typeof import('element-plus/es')['ElTimeline'] - ElTimelineItem: typeof import('element-plus/es')['ElTimelineItem'] ElTooltip: typeof import('element-plus/es')['ElTooltip'] ElTransfer: typeof import('element-plus/es')['ElTransfer'] ElTree: typeof import('element-plus/es')['ElTree'] @@ -105,6 +97,7 @@ declare module '@vue/runtime-core' { ScriptTask: typeof import('./../components/bpmnProcessDesigner/package/penal/task/task-components/ScriptTask.vue')['default'] Search: typeof import('./../components/Search/src/Search.vue')['default'] SignalAndMessage: typeof import('./../components/bpmnProcessDesigner/package/penal/signal-message/SignalAndMessage.vue')['default'] + Src: typeof import('./../components/RightToolbar/src/index.vue')['default'] Sticky: typeof import('./../components/Sticky/src/Sticky.vue')['default'] Table: typeof import('./../components/Table/src/Table.vue')['default'] Tooltip: typeof import('./../components/Tooltip/src/Tooltip.vue')['default'] diff --git a/src/types/auto-imports.d.ts b/src/types/auto-imports.d.ts index 7c9f5ff1a15fa50c0852849470ce92dda0bbb977..bd749b8ecfeec55c861aa51e877fd9457434dcf6 100644 --- a/src/types/auto-imports.d.ts +++ b/src/types/auto-imports.d.ts @@ -70,5 +70,5 @@ declare global { // for type re-export declare global { // @ts-ignore - export type { Component, ComponentPublicInstance, ComputedRef, InjectionKey, PropType, Ref, VNode } from 'vue' + export type { Component,ComponentPublicInstance,ComputedRef,InjectionKey,PropType,Ref,VNode } from 'vue' } diff --git a/src/utils/dict.ts b/src/utils/dict.ts index 15e57ff2409853af7b7c0a63116a0eaa0ff4e1f6..4f5d63fbf51bb073c33279df877e5c4a7aa454ae 100644 --- a/src/utils/dict.ts +++ b/src/utils/dict.ts @@ -69,7 +69,16 @@ export const getDictObj = (dictType: string, value: any) => { } }) } - +export const getDictLabel = (dictType: string, value: any) => { + const dictOptions: DictDataType[] = getDictOptions(dictType) + const dictLabel = ref('') + dictOptions.forEach((dict: DictDataType) => { + if (dict.value === value) { + dictLabel.value = dict.label + } + }) + return dictLabel.value +} export enum DICT_TYPE { USER_TYPE = 'user_type', COMMON_STATUS = 'common_status', diff --git a/src/utils/formatTime.ts b/src/utils/formatTime.ts index 39671279047615a827c36fb4370fd5cbdcbf9254..f0cf07362b02ae848d110ad6322dea90013c0d7c 100644 --- a/src/utils/formatTime.ts +++ b/src/utils/formatTime.ts @@ -64,6 +64,51 @@ export function formatDate(date: Date, format: string): string { } return format } +// 日期格式化 +export function parseTime(time: any, pattern?: string) { + if (arguments.length === 0 || !time) { + return null + } + const format = pattern || '{y}-{m}-{d} {h}:{i}:{s}' + let date + if (typeof time === 'object') { + date = time + } else { + if (typeof time === 'string' && /^[0-9]+$/.test(time)) { + time = parseInt(time) + } else if (typeof time === 'string') { + time = time + .replace(new RegExp(/-/gm), '/') + .replace('T', ' ') + .replace(new RegExp(/\.\d{3}/gm), '') + } + if (typeof time === 'number' && time.toString().length === 10) { + time = time * 1000 + } + date = new Date(time) + } + const formatObj = { + y: date.getFullYear(), + m: date.getMonth() + 1, + d: date.getDate(), + h: date.getHours(), + i: date.getMinutes(), + s: date.getSeconds(), + a: date.getDay() + } + const time_str = format.replace(/{([ymdhisa])+}/g, (result, key) => { + let value = formatObj[key] + // Note: getDay() returns 0 on Sunday + if (key === 'a') { + return ['日', '一', '二', '三', '四', '五', '六'][value] + } + if (result.length > 0 && value < 10) { + value = '0' + value + } + return value || 0 + }) + return time_str +} /** * 获取当前日期是第几周 diff --git a/src/views/system/sms/smsLog/index.vue b/src/views/system/sms/smsLog/index.vue index 334da2ad831292d043e52740ad87e44e22978f8c..f3d17666df814b126a03c5200026768844b45de3 100644 --- a/src/views/system/sms/smsLog/index.vue +++ b/src/views/system/sms/smsLog/index.vue @@ -1,57 +1,404 @@ - diff --git a/src/views/system/sms/smsLog/sms.log.data.ts b/src/views/system/sms/smsLog/sms.log.data.ts deleted file mode 100644 index c975bb0fa49fa3affe17a980dc9a164858f1c1c1..0000000000000000000000000000000000000000 --- a/src/views/system/sms/smsLog/sms.log.data.ts +++ /dev/null @@ -1,93 +0,0 @@ -import type { VxeCrudSchema } from '@/hooks/web/useVxeCrudSchemas' -import { DICT_TYPE, getStrDictOptions } from '@/utils/dict' - -const { t } = useI18n() // 国际化 - -const authorizedGrantOptions = getStrDictOptions(DICT_TYPE.SYSTEM_SMS_CHANNEL_CODE) -// CrudSchema -const crudSchemas = reactive({ - primaryKey: 'id', - primaryType: 'id', - primaryTitle: '日志编号', - action: true, - columns: [ - { - title: '手机号', - field: 'mobile', - isSearch: true - }, - { - title: '短信内容', - field: 'templateContent' - }, - { - title: '模板编号', - field: 'templateId', - isSearch: true - }, - { - title: '短信渠道', - field: 'channelId', - // dictType: DICT_TYPE.SYSTEM_SMS_CHANNEL_CODE, - // dictClass: 'number', - isSearch: true, - // table: { - // component: 'Select', - componentProps: { - options: authorizedGrantOptions - // multiple: false, - // filterable: true - } - // } - }, - { - title: '发送状态', - field: 'sendStatus', - dictType: DICT_TYPE.SYSTEM_SMS_SEND_STATUS, - dictClass: 'number', - isSearch: true - }, - { - title: '发送时间', - field: 'sendTime', - formatter: 'formatDate', - search: { - show: true, - itemRender: { - name: 'XDataTimePicker' - } - } - }, - { - title: '短信类型', - field: 'templateType', - dictType: DICT_TYPE.SYSTEM_SMS_TEMPLATE_TYPE, - dictClass: 'number', - isSearch: true - }, - { - title: '接收状态', - field: 'receiveStatus', - dictType: DICT_TYPE.SYSTEM_SMS_RECEIVE_STATUS, - dictClass: 'number', - isSearch: true - }, - { - title: '接收时间', - field: 'receiveTime', - formatter: 'formatDate', - search: { - show: true, - itemRender: { - name: 'XDataTimePicker' - } - } - }, - { - title: t('common.createTime'), - field: 'createTime', - formatter: 'formatDate' - } - ] -}) -export const { allSchemas } = useVxeCrudSchemas(crudSchemas) diff --git a/src/views/system/sms/smsTemplate/form.vue b/src/views/system/sms/smsTemplate/form.vue new file mode 100644 index 0000000000000000000000000000000000000000..4c9825f92660774558c7e6076d439e4aa43bd055 --- /dev/null +++ b/src/views/system/sms/smsTemplate/form.vue @@ -0,0 +1,267 @@ + + diff --git a/src/views/system/sms/smsTemplate/index.vue b/src/views/system/sms/smsTemplate/index.vue index bbc7c86369e8bcec3b31172eff6e137bc0c27652..ed934c0fe1414081ef82692007835af55d447ab1 100644 --- a/src/views/system/sms/smsTemplate/index.vue +++ b/src/views/system/sms/smsTemplate/index.vue @@ -1,232 +1,340 @@ diff --git a/src/views/system/sms/smsTemplate/sms.template.data.ts b/src/views/system/sms/smsTemplate/sms.template.data.ts deleted file mode 100644 index 6178d6c2b589093bd6e9acf3f2d49eb37f27226f..0000000000000000000000000000000000000000 --- a/src/views/system/sms/smsTemplate/sms.template.data.ts +++ /dev/null @@ -1,107 +0,0 @@ -import type { VxeCrudSchema } from '@/hooks/web/useVxeCrudSchemas' -import * as smsApi from '@/api/system/sms/smsChannel' -const { t } = useI18n() // 国际化 -const tenantPackageOption = [] -const getTenantPackageOptions = async () => { - const res = await smsApi.getSimpleSmsChannels() - console.log(res, 'resresres') - res.forEach((tenantPackage: TenantPackageVO) => { - tenantPackageOption.push({ - key: tenantPackage.id, - value: tenantPackage.id, - label: tenantPackage.signature - }) - }) -} -getTenantPackageOptions() -// 表单校验 -export const rules = reactive({ - type: [required], - status: [required], - code: [required], - name: [required], - content: [required], - apiTemplateId: [required], - channelId: [required] -}) - -// CrudSchema -const crudSchemas = reactive({ - primaryKey: 'id', - primaryType: 'id', - primaryTitle: '模板编号', - action: true, - actionWidth: '280', - columns: [ - { - title: '短信渠道编码', - field: 'channelId', - isSearch: false, - isForm: true, - isTable: false, - form: { - component: 'Select', - componentProps: { - options: tenantPackageOption - } - } - }, - { - title: '模板编码', - field: 'code', - isSearch: true - }, - { - title: '模板名称', - field: 'name', - isSearch: true - }, - { - title: '模板内容', - field: 'content' - }, - { - title: '短信 API 的模板编号', - field: 'apiTemplateId', - isSearch: true - }, - { - title: '短信类型', - field: 'type', - dictType: DICT_TYPE.SYSTEM_SMS_TEMPLATE_TYPE, - dictClass: 'number', - isSearch: true, - table: { - width: 80 - } - }, - { - title: t('common.status'), - field: 'status', - dictType: DICT_TYPE.COMMON_STATUS, - dictClass: 'number', - isSearch: true, - table: { - width: 80 - } - }, - { - title: t('form.remark'), - field: 'remark', - isTable: false - }, - { - title: t('common.createTime'), - field: 'createTime', - formatter: 'formatDate', - isForm: false, - search: { - show: true, - itemRender: { - name: 'XDataTimePicker' - } - } - } - ] -}) -export const { allSchemas } = useVxeCrudSchemas(crudSchemas)