-
+
+
-
- 配置后,使用此模板发送消息时会自动@指定的用户(适用于支持@功能的渠道,如钉钉、企业微信等)
-
@@ -326,7 +317,7 @@ watch(() => props.open, (newVal) => {
ref="textTemplateRef"
v-model="formData.text_template"
placeholder="请输入纯文本模板内容,可使用 {{key}} 作为占位符"
- rows="10"
+ rows="15"
/>
@@ -352,7 +343,7 @@ watch(() => props.open, (newVal) => {
ref="htmlTemplateRef"
v-model="formData.html_template"
placeholder="请输入HTML模板内容,可使用 {{key}} 作为占位符"
- rows="10"
+ rows="15"
/>
@@ -378,7 +369,7 @@ watch(() => props.open, (newVal) => {
ref="markdownTemplateRef"
v-model="formData.markdown_template"
placeholder="请输入Markdown模板内容,可使用 {{key}} 作为占位符"
- rows="10"
+ rows="15"
/>
diff --git a/web/src/components/pages/messageTemplate/TemplateInstanceConfig.vue b/web/src/components/pages/messageTemplate/TemplateInstanceConfig.vue
index 84f6918..a3a6bc7 100644
--- a/web/src/components/pages/messageTemplate/TemplateInstanceConfig.vue
+++ b/web/src/components/pages/messageTemplate/TemplateInstanceConfig.vue
@@ -80,6 +80,36 @@ const handlechannelNameChange = () => {
// 添加单条实例配置
const handleAddSubmit = async () => {
+ // 验证是否选择了渠道
+ if (!channelName.value) {
+ toast.error('请选择发送渠道')
+ return
+ }
+
+ // 验证内容类型
+ const contentType = formData.value.templ_type
+ if (!contentType) {
+ toast.error('请选择消息格式')
+ return
+ }
+
+ // 验证模板对应格式的内容是否为空
+ const templateFieldMap: Record
= {
+ 'text': 'text_template',
+ 'html': 'html_template',
+ 'markdown': 'markdown_template'
+ }
+
+ const fieldName = templateFieldMap[contentType.toLowerCase()]
+ if (fieldName) {
+ const templateContent = props.templateData?.[fieldName] || ''
+ // 检查是否为空(去除所有空白字符后检查)
+ if (!templateContent.trim()) {
+ toast.error(`模板的 ${contentType} 格式内容为空,无法添加此类型的实例`)
+ return
+ }
+ }
+
// 组建表单数据
let postData = {
"id": generateBizUniqueID('I'),