Commit ce43e30143793d4bde04128b03610fcf405e398f
Merge branch 'feat/alarm-add-dingtalk' into 'main_dev'
feat:告警联系人新增钉钉字段 See merge request yunteng/thingskit-front!1030
Showing
3 changed files
with
79 additions
and
1 deletions
| ... | ... | @@ -74,6 +74,12 @@ |
| 74 | 74 | username: values.username, |
| 75 | 75 | password: values.password, |
| 76 | 76 | }; |
| 77 | + } else if (values.messageType === 'DING_TALK_MESSAGE') { | |
| 78 | + config = { | |
| 79 | + AgentId: values?.AgentId, | |
| 80 | + ClientID: values?.ClientID, | |
| 81 | + ClientSecret: values?.ClientSecret, | |
| 82 | + }; | |
| 77 | 83 | } |
| 78 | 84 | Reflect.set(values, 'config', config); |
| 79 | 85 | let saveMessage = '添加成功'; | ... | ... |
| ... | ... | @@ -79,6 +79,9 @@ export const isMessage = (type: string) => { |
| 79 | 79 | export const isEmail = (type: string) => { |
| 80 | 80 | return type === MessageEnum.IS_EMAIL; |
| 81 | 81 | }; |
| 82 | +export const isDingtalk = (type: string) => { | |
| 83 | + return type === MessageEnum.IS_DINGTALK; | |
| 84 | +}; | |
| 82 | 85 | export const messageTypeIsTencentCloud = (type: string) => { |
| 83 | 86 | return type === 'TENCENT_CLOUD'; |
| 84 | 87 | }; |
| ... | ... | @@ -114,7 +117,17 @@ export const formSchema: FormSchema[] = [ |
| 114 | 117 | required: true, |
| 115 | 118 | component: 'ApiSelect', |
| 116 | 119 | componentProps: { |
| 117 | - api: findDictItemByCode, | |
| 120 | + // api: findDictItemByCode, | |
| 121 | + api: async (params: Recordable) => { | |
| 122 | + try { | |
| 123 | + const result = await findDictItemByCode(params as any); | |
| 124 | + return result.filter((item) => item.itemValue !== 'DING_TALK'); | |
| 125 | + } catch (e) { | |
| 126 | + // eslint-disable-next-line no-console | |
| 127 | + console.error(e); | |
| 128 | + return []; | |
| 129 | + } | |
| 130 | + }, | |
| 118 | 131 | params: { |
| 119 | 132 | dictCode: 'platform_type', |
| 120 | 133 | }, |
| ... | ... | @@ -124,6 +137,31 @@ export const formSchema: FormSchema[] = [ |
| 124 | 137 | ifShow: ({ values }) => isMessage(Reflect.get(values, 'messageType')), |
| 125 | 138 | }, |
| 126 | 139 | { |
| 140 | + field: 'platformType', | |
| 141 | + label: '平台类型', | |
| 142 | + required: true, | |
| 143 | + component: 'ApiSelect', | |
| 144 | + componentProps: { | |
| 145 | + // api: findDictItemByCode,console.log(result | |
| 146 | + api: async (params: Recordable) => { | |
| 147 | + try { | |
| 148 | + const result = await findDictItemByCode(params as any); | |
| 149 | + return result.filter((item) => item.itemValue === 'DING_TALK'); | |
| 150 | + } catch (e) { | |
| 151 | + // eslint-disable-next-line no-console | |
| 152 | + console.error(e); | |
| 153 | + return []; | |
| 154 | + } | |
| 155 | + }, | |
| 156 | + params: { | |
| 157 | + dictCode: 'platform_type', | |
| 158 | + }, | |
| 159 | + labelField: 'itemText', | |
| 160 | + valueField: 'itemValue', | |
| 161 | + }, | |
| 162 | + ifShow: ({ values }) => isDingtalk(Reflect.get(values, 'messageType')), | |
| 163 | + }, | |
| 164 | + { | |
| 127 | 165 | field: 'appId', |
| 128 | 166 | label: 'appId', |
| 129 | 167 | required: true, |
| ... | ... | @@ -251,6 +289,39 @@ export const formSchema: FormSchema[] = [ |
| 251 | 289 | }, |
| 252 | 290 | }, |
| 253 | 291 | { |
| 292 | + field: 'AgentId', | |
| 293 | + label: 'AgentId', | |
| 294 | + component: 'Input', | |
| 295 | + required: true, | |
| 296 | + ifShow: ({ values }) => isDingtalk(Reflect.get(values, 'messageType')), | |
| 297 | + componentProps: { | |
| 298 | + maxLength: 36, | |
| 299 | + placeholder: '请输入AgentId', | |
| 300 | + }, | |
| 301 | + }, | |
| 302 | + { | |
| 303 | + field: 'ClientID', | |
| 304 | + label: 'ClientID', | |
| 305 | + component: 'Input', | |
| 306 | + required: true, | |
| 307 | + ifShow: ({ values }) => isDingtalk(Reflect.get(values, 'messageType')), | |
| 308 | + componentProps: { | |
| 309 | + maxLength: 36, | |
| 310 | + placeholder: '请输入ClientID', | |
| 311 | + }, | |
| 312 | + }, | |
| 313 | + { | |
| 314 | + field: 'ClientSecret', | |
| 315 | + label: 'ClientSecret', | |
| 316 | + component: 'Input', | |
| 317 | + ifShow: ({ values }) => isDingtalk(Reflect.get(values, 'messageType')), | |
| 318 | + required: true, | |
| 319 | + componentProps: { | |
| 320 | + maxLength: 36, | |
| 321 | + placeholder: '请输入ClientSecret', | |
| 322 | + }, | |
| 323 | + }, | |
| 324 | + { | |
| 254 | 325 | field: 'status', |
| 255 | 326 | label: '状态', |
| 256 | 327 | component: 'RadioButtonGroup', | ... | ... |