|
@@ -1,5 +1,4 @@
|
|
|
<template>
|
|
<template>
|
|
|
- <main class="safety-platform-container__main">
|
|
|
|
|
<el-alert
|
|
<el-alert
|
|
|
v-if="isRectifyMode && detailReviewRejectReason"
|
|
v-if="isRectifyMode && detailReviewRejectReason"
|
|
|
type="error"
|
|
type="error"
|
|
@@ -7,6 +6,8 @@
|
|
|
show-icon
|
|
show-icon
|
|
|
class="detail-reject-alert"
|
|
class="detail-reject-alert"
|
|
|
/>
|
|
/>
|
|
|
|
|
+ <main class="safety-platform-container__main">
|
|
|
|
|
+
|
|
|
<el-form label-width="150px" :model="ruleFormData" :rules="isViewMode ? undefined : formRules" ref="basicFormRef">
|
|
<el-form label-width="150px" :model="ruleFormData" :rules="isViewMode ? undefined : formRules" ref="basicFormRef">
|
|
|
<el-form-item label="隐患问题类别:" prop="typeId">
|
|
<el-form-item label="隐患问题类别:" prop="typeId">
|
|
|
<el-select
|
|
<el-select
|
|
@@ -153,6 +154,62 @@
|
|
|
:disabled="isViewMode"
|
|
:disabled="isViewMode"
|
|
|
/>
|
|
/>
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
|
|
+
|
|
|
|
|
+ </section>
|
|
|
|
|
+ <section v-if="detailStatusOrder>=2">
|
|
|
|
|
+ <el-form-item label="整改完成情况:" prop="rectificationCompletionStatus">
|
|
|
|
|
+ <el-input
|
|
|
|
|
+ v-model="ruleFormData.rectificationCompletionStatus"
|
|
|
|
|
+ placeholder="请输入整改完成情况"
|
|
|
|
|
+ show-word-limit
|
|
|
|
|
+ :disabled="detailStatusOrder>=3"
|
|
|
|
|
+ style="width: 450px"
|
|
|
|
|
+ />
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+ <el-form-item label="整改完成时间:" prop="rectificationCompletionTime">
|
|
|
|
|
+ <el-date-picker
|
|
|
|
|
+ v-model="ruleFormData.rectificationCompletionTime"
|
|
|
|
|
+ type="date"
|
|
|
|
|
+ :disabled="detailStatusOrder>=3"
|
|
|
|
|
+ value-format="YYYY-MM-DD"
|
|
|
|
|
+ placeholder="请选择整改完成时间"
|
|
|
|
|
+ style="width: 450px"
|
|
|
|
|
+ />
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+ <el-form-item label="附件上传" prop="attachments">
|
|
|
|
|
+ <UploadFiles
|
|
|
|
|
+ label="选择附件"
|
|
|
|
|
+ :maxCount="1"
|
|
|
|
|
+ v-if="detailStatusOrder==2"
|
|
|
|
|
+ :disabled="detailStatusOrder>=3"
|
|
|
|
|
+ :file-list="attachmentsFileList"
|
|
|
|
|
+ :allow-all-file-types="true"
|
|
|
|
|
+ @uploadSuccess="(list: FileItem[]) => handleAttachmentsUploadSuccess(list)"
|
|
|
|
|
+ @preview="handlePreview"
|
|
|
|
|
+ />
|
|
|
|
|
+ <div class="file-list" v-if="detailStatusOrder>=3">
|
|
|
|
|
+ <div class="file-item" v-for="file in attachmentsFileList" :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
|
|
|
|
|
+ >
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+ <el-form-item label="复查意见:" prop="reviewComments" v-if="detailStatusOrder>=3" >
|
|
|
|
|
+ <el-input
|
|
|
|
|
+ v-model="ruleFormData.reviewComments"
|
|
|
|
|
+ type="textarea"
|
|
|
|
|
+ :rows="3"
|
|
|
|
|
+ placeholder="请输入复查意见(选填),限300字"
|
|
|
|
|
+ maxlength="300"
|
|
|
|
|
+ style="width: 450px"
|
|
|
|
|
+ show-word-limit
|
|
|
|
|
+ :disabled="isViewMode && !isReviewMode"
|
|
|
|
|
+ />
|
|
|
|
|
+ </el-form-item>
|
|
|
</section>
|
|
</section>
|
|
|
</el-form>
|
|
</el-form>
|
|
|
</main>
|
|
</main>
|
|
@@ -172,7 +229,8 @@
|
|
|
</template>
|
|
</template>
|
|
|
<!-- 纯查看时仅保留上面的返回,不显示其他按钮 -->
|
|
<!-- 纯查看时仅保留上面的返回,不显示其他按钮 -->
|
|
|
</footer>
|
|
</footer>
|
|
|
-
|
|
|
|
|
|
|
+ <!-- 预览 -->
|
|
|
|
|
+ <PreviewOnline ref="previewOnlineRef" />
|
|
|
<!-- 复查弹窗 -->
|
|
<!-- 复查弹窗 -->
|
|
|
<el-dialog v-model="showReviewDialog" title="复查隐患" width="520px" destroy-on-close @close="resetReviewForm">
|
|
<el-dialog v-model="showReviewDialog" title="复查隐患" width="520px" destroy-on-close @close="resetReviewForm">
|
|
|
<el-form ref="reviewFormRef" :model="reviewForm" :rules="reviewRules" label-width="120px">
|
|
<el-form ref="reviewFormRef" :model="reviewForm" :rules="reviewRules" label-width="120px">
|
|
@@ -298,6 +356,7 @@
|
|
|
import { getAllDepartments } from '@/api/auth/dept';
|
|
import { getAllDepartments } from '@/api/auth/dept';
|
|
|
import type { DeptTree } from '@/types/dept/type';
|
|
import type { DeptTree } from '@/types/dept/type';
|
|
|
import { queryAvailableUserList } from '@/api/production-safety/responsibility-implementation';
|
|
import { queryAvailableUserList } from '@/api/production-safety/responsibility-implementation';
|
|
|
|
|
+ import PreviewOnline from '@/views/disaster/components/PreviewOnline.vue';
|
|
|
|
|
|
|
|
const router = useRouter();
|
|
const router = useRouter();
|
|
|
const route = useRoute();
|
|
const route = useRoute();
|
|
@@ -321,7 +380,7 @@
|
|
|
HIDDEN_DANGER_FORM_DATA,
|
|
HIDDEN_DANGER_FORM_DATA,
|
|
|
HIDDEN_DANGER_FORM_RULES,
|
|
HIDDEN_DANGER_FORM_RULES,
|
|
|
);
|
|
);
|
|
|
-
|
|
|
|
|
|
|
+ const previewOnlineRef = ref<InstanceType<typeof PreviewOnline>>();
|
|
|
/** 查看详情:与复查时字段一致,全部为禁用状态 */
|
|
/** 查看详情:与复查时字段一致,全部为禁用状态 */
|
|
|
const viewFormConfig = computed(() =>
|
|
const viewFormConfig = computed(() =>
|
|
|
HIDDEN_DANGER_REVIEW_FORM_CONFIG.map((item) => ({
|
|
HIDDEN_DANGER_REVIEW_FORM_CONFIG.map((item) => ({
|
|
@@ -357,23 +416,49 @@
|
|
|
return { fileId: index + 1, fileName, fileType, fileSize: '0', fileUrl: url };
|
|
return { fileId: index + 1, fileName, fileType, fileSize: '0', fileUrl: url };
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|
|
|
- const attachmentsFileList = computed(() => convertAttachmentsToFileItems(ruleFormData.attachments || ''));
|
|
|
|
|
|
|
+// const attachmentsFileList = computed(() => convertAttachmentsToFileItems(ruleFormData.attachments || ''));
|
|
|
|
|
+
|
|
|
|
|
+const attachmentsFileList = ref([]) as any
|
|
|
async function handleAttachmentsUploadSuccess(files: FileItem[]) {
|
|
async function handleAttachmentsUploadSuccess(files: FileItem[]) {
|
|
|
if (!files?.length) {
|
|
if (!files?.length) {
|
|
|
ruleFormData.attachments = '';
|
|
ruleFormData.attachments = '';
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
- try {
|
|
|
|
|
- const list = await formatAttachmentList(files);
|
|
|
|
|
- ruleFormData.attachments = (list || [])
|
|
|
|
|
- .map((r) => r.fileUrl)
|
|
|
|
|
- .filter(Boolean)
|
|
|
|
|
- .join(',');
|
|
|
|
|
- } catch (e) {
|
|
|
|
|
- console.error('附件上传失败:', e);
|
|
|
|
|
- ElMessage.error(e?.message || e?.data || '附件上传失败,请重试');
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ console.log(files)
|
|
|
|
|
+ attachmentsFileList.value = files
|
|
|
|
|
+ ruleFormData.attachments = JSON.stringify(files) || '';
|
|
|
|
|
+ // try {
|
|
|
|
|
+ // const list = await formatAttachmentList(files);
|
|
|
|
|
+ // ruleFormData.attachments = (list || [])
|
|
|
|
|
+ // .map((r) => r.fileUrl)
|
|
|
|
|
+ // .filter(Boolean)
|
|
|
|
|
+ // .join(',');
|
|
|
|
|
+ // } catch (e) {
|
|
|
|
|
+ // console.error('附件上传失败:', e);
|
|
|
|
|
+ // ElMessage.error(e?.message || e?.data || '附件上传失败,请重试');
|
|
|
|
|
+ // }
|
|
|
}
|
|
}
|
|
|
|
|
+ const handlePreview = (url: string) => {
|
|
|
|
|
+ if (url) {
|
|
|
|
|
+ // 根据文件扩展名判断文件类型
|
|
|
|
|
+ const extension = url.split('.').pop()?.toLowerCase() || '';
|
|
|
|
|
+ let fileType: 'pdf' | 'word' | 'excel' | 'ppt' = 'pdf';
|
|
|
|
|
+ if (extension === 'doc' || extension === 'docx') {
|
|
|
|
|
+ fileType = 'word';
|
|
|
|
|
+ } else if (extension === 'xls' || extension === 'xlsx') {
|
|
|
|
|
+ fileType = 'excel';
|
|
|
|
|
+ } else if (extension === 'ppt' || extension === 'pptx') {
|
|
|
|
|
+ fileType = 'ppt';
|
|
|
|
|
+ }
|
|
|
|
|
+ previewOnlineRef.value?.open(url, fileType);
|
|
|
|
|
+ }
|
|
|
|
|
+ };
|
|
|
|
|
+
|
|
|
|
|
+ const previewOnline = (url: string | undefined, type) => {
|
|
|
|
|
+ if (url) {
|
|
|
|
|
+ previewOnlineRef.value?.open(url, type);
|
|
|
|
|
+ }
|
|
|
|
|
+ };
|
|
|
|
|
|
|
|
const basicFormRef = ref<InstanceType<typeof BasicForm>>();
|
|
const basicFormRef = ref<InstanceType<typeof BasicForm>>();
|
|
|
|
|
|
|
@@ -475,6 +560,8 @@
|
|
|
ruleFormData.rectificationCompletionStatus = d.rectificationCompletionStatus ?? '';
|
|
ruleFormData.rectificationCompletionStatus = d.rectificationCompletionStatus ?? '';
|
|
|
ruleFormData.rectificationCompletionTime = d.rectificationCompletionTime ?? '';
|
|
ruleFormData.rectificationCompletionTime = d.rectificationCompletionTime ?? '';
|
|
|
ruleFormData.attachments = d.attachments ?? '';
|
|
ruleFormData.attachments = d.attachments ?? '';
|
|
|
|
|
+ attachmentsFileList.value = JSON.parse(d.attachments|| '[]');
|
|
|
|
|
+ ruleFormData.reviewComments = d.reviewComments?? '';
|
|
|
// 整改页:保存审查不通过原因供 el-alert 展示(后端字段 reviewReason)
|
|
// 整改页:保存审查不通过原因供 el-alert 展示(后端字段 reviewReason)
|
|
|
if (isRectifyMode.value && d.reviewReason != null && String(d.reviewReason).trim()) {
|
|
if (isRectifyMode.value && d.reviewReason != null && String(d.reviewReason).trim()) {
|
|
|
detailReviewRejectReason.value = String(d.reviewReason).trim();
|
|
detailReviewRejectReason.value = String(d.reviewReason).trim();
|
|
@@ -482,9 +569,9 @@
|
|
|
detailReviewRejectReason.value = '';
|
|
detailReviewRejectReason.value = '';
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
- if (isReviewMode.value) {
|
|
|
|
|
- ruleFormData.reviewComments = '';
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ // if (isReviewMode.value) {
|
|
|
|
|
+ // ruleFormData.reviewComments = '';
|
|
|
|
|
+ // }
|
|
|
cloneRuleFormData();
|
|
cloneRuleFormData();
|
|
|
} catch (e) {
|
|
} catch (e) {
|
|
|
console.error('获取隐患详情失败:', e);
|
|
console.error('获取隐患详情失败:', e);
|
|
@@ -551,6 +638,10 @@
|
|
|
async function handleRectifySubmitDirect() {
|
|
async function handleRectifySubmitDirect() {
|
|
|
if (!currentId.value) return;
|
|
if (!currentId.value) return;
|
|
|
try {
|
|
try {
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ const uploadedFileList = await formatAttachmentList(attachmentsFileList.value);
|
|
|
|
|
+
|
|
|
await rectifyHiddenDanger({
|
|
await rectifyHiddenDanger({
|
|
|
dangerId: currentId.value,
|
|
dangerId: currentId.value,
|
|
|
rectificationPlan: '',
|
|
rectificationPlan: '',
|
|
@@ -559,7 +650,7 @@
|
|
|
rectificationEndTime: '',
|
|
rectificationEndTime: '',
|
|
|
rectificationCompletionStatus: ruleFormData.rectificationCompletionStatus || '',
|
|
rectificationCompletionStatus: ruleFormData.rectificationCompletionStatus || '',
|
|
|
rectificationCompletionTime: ruleFormData.rectificationCompletionTime || '',
|
|
rectificationCompletionTime: ruleFormData.rectificationCompletionTime || '',
|
|
|
- attachments: ruleFormData.attachments || '',
|
|
|
|
|
|
|
+ attachments: JSON.stringify(uploadedFileList) || undefined,
|
|
|
isCompleted: 1,
|
|
isCompleted: 1,
|
|
|
});
|
|
});
|
|
|
ElMessage.success('整改提交成功');
|
|
ElMessage.success('整改提交成功');
|
|
@@ -730,7 +821,10 @@
|
|
|
|
|
|
|
|
<style scoped lang="scss">
|
|
<style scoped lang="scss">
|
|
|
@use '@/styles/page-details-layout.scss' as *;
|
|
@use '@/styles/page-details-layout.scss' as *;
|
|
|
- .detail-reject-alert {
|
|
|
|
|
- margin-bottom: 16px;
|
|
|
|
|
|
|
+
|
|
|
|
|
+ .file-item{
|
|
|
|
|
+ display: flex;
|
|
|
|
|
+ justify-content: flex-start;
|
|
|
|
|
+ gap: 10px;
|
|
|
}
|
|
}
|
|
|
</style>
|
|
</style>
|