|
|
@@ -83,12 +83,14 @@
|
|
|
<script setup lang="ts">
|
|
|
import { ref, onMounted, onBeforeMount } from 'vue';
|
|
|
import { ElMessage, ElMessageBox } from 'element-plus';
|
|
|
+ import axios, { AxiosRequestConfig } from 'axios';
|
|
|
import QueryForm from '../common/QueryForm.vue';
|
|
|
import AlertTable from '../common/AlertTable.vue';
|
|
|
import DetailDialog from '../common/DetailDialog.vue';
|
|
|
import Pagination from '../common/Pagination.vue';
|
|
|
- import { useIssueType } from '../../hooks/useIssueType';
|
|
|
+ // import { useIssueType } from '../../hooks/useIssueType';
|
|
|
import { useWorkLocation } from '../../hooks/useWorkLocation';
|
|
|
+ import { useIssueMainType } from '../../hooks/useIssueMainType';
|
|
|
import {
|
|
|
getDefaultTableData,
|
|
|
deleteDefaultTableData,
|
|
|
@@ -101,10 +103,19 @@
|
|
|
import { getDevMode, switchDevMode as SDM } from '@/api/datamanagement/getDevMode';
|
|
|
|
|
|
import { useUserStore } from '@/store/modules/user';
|
|
|
+ import { useGlobSetting } from '@/hooks/setting';
|
|
|
|
|
|
const userStore = useUserStore();
|
|
|
- const { aiOptions, manualOptions, getAIOptions, getManualOptions } = useIssueType();
|
|
|
+ // const { aiOptions, manualOptions, getAIOptions, getManualOptions } = useIssueType();
|
|
|
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 tableData = ref([]);
|
|
|
@@ -141,6 +152,47 @@
|
|
|
query.value = queryForm;
|
|
|
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) => {
|
|
|
@@ -392,9 +444,11 @@
|
|
|
};
|
|
|
|
|
|
onBeforeMount(() => {
|
|
|
- getAIOptions();
|
|
|
- getManualOptions();
|
|
|
+ // getAIOptions();
|
|
|
+ // getManualOptions();
|
|
|
getLocationOptions();
|
|
|
+ getAIMainOptions();
|
|
|
+ getManualMainOptions();
|
|
|
});
|
|
|
</script>
|
|
|
|