Merge remote-tracking branch 'origin/dev' into dev

This commit is contained in:
xieyonghong 2023-01-17 13:34:39 +08:00
commit c9d40164ab
3 changed files with 98 additions and 48 deletions

View File

@ -313,7 +313,6 @@ const formData = ref<ConfigFormData>({
configuration: { configuration: {
appKey: '', appKey: '',
appSecret: '', appSecret: '',
url: '',
}, },
description: '', description: '',
name: '', name: '',
@ -325,13 +324,20 @@ const formData = ref<ConfigFormData>({
watch( watch(
() => formData.value.type, () => formData.value.type,
(val) => { (val) => {
formData.value.configuration = CONFIG_FIELD_MAP[val]; // formData.value.configuration = Object.values<any>(CONFIG_FIELD_MAP[val])[0];
msgType.value = MSG_TYPE[val]; msgType.value = MSG_TYPE[val];
formData.value.provider = msgType.value[0].value; formData.value.provider = msgType.value[0].value;
}, },
); );
computed(() =>
Object.assign(
formData.value.configuration,
CONFIG_FIELD_MAP[formData.value.type][formData.value.provider],
),
);
// //
const formRules = ref({ const formRules = ref({
type: [{ required: true, message: '请选择通知方式' }], type: [{ required: true, message: '请选择通知方式' }],

View File

@ -3,34 +3,62 @@ export interface IHeaders {
key: string; key: string;
value: string; value: string;
} }
export interface IConfiguration {
// 钉钉
appKey?: string;
appSecret?: string;
url?: string;
// 微信
corpId?: string;
corpSecret?: string;
// 邮件
host?: string;
port?: number;
ssl?: boolean;
sender?: string;
username?: string;
password?: string;
// 语音
regionId?: string;
accessKeyId?: string;
secret?: string;
// 短信
regionId?: string;
accessKeyId?: string;
secret?: string;
// webhook
// url?: string;
headers?: IHeaders[];
}
export type ConfigFormData = { export type ConfigFormData = {
configuration: { configuration: IConfiguration;
// 钉钉 // configuration: {
appKey?: string; // // 钉钉
appSecret?: string; // appKey?: string;
url?: string; // appSecret?: string;
// 微信 // url?: string;
corpId?: string; // // 微信
corpSecret?: string; // corpId?: string;
// 邮件 // corpSecret?: string;
host?: string; // // 邮件
port?: number; // host?: string;
ssl?: boolean; // port?: number;
sender?: string; // ssl?: boolean;
username?: string; // sender?: string;
password?: string; // username?: string;
// 语音 // password?: string;
regionId?: string; // // 语音
accessKeyId?: string; // regionId?: string;
secret?: string; // accessKeyId?: string;
// 短信 // secret?: string;
regionId?: string; // // 短信
accessKeyId?: string; // regionId?: string;
secret?: string; // accessKeyId?: string;
// webhook // secret?: string;
// url?: string; // // webhook
headers?: IHeaders[]; // // url?: string;
}; // headers?: IHeaders[];
// };
description: string; description: string;
name: string; name: string;
provider: string; provider: string;

View File

@ -93,36 +93,52 @@ export const MSG_TYPE = {
// 配置 // 配置
export const CONFIG_FIELD_MAP = { export const CONFIG_FIELD_MAP = {
dingTalk: { dingTalk: {
appKey: undefined, dingTalkMessage: {
appSecret: undefined, appKey: '',
url: undefined, appSecret: '',
},
dingTalkRobotWebHook: {
url: '',
}
}, },
weixin: { weixin: {
corpId: undefined, corpMessage: {
corpSecret: undefined, corpId: '',
corpSecret: '',
},
// officialMessage: {},
}, },
email: { email: {
host: undefined, embedded: {
port: 25, host: '',
ssl: false, port: 25,
sender: undefined, ssl: false,
username: undefined, sender: '',
password: undefined, username: '',
password: '',
}
}, },
voice: { voice: {
regionId: undefined, aliyun: {
accessKeyId: undefined, regionId: '',
secret: undefined, accessKeyId: '',
secret: '',
}
}, },
sms: { sms: {
regionId: undefined, aliyunSms: {
accessKeyId: undefined, regionId: '',
secret: undefined, accessKeyId: '',
secret: '',
}
}, },
webhook: { webhook: {
url: undefined, http: {
headers: [], url: undefined,
headers: [],
}
}, },
}; };
// 模板 // 模板