|
|
@@ -4,8 +4,14 @@
|
|
|
<div class="breadcrumb-title"> 风险清单管理 </div>
|
|
|
</header>
|
|
|
<main class="safety-platform-container__main">
|
|
|
- <div style="margin-bottom: 20px;">
|
|
|
- <el-button type="primary" @click="$router.push({ name: 'riskManageAdd' })">添加 </el-button>
|
|
|
+ <div>
|
|
|
+ <el-button class="search-table-container--button" type="primary" @click="$router.push({ name: 'riskManageAdd' })">添加 </el-button>
|
|
|
+ <el-button plain class="search-table-container--button" @click="handleImport">
|
|
|
+ 导入
|
|
|
+ </el-button>
|
|
|
+ <el-button plain class="search-table-container--button" @click="handleDownload">
|
|
|
+ 导出
|
|
|
+ </el-button>
|
|
|
</div>
|
|
|
<div class="search-form">
|
|
|
<el-form :inline="true">
|
|
|
@@ -114,6 +120,16 @@
|
|
|
/>
|
|
|
</div>
|
|
|
</main>
|
|
|
+ <BatchImport
|
|
|
+ v-if="batchImportVisible"
|
|
|
+ :visible="batchImportVisible"
|
|
|
+ :import-api-url="importApiUrl"
|
|
|
+ :template-url="templateUrl"
|
|
|
+ template-name="下载模板"
|
|
|
+ :show-template="false"
|
|
|
+ @close="batchImportVisible = false"
|
|
|
+ @update="handleUpdate"
|
|
|
+ />
|
|
|
</div>
|
|
|
</template>
|
|
|
<script lang="ts" setup>
|
|
|
@@ -125,6 +141,7 @@
|
|
|
safetyRiskListQueryPage,
|
|
|
safetyRiskListDelete,
|
|
|
safetyRiskListApprove,
|
|
|
+ exportRiskList,
|
|
|
} from '@/api/production-safety/responsibility-implementation';
|
|
|
import { omit } from 'lodash-es';
|
|
|
import { useUserInfoHook } from '@/hooks/useUserInfoHook';
|
|
|
@@ -132,6 +149,10 @@
|
|
|
import { downloadFile } from '@/views/disaster/utils';
|
|
|
import { formatDeptTree } from '@/views/disaster/utils/formatDeptTree';
|
|
|
import { getAllDepartments } from '@/api/auth/dept';
|
|
|
+ import BatchImport from '@/components/batch-import/BatchImport.vue';
|
|
|
+ import { useGlobSetting } from '@/hooks/setting';
|
|
|
+ import urlJoin from 'url-join';
|
|
|
+ import { downloadByData } from '@/utils/file/download';
|
|
|
|
|
|
const router = useRouter();
|
|
|
const { id } = useUserInfoHook();
|
|
|
@@ -232,6 +253,37 @@
|
|
|
queryTableList();
|
|
|
};
|
|
|
|
|
|
+ // 批量导入
|
|
|
+ const batchImportVisible = ref(false);
|
|
|
+ const { urlPrefix } = useGlobSetting();
|
|
|
+ // /productionSafety/academyFile/import
|
|
|
+ const importApiUrl = ref(urlJoin(urlPrefix, '/admin/prod/academyFile/importAcademyFile'));
|
|
|
+ const templateUrl = ref('./skyeye-file-upload/sfysecurity/TEMPLATE/import-academy-file-template.xlsx');
|
|
|
+
|
|
|
+ const handleImport = () => {
|
|
|
+ batchImportVisible.value = true;
|
|
|
+ };
|
|
|
+
|
|
|
+ const handleUpdate = () => {
|
|
|
+ batchImportVisible.value = false;
|
|
|
+ // getTableData();
|
|
|
+ };
|
|
|
+
|
|
|
+ const handleDownload = async () => {
|
|
|
+ try {
|
|
|
+ const response = await exportRiskList();
|
|
|
+ if (response) {
|
|
|
+ const fileName = `风险清单管理_${new Date().toISOString().split('T')[0]}.xlsx`;
|
|
|
+ downloadByData(response, fileName);
|
|
|
+ ElMessage.success('导出成功');
|
|
|
+ }
|
|
|
+ } catch (e) {
|
|
|
+ console.error('导出院级文件失败:', e);
|
|
|
+ ElMessage.error('导出失败,请重试');
|
|
|
+ }
|
|
|
+ };
|
|
|
+
|
|
|
+
|
|
|
onMounted(async () => {
|
|
|
await getDeptData();
|
|
|
queryTableList();
|