Commit fef4b81cb8114714116421f453f173f980dfd018
Merge branch 'perf/al-message-config' into 'main'
feat:消息配置添加电话语音 See merge request yunteng/thingskit-front!1111
Showing
5 changed files
with
50 additions
and
6 deletions
... | ... | @@ -80,6 +80,11 @@ |
80 | 80 | clientId: values?.clientId, |
81 | 81 | clientSecret: values?.clientSecret, |
82 | 82 | }; |
83 | + } else if (values.messageType === 'VOICE_MESSAGE') { | |
84 | + config = { | |
85 | + accessKeyId: values.accessKeyId, | |
86 | + accessKeySecret: values.accessKeySecret, | |
87 | + }; | |
83 | 88 | } |
84 | 89 | Reflect.set(values, 'config', config); |
85 | 90 | let saveMessage = '添加成功'; | ... | ... |
... | ... | @@ -82,6 +82,9 @@ export const isEmail = (type: string) => { |
82 | 82 | export const isDingtalk = (type: string) => { |
83 | 83 | return type === MessageEnum.IS_DINGTALK; |
84 | 84 | }; |
85 | +export const isVoice = (type: string) => { | |
86 | + return type === MessageEnum.IS_VOICE; | |
87 | +}; | |
85 | 88 | export const messageTypeIsTencentCloud = (type: string) => { |
86 | 89 | return type === 'TENCENT_CLOUD'; |
87 | 90 | }; |
... | ... | @@ -122,9 +125,13 @@ export const formSchema: FormSchema[] = [ |
122 | 125 | try { |
123 | 126 | const result = await findDictItemByCode(params as any); |
124 | 127 | if (isMessage(Reflect.get(formModel, 'messageType'))) |
125 | - return result.filter((item) => item.itemValue !== 'DING_TALK'); | |
128 | + return result.filter( | |
129 | + (item) => item.itemValue !== 'DING_TALK' && item.itemValue !== 'ALI_VOICE' | |
130 | + ); | |
126 | 131 | if (isDingtalk(Reflect.get(formModel, 'messageType'))) |
127 | 132 | return result.filter((item) => item.itemValue === 'DING_TALK'); |
133 | + if (isVoice(Reflect.get(formModel, 'messageType'))) | |
134 | + return result.filter((item) => item.itemValue === 'ALI_VOICE'); | |
128 | 135 | } catch (e) { |
129 | 136 | // eslint-disable-next-line no-console |
130 | 137 | console.error(e); |
... | ... | @@ -140,7 +147,8 @@ export const formSchema: FormSchema[] = [ |
140 | 147 | }, |
141 | 148 | ifShow: ({ values }) => |
142 | 149 | isMessage(Reflect.get(values, 'messageType')) || |
143 | - isDingtalk(Reflect.get(values, 'messageType')), | |
150 | + isDingtalk(Reflect.get(values, 'messageType')) || | |
151 | + isVoice(Reflect.get(values, 'messageType')), | |
144 | 152 | }, |
145 | 153 | { |
146 | 154 | field: 'appId', |
... | ... | @@ -187,7 +195,8 @@ export const formSchema: FormSchema[] = [ |
187 | 195 | placeholder: '请输入accessKeyId', |
188 | 196 | }, |
189 | 197 | ifShow: ({ values }) => |
190 | - isMessage(Reflect.get(values, 'messageType')) && | |
198 | + (isMessage(Reflect.get(values, 'messageType')) || | |
199 | + isVoice(Reflect.get(values, 'messageType'))) && | |
191 | 200 | !messageTypeIsTencentCloud(Reflect.get(values, 'platformType')), |
192 | 201 | }, |
193 | 202 | { |
... | ... | @@ -201,7 +210,8 @@ export const formSchema: FormSchema[] = [ |
201 | 210 | |
202 | 211 | component: 'InputPassword', |
203 | 212 | ifShow: ({ values }) => |
204 | - isMessage(Reflect.get(values, 'messageType')) && | |
213 | + (isMessage(Reflect.get(values, 'messageType')) || | |
214 | + isVoice(Reflect.get(values, 'messageType'))) && | |
205 | 215 | !messageTypeIsTencentCloud(Reflect.get(values, 'platformType')), |
206 | 216 | }, |
207 | 217 | { | ... | ... |
... | ... | @@ -19,6 +19,8 @@ |
19 | 19 | import { saveOrEditMessageTemplate } from '/@/api/message/template'; |
20 | 20 | import { useMessage } from '/@/hooks/web/useMessage'; |
21 | 21 | import { findMessageConfig } from '/@/api/message/config'; |
22 | + import { MessageEnum } from '/@/enums/messageEnum'; | |
23 | + | |
22 | 24 | export default defineComponent({ |
23 | 25 | name: 'TemplateDrawer', |
24 | 26 | components: { BasicDrawer, BasicForm }, |
... | ... | @@ -41,6 +43,14 @@ |
41 | 43 | Reflect.set(data.record, key + '', config[key]); |
42 | 44 | } |
43 | 45 | await setFieldsValue(data.record); |
46 | + if ( | |
47 | + Reflect.get(data.record, 'messageType') === MessageEnum.IS_VOICE && | |
48 | + Reflect.get(data.record, 'signName') | |
49 | + ) { | |
50 | + setFieldsValue({ | |
51 | + voiceSignName: data.record['signName'], | |
52 | + }); | |
53 | + } | |
44 | 54 | const res = await findMessageConfig({}); |
45 | 55 | const options = res.map((item) => { |
46 | 56 | return { |
... | ... | @@ -122,6 +132,12 @@ |
122 | 132 | }; |
123 | 133 | } |
124 | 134 | Reflect.set(values, 'config', config); |
135 | + if ( | |
136 | + Reflect.get(values, 'messageType') === MessageEnum.IS_VOICE && | |
137 | + Reflect.get(values, 'voiceSignName') | |
138 | + ) { | |
139 | + Reflect.set(values, 'signName', values['voiceSignName']); | |
140 | + } | |
125 | 141 | let saveMessage = '添加成功'; |
126 | 142 | let updateMessage = '修改成功'; |
127 | 143 | await saveOrEditMessageTemplate(values, unref(isUpdate)); | ... | ... |
... | ... | @@ -2,7 +2,7 @@ import { BasicColumn } from '/@/components/Table'; |
2 | 2 | import { FormSchema } from '/@/components/Table'; |
3 | 3 | import { findDictItemByCode } from '/@/api/system/dict'; |
4 | 4 | import { findMessageConfig } from '/@/api/message/config'; |
5 | -import { isDingtalk, isMessage } from '/@/views/message/config/config.data'; | |
5 | +import { isDingtalk, isMessage, isVoice } from '/@/views/message/config/config.data'; | |
6 | 6 | |
7 | 7 | export enum PlateFormTypeEnum { |
8 | 8 | ali_cound = 'ALI_CLOUD', |
... | ... | @@ -206,7 +206,19 @@ export const formSchema: FormSchema[] = [ |
206 | 206 | placeholder: '请输入模板编号', |
207 | 207 | }, |
208 | 208 | |
209 | - ifShow: ({ values }) => isMessage(Reflect.get(values, 'messageType')), | |
209 | + ifShow: ({ values }) => | |
210 | + isMessage(Reflect.get(values, 'messageType')) || isVoice(Reflect.get(values, 'messageType')), | |
211 | + }, | |
212 | + { | |
213 | + field: 'voiceSignName', | |
214 | + label: '专属号码', | |
215 | + component: 'Input', | |
216 | + helpMessage: ['只有在模板为专属模式外呼下填入此参数,否则无效'], | |
217 | + componentProps: { | |
218 | + maxLength: 20, | |
219 | + placeholder: '请输入专属号码', | |
220 | + }, | |
221 | + ifShow: ({ values }) => isVoice(Reflect.get(values, 'messageType')), | |
210 | 222 | }, |
211 | 223 | { |
212 | 224 | field: 'signName', | ... | ... |