Просмотр исходного кода

feat: 人员管理其他接口和保卫保密菜单icon

wyf 7 месяцев назад
Родитель
Сommit
93dc03fa4c

+ 16 - 0
src/api/security-confidentiality-person/outer-person.ts

@@ -6,6 +6,7 @@ import type {
   BreakTableData,
   VisitorTableQuery,
   VisitorTableData,
+  BreakPushConfig,
 } from '@/views/security-confidentiality/person-management/outer-person/types';
 
 export function getBreakTableList(data: QueryPageRequest<BreakTableQuery>) {
@@ -51,3 +52,18 @@ export function exportVisitorList(data: VisitorTableQuery) {
     },
   );
 }
+
+export function updateBreakPushConfig(data: BreakPushConfig) {
+  return http.request({
+    url: '/personnelManagement/updateIntrudeAlertPushConfigRes',
+    method: 'post',
+    data,
+  });
+}
+
+export function queryBreakPushConfig() {
+  return http.request<BreakPushConfig>({
+    url: '/personnelManagement/queryIntrudeAlertPushConfig',
+    method: 'get',
+  });
+}

Разница между файлами не показана из-за своего большого размера
+ 14 - 0
src/assets/svg/security-Surveillance.svg


Разница между файлами не показана из-за своего большого размера
+ 15 - 0
src/assets/svg/security-access.svg


Разница между файлами не показана из-за своего большого размера
+ 14 - 0
src/assets/svg/security-confidentiality-position.svg


Разница между файлами не показана из-за своего большого размера
+ 12 - 0
src/assets/svg/security-confidentiality-regulation.svg


Разница между файлами не показана из-за своего большого размера
+ 14 - 0
src/assets/svg/security-person.svg


Разница между файлами не показана из-за своего большого размера
+ 14 - 0
src/assets/svg/security-position.svg


Разница между файлами не показана из-за своего большого размера
+ 14 - 0
src/assets/svg/security-regulation.svg


Разница между файлами не показана из-за своего большого размера
+ 14 - 0
src/assets/svg/security-vehicle.svg


+ 8 - 9
src/router/router-icons.ts

@@ -75,13 +75,12 @@ export const constantRouterIcon = {
   TrafficViolationIcon: renderSvg('traffic-violation'),
   TrafficAccidentIcon: renderSvg('traffic-accident'),
   TrafficVehicleIcon: renderSvg('traffic-vehicle'),
-  // TODO 修改
-  SecurityRegulationIcon: renderSvg('traffic-vehicle'),
-  ConfidentialityRegulationIcon: renderSvg('traffic-vehicle'),
-  SecurityPersonIcon: renderSvg('traffic-vehicle'),
-  SecurityAccessIcon: renderSvg('traffic-vehicle'),
-  SecurityVehicleIcon: renderSvg('traffic-vehicle'),
-  SecurityPositionIcon: renderSvg('traffic-vehicle'),
-  ConfidentialityPositionIcon: renderSvg('traffic-vehicle'),
-  SecuritySurveillanceIcon: renderSvg('traffic-vehicle'),
+  SecurityRegulationIcon: renderSvg('security-regulation'),
+  ConfidentialityRegulationIcon: renderSvg('security-confidentiality-regulation'),
+  SecurityPersonIcon: renderSvg('security-person'),
+  SecurityAccessIcon: renderSvg('security-access'),
+  SecurityVehicleIcon: renderSvg('security-vehicle'),
+  SecurityPositionIcon: renderSvg('security-position'),
+  ConfidentialityPositionIcon: renderSvg('security-confidentiality-position'),
+  SecuritySurveillanceIcon: renderSvg('security-Surveillance'),
 };

+ 2 - 0
src/views/security-confidentiality/person-management/outer-person/components/BreakInto.vue

@@ -1,6 +1,7 @@
 <template>
   <div class="search-table-container">
     <header>
+      <RealtimePush />
       <div class="table-search">
         <section class="select-box">
           <div class="select-box--item">
@@ -48,6 +49,7 @@
   import { exportBreakTableList, getBreakTableList } from '@/api/security-confidentiality-person/outer-person';
   import { ElMessage } from 'element-plus';
   import { downloadFile } from '@/views/disaster/utils';
+  import RealtimePush from './RealtimePush.vue';
 
   const searchData = reactive<BreakTableQuery>({});
   const searchTime = ref<string[]>([]);

+ 151 - 0
src/views/security-confidentiality/person-management/outer-person/components/RealtimePush.vue

@@ -0,0 +1,151 @@
+<template>
+  <div class="realtime-push">
+    <!-- <el-tooltip effect="light" content="" placement="top">
+      <img src="@/assets/icons/help.png" alt="" />
+    </el-tooltip> -->
+    <img src="@/assets/icons/help.png" alt="" />
+
+    <span class="label">告警推送:</span>
+    <el-switch v-model="switchVal" class="switch" @change="handleSwitchChange" />
+    <span class="info-text">推送对象{{ objectNum }}人</span>
+    <el-popover :visible="formVisible" width="300" placement="bottom-end" title="推送设置">
+      <template #reference>
+        <img
+          style="margin: 0 10px; cursor: pointer"
+          @click="formVisible = !formVisible"
+          src="@/assets/icons/edit_2.png"
+          alt=""
+        />
+      </template>
+      <template #default>
+        <div class="config-form-container">
+          <el-form ref="ruleFormRef" :model="ruleFormData" label-width="82px">
+            <el-form-item
+              prop="userGroupList"
+              label="推送对象:"
+              :rules="[{ validator: formValidator, trigger: 'change' }]"
+            >
+              <GroupSelect
+                v-model="ruleFormData.userGroupList"
+                :groupOptions="groupOptions"
+                @change="handleUserGroupListChange"
+              />
+            </el-form-item>
+          </el-form>
+        </div>
+        <div class="config-form-btn">
+          <el-button @click="formVisible = false">取消</el-button>
+          <el-button type="primary" @click="updateConfig">确定</el-button>
+        </div>
+      </template>
+    </el-popover>
+  </div>
+</template>
+
+<script setup lang="ts">
+  import { onMounted, ref, reactive } from 'vue';
+  import { ElMessage } from 'element-plus';
+  import { updateBreakPushConfig, queryBreakPushConfig } from '@/api/security-confidentiality-person/outer-person';
+  import GroupSelect from '@/components/PersonGroup/components/GroupSelect.vue';
+  import { useGroupInfoHook } from '@/components/PersonGroup/hook/groupInfo';
+
+  const switchVal = ref(false);
+  const objectNum = ref(0);
+
+  const formVisible = ref(false);
+  const ruleFormRef = ref();
+  const ruleFormData = reactive<{
+    userGroupList: number[];
+  }>({
+    userGroupList: [],
+  });
+
+  const { getUserGroupList, groupOptions } = useGroupInfoHook();
+
+  async function getNoticeConfig() {
+    try {
+      const res = await queryBreakPushConfig();
+      switchVal.value = res.alertPush;
+      ruleFormData.userGroupList = res.pushGroupIdList!;
+      objectNum.value = res.pushObjectCount!;
+    } catch (error) {
+      ElMessage.error('获取闯入告警推送配置失败');
+    }
+  }
+
+  async function updateConfig() {
+    if (formVisible.value) {
+      const res = await ruleFormRef.value.validate();
+      if (!res) return false;
+    }
+    try {
+      await updateBreakPushConfig({ alertPush: switchVal.value, pushGroupIdList: ruleFormData.userGroupList! });
+    } catch (error) {
+      ElMessage.error('更新闯入告警推送配置失败');
+    }
+    if (formVisible.value) formVisible.value = false;
+    getNoticeConfig();
+  }
+
+  async function handleSwitchChange(val: boolean) {
+    if (val) {
+      if (objectNum.value > 0) {
+        updateConfig();
+      } else {
+        ElMessage.error('请先完成推送对象设置');
+      }
+    } else {
+      updateConfig();
+    }
+    getNoticeConfig();
+  }
+
+  const formValidator = (_rule, value, callback) => {
+    if (value == null || !value.length) {
+      return callback(new Error('请选择用户组'));
+    } else {
+      callback();
+    }
+  };
+
+  const handleUserGroupListChange = (userGroupList: number[]) => {
+    ruleFormData.userGroupList = userGroupList;
+  };
+
+  onMounted(() => {
+    getUserGroupList();
+    getNoticeConfig();
+  });
+</script>
+
+<style scoped>
+  .realtime-push {
+    display: flex;
+    align-items: center;
+    margin-bottom: 20px;
+  }
+  .label {
+    padding: 0 10px;
+    color: rgba(0, 0, 0, 0.85);
+    font-size: 14px;
+  }
+  .info-text {
+    width: 120px;
+    padding-right: 10px;
+    text-align: end;
+    color: rgba(0, 0, 0, 0.7);
+    font-size: 14px;
+  }
+  .config-form-container {
+    margin: 5px 0;
+  }
+  .config-form-btn {
+    margin-top: 10px;
+    text-align: end;
+  }
+
+  :deep(.el-popover__title) {
+    color: rgba(0, 0, 0, 0.85);
+    font-size: 14px;
+  }
+</style>

+ 1 - 1
src/views/security-confidentiality/person-management/outer-person/configs/table.ts

@@ -69,7 +69,7 @@ export const OUTER_PERSON_VISITOR_TABEL_COLUMNS: TableColumnProps[] = [
     prop: 'mobile',
   },
   {
-    label: '是否外',
+    label: '是否外',
     align: 'center',
     minWidth: '120px',
     prop: 'isForeigner',

+ 6 - 0
src/views/security-confidentiality/person-management/outer-person/types.ts

@@ -38,3 +38,9 @@ export interface VisitorTableData {
   visitTime: string;
   leaveTime: string;
 }
+
+export interface BreakPushConfig {
+  alertPush: boolean;
+  pushGroupIdList?: number[];
+  pushObjectCount?: number;
+}