|
|
@@ -24,8 +24,8 @@
|
|
|
|
|
|
<div class="evaluation-items-section">
|
|
|
<div class="section-header">
|
|
|
- <!-- <el-button plain @click="handleDownloadTemplate">模板下载</el-button> -->
|
|
|
- <!-- <el-button plain @click="handleImport">导入</el-button> -->
|
|
|
+ <el-button plain @click="handleDownloadTemplate">模板下载</el-button>
|
|
|
+ <el-button plain @click="handleImport">导入</el-button>
|
|
|
</div>
|
|
|
<div class="evaluation-items-table">
|
|
|
<el-table :data="evaluationItems" border :span-method="handleSpanMethod">
|
|
|
@@ -144,12 +144,14 @@
|
|
|
saveSecurityExamine,
|
|
|
querySecurityExamineDetail,
|
|
|
updateSecurityExamine,
|
|
|
+ addDownloadTheTemplate,
|
|
|
} from '@/api/evaluationSystem';
|
|
|
import type { EvaluationContent } from '@/api/evaluationSystem';
|
|
|
import type { FileItem } from '@/components/UploadFiles/types';
|
|
|
import { useUserInfoHook } from '@/hooks/useUserInfoHook';
|
|
|
import { formatAttachmentList } from '@/components/UploadFiles/utils';
|
|
|
import { queryAvailableUserList } from '@/api/production-safety/responsibility-implementation';
|
|
|
+ import { downloadByData } from '@/utils/file/download';
|
|
|
|
|
|
const props = defineProps<{
|
|
|
id?: number;
|
|
|
@@ -228,9 +230,19 @@
|
|
|
ruleFormData.value.attachmentDocument = files;
|
|
|
};
|
|
|
|
|
|
- const handleDownloadTemplate = () => {
|
|
|
- // TODO: 下载模板
|
|
|
- console.log('download template');
|
|
|
+ const handleDownloadTemplate = async () => {
|
|
|
+ try {
|
|
|
+ const exportParams = {};
|
|
|
+ const response = await addDownloadTheTemplate(exportParams);
|
|
|
+ if (response) {
|
|
|
+ const fileName = `安全考核内容模板_${new Date().toISOString().split('T')[0]}.xlsx`;
|
|
|
+ downloadByData(response, fileName);
|
|
|
+ ElMessage.success('导出成功');
|
|
|
+ }
|
|
|
+ } catch (e) {
|
|
|
+ console.error('导出月度扣分失败:', e);
|
|
|
+ ElMessage.error(e?.message || e?.data || '导出失败,请重试');
|
|
|
+ }
|
|
|
};
|
|
|
|
|
|
// 导入弹窗相关
|