Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
phsl
/
admin
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Unverified
Commit
97f9560c
authored
Apr 15, 2023
by
芋道源码
Committed by
Gitee
Apr 15, 2023
Browse files
Options
Browse Files
Download
Plain Diff
!124 重构VUE3【站内信-模板管理】
Merge pull request !124 from ZanGe丶/dev
parents
abf9b50c
776eb3a7
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
406 additions
and
272 deletions
+406
-272
src/api/system/notify/template/index.ts
+5
-4
src/views/system/notify/template/NotifyTemplateForm.vue
+140
-0
src/views/system/notify/template/index.vue
+261
-183
src/views/system/notify/template/template.data.ts
+0
-85
No files found.
src/api/system/notify/template/index.ts
View file @
97f9560c
import
request
from
'@/config/axios'
export
interface
NotifyTemplateVO
{
id
:
number
id
:
number
|
null
name
:
string
nickname
:
string
code
:
string
content
:
string
type
:
number
type
:
number
|
null
params
:
string
status
:
number
status
:
number
|
null
remark
:
string
}
...
...
@@ -19,7 +20,7 @@ export interface NotifyTemplatePageReqVO extends PageParam {
}
export
interface
NotifySendReqVO
{
userId
:
number
userId
:
number
|
null
templateCode
:
string
templateParams
:
Map
<
String
,
Object
>
}
...
...
src/views/system/notify/template/NotifyTemplateForm.vue
0 → 100644
View file @
97f9560c
<
template
>
<Dialog
:title=
"dialogTitle"
v-model=
"dialogVisible"
>
<el-form
ref=
"formRef"
:model=
"formData"
:rules=
"formRules"
label-width=
"140px"
v-loading=
"formLoading"
>
<el-form-item
label=
"模版编码"
prop=
"code"
>
<el-input
v-model=
"formData.code"
placeholder=
"请输入模版编码"
/>
</el-form-item>
<el-form-item
label=
"模板名称"
prop=
"name"
>
<el-input
v-model=
"formData.name"
placeholder=
"请输入模版名称"
/>
</el-form-item>
<el-form-item
label=
"发件人名称"
prop=
"nickname"
>
<el-input
v-model=
"formData.nickname"
placeholder=
"请输入发件人名称"
/>
</el-form-item>
<el-form-item
label=
"模板内容"
prop=
"content"
>
<el-input
type=
"textarea"
v-model=
"formData.content"
placeholder=
"请输入模板内容"
/>
</el-form-item>
<el-form-item
label=
"类型"
prop=
"type"
>
<el-select
v-model=
"formData.type"
placeholder=
"请选择类型"
>
<el-option
v-for=
"dict in getIntDictOptions(DICT_TYPE.SYSTEM_NOTIFY_TEMPLATE_TYPE)"
:key=
"dict.value"
:label=
"dict.label"
:value=
"parseInt(dict.value)"
/>
</el-select>
</el-form-item>
<el-form-item
label=
"开启状态"
prop=
"status"
>
<el-radio-group
v-model=
"formData.status"
>
<el-radio
v-for=
"dict in getIntDictOptions(DICT_TYPE.COMMON_STATUS)"
:key=
"dict.value"
:label=
"parseInt(dict.value as string)"
>
{{
dict
.
label
}}
</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item
label=
"备注"
prop=
"remark"
>
<el-input
v-model=
"formData.remark"
placeholder=
"请输入备注"
/>
</el-form-item>
</el-form>
<template
#
footer
>
<el-button
@
click=
"submitForm"
type=
"primary"
:disabled=
"formLoading"
>
确 定
</el-button>
<el-button
@
click=
"dialogVisible = false"
>
取 消
</el-button>
</
template
>
</Dialog>
</template>
<
script
setup
lang=
"ts"
>
import
{
DICT_TYPE
,
getIntDictOptions
}
from
'@/utils/dict'
import
*
as
NotifyTemplateApi
from
'@/api/system/notify/template'
import
{
CommonStatusEnum
}
from
'@/utils/constants'
const
message
=
useMessage
()
// 消息弹窗
const
dialogVisible
=
ref
(
false
)
// 弹窗的是否展示
const
dialogTitle
=
ref
(
''
)
// 弹窗的标题
const
formLoading
=
ref
(
false
)
// 表单的加载中:1)修改时的数据加载;2)提交的按钮禁用
const
formType
=
ref
(
''
)
// 表单的类型
const
formData
=
ref
<
NotifyTemplateApi
.
NotifyTemplateVO
>
({
id
:
null
,
name
:
''
,
nickname
:
''
,
code
:
''
,
content
:
''
,
type
:
null
,
params
:
''
,
status
:
CommonStatusEnum
.
ENABLE
,
remark
:
''
})
const
formRules
=
reactive
({
type
:
[{
required
:
true
,
message
:
'消息类型不能为空'
,
trigger
:
'change'
}],
status
:
[{
required
:
true
,
message
:
'开启状态不能为空'
,
trigger
:
'blur'
}],
code
:
[{
required
:
true
,
message
:
'模板编码不能为空'
,
trigger
:
'blur'
}],
name
:
[{
required
:
true
,
message
:
'模板名称不能为空'
,
trigger
:
'blur'
}],
nickname
:
[{
required
:
true
,
message
:
'发件人姓名不能为空'
,
trigger
:
'blur'
}],
content
:
[{
required
:
true
,
message
:
'模板内容不能为空'
,
trigger
:
'blur'
}]
})
const
formRef
=
ref
()
// 表单 Ref
const
open
=
async
(
type
:
string
,
id
?:
number
)
=>
{
dialogVisible
.
value
=
true
dialogTitle
.
value
=
type
formType
.
value
=
type
resetForm
()
// 修改时,设置数据
if
(
id
)
{
formLoading
.
value
=
true
try
{
formData
.
value
=
await
NotifyTemplateApi
.
getNotifyTemplateApi
(
id
)
}
finally
{
formLoading
.
value
=
false
}
}
}
defineExpose
({
open
})
// 提供 open 方法,用于打开弹窗
/** 提交表单 */
const
emit
=
defineEmits
([
'success'
])
// 定义 success 事件,用于操作成功后的回调
const
submitForm
=
async
()
=>
{
// 校验表单
if
(
!
formRef
)
return
const
valid
=
await
formRef
.
value
.
validate
()
if
(
!
valid
)
return
formLoading
.
value
=
true
try
{
const
data
=
formData
.
value
as
NotifyTemplateApi
.
NotifyTemplateVO
if
(
formType
.
value
===
'create'
)
{
await
NotifyTemplateApi
.
createNotifyTemplateApi
(
data
)
message
.
success
(
'新增成功'
)
}
else
{
await
NotifyTemplateApi
.
updateNotifyTemplateApi
(
data
)
message
.
success
(
'修改成功'
)
}
dialogVisible
.
value
=
false
// 发送操作成功的事件
emit
(
'success'
)
}
finally
{
formLoading
.
value
=
false
}
}
/** 重置表单 */
const
resetForm
=
()
=>
{
formData
.
value
=
{
id
:
null
,
name
:
''
,
nickname
:
''
,
code
:
''
,
content
:
''
,
type
:
null
,
params
:
''
,
status
:
CommonStatusEnum
.
ENABLE
,
remark
:
''
}
formRef
.
value
?.
resetFields
()
}
</
script
>
src/views/system/notify/template/index.vue
View file @
97f9560c
<
template
>
<doc-alert
title=
"站内信配置"
url=
"https://doc.iocoder.cn/notify/"
/>
<ContentWrap>
<!-- 列表 -->
<XTable
@
register=
"registerTable"
>
<template
#
toolbar_buttons
>
<!-- 操作:新增 -->
<XButton
type=
"primary"
preIcon=
"ep:zoom-in"
:title=
"t('action.add')"
v-hasPermi=
"['system:notify-template:create']"
@
click=
"handleCreate()"
/>
</
template
>
<
template
#
actionbtns_default=
"{ row }"
>
<!-- 操作:测试站内信 -->
<XTextButton
preIcon=
"ep:cpu"
:title=
"t('action.test')"
v-hasPermi=
"['system:notify-template:send-notify']"
@
click=
"handleSendNotify(row)"
/>
<!-- 操作:修改 -->
<XTextButton
preIcon=
"ep:edit"
:title=
"t('action.edit')"
v-hasPermi=
"['system:notify-template:update']"
@
click=
"handleUpdate(row.id)"
<!-- 搜索工作栏 -->
<el-form
class=
"-mb-15px"
:model=
"queryParams"
ref=
"queryFormRef"
:inline=
"true"
label-width=
"68px"
>
<el-form-item
label=
"模板名称"
prop=
"name"
>
<el-input
v-model=
"queryParams.name"
placeholder=
"请输入模板名称"
clearable
@
keyup
.
enter=
"handleQuery"
class=
"!w-240px"
/>
<!-- 操作:详情 -->
<XTextButton
preIcon=
"ep:view"
:title=
"t('action.detail')"
v-hasPermi=
"['system:notify-template:query']"
@
click=
"handleDetail(row.id)"
</el-form-item>
<el-form-item
label=
"模板编号"
prop=
"code"
>
<el-input
v-model=
"queryParams.code"
placeholder=
"请输入模版编码"
clearable
@
keyup
.
enter=
"handleQuery"
class=
"!w-240px"
/>
<!-- 操作:删除 -->
<XTextButton
preIcon=
"ep:delete"
:title=
"t('action.del')"
v-hasPermi=
"['system:notify-template:delete']"
@
click=
"deleteData(row.id)"
</el-form-item>
<el-form-item
label=
"状态"
prop=
"status"
>
<el-select
v-model=
"queryParams.status"
placeholder=
"请选择开启状态"
clearable
class=
"!w-240px"
>
<el-option
v-for=
"dict in getIntDictOptions(DICT_TYPE.COMMON_STATUS)"
:key=
"dict.value"
:label=
"dict.label"
:value=
"dict.value"
/>
</el-select>
</el-form-item>
<el-form-item
label=
"创建时间"
prop=
"createTime"
>
<el-date-picker
v-model=
"queryParams.createTime"
value-format=
"YYYY-MM-DD HH:mm:ss"
type=
"daterange"
start-placeholder=
"开始日期"
end-placeholder=
"结束日期"
:default-time=
"[new Date('1 00:00:00'), new Date('1 23:59:59')]"
class=
"!w-240px"
/>
</
template
>
</XTable>
</el-form-item>
<el-form-item>
<el-button
@
click=
"handleQuery"
><Icon
icon=
"ep:search"
class=
"mr-5px"
/>
搜索
</el-button>
<el-button
@
click=
"resetQuery"
><Icon
icon=
"ep:refresh"
class=
"mr-5px"
/>
重置
</el-button>
<el-button
type=
"primary"
plain
@
click=
"openForm('create')"
v-hasPermi=
"['system:notify-template:create']"
>
<Icon
icon=
"ep:plus"
class=
"mr-5px"
/>
新增
</el-button>
</el-form-item>
</el-form>
</ContentWrap>
<!-- 添加/修改的弹窗 -->
<Dialog
id=
"templateModel"
:loading=
"modelLoading"
v-model=
"dialogVisible"
:title=
"dialogTitle"
>
<!-- 表单:添加/修改 -->
<Form
ref=
"formRef"
v-if=
"['create', 'update'].includes(actionType)"
:schema=
"allSchemas.formSchema"
:rules=
"rules"
/>
<!-- 表单:详情 -->
<Descriptions
v-if=
"actionType === 'detail'"
:schema=
"allSchemas.detailSchema"
:data=
"detailData"
/>
<
template
#
footer
>
<!-- 按钮:保存 -->
<XButton
v-if=
"['create', 'update'].includes(actionType)"
type=
"primary"
:title=
"t('action.save')"
:loading=
"actionLoading"
@
click=
"submitForm()"
<!-- 列表 -->
<ContentWrap>
<el-table
v-loading=
"loading"
:data=
"list"
>
<el-table-column
label=
"模板编码"
align=
"center"
prop=
"code"
width=
"120"
:show-overflow-tooltip=
"true"
/>
<!-- 按钮:关闭 -->
<XButton
:loading=
"actionLoading"
:title=
"t('dialog.close')"
@
click=
"dialogVisible = false"
/>
</
template
>
</Dialog>
<el-table-column
label=
"模板名称"
align=
"center"
prop=
"name"
width=
"120"
:show-overflow-tooltip=
"true"
/>
<el-table-column
label=
"类型"
align=
"center"
prop=
"type"
>
<template
#
default=
"scope"
>
<dict-tag
:type=
"DICT_TYPE.SYSTEM_NOTIFY_TEMPLATE_TYPE"
:value=
"scope.row.type"
/>
</
template
>
</el-table-column>
<el-table-column
label=
"发送人名称"
align=
"center"
prop=
"nickname"
/>
<el-table-column
label=
"模板内容"
align=
"center"
prop=
"content"
width=
"200"
:show-overflow-tooltip=
"true"
/>
<el-table-column
label=
"开启状态"
align=
"center"
prop=
"status"
width=
"80"
>
<
template
#
default=
"scope"
>
<dict-tag
:type=
"DICT_TYPE.COMMON_STATUS"
:value=
"scope.row.status"
/>
</
template
>
</el-table-column>
<el-table-column
label=
"备注"
align=
"center"
prop=
"remark"
/>
<el-table-column
label=
"创建时间"
align=
"center"
prop=
"createTime"
width=
"180"
:formatter=
"dateFormatter"
/>
<el-table-column
label=
"操作"
align=
"center"
width=
"210"
fixed=
"right"
>
<
template
#
default=
"scope"
>
<el-button
link
type=
"primary"
@
click=
"openForm('update', scope.row.id)"
v-hasPermi=
"['system:notify-template:update']"
>
修改
</el-button>
<el-button
link
type=
"primary"
@
click=
"openSendForm(scope.row)"
v-hasPermi=
"['system:notify-template:send-notify']"
>
测试
</el-button>
<el-button
link
type=
"danger"
@
click=
"handleDelete(scope.row.id)"
v-hasPermi=
"['system:notify-template:delete']"
>
删除
</el-button>
</
template
>
</el-table-column>
</el-table>
<!-- 分页 -->
<Pagination
:total=
"total"
v-model:page=
"queryParams.pageNo"
v-model:limit=
"queryParams.pageSize"
@
pagination=
"getList"
/>
</ContentWrap>
<!-- 测试站内信的弹窗 -->
<Dialog
id=
"sendTest"
v-model=
"sendVisible"
title=
"测试"
>
<el-form
:model=
"sendForm"
:rules=
"sendRules"
label-width=
"200px"
label-position=
"top"
>
<Dialog
v-model=
"dialogFormVisible"
title=
"测试发送"
:max-height=
"500"
>
<el-form
ref=
"sendFormRef"
:model=
"sendFormData"
:rules=
"sendFormRules"
label-width=
"140px"
v-loading=
"formLoading"
>
<el-form-item
label=
"模板内容"
prop=
"content"
>
<el-input
type=
"textarea"
v-model=
"sendForm
.content"
readonly
/>
<el-input
v-model=
"sendFormData
.content"
readonly
/>
</el-form-item>
<el-form-item
label=
"接收人"
prop=
"userId"
>
<el-select
v-model=
"sendForm.userId"
placeholder=
"请选择接收人"
>
<el-select
v-model=
"sendForm
Data
.userId"
placeholder=
"请选择接收人"
>
<el-option
v-for=
"item in userOption"
:key=
"item.id"
...
...
@@ -91,159 +173,155 @@
</el-select>
</el-form-item>
<el-form-item
v-for=
"param in sendForm.params"
v-for=
"param in sendForm
Data
.params"
:key=
"param"
:label=
"'参数 {' + param + '}'"
:prop=
"'templateParams.' + param"
>
<el-input
v-model=
"sendForm.templateParams[param]"
v-model=
"sendForm
Data
.templateParams[param]"
:placeholder=
"'请输入 ' + param + ' 参数'"
/>
</el-form-item>
</el-form>
<!-- 操作按钮 -->
<
template
#
footer
>
<XButton
type=
"primary"
:title=
"t('action.test')"
:loading=
"actionLoading"
@
click=
"sendTest()"
/>
<XButton
:title=
"t('dialog.close')"
@
click=
"sendVisible = false"
/>
<span
class=
"dialog-footer"
>
<el-button
@
click=
"dialogFormVisible = false"
>
取消
</el-button>
<el-button
type=
"primary"
@
click=
"submitForm"
>
确定
</el-button>
</span>
</
template
>
</Dialog>
<!-- 表单弹窗:添加/修改 -->
<NotifyTemplateForm
ref=
"formRef"
@
success=
"getList"
/>
</template>
<
script
setup
lang=
"ts"
name=
"SystemNotifyTemplate"
>
import
{
FormExpose
}
from
'@/components/Form'
// 业务相关的 import
import
{
rules
,
allSchemas
}
from
'./template.data'
<
script
setup
lang=
"ts"
name=
"NotifySmsTemplate"
>
import
{
DICT_TYPE
,
getIntDictOptions
}
from
'@/utils/dict'
import
{
dateFormatter
}
from
'@/utils/formatTime'
import
*
as
NotifyTemplateApi
from
'@/api/system/notify/template'
import
{
getSimpleUserList
,
UserVO
}
from
'@/api/system/user'
import
NotifyTemplateForm
from
'./NotifyTemplateForm.vue'
const
{
t
}
=
useI18n
()
// 国际化
const
message
=
useMessage
()
// 消息弹窗
// 列表相关的变量
const
[
registerTable
,
{
reload
,
deleteData
}]
=
useXTable
({
allSchemas
:
allSchemas
,
getListApi
:
NotifyTemplateApi
.
getNotifyTemplatePageApi
,
deleteApi
:
NotifyTemplateApi
.
deleteNotifyTemplateApi
})
// 弹窗相关的变量
const
dialogVisible
=
ref
(
false
)
// 是否显示弹出层
const
dialogTitle
=
ref
(
'edit'
)
// 弹出层标题
const
modelLoading
=
ref
(
false
)
// 弹出层loading
const
actionType
=
ref
(
''
)
// 操作按钮的类型
const
actionLoading
=
ref
(
false
)
// 按钮 Loading
const
formRef
=
ref
<
FormExpose
>
()
// 表单 Ref
const
detailData
=
ref
()
// 详情 Ref
// 设置标题
const
setDialogTile
=
(
type
:
string
)
=>
{
modelLoading
.
value
=
true
dialogTitle
.
value
=
t
(
'action.'
+
type
)
actionType
.
value
=
type
dialogVisible
.
value
=
true
}
// 新增操作
const
handleCreate
=
()
=>
{
setDialogTile
(
'create'
)
modelLoading
.
value
=
false
}
// 修改操作
const
handleUpdate
=
async
(
rowId
:
number
)
=>
{
setDialogTile
(
'update'
)
// 设置数据
const
res
=
await
NotifyTemplateApi
.
getNotifyTemplateApi
(
rowId
)
unref
(
formRef
)?.
setValues
(
res
)
modelLoading
.
value
=
false
}
// 详情操作
const
handleDetail
=
async
(
rowId
:
number
)
=>
{
setDialogTile
(
'detail'
)
const
res
=
await
NotifyTemplateApi
.
getNotifyTemplateApi
(
rowId
)
detailData
.
value
=
res
modelLoading
.
value
=
false
}
const
loading
=
ref
(
false
)
// 列表的加载中
const
total
=
ref
(
0
)
// 列表的总页数
const
list
=
ref
([])
// 列表的数据
const
queryFormRef
=
ref
()
// 搜索的表单
// 提交按钮
const
submitForm
=
async
()
=>
{
const
elForm
=
unref
(
formRef
)?.
getElFormRef
()
if
(
!
elForm
)
return
elForm
.
validate
(
async
(
valid
)
=>
{
if
(
valid
)
{
actionLoading
.
value
=
true
// 提交请求
try
{
const
data
=
unref
(
formRef
)?.
formModel
as
NotifyTemplateApi
.
NotifyTemplateVO
if
(
actionType
.
value
===
'create'
)
{
await
NotifyTemplateApi
.
createNotifyTemplateApi
(
data
)
message
.
success
(
t
(
'common.createSuccess'
))
}
else
{
await
NotifyTemplateApi
.
updateNotifyTemplateApi
(
data
)
message
.
success
(
t
(
'common.updateSuccess'
))
}
dialogVisible
.
value
=
false
}
finally
{
actionLoading
.
value
=
false
// 刷新列表
await
reload
()
}
}
})
}
const
formLoading
=
ref
(
false
)
const
dialogFormVisible
=
ref
(
false
)
const
sendFormRef
=
ref
()
// 表单 Ref
const
queryParams
=
reactive
({
pageNo
:
1
,
pageSize
:
10
,
name
:
undefined
,
status
:
undefined
,
code
:
undefined
,
createTime
:
[]
})
// ========== 测试相关 ==========
const
sendForm
=
ref
({
const
sendFormData
=
ref
({
content
:
''
,
params
:
{},
userId
:
0
,
userId
:
null
,
templateCode
:
''
,
templateParams
:
{}
})
const
sendRules
=
ref
({
userId
:
[{
required
:
true
,
message
:
'用户编号不能为空'
,
trigger
:
'blur'
}],
const
sendFormRules
=
ref
({
userId
:
[{
required
:
true
,
message
:
'用户编号不能为空'
,
trigger
:
'change'
}],
templateCode
:
[{
required
:
true
,
message
:
'模版编号不能为空'
,
trigger
:
'blur'
}],
templateParams
:
{}
})
const
sendVisible
=
ref
(
false
)
const
userOption
=
ref
<
UserVO
[]
>
([])
const
handleSendNotify
=
(
row
:
any
)
=>
{
sendForm
.
value
.
content
=
row
.
content
sendForm
.
value
.
params
=
row
.
params
sendForm
.
value
.
templateCode
=
row
.
code
sendForm
.
value
.
templateParams
=
row
.
params
.
reduce
(
function
(
obj
,
item
)
{
/** 查询列表 */
const
getList
=
async
()
=>
{
loading
.
value
=
true
try
{
const
data
=
await
NotifyTemplateApi
.
getNotifyTemplatePageApi
(
queryParams
)
list
.
value
=
data
.
list
total
.
value
=
data
.
total
}
finally
{
loading
.
value
=
false
}
}
/** 搜索按钮操作 */
const
handleQuery
=
()
=>
{
queryParams
.
pageNo
=
1
getList
()
}
/** 重置按钮操作 */
const
resetQuery
=
()
=>
{
queryFormRef
.
value
.
resetFields
()
handleQuery
()
}
/** 添加/修改操作 */
const
formRef
=
ref
()
const
openForm
=
(
type
:
string
,
id
?:
number
)
=>
{
formRef
.
value
.
open
(
type
,
id
)
}
/** 删除按钮操作 */
const
handleDelete
=
async
(
id
:
number
)
=>
{
try
{
// 删除的二次确认
await
message
.
delConfirm
()
// 发起删除
await
NotifyTemplateApi
.
deleteNotifyTemplateApi
(
id
)
message
.
success
(
'删除成功'
)
// 刷新列表
await
getList
()
}
catch
{}
}
const
openSendForm
=
(
row
:
any
)
=>
{
sendFormData
.
value
.
content
=
row
.
content
sendFormData
.
value
.
params
=
row
.
params
sendFormData
.
value
.
templateCode
=
row
.
code
sendFormData
.
value
.
templateParams
=
row
.
params
.
reduce
(
function
(
obj
,
item
)
{
obj
[
item
]
=
undefined
return
obj
},
{})
sendRules
.
value
.
templateParams
=
row
.
params
.
reduce
(
function
(
obj
,
item
)
{
send
Form
Rules
.
value
.
templateParams
=
row
.
params
.
reduce
(
function
(
obj
,
item
)
{
obj
[
item
]
=
{
required
:
true
,
message
:
'参数 '
+
item
+
' 不能为空'
,
trigger
:
'change'
}
return
obj
},
{})
send
Visible
.
value
=
true
dialogForm
Visible
.
value
=
true
}
const
sendTest
=
async
()
=>
{
const
data
:
NotifyTemplateApi
.
NotifySendReqVO
=
{
userId
:
sendForm
.
value
.
userId
,
templateCode
:
sendForm
.
value
.
templateCode
,
templateParams
:
sendForm
.
value
.
templateParams
as
unknown
as
Map
<
string
,
Object
>
}
const
res
=
await
NotifyTemplateApi
.
sendNotifyApi
(
data
)
if
(
res
)
{
message
.
success
(
'提交发送成功!发送结果,见发送日志编号:'
+
res
)
/** 提交表单 */
const
submitForm
=
async
()
=>
{
// 校验表单
if
(
!
sendFormRef
)
return
const
valid
=
await
sendFormRef
.
value
.
validate
()
if
(
!
valid
)
return
// 提交请求
formLoading
.
value
=
true
try
{
const
data
:
NotifyTemplateApi
.
NotifySendReqVO
=
{
userId
:
sendFormData
.
value
.
userId
,
templateCode
:
sendFormData
.
value
.
templateCode
,
templateParams
:
sendFormData
.
value
.
templateParams
as
unknown
as
Map
<
string
,
Object
>
}
const
res
=
await
NotifyTemplateApi
.
sendNotifyApi
(
data
)
if
(
res
)
{
message
.
success
(
'提交发送成功!发送结果,见消息记录编号:'
+
res
)
}
dialogFormVisible
.
value
=
false
}
finally
{
formLoading
.
value
=
false
}
sendVisible
.
value
=
false
}
/
/ ========== 初始化 ==========
/
** 初始化 **/
onMounted
(()
=>
{
getList
()
getSimpleUserList
().
then
((
data
)
=>
{
userOption
.
value
=
data
})
...
...
src/views/system/notify/template/template.data.ts
deleted
100644 → 0
View file @
abf9b50c
import
type
{
VxeCrudSchema
}
from
'@/hooks/web/useVxeCrudSchemas'
// 表单校验
export
const
rules
=
reactive
({
name
:
[
required
],
code
:
[
required
],
content
:
[
required
],
type
:
[
required
],
status
:
[
required
]
})
// CrudSchema
const
crudSchemas
=
reactive
<
VxeCrudSchema
>
({
primaryKey
:
'id'
,
primaryTitle
:
'编号'
,
primaryType
:
null
,
action
:
true
,
actionWidth
:
'260'
,
// 3个按钮默认200,如有删减对应增减即可
columns
:
[
{
title
:
'模版编码'
,
field
:
'code'
,
isSearch
:
true
},
{
title
:
'模板名称'
,
field
:
'name'
,
isSearch
:
true
},
{
title
:
'发件人名称'
,
field
:
'nickname'
},
{
title
:
'类型'
,
field
:
'type'
,
dictType
:
DICT_TYPE
.
SYSTEM_NOTIFY_TEMPLATE_TYPE
,
dictClass
:
'number'
},
{
title
:
'模版内容'
,
field
:
'content'
,
table
:
{
width
:
300
},
form
:
{
component
:
'Input'
,
componentProps
:
{
type
:
'textarea'
,
rows
:
4
},
colProps
:
{
span
:
24
}
}
},
{
title
:
'状态'
,
field
:
'status'
,
dictType
:
DICT_TYPE
.
COMMON_STATUS
,
dictClass
:
'number'
,
isSearch
:
true
},
{
title
:
'备注'
,
field
:
'remark'
},
{
title
:
'创建时间'
,
field
:
'createTime'
,
isForm
:
false
,
formatter
:
'formatDate'
,
search
:
{
show
:
true
,
itemRender
:
{
name
:
'XDataTimePicker'
}
},
table
:
{
width
:
180
}
}
]
})
export
const
{
allSchemas
}
=
useVxeCrudSchemas
(
crudSchemas
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment