提交 | 用户 | 时间
|
314507
|
1 |
<template> |
H |
2 |
<ContentWrap> |
|
3 |
<el-form |
|
4 |
class="-mb-15px" |
|
5 |
:model="queryParams" |
|
6 |
ref="queryFormRef" |
|
7 |
:inline="true" |
|
8 |
label-width="68px" |
|
9 |
> |
|
10 |
<el-form-item label="短信签名" prop="signature"> |
|
11 |
<el-input |
|
12 |
v-model="queryParams.signature" |
|
13 |
placeholder="请输入短信签名" |
|
14 |
clearable |
|
15 |
@keyup.enter="handleQuery" |
|
16 |
/> |
|
17 |
</el-form-item> |
|
18 |
<el-form-item label="启用状态" prop="status"> |
|
19 |
<el-select |
|
20 |
v-model="queryParams.status" |
|
21 |
placeholder="请选择启用状态" |
|
22 |
class="!w-240px" |
|
23 |
clearable |
|
24 |
> |
|
25 |
<el-option |
|
26 |
v-for="dict in getIntDictOptions(DICT_TYPE.COMMON_STATUS)" |
|
27 |
:key="dict.value" |
|
28 |
:label="dict.label" |
|
29 |
:value="dict.value" |
|
30 |
/> |
|
31 |
</el-select> |
|
32 |
</el-form-item> |
|
33 |
<el-form-item label="创建时间" prop="createTime"> |
|
34 |
<el-date-picker |
|
35 |
v-model="queryParams.createTime" |
|
36 |
value-format="YYYY-MM-DD HH:mm:ss" |
|
37 |
type="daterange" |
|
38 |
start-placeholder="开始日期" |
|
39 |
end-placeholder="结束日期" |
|
40 |
:default-time="[new Date('1 00:00:00'), new Date('1 23:59:59')]" |
|
41 |
/> |
|
42 |
</el-form-item> |
|
43 |
<el-form-item> |
|
44 |
<el-button @click="handleQuery"><Icon icon="ep:search" class="mr-5px" /> 搜索</el-button> |
|
45 |
<el-button @click="resetQuery"><Icon icon="ep:refresh" class="mr-5px" /> 重置</el-button> |
|
46 |
<el-button |
|
47 |
type="primary" |
|
48 |
plain |
|
49 |
@click="openForm('create')" |
|
50 |
v-hasPermi="['system:sms-channel:create']" |
|
51 |
> |
|
52 |
<Icon icon="ep:plus" class="mr-5px" /> 新增</el-button |
|
53 |
> |
|
54 |
</el-form-item> |
|
55 |
</el-form> |
|
56 |
</ContentWrap> |
|
57 |
|
|
58 |
<!-- 列表 --> |
|
59 |
<ContentWrap> |
|
60 |
<el-table v-loading="loading" :data="list"> |
|
61 |
<el-table-column label="编号" align="center" prop="id" /> |
|
62 |
<el-table-column label="短信签名" align="center" prop="signature" /> |
|
63 |
<el-table-column label="渠道编码" align="center" prop="code"> |
|
64 |
<template #default="scope"> |
|
65 |
<dict-tag :type="DICT_TYPE.SYSTEM_SMS_CHANNEL_CODE" :value="scope.row.code" /> |
|
66 |
</template> |
|
67 |
</el-table-column> |
|
68 |
<el-table-column label="启用状态" align="center" prop="status"> |
|
69 |
<template #default="scope"> |
|
70 |
<dict-tag :type="DICT_TYPE.COMMON_STATUS" :value="scope.row.status" /> |
|
71 |
</template> |
|
72 |
</el-table-column> |
|
73 |
<el-table-column label="备注" align="center" prop="remark" :show-overflow-tooltip="true" /> |
|
74 |
<el-table-column |
|
75 |
label="短信 API 的账号" |
|
76 |
align="center" |
|
77 |
prop="apiKey" |
|
78 |
:show-overflow-tooltip="true" |
|
79 |
width="180" |
|
80 |
/> |
|
81 |
<el-table-column |
|
82 |
label="短信 API 的密钥" |
|
83 |
align="center" |
|
84 |
prop="apiSecret" |
|
85 |
:show-overflow-tooltip="true" |
|
86 |
width="180" |
|
87 |
/> |
|
88 |
<el-table-column |
|
89 |
label="短信发送回调 URL" |
|
90 |
align="center" |
|
91 |
prop="callbackUrl" |
|
92 |
:show-overflow-tooltip="true" |
|
93 |
width="180" |
|
94 |
/> |
|
95 |
<el-table-column |
|
96 |
label="创建时间" |
|
97 |
align="center" |
|
98 |
prop="createTime" |
|
99 |
width="180" |
|
100 |
:formatter="dateFormatter" |
|
101 |
/> |
|
102 |
<el-table-column label="操作" align="center"> |
|
103 |
<template #default="scope"> |
|
104 |
<el-button |
|
105 |
link |
|
106 |
type="primary" |
|
107 |
@click="openForm('update', scope.row.id)" |
|
108 |
v-hasPermi="['system:sms-channel:update']" |
|
109 |
> |
|
110 |
编辑 |
|
111 |
</el-button> |
|
112 |
<el-button |
|
113 |
link |
|
114 |
type="danger" |
|
115 |
@click="handleDelete(scope.row.id)" |
|
116 |
v-hasPermi="['system:sms-channel:delete']" |
|
117 |
> |
|
118 |
删除 |
|
119 |
</el-button> |
|
120 |
</template> |
|
121 |
</el-table-column> |
|
122 |
</el-table> |
|
123 |
<!-- 分页 --> |
|
124 |
<Pagination |
|
125 |
:total="total" |
|
126 |
v-model:page="queryParams.pageNo" |
|
127 |
v-model:limit="queryParams.pageSize" |
|
128 |
@pagination="getList" |
|
129 |
/> |
|
130 |
</ContentWrap> |
|
131 |
|
|
132 |
<!-- 表单弹窗:添加/修改 --> |
|
133 |
<SmsChannelForm ref="formRef" @success="getList" /> |
|
134 |
</template> |
|
135 |
<script lang="ts" setup> |
|
136 |
import { DICT_TYPE, getIntDictOptions } from '@/utils/dict' |
|
137 |
import { dateFormatter } from '@/utils/formatTime' |
|
138 |
import * as SmsChannelApi from '@/api/system/sms/smsChannel' |
|
139 |
import SmsChannelForm from './SmsChannelForm.vue' |
|
140 |
|
|
141 |
defineOptions({ name: 'SystemSmsChannel' }) |
|
142 |
|
|
143 |
const { t } = useI18n() // 国际化 |
|
144 |
const message = useMessage() // 消息弹窗 |
|
145 |
|
|
146 |
const loading = ref(false) // 列表的加载中 |
|
147 |
const total = ref(0) // 列表的总页数 |
|
148 |
const list = ref([]) // 列表的数据 |
|
149 |
const queryFormRef = ref() // 搜索的表单 |
|
150 |
const queryParams = reactive({ |
|
151 |
pageNo: 1, |
|
152 |
pageSize: 10, |
|
153 |
signature: undefined, |
|
154 |
status: undefined, |
|
155 |
createTime: [] |
|
156 |
}) |
|
157 |
|
|
158 |
/** 查询列表 */ |
|
159 |
const getList = async () => { |
|
160 |
loading.value = true |
|
161 |
try { |
|
162 |
const data = await SmsChannelApi.getSmsChannelPage(queryParams) |
|
163 |
list.value = data.list |
|
164 |
total.value = data.total |
|
165 |
} finally { |
|
166 |
loading.value = false |
|
167 |
} |
|
168 |
} |
|
169 |
|
|
170 |
/** 搜索按钮操作 */ |
|
171 |
const handleQuery = () => { |
|
172 |
queryParams.pageNo = 1 |
|
173 |
getList() |
|
174 |
} |
|
175 |
|
|
176 |
/** 重置按钮操作 */ |
|
177 |
const resetQuery = () => { |
|
178 |
queryFormRef.value.resetFields() |
|
179 |
handleQuery() |
|
180 |
} |
|
181 |
|
|
182 |
/** 添加/修改操作 */ |
|
183 |
const formRef = ref() |
|
184 |
const openForm = (type: string, id?: number) => { |
|
185 |
formRef.value.open(type, id) |
|
186 |
} |
|
187 |
|
|
188 |
/** 删除按钮操作 */ |
|
189 |
const handleDelete = async (id: number) => { |
|
190 |
try { |
|
191 |
// 删除的二次确认 |
|
192 |
await message.delConfirm() |
|
193 |
// 发起删除 |
|
194 |
await SmsChannelApi.deleteSmsChannel(id) |
|
195 |
message.success(t('common.delSuccess')) |
|
196 |
// 刷新列表 |
|
197 |
await getList() |
|
198 |
} catch {} |
|
199 |
} |
|
200 |
|
|
201 |
/** 初始化 **/ |
|
202 |
onMounted(() => { |
|
203 |
getList() |
|
204 |
}) |
|
205 |
</script> |