Commit 1ccf953960be5d2193ab06c0af2b156faa9f80c9

Authored by xp.Huang
2 parents d89a9f01 80b46a8c

Merge branch 'fix/DEFEC-1823' into 'main_dev'

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

See merge request yunteng/thingskit-front!1125
@@ -2,4 +2,5 @@ export enum MessageEnum { @@ -2,4 +2,5 @@ export enum MessageEnum {
2 IS_SMS = 'PHONE_MESSAGE', 2 IS_SMS = 'PHONE_MESSAGE',
3 IS_EMAIL = 'EMAIL_MESSAGE', 3 IS_EMAIL = 'EMAIL_MESSAGE',
4 IS_DINGTALK = 'DING_TALK_MESSAGE', 4 IS_DINGTALK = 'DING_TALK_MESSAGE',
  5 + IS_VOICE = 'VOICE_MESSAGE',
5 } 6 }
@@ -17,7 +17,7 @@ export const getAlarmSearchSchemas = (deviceAlaramDetailMode?: boolean): FormSch @@ -17,7 +17,7 @@ export const getAlarmSearchSchemas = (deviceAlaramDetailMode?: boolean): FormSch
17 '激活未确认: 可以处理,清除', 17 '激活未确认: 可以处理,清除',
18 '激活已确认: 只可清除,已经处理', 18 '激活已确认: 只可清除,已经处理',
19 '清除未确认: 只可处理,已经清除', 19 '清除未确认: 只可处理,已经清除',
20 - '清除已确认: 不需要做处理和清除', 20 + // '清除已确认: 不需要做处理和清除',
21 ], 21 ],
22 componentProps: { 22 componentProps: {
23 popupClassName: 'alarm-stauts-cascader', 23 popupClassName: 'alarm-stauts-cascader',
@@ -26,10 +26,10 @@ export const getAlarmSearchSchemas = (deviceAlaramDetailMode?: boolean): FormSch @@ -26,10 +26,10 @@ export const getAlarmSearchSchemas = (deviceAlaramDetailMode?: boolean): FormSch
26 value: '0', 26 value: '0',
27 label: '清除', 27 label: '清除',
28 children: [ 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 value: AlarmStatus.CLEARED_ACK, 34 value: AlarmStatus.CLEARED_ACK,
35 label: '清除已确认', 35 label: '清除已确认',
@@ -30,7 +30,9 @@ @@ -30,7 +30,9 @@
30 cancel-text="取消" 30 cancel-text="取消"
31 @confirm="handleBatchPublish('batchPublish')" 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 </Popconfirm> 36 </Popconfirm>
35 </Authority> 37 </Authority>
36 <!-- <Popconfirm 38 <!-- <Popconfirm
@@ -93,7 +95,7 @@ @@ -93,7 +95,7 @@
93 <PublicApiForm @register="registerDrawer" @success="handleSuccess" /> 95 <PublicApiForm @register="registerDrawer" @success="handleSuccess" />
94 </template> 96 </template>
95 <script lang="ts" setup name="list"> 97 <script lang="ts" setup name="list">
96 - import { h, ref } from 'vue'; 98 + import { h, ref, computed } from 'vue';
97 import { BasicTable, useTable, TableAction } from '/@/components/Table'; 99 import { BasicTable, useTable, TableAction } from '/@/components/Table';
98 import { useDrawer } from '/@/components/Drawer'; 100 import { useDrawer } from '/@/components/Drawer';
99 import { columns, searchFormSchema } from './config/config'; 101 import { columns, searchFormSchema } from './config/config';
@@ -150,6 +152,14 @@ @@ -150,6 +152,14 @@
150 152
151 const { createMessage } = useMessage(); 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 const handleSuccess = () => { 163 const handleSuccess = () => {
154 reload(); 164 reload();
155 setStatusIsTrue(); 165 setStatusIsTrue();
@@ -80,6 +80,11 @@ @@ -80,6 +80,11 @@
80 clientId: values?.clientId, 80 clientId: values?.clientId,
81 clientSecret: values?.clientSecret, 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 Reflect.set(values, 'config', config); 89 Reflect.set(values, 'config', config);
85 let saveMessage = '添加成功'; 90 let saveMessage = '添加成功';
@@ -82,6 +82,9 @@ export const isEmail = (type: string) => { @@ -82,6 +82,9 @@ export const isEmail = (type: string) => {
82 export const isDingtalk = (type: string) => { 82 export const isDingtalk = (type: string) => {
83 return type === MessageEnum.IS_DINGTALK; 83 return type === MessageEnum.IS_DINGTALK;
84 }; 84 };
  85 +export const isVoice = (type: string) => {
  86 + return type === MessageEnum.IS_VOICE;
  87 +};
85 export const messageTypeIsTencentCloud = (type: string) => { 88 export const messageTypeIsTencentCloud = (type: string) => {
86 return type === 'TENCENT_CLOUD'; 89 return type === 'TENCENT_CLOUD';
87 }; 90 };
@@ -122,9 +125,13 @@ export const formSchema: FormSchema[] = [ @@ -122,9 +125,13 @@ export const formSchema: FormSchema[] = [
122 try { 125 try {
123 const result = await findDictItemByCode(params as any); 126 const result = await findDictItemByCode(params as any);
124 if (isMessage(Reflect.get(formModel, 'messageType'))) 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 if (isDingtalk(Reflect.get(formModel, 'messageType'))) 131 if (isDingtalk(Reflect.get(formModel, 'messageType')))
127 return result.filter((item) => item.itemValue === 'DING_TALK'); 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 } catch (e) { 135 } catch (e) {
129 // eslint-disable-next-line no-console 136 // eslint-disable-next-line no-console
130 console.error(e); 137 console.error(e);
@@ -140,7 +147,8 @@ export const formSchema: FormSchema[] = [ @@ -140,7 +147,8 @@ export const formSchema: FormSchema[] = [
140 }, 147 },
141 ifShow: ({ values }) => 148 ifShow: ({ values }) =>
142 isMessage(Reflect.get(values, 'messageType')) || 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 field: 'appId', 154 field: 'appId',
@@ -187,7 +195,8 @@ export const formSchema: FormSchema[] = [ @@ -187,7 +195,8 @@ export const formSchema: FormSchema[] = [
187 placeholder: '请输入accessKeyId', 195 placeholder: '请输入accessKeyId',
188 }, 196 },
189 ifShow: ({ values }) => 197 ifShow: ({ values }) =>
190 - isMessage(Reflect.get(values, 'messageType')) && 198 + (isMessage(Reflect.get(values, 'messageType')) ||
  199 + isVoice(Reflect.get(values, 'messageType'))) &&
191 !messageTypeIsTencentCloud(Reflect.get(values, 'platformType')), 200 !messageTypeIsTencentCloud(Reflect.get(values, 'platformType')),
192 }, 201 },
193 { 202 {
@@ -201,7 +210,8 @@ export const formSchema: FormSchema[] = [ @@ -201,7 +210,8 @@ export const formSchema: FormSchema[] = [
201 210
202 component: 'InputPassword', 211 component: 'InputPassword',
203 ifShow: ({ values }) => 212 ifShow: ({ values }) =>
204 - isMessage(Reflect.get(values, 'messageType')) && 213 + (isMessage(Reflect.get(values, 'messageType')) ||
  214 + isVoice(Reflect.get(values, 'messageType'))) &&
205 !messageTypeIsTencentCloud(Reflect.get(values, 'platformType')), 215 !messageTypeIsTencentCloud(Reflect.get(values, 'platformType')),
206 }, 216 },
207 { 217 {
@@ -19,6 +19,8 @@ @@ -19,6 +19,8 @@
19 import { saveOrEditMessageTemplate } from '/@/api/message/template'; 19 import { saveOrEditMessageTemplate } from '/@/api/message/template';
20 import { useMessage } from '/@/hooks/web/useMessage'; 20 import { useMessage } from '/@/hooks/web/useMessage';
21 import { findMessageConfig } from '/@/api/message/config'; 21 import { findMessageConfig } from '/@/api/message/config';
  22 + import { MessageEnum } from '/@/enums/messageEnum';
  23 +
22 export default defineComponent({ 24 export default defineComponent({
23 name: 'TemplateDrawer', 25 name: 'TemplateDrawer',
24 components: { BasicDrawer, BasicForm }, 26 components: { BasicDrawer, BasicForm },
@@ -41,6 +43,14 @@ @@ -41,6 +43,14 @@
41 Reflect.set(data.record, key + '', config[key]); 43 Reflect.set(data.record, key + '', config[key]);
42 } 44 }
43 await setFieldsValue(data.record); 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 const res = await findMessageConfig({}); 54 const res = await findMessageConfig({});
45 const options = res.map((item) => { 55 const options = res.map((item) => {
46 return { 56 return {
@@ -122,6 +132,9 @@ @@ -122,6 +132,9 @@
122 }; 132 };
123 } 133 }
124 Reflect.set(values, 'config', config); 134 Reflect.set(values, 'config', config);
  135 + if (Reflect.get(values, 'messageType') === MessageEnum.IS_VOICE) {
  136 + Reflect.set(values, 'signName', values['voiceSignName']);
  137 + }
125 let saveMessage = '添加成功'; 138 let saveMessage = '添加成功';
126 let updateMessage = '修改成功'; 139 let updateMessage = '修改成功';
127 await saveOrEditMessageTemplate(values, unref(isUpdate)); 140 await saveOrEditMessageTemplate(values, unref(isUpdate));
@@ -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 { isDingtalk, isMessage } from '/@/views/message/config/config.data'; 5 +import { isDingtalk, isMessage, isVoice } 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',
@@ -206,7 +206,19 @@ export const formSchema: FormSchema[] = [ @@ -206,7 +206,19 @@ export const formSchema: FormSchema[] = [
206 placeholder: '请输入模板编号', 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 field: 'signName', 224 field: 'signName',