|
|
@@ -2,14 +2,38 @@
|
|
|
<main class="safety-platform-container__main">
|
|
|
<BasicForm ref="basicFormRef" :formData="ruleFormData" :formRules="formRules" :formConfig="formConfig">
|
|
|
<template #attachment>
|
|
|
- <UploadFiles
|
|
|
+ <!-- <UploadFiles
|
|
|
label="上传附件"
|
|
|
:file-list="attachmentFileList"
|
|
|
:readonly="!isCreateOrEditMode"
|
|
|
:disabled="!isCreateOrEditMode"
|
|
|
@uploadSuccess="handleAttachmentUploadSuccess"
|
|
|
@preview="handlePreview"
|
|
|
+ /> -->
|
|
|
+ <UploadFiles
|
|
|
+ v-if="!isViewMode"
|
|
|
+ label="上传文件"
|
|
|
+ :maxCount="1"
|
|
|
+ :file-list="attachmentFileList"
|
|
|
+ :disabled="isViewMode"
|
|
|
+ :allow-all-file-types="true"
|
|
|
+ :accept="'.jpg,.jpeg,.png'"
|
|
|
+ :desc="'支持.jpg,.jpeg,.png'"
|
|
|
+ @uploadSuccess="(list: FileItem[]) => handleAttachmentUploadSuccess(list)"
|
|
|
/>
|
|
|
+ <div class="file-list" v-else>
|
|
|
+ <div class="file-item" v-for="file in attachmentFileList" :key="file.fileId">
|
|
|
+ <span class="file-item--name">{{ file.fileName }}</span>
|
|
|
+ <div class="file-item--footer">
|
|
|
+ <el-button link type="primary" @click="previewOnline(file.fileUrl, file.fileType)"
|
|
|
+ >预览</el-button
|
|
|
+ >
|
|
|
+ <el-button link type="primary" @click.stop="downloadFile(file.fileUrl, file.fileName)"
|
|
|
+ >下载</el-button
|
|
|
+ >
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
</template>
|
|
|
</BasicForm>
|
|
|
<!-- 审核弹窗 -->
|
|
|
@@ -69,6 +93,7 @@
|
|
|
type ApproveEmployeeHazardReportReq,
|
|
|
} from '@/api/production-safety';
|
|
|
import PreviewOnline from '@/views/disaster/components/PreviewOnline.vue';
|
|
|
+ import { downloadFile } from '@/views/disaster/utils';
|
|
|
|
|
|
const router = useRouter();
|
|
|
const route = useRoute();
|
|
|
@@ -279,6 +304,12 @@
|
|
|
}
|
|
|
};
|
|
|
|
|
|
+ const previewOnline = (url: string | undefined, type) => {
|
|
|
+ if (url) {
|
|
|
+ previewOnlineRef.value?.open(url, type);
|
|
|
+ }
|
|
|
+ };
|
|
|
+
|
|
|
onMounted(() => {
|
|
|
cloneRuleFormData();
|
|
|
if (currentId.value) {
|