Commit fb7d09b8d3984df8327c614eade05f97a9f24299
Merge branch 'feat/wechart-alarm' into feat/account-role-manage
Showing
3 changed files
with
54 additions
and
8 deletions
| ... | ... | @@ -17,6 +17,7 @@ |
| 17 | 17 | import { BasicDrawer, useDrawerInner } from '/@/components/Drawer'; |
| 18 | 18 | import { saveOrEditMessageConfig } from '/@/api/message/config'; |
| 19 | 19 | import { useMessage } from '/@/hooks/web/useMessage'; |
| 20 | + import { MessageEnum } from '/@/enums/messageEnum'; | |
| 20 | 21 | |
| 21 | 22 | export default defineComponent({ |
| 22 | 23 | name: 'ConfigDrawer', |
| ... | ... | @@ -85,6 +86,12 @@ |
| 85 | 86 | accessKeyId: values.accessKeyId, |
| 86 | 87 | accessKeySecret: values.accessKeySecret, |
| 87 | 88 | }; |
| 89 | + } else if (values.messageType === MessageEnum.IS_ENTERPRISE_WECHAT) { | |
| 90 | + config = { | |
| 91 | + agentId: values.agentId, | |
| 92 | + corpId: values.corpId, | |
| 93 | + corpSecret: values.corpSecret, | |
| 94 | + }; | |
| 88 | 95 | } |
| 89 | 96 | Reflect.set(values, 'config', config); |
| 90 | 97 | let saveMessage = '添加成功'; | ... | ... |
| ... | ... | @@ -85,6 +85,9 @@ export const isDingtalk = (type: string) => { |
| 85 | 85 | export const isVoice = (type: string) => { |
| 86 | 86 | return type === MessageEnum.IS_VOICE; |
| 87 | 87 | }; |
| 88 | + | |
| 89 | +export const isEnterpriseWechat = (type: string) => type === MessageEnum.IS_ENTERPRISE_WECHAT; | |
| 90 | + | |
| 88 | 91 | export const messageTypeIsTencentCloud = (type: string) => { |
| 89 | 92 | return type === 'TENCENT_CLOUD'; |
| 90 | 93 | }; |
| ... | ... | @@ -124,13 +127,19 @@ export const formSchema: FormSchema[] = [ |
| 124 | 127 | api: async (params: Recordable) => { |
| 125 | 128 | try { |
| 126 | 129 | const result = await findDictItemByCode(params as any); |
| 127 | - if (isMessage(Reflect.get(formModel, 'messageType'))) | |
| 130 | + const messageType = Reflect.get(formModel, 'messageType'); | |
| 131 | + if (isMessage(messageType)) | |
| 128 | 132 | return result.filter( |
| 129 | 133 | (item) => item.itemValue !== 'DING_TALK' && item.itemValue !== 'ALI_VOICE' |
| 130 | 134 | ); |
| 131 | - if (isDingtalk(Reflect.get(formModel, 'messageType'))) | |
| 135 | + | |
| 136 | + if (isEnterpriseWechat(messageType)) { | |
| 137 | + return result.filter((item) => item.itemValue === 'ENTERPRISE_WECHAT'); | |
| 138 | + } | |
| 139 | + | |
| 140 | + if (isDingtalk(messageType)) | |
| 132 | 141 | return result.filter((item) => item.itemValue === 'DING_TALK'); |
| 133 | - if (isVoice(Reflect.get(formModel, 'messageType'))) | |
| 142 | + if (isVoice(messageType)) | |
| 134 | 143 | return result.filter((item) => item.itemValue === 'ALI_VOICE'); |
| 135 | 144 | } catch (e) { |
| 136 | 145 | // eslint-disable-next-line no-console |
| ... | ... | @@ -145,10 +154,15 @@ export const formSchema: FormSchema[] = [ |
| 145 | 154 | valueField: 'itemValue', |
| 146 | 155 | }; |
| 147 | 156 | }, |
| 148 | - ifShow: ({ values }) => | |
| 149 | - isMessage(Reflect.get(values, 'messageType')) || | |
| 150 | - isDingtalk(Reflect.get(values, 'messageType')) || | |
| 151 | - isVoice(Reflect.get(values, 'messageType')), | |
| 157 | + ifShow: ({ values }) => { | |
| 158 | + const messageType = Reflect.get(values, 'messageType'); | |
| 159 | + return ( | |
| 160 | + isMessage(messageType) || | |
| 161 | + isDingtalk(messageType) || | |
| 162 | + isVoice(messageType) || | |
| 163 | + isEnterpriseWechat(messageType) | |
| 164 | + ); | |
| 165 | + }, | |
| 152 | 166 | }, |
| 153 | 167 | { |
| 154 | 168 | field: 'appId', |
| ... | ... | @@ -283,7 +297,10 @@ export const formSchema: FormSchema[] = [ |
| 283 | 297 | label: 'agentId', |
| 284 | 298 | component: 'InputPassword', |
| 285 | 299 | required: true, |
| 286 | - ifShow: ({ values }) => isDingtalk(Reflect.get(values, 'messageType')), | |
| 300 | + ifShow: ({ values }) => { | |
| 301 | + const messageType = Reflect.get(values, 'messageType'); | |
| 302 | + return isDingtalk(messageType) || isEnterpriseWechat(messageType); | |
| 303 | + }, | |
| 287 | 304 | componentProps: { |
| 288 | 305 | maxLength: 36, |
| 289 | 306 | placeholder: '请输入agentId', |
| ... | ... | @@ -311,6 +328,27 @@ export const formSchema: FormSchema[] = [ |
| 311 | 328 | }, |
| 312 | 329 | }, |
| 313 | 330 | { |
| 331 | + field: 'corpId', | |
| 332 | + label: 'corpId', | |
| 333 | + component: 'InputPassword', | |
| 334 | + required: true, | |
| 335 | + ifShow: ({ values }) => isEnterpriseWechat(Reflect.get(values, 'messageType')), | |
| 336 | + componentProps: { | |
| 337 | + maxLength: 18, | |
| 338 | + placeholder: '请输入corpId', | |
| 339 | + }, | |
| 340 | + }, | |
| 341 | + { | |
| 342 | + field: 'corpSecret', | |
| 343 | + label: 'corpSecret', | |
| 344 | + component: 'InputPassword', | |
| 345 | + required: true, | |
| 346 | + ifShow: ({ values }) => isEnterpriseWechat(Reflect.get(values, 'messageType')), | |
| 347 | + componentProps: { | |
| 348 | + placeholder: '请输入corpSecret', | |
| 349 | + }, | |
| 350 | + }, | |
| 351 | + { | |
| 314 | 352 | field: 'status', |
| 315 | 353 | label: '状态', |
| 316 | 354 | component: 'RadioButtonGroup', | ... | ... |