Pārlūkot izejas kodu

Merge branch 'dev' of http://110.41.163.243:9980/kd-aiot/kd-aiot-frontend-eam into dev

liujt 4 dienas atpakaļ
vecāks
revīzija
a86b9f174d

+ 32 - 1
src/api/warning/index.js

@@ -49,6 +49,13 @@ export async function remove(data) {
   return Promise.reject(new Error(res.data.message));
 }
 
+export async function updateStatus(data) {
+  const res = await request.put('/eam/alarmsetting/updateStatus', data);
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
 /**
  * 列表
  */
@@ -58,4 +65,28 @@ export async function alarmlogsheetPage(params) {
     return res.data.data;
   }
   return Promise.reject(new Error(res.data.message));
-}
+}
+// // 详情
+export async function getAlarmlogsheetById(id) {
+  const res = await request.get(`/eam/alarmlogsheet/getById/${id}`);
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+// // 处理
+export async function updateAlarmlogsheet(data) {
+  const res = await request.post(`/eam/alarmlogsheet/update`, data);
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+// // 详情
+export async function getDetail(id) {
+  const res = await request.get(`/eam/alarmlogsheet/detail/${id}`);
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}

+ 8 - 1
src/enum/dict.js

@@ -44,7 +44,7 @@ export default {
   流程实例的结果: 'bpm_process_instance_result',
   表计类型: 'meter_type',
   定时任务状态: 'infra_job_status',
-  设备管理状态:'activity_status',
+  设备管理状态: 'activity_status',
   摄像机类型: 'isp_camera_type',
   摄像头品牌: 'camera_brand',
   NVR设备类型:'device_type_nvr',
@@ -52,6 +52,7 @@ export default {
   机器人类型: 'isp_robot_type',
   设备管理设备类型: 'isp_device_type',
   设备品牌: 'device_brand'
+
 };
 
 export const numberList = ['patrol_cycle'];
@@ -124,5 +125,11 @@ export const energyConsumingUnitList = [
       { value: '3', label: '元/MJ' },
       { value: '4', label: '元/GJ' }
     ]
+  },
+  {
+    value: '5',
+    label: '煤',
+    unit: [{ value: '1', label: '吨' }],
+    priceUnit: [{ value: '1', label: '元/吨' }]
   }
 ];

+ 17 - 3
src/views/maintenance/patrol/workOrder/index.vue

@@ -1,6 +1,12 @@
 <template>
   <div class="ele-body">
     <el-card shadow="never" v-loading="loading">
+      <el-tabs v-model="activeTab" @tab-click="handleTabClick" style="margin-bottom: 10px">
+        <el-tab-pane label="全部" name=""></el-tab-pane>
+        <el-tab-pane label="场站5" name="2008729845612720129"></el-tab-pane>
+        <el-tab-pane label="场站6" name="2008729929536548865"></el-tab-pane>
+        <el-tab-pane label="场站7" name="2008730320160468994"></el-tab-pane>
+      </el-tabs>
       <work-search @search="reload"> </work-search>
       <!-- 数据表格 -->
       <!-- :default-sort="{ prop: 'createTime', order: 'descending' }" -->
@@ -274,6 +280,7 @@
         ],
         // 加载状态
         loading: false,
+        activeTab: '',
         pageType: 'add',
         dialogTitle: '',
         isBindPlan: false
@@ -286,12 +293,16 @@
     methods: {
       /* 表格数据源 */
       datasource({ page, limit, where, order }) {
-        return getWorkOrderPage({
+        const params = {
           pageNum: page,
           size: limit,
           ...where,
           type: 1
-        });
+        };
+        if (this.activeTab) {
+          params.executeGroupId = this.activeTab;
+        }
+        return getWorkOrderPage(params);
       },
       async changeEnable(row) {
         const res = await putRoles(row);
@@ -306,7 +317,10 @@
       },
       /* 刷新表格 */
       reload(where) {
-        this.$refs.table.reload({ page: 1, where });
+        this.$refs.table.reload({ page: 1, where: { ...where, executeGroupId: this.activeTab || undefined } });
+      },
+      handleTabClick() {
+        this.$refs.table.reload({ page: 1, where: { executeGroupId: this.activeTab || undefined } });
       },
       startExecuting(row) {
         startExecuting({ id: row.id }).then((res) => {

+ 2 - 2
src/views/warning/warningMessage/components/message-search.vue

@@ -10,8 +10,8 @@
       <el-col v-bind="styleResponsive ? { lg: 5, md: 12 } : { span: 5 }">
         <el-form-item label="告警级别:" prop="level">
           <el-select filterable v-model="where.level" size="small">
-            <el-option label="提示" :value="1"></el-option>
-            <el-option label="一般" :value="2"></el-option>
+            <el-option label="轻微" :value="1"></el-option>
+            <el-option label="中等" :value="2"></el-option>
             <el-option label="严重" :value="3"></el-option>
             <el-option label="紧急" :value="4"></el-option>
             <el-option label="致命" :value="5"></el-option>

+ 215 - 0
src/views/warning/warningMessage/components/processDialog.vue

@@ -0,0 +1,215 @@
+<template>
+  <ele-modal
+    :visible.sync="visible"
+    title="处理"
+    width="70%"
+    append-to-body
+    :maxable="true"
+    @close="cancel"
+  >
+    <el-form
+      ref="form"
+      :model="form"
+      :rules="rules"
+      label-width="120px"
+      class="el-form-box"
+    >
+      <!-- 告警详细 -->
+      <header-title title="告警详细"></header-title>
+      <el-row>
+        <el-col :span="8">
+          <el-form-item label="告警名称:">
+            <el-input disabled v-model="form.name" placeholder=" " />
+          </el-form-item>
+        </el-col>
+        <el-col :span="8">
+          <el-form-item label="告警级别:">
+            <el-input
+              disabled
+              :value="getLevel(form.alarmLevel)"
+              placeholder=" "
+            />
+          </el-form-item>
+        </el-col>
+
+        <el-col :span="8">
+          <el-form-item label="告警设备:">
+            <el-input disabled v-model="form.deviceName" placeholder=" " />
+          </el-form-item>
+        </el-col>
+        <el-col :span="8">
+          <el-form-item label="告警描述:">
+            <el-input disabled v-model="form.description" placeholder=" " />
+          </el-form-item>
+        </el-col>
+        <el-col :span="8">
+          <el-form-item label="告警时间:">
+            <el-input disabled v-model="form.alarmTime" placeholder=" " />
+          </el-form-item>
+        </el-col>
+      </el-row>
+
+      <!-- 告警处理意见 -->
+      <header-title title="告警处理意见"></header-title>
+      <el-row>
+        <el-col :span="8">
+          <el-form-item label="处理时间:" prop="handleTime">
+            <el-date-picker
+              v-model="form.handleTime"
+              type="datetime"
+              placeholder="时间 "
+              style="width: 100%"
+              format="yyyy-MM-dd HH:mm:ss"
+              value-format="yyyy-MM-dd HH:mm:ss"
+              :disabled="type == 'view'"
+            ></el-date-picker>
+          </el-form-item>
+        </el-col>
+        <el-col :span="8">
+          <el-form-item label="处理方式:" prop="handleResult">
+            <el-select
+              v-model="form.handleResult"
+              placeholder="请选择"
+              :disabled="type == 'view'"
+              style="width: 100%"
+            >
+              <el-option label="现场处理" :value="1"></el-option>
+              <el-option label="远程处理" :value="2"></el-option>
+              <el-option label="转派处理" :value="3"></el-option>
+            </el-select>
+          </el-form-item>
+        </el-col>
+      </el-row>
+      <el-row>
+        <el-col :span="24">
+          <el-form-item label="处理意见:">
+            <el-input
+              v-model="form.remark"
+              :disabled="type == 'view'"
+              type="textarea"
+              :rows="4"
+              placeholder="请输入"
+            ></el-input>
+          </el-form-item>
+        </el-col>
+      </el-row>
+
+      <el-row>
+        <el-col :span="24">
+          <el-form-item label="处理照片:">
+            <fileMain
+              v-model="form.attachmentUrl"
+              :type="type == 'view' ? 'view' : 'add'"
+            ></fileMain>
+          </el-form-item>
+        </el-col>
+      </el-row>
+    </el-form>
+
+    <template v-slot:footer>
+      <el-button
+        type="primary"
+        @click="save()"
+        v-loading="loading"
+        v-if="type != 'view'"
+        >保存</el-button
+      >
+      <el-button @click="cancel">关闭</el-button>
+    </template>
+  </ele-modal>
+</template>
+
+<script>
+  import dayjs from 'dayjs';
+  import {
+    getAlarmlogsheetById,
+    updateAlarmlogsheet
+  } from '@/api/warning/index.js';
+
+  const defForm = {
+    name: '',
+    levelText: '',
+    energyClassificationName: '',
+    areaName: '',
+    description: '',
+    warningTime: '',
+    handleTime: '',
+    handleResult: '',
+    remark: '',
+    increaseDate: '',
+    increaseUnit: 'degree',
+    increaseDosage: '',
+    qualitativeProcessing: 'needCheck',
+    deviceName: '',
+    attachmentUrl: []
+  };
+
+  export default {
+    data() {
+      return {
+        visible: false,
+        loading: false,
+        form: { ...defForm },
+        type: 'edit',
+        fileList: [],
+        rules: {
+          handleTime: [
+            { required: true, message: '请选择处理时间', trigger: 'change' }
+          ],
+          handleResult: [
+            { required: true, message: '请选择处理方式', trigger: 'change' }
+          ]
+        }
+      };
+    },
+    methods: {
+      async open(row, type) {
+        this.visible = true;
+        this.type = type;
+        if (row) {
+          this.form = await getAlarmlogsheetById(row.id);
+          if (this.type !== 'view' && !this.form.handleTime) {
+            this.form.handleTime = dayjs().format('YYYY-MM-DD HH:mm:ss');
+          }
+        }
+      },
+      getLevel(val) {
+        return { 1: '轻微', 2: '中等', 3: '严重', 4: '紧急', 5: '致命' }[val];
+      },
+      cancel() {
+        this.form = { ...defForm };
+        this.visible = false;
+      },
+
+      save() {
+        this.$refs.form.validate((valid) => {
+          if (valid) {
+            this.loading = true;
+            this.form.handleUserName = this.$store.state.user.info.name;
+            this.form.handleUserId = this.$store.state.user.info.userId;
+            this.form.handleStatus = 2;
+            updateAlarmlogsheet(this.form)
+              .then((res) => {
+                this.loading = false;
+                this.$message.success('操作成功');
+                this.cancel();
+                this.$emit('reload');
+              })
+              .finally(() => {
+                this.loading = false;
+              });
+          }
+        });
+      }
+    }
+  };
+</script>
+
+<style lang="scss" scoped>
+  .el-form-box {
+    ::v-deep .el-input.is-disabled .el-input__inner {
+      background-color: #f5f7fa;
+      color: #606266;
+    }
+  }
+</style>

+ 160 - 9
src/views/warning/warningMessage/index.vue

@@ -26,20 +26,99 @@
         :datasource="datasource"
         cache-key="systemRoleTable"
       >
+        <template v-slot:action="{ row }">
+          <el-link
+            type="primary"
+            :underline="false"
+            icon="el-icon-edit"
+            @click="openEdit(row)"
+            v-if="
+              !row.handleStatus && $hasPermission('eam:alarmlogsheet:update')
+            "
+          >
+            处理
+          </el-link>
+        </template>
+        <template v-slot:triggerCount="{ row }">
+          <el-link type="primary" :underline="false" @click="triggerCount(row)">
+            {{ row.triggerCount }}
+          </el-link>
+        </template>
+        <template v-slot:deviceName="{ row }">
+          <el-link
+            type="primary"
+            :underline="false"
+            @click="openEdit(row, 'view')"
+          >
+            {{ row.deviceName }}
+          </el-link>
+        </template>
       </ele-pro-table>
     </el-card>
+    <processDialog ref="processDialogRef" @reload="reload"></processDialog>
+
+    <!-- 告警次数详情弹窗 -->
+    <el-dialog
+      title="告警详情"
+      :visible.sync="triggerDialogVisible"
+      width="70%"
+      append-to-body
+    >
+      <el-table :data="triggerList" border style="width: 100%">
+        <el-table-column
+          type="index"
+          label="序号"
+          width="55"
+          align="center"
+        />
+        <el-table-column
+          prop="description"
+          label="告警描述"
+          align="center"
+          show-overflow-tooltip
+          min-width="180"
+        />
+        <el-table-column
+          prop="triggerTime"
+          label="告警时间"
+          align="center"
+          show-overflow-tooltip
+          min-width="160"
+        />
+        <el-table-column
+          label="告警内容"
+          align="center"
+          show-overflow-tooltip
+          min-width="200"
+        >
+          <template slot-scope="{ row }">
+            <div v-if="row._deviceData && row._deviceData.length">
+              <div
+                v-for="(item, index) in row._deviceData"
+                :key="index"
+              >
+                告警值:{{ item.attributeName }} {{ item.value }}
+              </div>
+            </div>
+            <span v-else>-</span>
+          </template>
+        </el-table-column>
+      </el-table>
+    </el-dialog>
   </div>
 </template>
 
 <script>
   import MessageSearch from './components/message-search.vue';
-  import { alarmlogsheetPage } from '@/api/warning/index.js';
+  import processDialog from './components/processDialog.vue';
+  import { alarmlogsheetPage,getDetail } from '@/api/warning/index.js';
 
   import dictMixins from '@/mixins/dictMixins';
   export default {
     mixins: [dictMixins],
     components: {
-      MessageSearch
+      MessageSearch,
+      processDialog
     },
     data() {
       return {
@@ -59,7 +138,7 @@
             label: '告警级别',
             align: 'center',
             showOverflowTooltip: true,
-            minWidth: 110,
+            minWidth: 80,
             formatter: (_row, _column, cellValue) => {
               const map = {
                 1: '轻微',
@@ -81,9 +160,10 @@
           {
             prop: 'deviceName',
             label: '设备名称',
+            slot: 'deviceName',
             align: 'center',
             showOverflowTooltip: true,
-            minWidth: 110
+            minWidth: 200
           },
           {
             prop: 'description',
@@ -125,25 +205,72 @@
             minWidth: 110
           },
           {
-            prop: 'remark',
-            label: '备注',
+            prop: 'triggerCount',
+            slot: 'triggerCount',
+            label: '告警次数',
             align: 'center',
             showOverflowTooltip: true,
             minWidth: 110
           },
           {
             prop: 'alarmTime',
-            label: '告警时间',
+            label: '首次告警时间',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 160,
+            formatter: (_row, _column, cellValue) => {
+              return this.$util.toDateString(cellValue);
+            }
+          },
+          {
+            prop: 'lastTriggerTime',
+            label: '最近告警时间',
             align: 'center',
             showOverflowTooltip: true,
             minWidth: 160,
             formatter: (_row, _column, cellValue) => {
               return this.$util.toDateString(cellValue);
             }
+          },
+
+          {
+            prop: 'handleStatus',
+            label: '处理状态',
+            align: 'center',
+            formatter: (_row, _column, cellValue) => {
+              return { 0: '未处理', 1: '处理中', 2: '已处理' }[cellValue];
+            },
+            showOverflowTooltip: true,
+            minWidth: 110
+          },
+          {
+            prop: 'handleUserName',
+            label: '处理人',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 110
+          },
+          {
+            prop: 'remark',
+            label: '处理意见',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 110
+          },
+          {
+            columnKey: 'action',
+            label: '操作',
+            width: 150,
+            align: 'center',
+            resizable: false,
+            slot: 'action',
+            showOverflowTooltip: true
           }
         ],
         // 加载状态
-        loading: false
+        loading: false,
+        triggerDialogVisible: false,
+        triggerList: []
       };
     },
     computed: {},
@@ -159,7 +286,31 @@
           ...where
         });
       },
-
+      openEdit(row, type) {
+        this.$refs.processDialogRef.open(row, type);
+      },
+      triggerCount(row) {
+        getDetail(row.id).then((res) => {
+          let list = Array.isArray(res) ? res : [];
+          list = list.map((item) => {
+            let deviceDataArr = [];
+            if (item.deviceData) {
+              try {
+                const parsed = JSON.parse(item.deviceData);
+                deviceDataArr = Array.isArray(parsed) ? parsed : [];
+              } catch (e) {
+                deviceDataArr = [];
+              }
+            }
+            return {
+              ...item,
+              _deviceData: deviceDataArr
+            };
+          });
+          this.triggerList = list;
+          this.triggerDialogVisible = true;
+        });
+      },
       /* 刷新表格 */
       reload(where) {
         this.$refs.table.reload({ page: 1, where, ruleType: 2 });

+ 14 - 5
src/views/warning/warningSetting/components/addWarningDialog.vue

@@ -76,10 +76,10 @@
                   v-model="baseInfoForm.generateDocumentType"
                   @change="isCreateChange"
                 >
-                  <el-radio :label="4">维修</el-radio>
-                  <el-radio :label="1">巡点检</el-radio>
-                  <el-radio :label="2">保养</el-radio>
-                  <el-radio :label="5">量具送检</el-radio>
+                  <el-radio :label="4" @click.native.prevent="toggleDocumentType(4)">维修</el-radio>
+                  <el-radio :label="1" @click.native.prevent="toggleDocumentType(1)">巡点检</el-radio>
+                  <el-radio :label="2" @click.native.prevent="toggleDocumentType(2)">保养</el-radio>
+                  <el-radio :label="5" @click.native.prevent="toggleDocumentType(5)">量具送检</el-radio>
                 </el-radio-group>
               </el-form-item>
             </el-col>
@@ -153,7 +153,7 @@
                   <template slot-scope="scope">
                     <el-input
                       v-model="scope.row.thresholdValue"
-                      oninput="value=value.replace(/[^\d.]/g,'')"
+                      type="number"
                       size="small"
                       placeholder="请输入值"
                     ></el-input>
@@ -521,6 +521,15 @@
           this.alarmNotifierList = res.list;
         } catch (error) {}
       },
+      toggleDocumentType(val) {
+        if (this.baseInfoForm.generateDocumentType === val) {
+          this.baseInfoForm.generateDocumentType = null;
+        } else {
+          this.baseInfoForm.generateDocumentType = val;
+           this.isCreateChange(this.baseInfoForm.generateDocumentType);
+        }
+       
+      },
       async isCreateChange(val) {
         const res = await getRule({
           status: 1,

+ 7 - 3
src/views/warning/warningSetting/components/setting-search.vue

@@ -10,15 +10,19 @@
       <el-col v-bind="styleResponsive ? { lg: 6, md: 12 } : { span: 6 }">
         <el-form-item label="告警级别:" prop="level">
           <el-select filterable v-model="where.level" size="small">
-            <el-option label="提示" :value="1"></el-option>
-            <el-option label="一般" :value="2"></el-option>
+            <el-option label="轻微" :value="1"></el-option>
+            <el-option label="中等" :value="2"></el-option>
             <el-option label="严重" :value="3"></el-option>
             <el-option label="紧急" :value="4"></el-option>
             <el-option label="致命" :value="5"></el-option>
           </el-select>
         </el-form-item>
       </el-col>
-
+      <!-- <el-col v-bind="styleResponsive ? { lg: 6, md: 12 } : { span: 6 }">
+        <el-form-item label="告警名称:" prop="name">
+          <el-input filterable v-model="where.name" size="small"> </el-input>
+        </el-form-item>
+      </el-col> -->
       <!-- <el-col v-bind="styleResponsive ? { lg: 6, md: 12 } : { span: 6 }">
         <el-form-item label="组织机构:">
           <auth-selection

+ 54 - 1
src/views/warning/warningSetting/index.vue

@@ -9,6 +9,7 @@
         :columns="columns"
         :datasource="datasource"
         cache-key="systemRoleTable"
+        :selection.sync="selection"
         height="calc(100vh - 350px)"
       >
         <!-- 表头工具栏 -->
@@ -22,6 +23,24 @@
           >
             新建
           </el-button>
+          <el-button
+            size="small"
+            type="danger"
+            class="ele-btn-icon"
+            @click="setEnable(0)"
+            v-if="$hasPermission('eam:alarmsetting:update')"
+          >
+            批量停用
+          </el-button>
+          <el-button
+            size="small"
+            type="primary"
+            class="ele-btn-icon"
+            @click="setEnable(1)"
+            v-if="$hasPermission('eam:alarmsetting:update')"
+          >
+            批量启用
+          </el-button>
         </template>
         <template v-slot:enable="{ row }">
           <el-switch
@@ -50,12 +69,15 @@
             :underline="false"
             icon="el-icon-edit"
             @click="openEdit('edit', row)"
+            v-if="$hasPermission('eam:alarmsetting:update')"
           >
             修改
           </el-link>
           <el-popconfirm
             class="ele-action"
             title="确定要删除此告警设置吗?"
+            @click="openEdit('edit', row)"
+            v-if="$hasPermission('eam:alarmsetting:delete')"
             @confirm="remove(row)"
           >
             <template v-slot:reference>
@@ -76,7 +98,7 @@
   import SettingSearch from './components/setting-search.vue';
   import AddWarningDialog from './components/addWarningDialog.vue';
   import dictMixins from '@/mixins/dictMixins';
-  import { getList, remove } from '@/api/warning/index.js';
+  import { getList, remove, updateStatus } from '@/api/warning/index.js';
   export default {
     mixins: [dictMixins],
     components: {
@@ -85,6 +107,7 @@
     },
     data() {
       return {
+        selection: [],
         // 表格列配置
         columns: [
           {
@@ -96,6 +119,13 @@
             showOverflowTooltip: true,
             fixed: 'left'
           },
+          {
+            width: 45,
+            type: 'selection',
+            columnKey: 'selection',
+            fixed: 'left',
+            align: 'center'
+          },
           {
             prop: 'code',
             label: '告警编码',
@@ -139,6 +169,16 @@
             showOverflowTooltip: true,
             minWidth: 110
           },
+          {
+            prop: 'status',
+            label: '状态',
+            align: 'center',
+            showOverflowTooltip: true,
+            formatter: (row) => {
+              return row.status == 1 ? '启用' : '停用';
+            },
+            minWidth: 110
+          },
           {
             columnKey: 'action',
             label: '操作',
@@ -178,7 +218,20 @@
       openEdit(type, row) {
         this.$refs.addWarningDialogRef.open(type, row);
       },
+      setEnable(status) {
+        if (!this.selection.length) {
+          this.$message.error('请至少选择一条数据!');
+          return;
+        }
 
+        updateStatus({
+          ids: this.selection.map((item) => item.id),
+          status
+        }).then((res) => {
+          this.$message.success('操作成功!');
+          this.reload();
+        });
+      },
       remove(row) {
         remove([row.id]).then((res) => {
           this.$message.success('删除成功!');

+ 4 - 0
vue.config.js

@@ -27,6 +27,10 @@ module.exports = {
     }
   },
   devServer: {
+    headers: {
+      // 允许跨域访问子应用页面
+      'Access-Control-Allow-Origin': '*'
+    },
     // 代理跨域的配置
     proxy: {
       // 当我们的本地的请求 有/api的时候,就会代理我们的请求地址向另外一个服务器发出请求