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

fix: 报警问题处理代码同步

bxy 1 год назад
Родитель
Сommit
687e8a2af4

+ 1 - 1
src/api/tenant/index.ts

@@ -62,6 +62,6 @@ export function getListUseZongbu() {
       url: '/tenant/listUseZongbu',
       url: '/tenant/listUseZongbu',
       method: 'get',
       method: 'get',
     },
     },
-    { isShowErrorMessage: false },
+    { isShowErrorMessage: false, isShowMessage: false },
   );
   );
 }
 }

+ 9 - 8
src/views/datamanager/alertformdata/components/common/constant.question.ts

@@ -61,14 +61,6 @@ export const getNameByState = (issueState: IssueState) => {
   return issueStateNameMap[issueState] || '-';
   return issueStateNameMap[issueState] || '-';
 };
 };
 
 
-// 问题四大类
-export enum QUESTION_TYPE_MAIN {
-  fromHuman = 1, //人的不安全行为
-  fromThing = 2, //物的不安全状态
-  fromEnvir = 3, //环境的不安全因素
-  fromManage = 4, //管理措施的不规范
-}
-
 // 中建材 —— 待处理(0123456),已处理(78)
 // 中建材 —— 待处理(0123456),已处理(78)
 export enum IssueStateZJC {
 export enum IssueStateZJC {
   toDeal0 = 0,
   toDeal0 = 0,
@@ -99,6 +91,15 @@ export const issueStateOptionsZJC = [
 export const getNameByStateZJC = (issueState: IssueStateZJC) => {
 export const getNameByStateZJC = (issueState: IssueStateZJC) => {
   return issueStateNameMapZJC[issueState] || '-';
   return issueStateNameMapZJC[issueState] || '-';
 };
 };
+
+// 问题四大类
+export enum QUESTION_TYPE_MAIN {
+  fromHuman = 1, //人的不安全行为
+  fromThing = 2, //物的不安全状态
+  fromEnvir = 3, //环境的不安全因素
+  fromManage = 4, //管理措施的不规范
+}
+
 export const questionMainTypeNameMap = {
 export const questionMainTypeNameMap = {
   [QUESTION_TYPE_MAIN.fromHuman]: '人的不安全行为',
   [QUESTION_TYPE_MAIN.fromHuman]: '人的不安全行为',
   [QUESTION_TYPE_MAIN.fromThing]: '物的不安全状态',
   [QUESTION_TYPE_MAIN.fromThing]: '物的不安全状态',

+ 58 - 4
src/views/datamanager/alertformdata/components/default/Default.vue

@@ -83,12 +83,14 @@
 <script setup lang="ts">
 <script setup lang="ts">
   import { ref, onMounted, onBeforeMount } from 'vue';
   import { ref, onMounted, onBeforeMount } from 'vue';
   import { ElMessage, ElMessageBox } from 'element-plus';
   import { ElMessage, ElMessageBox } from 'element-plus';
+  import axios, { AxiosRequestConfig } from 'axios';
   import QueryForm from '../common/QueryForm.vue';
   import QueryForm from '../common/QueryForm.vue';
   import AlertTable from '../common/AlertTable.vue';
   import AlertTable from '../common/AlertTable.vue';
   import DetailDialog from '../common/DetailDialog.vue';
   import DetailDialog from '../common/DetailDialog.vue';
   import Pagination from '../common/Pagination.vue';
   import Pagination from '../common/Pagination.vue';
-  import { useIssueType } from '../../hooks/useIssueType';
+  // import { useIssueType } from '../../hooks/useIssueType';
   import { useWorkLocation } from '../../hooks/useWorkLocation';
   import { useWorkLocation } from '../../hooks/useWorkLocation';
+  import { useIssueMainType } from '../../hooks/useIssueMainType';
   import {
   import {
     getDefaultTableData,
     getDefaultTableData,
     deleteDefaultTableData,
     deleteDefaultTableData,
@@ -101,10 +103,19 @@
   import { getDevMode, switchDevMode as SDM } from '@/api/datamanagement/getDevMode';
   import { getDevMode, switchDevMode as SDM } from '@/api/datamanagement/getDevMode';
 
 
   import { useUserStore } from '@/store/modules/user';
   import { useUserStore } from '@/store/modules/user';
+  import { useGlobSetting } from '@/hooks/setting';
 
 
   const userStore = useUserStore();
   const userStore = useUserStore();
-  const { aiOptions, manualOptions, getAIOptions, getManualOptions } = useIssueType();
+  // const { aiOptions, manualOptions, getAIOptions, getManualOptions } = useIssueType();
   const { locationOptions, getLocationOptions } = useWorkLocation();
   const { locationOptions, getLocationOptions } = useWorkLocation();
+  const { aiMainOptions, manualMainOptions, getAIMainOptions, getManualMainOptions } =
+    useIssueMainType();
+
+  const headers = {
+    Satoken: userStore.getToken,
+    Tenantid: userStore.getTenantId,
+  };
+  const { urlPrefix } = useGlobSetting();
 
 
   const alertTableRef = ref<typeof AlertTable>();
   const alertTableRef = ref<typeof AlertTable>();
   const tableData = ref([]);
   const tableData = ref([]);
@@ -141,6 +152,47 @@
     query.value = queryForm;
     query.value = queryForm;
     getTableData();
     getTableData();
   };
   };
+  // 导出
+  const handleExport = async (queryForm, workShop) => {
+    console.log(queryForm);
+    console.log('workshopId', workShop);
+
+    try {
+      const now = new Date();
+      const year = now.getFullYear();
+      const month = String(now.getMonth() + 1).padStart(2, '0');
+      const day = String(now.getDate()).padStart(2, '0');
+      const currentDate = `${year}${month}${day}`;
+
+      const requestBody = {
+        endTime: queryForm.endTime,
+        fileName: '',
+        isExportHidden: true,
+        startTime: queryForm.startTime,
+        workshopIds: workShop,
+      };
+
+      const config: AxiosRequestConfig = {
+        headers,
+        responseType: 'blob',
+      };
+      const response = await axios.post(urlPrefix + '/issue/export', requestBody, config);
+      const blob = new Blob([response.data], {
+        type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
+      });
+      // 创建下载链接
+      let downloadLink: HTMLAnchorElement | null = document.createElement('a');
+      const url = window.URL.createObjectURL(blob);
+      downloadLink.href = url;
+      downloadLink.download = `安全违规问题数据统计表${currentDate}.xlsx`;
+      downloadLink.click();
+      // 移除下载链接
+      window.URL.revokeObjectURL(url);
+      downloadLink = null;
+    } catch (error) {
+      console.error('Error downloading file:', error);
+    }
+  };
 
 
   // 多选
   // 多选
   const handlePop = (selection) => {
   const handlePop = (selection) => {
@@ -392,9 +444,11 @@
   };
   };
 
 
   onBeforeMount(() => {
   onBeforeMount(() => {
-    getAIOptions();
-    getManualOptions();
+    // getAIOptions();
+    // getManualOptions();
     getLocationOptions();
     getLocationOptions();
+    getAIMainOptions();
+    getManualMainOptions();
   });
   });
 </script>
 </script>