Commit 80b46a8cea88b4841cdd8db04cf5f48191a2184f

Authored by 张 峰林
Committed by xp.Huang
1 parent d89a9f01

fix: 修改告警记录信息清楚未确认选项

... ... @@ -2,4 +2,5 @@ export enum MessageEnum {
2 2 IS_SMS = 'PHONE_MESSAGE',
3 3 IS_EMAIL = 'EMAIL_MESSAGE',
4 4 IS_DINGTALK = 'DING_TALK_MESSAGE',
  5 + IS_VOICE = 'VOICE_MESSAGE',
5 6 }
... ...
... ... @@ -17,7 +17,7 @@ export const getAlarmSearchSchemas = (deviceAlaramDetailMode?: boolean): FormSch
17 17 '激活未确认: 可以处理,清除',
18 18 '激活已确认: 只可清除,已经处理',
19 19 '清除未确认: 只可处理,已经清除',
20   - '清除已确认: 不需要做处理和清除',
  20 + // '清除已确认: 不需要做处理和清除',
21 21 ],
22 22 componentProps: {
23 23 popupClassName: 'alarm-stauts-cascader',
... ... @@ -26,10 +26,10 @@ export const getAlarmSearchSchemas = (deviceAlaramDetailMode?: boolean): FormSch
26 26 value: '0',
27 27 label: '清除',
28 28 children: [
29   - {
30   - value: AlarmStatus.CLEARED_UN_ACK,
31   - label: '清除未确认',
32   - },
  29 + // {
  30 + // value: AlarmStatus.CLEARED_UN_ACK,
  31 + // label: '清除未确认',
  32 + // },
33 33 {
34 34 value: AlarmStatus.CLEARED_ACK,
35 35 label: '清除已确认',
... ...
... ... @@ -30,7 +30,9 @@
30 30 cancel-text="取消"
31 31 @confirm="handleBatchPublish('batchPublish')"
32 32 >
33   - <a-button color="error" :disabled="hasBatchPublish"> 批量发布 </a-button>
  33 + <a-button :style="publishButtonBg" :disabled="hasBatchPublish">
  34 + <span :style="publishButtonTextColor">批量发布</span>
  35 + </a-button>
34 36 </Popconfirm>
35 37 </Authority>
36 38 <!-- <Popconfirm
... ... @@ -93,7 +95,7 @@
93 95 <PublicApiForm @register="registerDrawer" @success="handleSuccess" />
94 96 </template>
95 97 <script lang="ts" setup name="list">
96   - import { h, ref } from 'vue';
  98 + import { h, ref, computed } from 'vue';
97 99 import { BasicTable, useTable, TableAction } from '/@/components/Table';
98 100 import { useDrawer } from '/@/components/Drawer';
99 101 import { columns, searchFormSchema } from './config/config';
... ... @@ -150,6 +152,14 @@
150 152
151 153 const { createMessage } = useMessage();
152 154
  155 + const publishButtonBg = computed(() => {
  156 + return { backgroundColor: `rgba(0, 128, 0, ${hasBatchPublish.value ? 0.5 : 1})` };
  157 + });
  158 +
  159 + const publishButtonTextColor = computed(() => {
  160 + return { color: `rgba(255, 255, 255, ${hasBatchPublish.value ? 0.5 : 1})` };
  161 + });
  162 +
153 163 const handleSuccess = () => {
154 164 reload();
155 165 setStatusIsTrue();
... ...
... ... @@ -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,9 @@
122 132 };
123 133 }
124 134 Reflect.set(values, 'config', config);
  135 + if (Reflect.get(values, 'messageType') === MessageEnum.IS_VOICE) {
  136 + Reflect.set(values, 'signName', values['voiceSignName']);
  137 + }
125 138 let saveMessage = '添加成功';
126 139 let updateMessage = '修改成功';
127 140 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',
... ...