Commit 3e974a408163f8dabcb260a4032be409705f41c5
Merge branch 'feat/alarm-add-dingtalk' into 'main_dev'
fix: 修改消息配置添加钉钉相关逻辑 See merge request yunteng/thingskit-front!1034
Showing
6 changed files
with
59 additions
and
61 deletions
@@ -76,9 +76,9 @@ | @@ -76,9 +76,9 @@ | ||
76 | }; | 76 | }; |
77 | } else if (values.messageType === 'DING_TALK_MESSAGE') { | 77 | } else if (values.messageType === 'DING_TALK_MESSAGE') { |
78 | config = { | 78 | config = { |
79 | - AgentId: values?.AgentId, | ||
80 | - ClientID: values?.ClientID, | ||
81 | - ClientSecret: values?.ClientSecret, | 79 | + agentId: values?.agentId, |
80 | + clientId: values?.clientId, | ||
81 | + clientSecret: values?.clientSecret, | ||
82 | }; | 82 | }; |
83 | } | 83 | } |
84 | Reflect.set(values, 'config', config); | 84 | Reflect.set(values, 'config', config); |
@@ -116,50 +116,31 @@ export const formSchema: FormSchema[] = [ | @@ -116,50 +116,31 @@ export const formSchema: FormSchema[] = [ | ||
116 | label: '平台类型', | 116 | label: '平台类型', |
117 | required: true, | 117 | required: true, |
118 | component: 'ApiSelect', | 118 | component: 'ApiSelect', |
119 | - componentProps: { | ||
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 | - }, | ||
131 | - params: { | ||
132 | - dictCode: 'platform_type', | ||
133 | - }, | ||
134 | - labelField: 'itemText', | ||
135 | - valueField: 'itemValue', | ||
136 | - }, | ||
137 | - ifShow: ({ values }) => isMessage(Reflect.get(values, 'messageType')), | ||
138 | - }, | ||
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', | 119 | + componentProps({ formModel }) { |
120 | + return { | ||
121 | + api: async (params: Recordable) => { | ||
122 | + try { | ||
123 | + const result = await findDictItemByCode(params as any); | ||
124 | + if (isMessage(Reflect.get(formModel, 'messageType'))) | ||
125 | + return result.filter((item) => item.itemValue !== 'DING_TALK'); | ||
126 | + if (isDingtalk(Reflect.get(formModel, 'messageType'))) | ||
127 | + return result.filter((item) => item.itemValue === 'DING_TALK'); | ||
128 | + } catch (e) { | ||
129 | + // eslint-disable-next-line no-console | ||
130 | + console.error(e); | ||
131 | + return []; | ||
132 | + } | ||
133 | + }, | ||
134 | + params: { | ||
135 | + dictCode: 'platform_type', | ||
136 | + }, | ||
137 | + labelField: 'itemText', | ||
138 | + valueField: 'itemValue', | ||
139 | + }; | ||
161 | }, | 140 | }, |
162 | - ifShow: ({ values }) => isDingtalk(Reflect.get(values, 'messageType')), | 141 | + ifShow: ({ values }) => |
142 | + isMessage(Reflect.get(values, 'messageType')) || | ||
143 | + isDingtalk(Reflect.get(values, 'messageType')), | ||
163 | }, | 144 | }, |
164 | { | 145 | { |
165 | field: 'appId', | 146 | field: 'appId', |
@@ -189,7 +170,6 @@ export const formSchema: FormSchema[] = [ | @@ -189,7 +170,6 @@ export const formSchema: FormSchema[] = [ | ||
189 | label: 'secretKey', | 170 | label: 'secretKey', |
190 | required: true, | 171 | required: true, |
191 | componentProps: { | 172 | componentProps: { |
192 | - maxLength: 36, | ||
193 | placeholder: '请输入secretKey', | 173 | placeholder: '请输入secretKey', |
194 | }, | 174 | }, |
195 | 175 | ||
@@ -289,36 +269,36 @@ export const formSchema: FormSchema[] = [ | @@ -289,36 +269,36 @@ export const formSchema: FormSchema[] = [ | ||
289 | }, | 269 | }, |
290 | }, | 270 | }, |
291 | { | 271 | { |
292 | - field: 'AgentId', | ||
293 | - label: 'AgentId', | 272 | + field: 'agentId', |
273 | + label: 'agentId', | ||
294 | component: 'Input', | 274 | component: 'Input', |
295 | required: true, | 275 | required: true, |
296 | ifShow: ({ values }) => isDingtalk(Reflect.get(values, 'messageType')), | 276 | ifShow: ({ values }) => isDingtalk(Reflect.get(values, 'messageType')), |
297 | componentProps: { | 277 | componentProps: { |
298 | maxLength: 36, | 278 | maxLength: 36, |
299 | - placeholder: '请输入AgentId', | 279 | + placeholder: '请输入agentId', |
300 | }, | 280 | }, |
301 | }, | 281 | }, |
302 | { | 282 | { |
303 | - field: 'ClientID', | ||
304 | - label: 'ClientID', | 283 | + field: 'clientId', |
284 | + label: 'clientId', | ||
305 | component: 'Input', | 285 | component: 'Input', |
306 | required: true, | 286 | required: true, |
307 | ifShow: ({ values }) => isDingtalk(Reflect.get(values, 'messageType')), | 287 | ifShow: ({ values }) => isDingtalk(Reflect.get(values, 'messageType')), |
308 | componentProps: { | 288 | componentProps: { |
309 | maxLength: 36, | 289 | maxLength: 36, |
310 | - placeholder: '请输入ClientID', | 290 | + placeholder: '请输入clientID', |
311 | }, | 291 | }, |
312 | }, | 292 | }, |
313 | { | 293 | { |
314 | - field: 'ClientSecret', | ||
315 | - label: 'ClientSecret', | 294 | + field: 'clientSecret', |
295 | + label: 'clientSecret', | ||
316 | component: 'Input', | 296 | component: 'Input', |
317 | ifShow: ({ values }) => isDingtalk(Reflect.get(values, 'messageType')), | 297 | ifShow: ({ values }) => isDingtalk(Reflect.get(values, 'messageType')), |
318 | required: true, | 298 | required: true, |
319 | componentProps: { | 299 | componentProps: { |
320 | maxLength: 36, | 300 | maxLength: 36, |
321 | - placeholder: '请输入ClientSecret', | 301 | + placeholder: '请输入clientSecret', |
322 | }, | 302 | }, |
323 | }, | 303 | }, |
324 | { | 304 | { |
@@ -6,7 +6,7 @@ export interface TabItem { | @@ -6,7 +6,7 @@ export interface TabItem { | ||
6 | export const achieveList: TabItem[] = [ | 6 | export const achieveList: TabItem[] = [ |
7 | { | 7 | { |
8 | key: '1', | 8 | key: '1', |
9 | - name: '短信发送记录', | 9 | + name: '消息发送记录', |
10 | component: 'SmsLog', | 10 | component: 'SmsLog', |
11 | }, | 11 | }, |
12 | { | 12 | { |
@@ -61,7 +61,7 @@ | @@ -61,7 +61,7 @@ | ||
61 | components: { BasicTable, TableAction, Authority, Popconfirm, Tooltip }, | 61 | components: { BasicTable, TableAction, Authority, Popconfirm, Tooltip }, |
62 | setup() { | 62 | setup() { |
63 | const [registerTable, { reload, setProps }] = useTable({ | 63 | const [registerTable, { reload, setProps }] = useTable({ |
64 | - title: '短信发送列表', | 64 | + title: '消息发送列表', |
65 | api: smsLogPage, | 65 | api: smsLogPage, |
66 | columns, | 66 | columns, |
67 | formConfig: { | 67 | formConfig: { |
@@ -12,7 +12,7 @@ export const columns: BasicColumn[] = [ | @@ -12,7 +12,7 @@ export const columns: BasicColumn[] = [ | ||
12 | width: 160, | 12 | width: 160, |
13 | }, | 13 | }, |
14 | { | 14 | { |
15 | - title: '短信平台', | 15 | + title: '消息平台', |
16 | dataIndex: 'typeDictText', | 16 | dataIndex: 'typeDictText', |
17 | width: 160, | 17 | width: 160, |
18 | }, | 18 | }, |
@@ -50,6 +50,12 @@ export const columns: BasicColumn[] = [ | @@ -50,6 +50,12 @@ export const columns: BasicColumn[] = [ | ||
50 | }, | 50 | }, |
51 | ]; | 51 | ]; |
52 | 52 | ||
53 | +export const typeList = [ | ||
54 | + { label: '阿里', value: 'ALI_CLOUD' }, | ||
55 | + { label: '钉钉', value: 'DING_TALK' }, | ||
56 | + { label: '腾讯', value: 'TENCENT_CLOUD' }, | ||
57 | +]; | ||
58 | + | ||
53 | export const searchFormSchema: FormSchema[] = [ | 59 | export const searchFormSchema: FormSchema[] = [ |
54 | { | 60 | { |
55 | field: 'toPhone', | 61 | field: 'toPhone', |
@@ -61,6 +67,15 @@ export const searchFormSchema: FormSchema[] = [ | @@ -61,6 +67,15 @@ export const searchFormSchema: FormSchema[] = [ | ||
61 | }, | 67 | }, |
62 | }, | 68 | }, |
63 | { | 69 | { |
70 | + field: 'type', | ||
71 | + label: '消息平台', | ||
72 | + component: 'Select', | ||
73 | + colProps: { span: 6 }, | ||
74 | + componentProps: { | ||
75 | + options: typeList, | ||
76 | + }, | ||
77 | + }, | ||
78 | + { | ||
64 | field: 'sendTime', | 79 | field: 'sendTime', |
65 | label: '发送时间', | 80 | label: '发送时间', |
66 | component: 'RangePicker', | 81 | component: 'RangePicker', |
@@ -2,7 +2,7 @@ import { BasicColumn } from '/@/components/Table'; | @@ -2,7 +2,7 @@ import { BasicColumn } from '/@/components/Table'; | ||
2 | import { FormSchema } from '/@/components/Table'; | 2 | import { FormSchema } from '/@/components/Table'; |
3 | import { findDictItemByCode } from '/@/api/system/dict'; | 3 | import { findDictItemByCode } from '/@/api/system/dict'; |
4 | import { findMessageConfig } from '/@/api/message/config'; | 4 | import { findMessageConfig } from '/@/api/message/config'; |
5 | -import { isMessage } from '/@/views/message/config/config.data'; | 5 | +import { isDingtalk, isMessage } from '/@/views/message/config/config.data'; |
6 | 6 | ||
7 | export enum PlateFormTypeEnum { | 7 | export enum PlateFormTypeEnum { |
8 | ali_cound = 'ALI_CLOUD', | 8 | ali_cound = 'ALI_CLOUD', |
@@ -172,6 +172,7 @@ export const formSchema: FormSchema[] = [ | @@ -172,6 +172,7 @@ export const formSchema: FormSchema[] = [ | ||
172 | const record = await findMessageConfig(params); | 172 | const record = await findMessageConfig(params); |
173 | return record.filter((item) => item.status === 1); | 173 | return record.filter((item) => item.status === 1); |
174 | } catch (error) { | 174 | } catch (error) { |
175 | + // eslint-disable-next-line no-console | ||
175 | console.log(error); | 176 | console.log(error); |
176 | return []; | 177 | return []; |
177 | } | 178 | } |
@@ -218,7 +219,9 @@ export const formSchema: FormSchema[] = [ | @@ -218,7 +219,9 @@ export const formSchema: FormSchema[] = [ | ||
218 | placeholder: '请输入签名', | 219 | placeholder: '请输入签名', |
219 | }, | 220 | }, |
220 | 221 | ||
221 | - ifShow: ({ values }) => isMessage(Reflect.get(values, 'messageType')), | 222 | + ifShow: ({ values }) => |
223 | + isMessage(Reflect.get(values, 'messageType')) || | ||
224 | + isDingtalk(Reflect.get(values, 'messageType')), | ||
222 | }, | 225 | }, |
223 | { | 226 | { |
224 | field: 'templatePurpose', | 227 | field: 'templatePurpose', |