feat: 1.4.0

1.前端新增飞书通知入口
2. 优化场景和通知的列表支持滑动
3. 限制固定间隔和随机间隔两个退避策略的间隔时间不能小于10秒
This commit is contained in:
www.byteblogs.com 2023-05-30 23:21:24 +08:00
parent 357869aac9
commit ad5ed2b582
2 changed files with 37 additions and 16 deletions

View File

@ -5,6 +5,7 @@
:dataSource="data" :dataSource="data"
:pagination="false" :pagination="false"
:loading="memberLoading" :loading="memberLoading"
:scroll="{ x: 1200 }"
> >
<template v-for="(col, i) in ['description']" :slot="col" slot-scope="text, record"> <template v-for="(col, i) in ['description']" :slot="col" slot-scope="text, record">
<a-input <a-input
@ -102,6 +103,16 @@
{rules: [{ required: true, message: '请输入钉钉URL', whitespace: true}]} {rules: [{ required: true, message: '请输入钉钉URL', whitespace: true}]}
]" /> ]" />
</a-form-item> </a-form-item>
<a-form-item
v-if="this.notifyTypeValue === '4'"
label="飞书URL">
<a-input
placeholder="请输入飞书URL"
v-decorator="[
'feiShuUrl',
{rules: [{ required: true, message: '请输入飞书URL', whitespace: true}]}
]" />
</a-form-item>
<a-form-item <a-form-item
v-if="this.notifyTypeValue === '2'" v-if="this.notifyTypeValue === '2'"
label="用户名"> label="用户名">
@ -201,7 +212,7 @@ export default {
title: '通知场景', title: '通知场景',
dataIndex: 'notifyScene', dataIndex: 'notifyScene',
key: 'notifyScene', key: 'notifyScene',
width: '15%', width: '20%',
scopedSlots: { customRender: 'notifyScene' } scopedSlots: { customRender: 'notifyScene' }
}, },
{ {
@ -215,19 +226,20 @@ export default {
title: '配置属性', title: '配置属性',
dataIndex: 'notifyAttribute', dataIndex: 'notifyAttribute',
key: 'notifyAttribute', key: 'notifyAttribute',
width: '25%', width: '30%',
scopedSlots: { customRender: 'notifyAttribute' } scopedSlots: { customRender: 'notifyAttribute' }
}, },
{ {
title: '描述', title: '描述',
dataIndex: 'description', dataIndex: 'description',
key: 'description', key: 'description',
width: '25%', width: '15%',
scopedSlots: { customRender: 'description' } scopedSlots: { customRender: 'description' }
}, },
{ {
title: '操作', title: '操作',
key: 'action', key: 'action',
fixed: 'right',
scopedSlots: { customRender: 'operation' } scopedSlots: { customRender: 'operation' }
} }
], ],
@ -248,7 +260,8 @@ export default {
}, },
notifyType: { notifyType: {
'1': '钉钉通知', '1': '钉钉通知',
'2': '邮箱通知' '2': '邮箱通知',
'4': '飞书'
// '3': '' // '3': ''
}, },
notifyThresholdDisabled: ['3', '4'], notifyThresholdDisabled: ['3', '4'],
@ -319,8 +332,6 @@ export default {
const target = this.formData.find(item => key === item.key) const target = this.formData.find(item => key === item.key)
if (!target) { if (!target) {
console.log(target)
console.log(this.formData)
this.formData.push({ this.formData.push({
key: key, key: key,
id, id,
@ -374,7 +385,7 @@ export default {
setTimeout(resolve, 1500) setTimeout(resolve, 1500)
}).then(() => { }).then(() => {
const { form } = this const { form } = this
const formData = pick(record.notifyAttribute, ['dingDingUrl', 'user', 'pass', 'host', 'port', 'from', 'tos']) const formData = pick(record.notifyAttribute, ['dingDingUrl', 'feiShuUrl', 'user', 'pass', 'host', 'port', 'from', 'tos'])
console.log(formData) console.log(formData)
form.setFieldsValue(formData) form.setFieldsValue(formData)
}) })
@ -410,6 +421,8 @@ export default {
if (record.notifyType === '1') { if (record.notifyType === '1') {
s = '钉钉地址:' + text['dingDingUrl'] + ';' s = '钉钉地址:' + text['dingDingUrl'] + ';'
} else if (record.notifyType === '4') {
s = '飞书地址:' + text['feiShuUrl'] + ';'
} }
return s return s

View File

@ -26,6 +26,7 @@
:pagination="pagination" :pagination="pagination"
:loading="memberLoading" :loading="memberLoading"
@change="handleTableChange" @change="handleTableChange"
:scroll="{ x: 1200 }"
> >
<template v-for="(col, i) in ['sceneName', 'description']" :slot="col" slot-scope="text, record"> <template v-for="(col, i) in ['sceneName', 'description']" :slot="col" slot-scope="text, record">
<a-input <a-input
@ -68,7 +69,7 @@
<a-input-number <a-input-number
v-if="record.editable" v-if="record.editable"
:min="1" :min="1"
:max="99999" :max="max"
style="width: 100%;" style="width: 100%;"
:value="text" :value="text"
placeholder="最大重试次数" placeholder="最大重试次数"
@ -90,7 +91,7 @@
<a-input <a-input
v-if="record.editable" v-if="record.editable"
style="margin: -5px 0" style="margin: -5px 0"
placeholder="间隔时间" :placeholder="data.find(item => item.key === record.key).backOff === '3' ? '请输入CRON表达式' : '请输入间隔时间'"
:value="text" :value="text"
:disabled="data.find(item => item.key === record.key).backOff === '1'" :disabled="data.find(item => item.key === record.key).backOff === '1'"
@change="e => handleChange(e.target.value, record.key, 'triggerInterval')" @change="e => handleChange(e.target.value, record.key, 'triggerInterval')"
@ -149,7 +150,7 @@ export default {
title: '场景状态', title: '场景状态',
dataIndex: 'sceneStatus', dataIndex: 'sceneStatus',
key: 'sceneStatus', key: 'sceneStatus',
width: '10%', width: '8%',
scopedSlots: { customRender: 'sceneStatus' } scopedSlots: { customRender: 'sceneStatus' }
}, },
{ {
@ -163,33 +164,34 @@ export default {
title: '最大重试次数', title: '最大重试次数',
dataIndex: 'maxRetryCount', dataIndex: 'maxRetryCount',
key: 'maxRetryCount', key: 'maxRetryCount',
width: '12%', width: '10%',
scopedSlots: { customRender: 'maxRetryCount' } scopedSlots: { customRender: 'maxRetryCount' }
}, },
{ {
title: '调用链超时时间', title: '调用链超时时间',
dataIndex: 'deadlineRequest', dataIndex: 'deadlineRequest',
key: 'deadlineRequest', key: 'deadlineRequest',
width: '15%', width: '10%',
scopedSlots: { customRender: 'deadlineRequest' } scopedSlots: { customRender: 'deadlineRequest' }
}, },
{ {
title: '间隔时间', title: '间隔时间',
dataIndex: 'triggerInterval', dataIndex: 'triggerInterval',
key: 'triggerInterval', key: 'triggerInterval',
width: '10%', width: '15%',
scopedSlots: { customRender: 'triggerInterval' } scopedSlots: { customRender: 'triggerInterval' }
}, },
{ {
title: '描述', title: '描述',
dataIndex: 'description', dataIndex: 'description',
key: 'description', key: 'description',
width: '15%', width: '18%',
scopedSlots: { customRender: 'description' } scopedSlots: { customRender: 'description' }
}, },
{ {
title: '操作', title: '操作',
key: 'action', key: 'action',
fixed: 'right',
scopedSlots: { customRender: 'operation' } scopedSlots: { customRender: 'operation' }
} }
], ],
@ -199,7 +201,7 @@ export default {
advanced: false, advanced: false,
memberLoading: false, memberLoading: false,
triggerIntervalDisabled: false, triggerIntervalDisabled: false,
max: 21, max: 26,
pagination: {}, pagination: {},
backOffLabels: { backOffLabels: {
'1': '延迟等级', '1': '延迟等级',
@ -332,6 +334,12 @@ export default {
return return
} }
if ((backOff === '2' || backOff === '4') && triggerInterval < 10) {
this.memberLoading = false
this.$message.error('描述: 间隔时间最小为10秒')
return
}
const target = this.formData.find(item => key === item.key) const target = this.formData.find(item => key === item.key)
if (!target) { if (!target) {
this.formData.push({ this.formData.push({
@ -377,7 +385,7 @@ export default {
switch (value) { switch (value) {
case '1': case '1':
this.triggerIntervalDisabled = true this.triggerIntervalDisabled = true
this.max = 21 this.max = 26
break break
default: default:
this.triggerIntervalDisabled = false this.triggerIntervalDisabled = false