Skip to content

Commit 2a3fe7d

Browse files
YunaiVgitee-org
authored andcommitted
!45 重构:短信模板和短信日志vue2改vue3
Merge pull request !45 from puhui999/master
2 parents 4481964 + c735cd7 commit 2a3fe7d

File tree

26 files changed

+1206
-530
lines changed

26 files changed

+1206
-530
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,5 @@ dist-ssr
55
*.local
66
/dist*
77
*-lock.*
8-
pnpm-debug
8+
pnpm-debug
9+
.idea

src/api/system/sensitiveWord/index.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,41 +24,41 @@ export interface SensitiveWordExportReqVO {
2424
}
2525

2626
// 查询敏感词列表
27-
export const getSensitiveWordPageApi = (params: SensitiveWordPageReqVO) => {
27+
export const getSensitiveWordPage = (params: SensitiveWordPageReqVO) => {
2828
return request.get({ url: '/system/sensitive-word/page', params })
2929
}
3030

3131
// 查询敏感词详情
32-
export const getSensitiveWordApi = (id: number) => {
32+
export const getSensitiveWord = (id: number) => {
3333
return request.get({ url: '/system/sensitive-word/get?id=' + id })
3434
}
3535

3636
// 新增敏感词
37-
export const createSensitiveWordApi = (data: SensitiveWordVO) => {
37+
export const createSensitiveWord = (data: SensitiveWordVO) => {
3838
return request.post({ url: '/system/sensitive-word/create', data })
3939
}
4040

4141
// 修改敏感词
42-
export const updateSensitiveWordApi = (data: SensitiveWordVO) => {
42+
export const updateSensitiveWord = (data: SensitiveWordVO) => {
4343
return request.put({ url: '/system/sensitive-word/update', data })
4444
}
4545

4646
// 删除敏感词
47-
export const deleteSensitiveWordApi = (id: number) => {
47+
export const deleteSensitiveWord = (id: number) => {
4848
return request.delete({ url: '/system/sensitive-word/delete?id=' + id })
4949
}
5050

5151
// 导出敏感词
52-
export const exportSensitiveWordApi = (params: SensitiveWordExportReqVO) => {
52+
export const exportSensitiveWord = (params: SensitiveWordExportReqVO) => {
5353
return request.download({ url: '/system/sensitive-word/export-excel', params })
5454
}
5555

5656
// 获取所有敏感词的标签数组
57-
export const getSensitiveWordTagsApi = () => {
57+
export const getSensitiveWordTags = () => {
5858
return request.get({ url: '/system/sensitive-word/get-tags' })
5959
}
6060

6161
// 获得文本所包含的不合法的敏感词数组
62-
export const validateTextApi = (id: number) => {
62+
export const validateText = (id: number) => {
6363
return request.get({ url: '/system/sensitive-word/validate-text?' + id })
6464
}

src/api/system/sms/smsChannel/index.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,12 @@ export interface SmsChannelVO {
1212
createTime: Date
1313
}
1414

15+
export interface SmsChannelListVO {
16+
id: number
17+
code: string
18+
signature: string
19+
}
20+
1521
export interface SmsChannelPageReqVO extends PageParam {
1622
signature?: string
1723
code?: string

src/api/system/sms/smsLog/index.ts

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,40 @@
11
import request from '@/config/axios'
22

33
export interface SmsLogVO {
4-
id: number
5-
channelId: number
4+
id: number | null
5+
channelId: number | null
66
channelCode: string
7-
templateId: number
7+
templateId: number | null
88
templateCode: string
9-
templateType: number
9+
templateType: number | null
1010
templateContent: string
11-
templateParams: Map<string, object>
11+
templateParams: Map<string, object> | null
12+
apiTemplateId: string
1213
mobile: string
13-
userId: number
14-
userType: number
15-
sendStatus: number
16-
sendTime: Date
17-
sendCode: number
14+
userId: number | null
15+
userType: number | null
16+
sendStatus: number | null
17+
sendTime: Date | null
18+
sendCode: number | null
1819
sendMsg: string
1920
apiSendCode: string
2021
apiSendMsg: string
2122
apiRequestId: string
2223
apiSerialNo: string
23-
receiveStatus: number
24-
receiveTime: Date
24+
receiveStatus: number | null
25+
receiveTime: Date | null
2526
apiReceiveCode: string
2627
apiReceiveMsg: string
27-
createTime: Date
28+
createTime: Date | null
2829
}
2930

3031
export interface SmsLogPageReqVO extends PageParam {
31-
channelId?: number
32-
templateId?: number
32+
channelId?: number | null
33+
templateId?: number | null
3334
mobile?: string
34-
sendStatus?: number
35+
sendStatus?: number | null
3536
sendTime?: Date[]
36-
receiveStatus?: number
37+
receiveStatus?: number | null
3738
receiveTime?: Date[]
3839
}
3940
export interface SmsLogExportReqVO {

src/api/system/sms/smsTemplate/index.ts

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
import request from '@/config/axios'
22

33
export interface SmsTemplateVO {
4-
id: number
5-
type: number
6-
status: number
4+
id: number | null
5+
type: number | null
6+
status: number | null
77
code: string
88
name: string
99
content: string
1010
remark: string
1111
apiTemplateId: string
12-
channelId: number
13-
channelCode: string
14-
params: string[]
15-
createTime: Date
12+
channelId: number | null
13+
channelCode?: string
14+
params?: string[]
15+
createTime?: Date
1616
}
1717

1818
export interface SendSmsReqVO {
@@ -21,13 +21,13 @@ export interface SendSmsReqVO {
2121
templateParams: Map<String, Object>
2222
}
2323

24-
export interface SmsTemplatePageReqVO {
25-
type?: number
26-
status?: number
24+
export interface SmsTemplatePageReqVO extends PageParam {
25+
type?: number | null
26+
status?: number | null
2727
code?: string
2828
content?: string
2929
apiTemplateId?: string
30-
channelId?: number
30+
channelId?: number | null
3131
createTime?: Date[]
3232
}
3333

src/components/RightToolbar/index.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import RightToolbar from './src/index.vue'
2+
3+
export interface columnsType {
4+
key?: number
5+
label?: string
6+
visible?: boolean
7+
}
8+
9+
export { RightToolbar }
Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
<template>
2+
<div :style="style">
3+
<el-row justify="end">
4+
<el-tooltip
5+
class="item"
6+
effect="dark"
7+
:content="showSearch ? '隐藏搜索' : '显示搜索'"
8+
placement="top"
9+
v-if="search"
10+
>
11+
<el-button circle @click="toggleSearch()">
12+
<Icon icon="ep:search" />
13+
</el-button>
14+
</el-tooltip>
15+
<el-tooltip class="item" effect="dark" content="刷新" placement="top">
16+
<el-button circle @click="refresh()">
17+
<Icon icon="ep:refresh" />
18+
</el-button>
19+
</el-tooltip>
20+
<el-tooltip class="item" effect="dark" content="显隐列" placement="top" v-if="isColumns">
21+
<el-button circle @click="showColumn()">
22+
<Icon icon="ep:menu" />
23+
</el-button>
24+
</el-tooltip>
25+
</el-row>
26+
<el-dialog :title="title" v-model="open" append-to-body>
27+
<el-transfer
28+
:titles="['显示', '隐藏']"
29+
v-model="value"
30+
:data="columns"
31+
@change="dataChange"
32+
/>
33+
</el-dialog>
34+
</div>
35+
</template>
36+
<script lang="ts" setup name="RightToolbar">
37+
import type { CSSProperties } from 'vue'
38+
import type { columnsType } from '@/components/RightToolbar'
39+
import { propTypes } from '@/utils/propTypes'
40+
// 显隐数据
41+
const value = ref<number[]>([])
42+
// 弹出层标题
43+
const title = ref('显示/隐藏')
44+
// 是否显示弹出层
45+
const open = ref(false)
46+
47+
const props = defineProps({
48+
showSearch: propTypes.bool.def(true),
49+
columns: {
50+
type: Array as PropType<columnsType[]>,
51+
default: () => []
52+
},
53+
search: propTypes.bool.def(true),
54+
gutter: propTypes.number.def(10)
55+
})
56+
const isColumns = computed(() => props.columns?.length > 0)
57+
const style = computed((): CSSProperties => {
58+
const ret: CSSProperties = {}
59+
if (props.gutter) {
60+
ret.marginRight = `${props.gutter / 2}px`
61+
}
62+
return ret
63+
})
64+
const emit = defineEmits(['update:showSearch', 'queryTable'])
65+
// 搜索
66+
const toggleSearch = () => {
67+
emit('update:showSearch', !props.showSearch)
68+
}
69+
// 刷新
70+
const refresh = () => {
71+
emit('queryTable')
72+
}
73+
// 右侧列表元素变化
74+
const dataChange = (data: number[]) => {
75+
props.columns.forEach((item) => {
76+
const key: number = item.key!
77+
item.visible = !data.includes(key)
78+
})
79+
}
80+
// 打开显隐列dialog
81+
const showColumn = () => {
82+
open.value = true
83+
}
84+
// 显隐列初始默认隐藏列
85+
const init = () => {
86+
props.columns.forEach((item, index) => {
87+
if (item.visible === false) {
88+
value.value.push(index)
89+
}
90+
})
91+
}
92+
init()
93+
</script>
94+
<style lang="scss" scoped>
95+
:deep(.el-transfer__button) {
96+
border-radius: 50%;
97+
padding: 12px;
98+
display: block;
99+
margin-left: 0px;
100+
}
101+
:deep(.el-transfer__button:first-child) {
102+
margin-bottom: 10px;
103+
}
104+
</style>

src/components/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import { XButton, XTextButton } from '@/components/XButton'
99
import { DictTag } from '@/components/DictTag'
1010
import { ContentWrap } from '@/components/ContentWrap'
1111
import { Descriptions } from '@/components/Descriptions'
12+
import { RightToolbar } from '@/components/RightToolbar'
1213

1314
export const setupGlobCom = (app: App<Element>): void => {
1415
app.component('Icon', Icon)
@@ -22,4 +23,5 @@ export const setupGlobCom = (app: App<Element>): void => {
2223
app.component('DictTag', DictTag)
2324
app.component('ContentWrap', ContentWrap)
2425
app.component('Descriptions', Descriptions)
26+
app.component('RightToolbar', RightToolbar)
2527
}

src/layout/components/Message/src/Message.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<script setup lang="ts">
2-
import dayjs from 'dayjs'
2+
import { parseTime } from '@/utils/formatTime'
33
import * as NotifyMessageApi from '@/api/system/notify/message'
44
55
const { push } = useRouter()
@@ -57,7 +57,7 @@ onMounted(() => {
5757
{{ item.templateNickname }}:{{ item.templateContent }}
5858
</span>
5959
<span class="message-date">
60-
{{ dayjs(item.createTime).format('YYYY-MM-DD HH:mm:ss') }}
60+
{{ parseTime(item.createTime) }}
6161
</span>
6262
</div>
6363
</div>

src/locales/zh-CN.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,14 @@ export default {
303303
dialog: {
304304
dialog: '弹窗',
305305
open: '打开',
306-
close: '关闭'
306+
close: '关闭',
307+
sms: {
308+
template: {
309+
addTitle: '添加短信模板',
310+
updtaeTitle: '修改短信模板',
311+
sendSms: '发送短信'
312+
}
313+
}
307314
},
308315
sys: {
309316
api: {

0 commit comments

Comments
 (0)