浏览代码

master: Added 添加报警归档

gitboyzcf 4 月之前
父节点
当前提交
c119464719

+ 12 - 0
src/api/system.ts

@@ -49,6 +49,18 @@ export function getAlarmImgFiles(path: string, headers = {}): Promise<any> {
     headers,
   });
 }
+export function getSetArchived(
+  params: { AlarmID: string; Archived: string },
+  headers = {}
+): Promise<any> {
+  return axios.put(
+    `/rpc/rabbitMQ/KunPengYun/SetArchived?AlarmID=${params.AlarmID}&Archived=${params.Archived}`,
+    {},
+    {
+      headers,
+    }
+  );
+}
 export function getToken(params = {}, headers = {}): Promise<any> {
   return axios.get(
     `https://${import.meta.env.VITE_API_INTERCOM_TOKEN_IP}/getToken`,

+ 14 - 10
src/assets/style/global.scss

@@ -85,7 +85,7 @@ body,
 }
 
 .split-line {
-  border-color: rgb(var(--gray-2));
+  border-color: rgb(var(--gray-2)) !important;
 }
 
 .arco-table-cell {
@@ -94,11 +94,11 @@ body,
     width: 6px;
     height: 6px;
     margin-right: 4px;
-    background-color: rgb(var(--blue-6));
+    background-color: rgb(var(--blue-6)) !important;
     border-radius: 50%;
 
     &.pass {
-      background-color: rgb(var(--green-6));
+      background-color: rgb(var(--green-6)) !important;
     }
   }
 }
@@ -110,13 +110,13 @@ body,
 .arco-btn-primary,
 .arco-btn-primary[type='button'],
 .arco-btn-primary[type='submit'] {
-  background-color: rgb(var(--primary-8));
+  background-color: rgb(var(--primary-8)) !important;
 }
 
 .arco-btn-secondary.arco-btn-disabled,
 .arco-btn-secondary[type='button'].arco-btn-disabled,
 .arco-btn-secondary[type='submit'].arco-btn-disabled {
-  background-color: transparent;
+  background-color: transparent !important;
 }
 
 @keyframes fadeIn {
@@ -133,23 +133,27 @@ body,
 }
 
 .arco-alert-warning {
-  background-color: var(--color-warning-light-4);
+  background-color: var(--color-warning-light-4) !important;
 }
 .arco-input-wrapper,
 .arco-picker,
 .arco-select-view-single,
 .arco-radio-group-button {
-  background-color: var(--color-neutral-2);
+  background-color: #051f44 !important;
 }
+.arco-radio-button.arco-radio-checked,
+.arco-radio-button:hover {
+  background-color: #0d2952 !important;
+}
+
 .arco-modal-body {
   height: 100%;
 }
 .arco-radio-button.arco-radio-checked,
 .arco-radio-button:hover {
-  background-color: var(--color-bg-3);
+  background-color: var(--color-bg-3) !important;
 }
 
 .arco-divider-horizontal {
-  border-bottom: 1px solid var(--color-neutral-2);
+  border-bottom: 1px solid var(--color-neutral-2) !important;
 }
-

+ 60 - 2
src/views/preview-list/components/alarm-all.vue

@@ -17,7 +17,7 @@
           >
         </a-select>
       </a-grid-item>
-      <a-grid-item class="demo-item" :span="2">
+      <a-grid-item class="demo-item">
         <label>{{ $t('previewList.bjsj') }}</label>
         <a-range-picker
           show-time
@@ -26,6 +26,22 @@
           @ok="onOk"
         />
       </a-grid-item>
+      <a-grid-item class="demo-item">
+        <label>{{ $t('previewList.bjgd') }}</label>
+        <a-select
+          v-model="paramObj.Archived"
+          allow-clear
+          :style="{ width: '320px' }"
+          :placeholder="$t('previewList.qxz')"
+        >
+          <a-option
+            v-for="item in alarmArchivingOptions"
+            :key="item.value"
+            :value="item.value"
+            >{{ item.label }}</a-option
+          >
+        </a-select>
+      </a-grid-item>
       <a-grid-item class="demo-item">
         <a-radio-group
           type="button"
@@ -68,7 +84,7 @@
             :width="150"
             :body-cell-style="
               (record) => ({
-                background: record.status ? '' : '#7e2d2d',
+                background: record.status ? '#4cd26380' : '#7e2d2d80',
               })
             "
           >
@@ -78,6 +94,31 @@
               }}</span>
             </template>
           </a-table-column>
+          <a-table-column
+            :title="$t('previewList.bjgd')"
+            data-index="AlarmArchiving"
+            :width="150"
+            :body-cell-style="
+              (record) => ({
+                background:
+                  record.AlarmArchiving == '0'
+                    ? '#ffb65d80'
+                    : record.AlarmArchiving == '0'
+                    ? '#4cd26380'
+                    : '#7e2d2d80',
+              })
+            "
+          >
+            <template #cell="{ record }">
+              <span>{{
+                record.AlarmArchiving == '0'
+                  ? '未归档'
+                  : record.AlarmArchiving == '1'
+                  ? '正确报警'
+                  : '错误报警'
+              }}</span>
+            </template>
+          </a-table-column>
           <!-- <a-table-column
             :title="$t('previewList.dqstatus')"
             data-index="isRead"
@@ -164,18 +205,34 @@
     PageNum: number;
     PageSize: number;
     AlertType: string;
+    Archived: string;
     StartDate: string | number;
     EndDate: string | number;
   }>({
     PageNum: 1,
     PageSize: 10,
     AlertType: '',
+    Archived: '',
     StartDate: '',
     EndDate: '',
   });
   const loading = ref(false);
   const total = ref(0);
   const typeAlarmOptions = ref<any[]>([]);
+  const alarmArchivingOptions = ref<any[]>([
+    {
+      label: '未归档',
+      value: '0',
+    },
+    {
+      label: '正确报警',
+      value: '1',
+    },
+    {
+      label: '错误报警',
+      value: '2',
+    },
+  ]);
   const viewData = ref<AlarmData>({});
 
   const alarmData = ref<AlarmData[]>([
@@ -216,6 +273,7 @@
                 tImg: `${app.ip}/rpc/rabbitMQ/KunPengYun/Files/${item.Thumbnail}&GUID=${props.guid}`,
                 imgJson: results[i],
                 imgLoading: true,
+                AlarmArchiving: `${item.Archived}`,
               };
             }
           );

+ 47 - 6
src/views/preview-list/components/view-alarm.vue

@@ -16,6 +16,28 @@
         <div>{{ data.timeN }}</div>
       </a-col>
     </a-row>
+    <template v-if="isShowCl">
+      <a-divider />
+      <a-row class="grid-demo" justify="center" style="margin-bottom: 16px">
+        <a-col :span="19">
+          <a-radio-group v-model="alarmArchiving" type="button" size="small">
+            <a-radio
+              v-for="(item, i) in alarmArchivingOptions"
+              :key="i"
+              :value="item.value"
+              ><div style="display: flex; align-items: center; gap: 4px"
+                ><Icon :icon="item.icon" />{{ item.label }}</div
+              ></a-radio
+            >
+            <a-button size="small" @click="() => (alarmArchiving = '0')">
+              <template #icon>
+                <icon-refresh />
+              </template>
+            </a-button>
+          </a-radio-group>
+        </a-col>
+      </a-row>
+    </template>
     <a-divider />
     <div class="view-alarm-pic">
       <img id="image" class="view-pic" :src="data.tImg" alt="Picture" />
@@ -29,7 +51,9 @@
 </template>
 
 <script setup lang="ts">
-  import { onMounted, onUnmounted, ref } from 'vue';
+  import { onMounted, onUnmounted, ref, watch } from 'vue';
+  import { Icon } from '@iconify/vue';
+  import { getSetArchived } from '@/api/system';
   import Viewer from 'viewerjs';
   import 'viewerjs/dist/viewer.css';
 
@@ -39,7 +63,9 @@
 
   const props = defineProps<{
     data: DataProps;
+    isShowCl: boolean;
   }>();
+  const emits = defineEmits(['alarmArchiving']);
   const viewer = ref<Viewer | null>(null);
   const loading = ref(true);
 
@@ -130,9 +156,27 @@
       }, 'image/jpeg');
     };
   };
-  onMounted(async () => {
-    init();
+  const alarmArchiving = ref('0');
+  const alarmArchivingOptions = ref<any[]>([
+    {
+      label: '正确报警',
+      value: '1',
+      icon: 'mdi:alarm-light-outline',
+    },
+    {
+      label: '错误报警',
+      value: '2',
+      icon: 'mdi:alarm-light-off-outline',
+    },
+  ]);
+  watch(alarmArchiving, async (Archived) => {
+    await getSetArchived({
+      AlarmID: props.data.Id,
+      Archived,
+    });
+    emits('alarmArchiving', Archived);
   });
+  onMounted(() => init());
   onUnmounted(() => {
     viewer.value?.destroy();
     URL.revokeObjectURL(url);
@@ -165,11 +209,8 @@
     }
     .view-alarm-pic {
       width: 200px;
-      height: 200px;
       img {
         width: 100%;
-        height: 100%;
-        object-fit: cover;
       }
     }
   }

+ 17 - 3
src/views/preview-list/components/view-drawer.vue

@@ -11,7 +11,11 @@
     @cancel="handleCancel"
   >
     <template #title>{{ $t('previewList.tpck') }}</template>
-    <ViewAlarm :data="viewData" />
+    <ViewAlarm
+      :data="viewData"
+      :is-show-cl="isShowCl"
+      @alarm-archiving="(v) => (alarmArchiving = v)"
+    />
     <template #footer>
       <a-button type="primary" :loading="clLoading" @click="handleCl">{{
         $t('previewList.cl')
@@ -36,6 +40,7 @@
   const emits = defineEmits(['update:viewData']);
   const clLoading = ref(false);
   const tpckVisible = ref(false);
+  const alarmArchiving = ref('0');
 
   const close = () => {
     tpckVisible.value = false;
@@ -44,7 +49,11 @@
     tpckVisible.value = true;
   };
   const handleOk = () => {
-    emits('update:viewData', { ...props.viewData, isRead: true });
+    emits('update:viewData', {
+      ...props.viewData,
+      isRead: true,
+      AlarmArchiving: alarmArchiving,
+    });
     close();
   };
   const handleCancel = () => {
@@ -60,7 +69,12 @@
       { GUID: props.guid }
     );
     clLoading.value = false;
-    emits('update:viewData', { ...props.viewData, isRead: true, status: 1 });
+    emits('update:viewData', {
+      ...props.viewData,
+      isRead: true,
+      status: 1,
+      AlarmArchiving: alarmArchiving,
+    });
     close();
   };
 

+ 11 - 7
src/views/preview-list/index.vue

@@ -20,12 +20,12 @@
                     background-color: var(--color-fill-2);
                   "
                 />
-                <a-alert
+                <!-- <a-alert
                   v-if="originTreeData.some((v) => v.disabled)"
                   type="warning"
                   closable
                   >{{ $t('previewList.tip3') }}</a-alert
-                >
+                > -->
                 <a-spin v-if="loading" />
                 <a-tree v-else block-node :data="treeData" @select="onSelect">
                   <template #icon>
@@ -51,6 +51,7 @@
                     <a-button
                       type="text"
                       size="mini"
+                      :disabled="nodeData.disabled"
                       @click="toView('PreviewInfo', nodeData)"
                     >
                       <icon-to-left
@@ -429,10 +430,10 @@
       label: t('previewList.jfp'),
       value: 9,
     },
-    {
-      label: t('previewList.slfp'),
-      value: 16,
-    },
+    // {
+    //   label: t('previewList.slfp'),
+    //   value: 16,
+    // },
   ]);
   const typeList = computed<IBtn[]>(() => [
     {
@@ -510,7 +511,7 @@
         title: item.alias,
         port: item.port,
         status: item.status === '0' ? 'Offline' : 'Online',
-        disabled: !item.id,
+        disabled: item.status === '0',
       }));
     } catch (err) {
       // you can report use errorHandler or other
@@ -814,6 +815,9 @@
   :deep(.arco-tree-node-switcher) {
     display: none;
   }
+  :deep(.arco-input-wrapper) {
+    background-color: var(--color-fill-2) !important;
+  }
   .container {
     padding: 0 20px 20px 20px;
     height: 100%;

+ 1 - 0
src/views/preview-list/locale/en-US.ts

@@ -13,6 +13,7 @@ export default {
   'previewList.sp': 'Vertical screen',
   'previewList.bjlx': 'Alarm type',
   'previewList.bjsj': 'Alarm time',
+  'previewList.bjgd': 'Alarm archiving',
   'previewList.bjlb': 'Alarm List',
   'previewList.status': 'Alarm status',
   'previewList.dqstatus': 'Read status',

+ 1 - 0
src/views/preview-list/locale/zh-CN.ts

@@ -13,6 +13,7 @@ export default {
   'previewList.sp': '竖屏模式',
   'previewList.bjlx': '报警类型',
   'previewList.bjsj': '报警时间',
+  'previewList.bjgd': '报警归档',
   'previewList.bjlb': '报警列表',
   'previewList.status': '处理状态',
   'previewList.dqstatus': '读取状态',