From 20e7bce4b0c485698ce0f6e59f9e074e455476a5 Mon Sep 17 00:00:00 2001
From: 马宇豪 <978517621@qq.com>
Date: Thu, 22 May 2025 17:11:41 +0800
Subject: [PATCH] 修改导出
---
src/views/analyse/assessApply/components/reportDialog.vue | 291 ++++++++++++++++++++++++++++++++++++++++++++++++++-------
1 files changed, 252 insertions(+), 39 deletions(-)
diff --git a/src/views/analyse/assessApply/components/reportDialog.vue b/src/views/analyse/assessApply/components/reportDialog.vue
index 95b484d..f5ba557 100644
--- a/src/views/analyse/assessApply/components/reportDialog.vue
+++ b/src/views/analyse/assessApply/components/reportDialog.vue
@@ -24,7 +24,8 @@
<!-- <el-radio :label="5">特种设备类</el-radio>-->
<!-- <el-radio :label="6">其他类</el-radio>-->
<!-- </el-radio-group>-->
- {{reportDialogState.experimentTypeList.find(i=>i.id === reportDialogState.reportForm.experimentType)?.name}}
+<!-- {{reportDialogState.experimentTypeList.find(i=>i.id === reportDialogState.reportForm.experimentAndType)?.name}}-->
+ {{typeValue}}
</td>
</tr>
<tr>
@@ -107,28 +108,11 @@
<div>{{item.siteType}}</div>
</td>
</tr>
- <tr>
- <td class="w-25 m-color required">评估人</td>
- <td class="w-75 m-color">
-<!-- <el-select style="width: 100%" :disabled="reportDialogState.disabled" v-model="reportDialogState.reportForm.assessPerson" clearable filterable>-->
-<!-- <el-option-->
-<!-- v-for="item in reportDialogState.allPersonList"-->
-<!-- :key="item.id"-->
-<!-- :value="item.id"-->
-<!-- :label="item.personName"-->
-<!-- ></el-option>-->
-<!-- </el-select>-->
- <el-input :disabled="reportDialogState.disabled" v-model="reportDialogState.reportForm.assessPerson" placeholder="评估人" />
- </td>
-<!-- <td class="w-25 m-color required">评估时间</td>-->
-<!-- <td class="w-25 m-color">-->
-<!-- <el-date-picker :disabled="reportDialogState.disabled" type="datetime" format="YYYY/MM/DD HH:mm:ss" value-format="YYYY-MM-DD HH:mm:ss" v-model="reportDialogState.reportForm.assessTime" />-->
-<!-- </td>-->
- </tr>
<tr class="m-color b-font" style="text-align: center">实验概况</tr>
<tr>
- <el-input type="textarea" :autosize="{ minRows: 3}" disabled v-model="reportDialogState.reportForm.experimentDesc" placeholder="(简要描述实验原理、实验步骤、所用试剂或材料设备等)" />
+<!-- <el-input type="textarea" :autosize="{ minRows: 3}" disabled v-model="reportDialogState.reportForm.experimentDesc" placeholder="(简要描述实验原理、实验步骤、所用试剂或材料设备等)" />-->
+ <el-input type="textarea" :autosize="{ minRows: 3}" disabled v-model="reportDialogState.reportForm.process" placeholder="(简要描述实验原理、实验步骤、所用试剂或材料设备等)" />
</tr>
<tr class="m-color b-font" style="text-align: center">实验涉及的危险源</tr>
<tr>
@@ -144,12 +128,19 @@
<!-- <el-radio :label="7">激光安全</el-radio>-->
<!-- <el-radio :label="8">其他安全</el-radio>-->
<!-- </el-radio-group>-->
- <el-checkbox-group disabled>
+ <el-checkbox-group disabled class="checkTip">
<el-checkbox v-for="item in reportDialogState.reportForm.riskSourceType" :label="item.riskSourceType" :checked="item.status==1?true:false"/>
</el-checkbox-group>
</td>
</tr>
+
<select-danger ref="selectDangerRef" v-model:data="reportDialogState.reportForm.riskSource" v-model:disabled="reportDialogState.disabled"></select-danger>
+
+<!-- <tr class="m-color b-font required" style="text-align: center">安全风险分析(总结)</tr>-->
+<!-- <tr>-->
+<!-- <el-input type="textarea" :autosize="{ minRows: 3}" :disabled="reportDialogState.disabled" v-model="reportDialogState.reportForm.safeRiskAnalysis" placeholder="1.实验过程中是否有爆炸、火灾、腐蚀、中毒风险、产生危险废弃物等(根据危险源清单,分析实验过程中可能对人身安全、人体健康、实验室环境和周边环境等带来的负面影响)" />-->
+<!-- </tr>-->
+
<tr class="m-color b-font required" style="text-align: center">安全风险分析(总结)</tr>
<tr>
<el-input type="textarea" :autosize="{ minRows: 3}" :disabled="reportDialogState.disabled" v-model="reportDialogState.reportForm.safeRiskAnalysis" placeholder="1.实验过程中是否有爆炸、火灾、腐蚀、中毒风险、产生危险废弃物等(根据危险源清单,分析实验过程中可能对人身安全、人体健康、实验室环境和周边环境等带来的负面影响)" />
@@ -160,24 +151,74 @@
</tr>
<tr class="m-color b-font required" style="text-align: center">实验和实验项目综合风险等级评定</tr>
<tr>
- <td class="m-color" style="width: 100%">
- <el-radio-group :disabled="reportDialogState.disabled" v-model="reportDialogState.reportForm.assessLevel">
- <el-radio :label="1">低风险(一级)</el-radio>
- <el-radio :label="2">一般风险(二级)</el-radio>
- <el-radio :label="3">较大风险(三级)</el-radio>
- <el-radio :label="4">重大风险(四级)</el-radio>
+ <td class="m-color" style="width: 100%;height: 65px">
+ <el-radio-group :disabled="reportDialogState.disabled" v-model="reportDialogState.reportForm.assessLevel" class="checkTip">
+ <div style="display: flex;justify-content: center">
+ <div style="display: flex;flex-direction: column">
+ <el-radio :label="1">重大风险(一级)</el-radio>
+ <el-tag v-if="reportDialogState.reportForm.assessLevel == 1" class="tag-style tag-bg1" />
+ </div>
+ <div style="display: flex;flex-direction: column">
+ <el-radio :label="2">较大风险(二级)</el-radio>
+ <el-tag v-if="reportDialogState.reportForm.assessLevel == 2" class="tag-style tag-bg2" />
+ </div>
+ <div style="display: flex;flex-direction: column">
+ <el-radio :label="3">一般风险(三级)</el-radio>
+ <el-tag v-if="reportDialogState.reportForm.assessLevel == 3" class="tag-style tag-bg3" />
+ </div>
+ <div style="display: flex;flex-direction: column">
+ <el-radio :label="4">低风险(四级)</el-radio>
+ <el-tag v-if="reportDialogState.reportForm.assessLevel == 4" style="width: 43px;margin-left: 20px;" class="tag-bg4" />
+ </div>
+ </div>
</el-radio-group>
</td>
</tr>
<tr>
<el-input type="textarea" :autosize="{ minRows: 3}" :disabled="reportDialogState.disabled" v-model="reportDialogState.reportForm.description" placeholder="评定依据(必填)" />
</tr>
+ <tr>
+ <td class="w-25 m-color required">评估人</td>
+ <td class="w-75 m-color">
+ <!-- <el-select style="width: 100%" :disabled="reportDialogState.disabled" v-model="reportDialogState.reportForm.assessPerson" clearable filterable>-->
+ <!-- <el-option-->
+ <!-- v-for="item in reportDialogState.allPersonList"-->
+ <!-- :key="item.id"-->
+ <!-- :value="item.id"-->
+ <!-- :label="item.personName"-->
+ <!-- ></el-option>-->
+ <!-- </el-select>-->
+ <el-input :disabled="reportDialogState.disabled" v-model="reportDialogState.reportForm.assessPerson" placeholder="评估人" />
+ </td>
+ <!-- <td class="w-25 m-color required">评估时间</td>-->
+ <!-- <td class="w-25 m-color">-->
+ <!-- <el-date-picker :disabled="reportDialogState.disabled" type="datetime" format="YYYY/MM/DD HH:mm:ss" value-format="YYYY-MM-DD HH:mm:ss" v-model="reportDialogState.reportForm.assessTime" />-->
+ <!-- </td>-->
+ </tr>
+ <tr v-if="reportDialogState.reportForm.person?.length>0" class="m-color b-font" style="text-align: center">审批内容</tr>
+ <template v-if="reportDialogState.reportForm.person?.length > 0">
+ <template v-for="item in reportDialogState.reportForm.person">
+ <tr>
+ <td class="w-25 m-color">{{item.approveStage}}</td>
+ <td class="w-25">{{item.approvePerson}}</td>
+ <td class="w-25 m-color">审批结果</td>
+ <td class="w-25" :class="item.approveStatus==3?'redTit':''">{{item.approveStatus==1?'未审批':item.approveStatus==2?'通过':'未通过'}}</td>
+ </tr>
+ <tr>
+ <td class="w-25 m-color autoheight">审批意见</td>
+ <td class="w-75 autoheight l-border">
+ {{ item.approveDesc }}
+ </td>
+ </tr>
+ </template>
+ </template>
</table>
</el-form>
<template #footer>
<span class="dialog-footer" style="padding-top:10px;text-align: center !important;">
<el-button @click="reportDialogState.reportDialogVisible = !reportDialogState.reportDialogVisible" size="default">取 消</el-button>
<el-button type="primary" v-if="!reportDialogState.disabled" @click="onSubmitProject()" size="default">提交审批</el-button>
+ <el-button type="primary" v-if="reportDialogState.disabled" @click="startGeneration()" size="default">导出评估报告</el-button>
</span>
</template>
</el-dialog>
@@ -186,13 +227,14 @@
<script setup lang="ts">
import {defineAsyncComponent, nextTick, onMounted, reactive, ref} from "vue";
+import {generateWordDocument} from "/@/views/experiment/developing/components/exportWord.js";
import {ElMessage} from "element-plus";
import {projectApi} from "/@/api/experiment/project";
import {personApi} from "/@/api/basic/person";
import {userApi} from "/@/api/systemManage/user";
import {roomApi} from "/@/api/basic/room";
import {assessApplyApi} from "/@/api/analyse/assessApply";
-
+const typeValue = ref([])
const SelectDanger = defineAsyncComponent(() => import('./selectDanger.vue'))
const selectDangerRef = ref()
const reportFormRef = ref()
@@ -220,7 +262,10 @@
riskSource: [],
riskSourceType: [],
description: '',
- person:[]
+ person:[],
+ process: '',
+ experimentAndType: [],
+ oldRiskAssess: []
},
reportFormRules: {
assessPerson: [{ required: true, message: '请填写评估人员', trigger: 'blur' }],
@@ -230,6 +275,7 @@
},
allPersonList: [],
allRoomList: [],
+ phaList: [],
systemPersonList: [],
experimentTypeList: [
{id: 1, name: '化学类'},
@@ -238,7 +284,23 @@
{id: 4, name: '机电类'},
{id: 5, name: '特种设备类'},
{id: 6, name: '其它类'}
- ]
+ ],
+ riskSourceTypeList: [
+ {id: 1, name: '化学安全'},
+ {id: 2, name: '辐射安全'},
+ {id: 3, name: '生物安全'},
+ {id: 4, name: '机电安全'},
+ {id: 5, name: '电气安全'},
+ {id: 6, name: '激光安全'},
+ {id: 7, name: '特种设备安全'},
+ {id: 8, name: '其他安全'},
+ ],
+ riskLevelList: [
+ {id: 1, name: '重大风险(一级)'},
+ {id: 2, name: '较大风险(二级)'},
+ {id: 3, name: '一般风险(三级)'},
+ {id: 4, name: '低风险(四级)'},
+ ],
})
const showReportDialog = (title: string, value: ProjectType, allRoomList: RoomType []) => {
@@ -256,6 +318,10 @@
// reportDialogState.reportForm[i] = value[i];
// }
// }
+ reportDialogState.reportForm.riskSource = []
+ setTimeout(()=>{
+ selectDangerRef.value.dangerSourceState.dangerList = []
+ },2000)
}else if(title === '修改'){
reportDialogState.title = '修改报告';
reportDialogState.disabled = false
@@ -279,7 +345,8 @@
experimentId: id,
pageIndex: 1,
pageSize: 10,
- tag: 3
+ tag: 3,
+ exportTag:true
});
if(res.data.code === 100){
reportDialogState.reportForm = {
@@ -302,12 +369,15 @@
riskSource: [],
riskSourceType: [],
description: '',
- person:[]
+ person:[],
+ process: '',
+ experimentAndType: [],
+ oldRiskAssess: []
}
if(res.data.data&&res.data.data.length==0){
ElMessage({
type: 'warning',
- message: '暂时无法获取实验信息,可能与用户身份有关'
+ message: '暂时无法获取实验信息,可能评估流程未完成,用户无法查看'
});
}else{
for(let i in reportDialogState.reportForm) {
@@ -315,6 +385,9 @@
reportDialogState.reportForm[i] = res.data.data[0][i];
}
}
+ reportDialogState.phaList = res.data.data[0].riskPlanMethodBO ?res.data.data[0].riskPlanMethodBO: []
+ const arr = reportDialogState.reportForm.experimentAndType.map(item => item.type.experimentType)
+ typeValue.value = arr.join(',')
}
}else{
ElMessage({
@@ -343,9 +416,14 @@
const onSubmitProject = () => {
reportFormRef.value.validate(async(valid: boolean) => {
if(valid){
- const { id,assessPerson,safeRiskAnalysis,assessLevel,description } = reportDialogState.reportForm
- const data = { id,assessPerson,safeRiskAnalysis,assessLevel,description }
+ reportDialogState.reportForm.riskSource = selectDangerRef.value.dangerSourceState.dangerList
+ const { id,assessPerson,riskSource,safeRiskAnalysis,assessLevel,description } = reportDialogState.reportForm
+ const data = { id,assessPerson,riskSource,safeRiskAnalysis,assessLevel,description }
if(reportDialogState.title === '提交报告'){
+ for(let i in data.riskSource){
+ riskSource[i].reportId = data.id
+ riskSource[i].riskSourceIndex = i + 1
+ }
let res = await assessApplyApi().updateRiskReport(data);
if(res.data.code === 100){
emit('refresh')
@@ -387,10 +465,13 @@
const getPersonList = async () => {
let res = await userApi().getUserList({
- roleId: 1,
- usePage: false,
pageIndex: 1,
- pageSize: 10
+ pageSize: 99999,
+ searchParams:{
+ roleId: null,
+ name: '',
+ realName: ''
+ }
});
if(res.data.code === 100){
reportDialogState.systemPersonList = JSON.parse(JSON.stringify(res.data.data));
@@ -412,6 +493,84 @@
message: res.data.msg
})
}
+};
+
+const templatePath = '/static/exampleScience.docx'
+const startGeneration = async () => {
+ const data = JSON.parse(JSON.stringify(reportDialogState.reportForm))
+ const experimentTypeNameList = data.experimentAndType.map(item => {
+ return {
+ id: item.type.id,
+ experimentType: item.type.experimentType
+ }
+ })
+
+ const experimentTypeListExample = JSON.parse(JSON.stringify(reportDialogState.experimentTypeList))
+ experimentTypeListExample.forEach(item => {
+ if(experimentTypeNameList.some(i => i.experimentType == item.name)){
+ item.label = item.name
+ item.checked = false
+ }else {
+ item.label = item.name
+ item.checked = true
+ }
+ })
+ data.typeList = experimentTypeListExample
+ data.depNameList = data.dep
+ const siteTest = data.experimentSite.map(item => item.siteName)
+ data.siteList = siteTest.join(',')
+
+ const riskType = data.riskSourceType.filter(item => item.status == 1)
+ const riskListExample = reportDialogState.riskSourceTypeList
+ riskListExample.forEach(item => {
+ if(riskType.some(i => i.riskSourceType === item.name)){
+ item.label = item.name
+ item.checked = false
+ }else {
+ item.label = item.name
+ item.checked = true
+ }
+ })
+ data.riskList = riskListExample
+
+ const level = data.assessLevel.toString().split(',')
+ const levelExample = JSON.parse(JSON.stringify(reportDialogState.riskLevelList))
+ levelExample.forEach(item => {
+ if(level.some(i => i == item.id)){
+ item.label = item.name
+ item.checked = false
+ }else {
+ item.label = item.name
+ item.checked = true
+ }
+ })
+ data.riskLevel = levelExample
+ // data.tableData = data.oldRiskAssess ?data.oldRiskAssess: []
+ data.phaData = reportDialogState.phaList.map(item=>{
+ return {
+ ...item,
+ riskLevelName: item.riskLevel == 1?'低风险':item.riskLevel == 2?'一般风险':item.riskLevel == 3?'较大风险':item.riskLevel == 4?'重大风险':'--'
+ }
+ })
+ data.riskSource = data.riskSource ? data.riskSource.map(item => {
+ return {
+ ...item,
+ description: item.description ? item.description: ''
+ }
+ }) : []
+
+ data.safeRiskAnalysis = data.safeRiskAnalysis ?data.safeRiskAnalysis : ''
+
+ console.log(data,'data')
+
+ try {
+ generateWordDocument(templatePath, data, `材料科学姑苏实验室安全风险评估表---${data.experimentName}.docx`);
+ } catch (error){
+ ElMessage({
+ type: 'warning',
+ message: '失败'
+ });
+ }
};
const emit = defineEmits(['refresh']);
@@ -514,6 +673,10 @@
width: 75%;
}
+&.redTit{
+ color: red;
+}
+
.ant-input {
height: 100%;
border: none;
@@ -536,7 +699,22 @@
.m-color {
color: #0c4995;
}
-
+.tag-style{
+ width: 58px;
+ margin-left: 20px;
+}
+.tag-bg1 {
+ background: rgba(255,0,0,0.65);
+}
+.tag-bg2 {
+ background: rgba(248,82,8,0.65);
+}
+.tag-bg3 {
+ background: rgba(247,255,0,0.65);
+}
+.tag-bg4 {
+ background: rgba(0,112,192,0.65);
+}
.roomSelect{
::v-deep(.el-popper){
.el-select-dropdown__item{
@@ -582,6 +760,41 @@
display: flex;
justify-content: center;
}
+:deep(.el-tag){
+ border: none;
+}
</style>
+<style>
+.checkTip{
+ .is-disabled{
+ .el-checkbox__label{
+ color: #606266 !important
+ }
+ .el-radio__label{
+ color: #606266 !important
+ }
+ &.is-checked{
+ .el-checkbox__label{
+ color: #409eff !important
+ }
+ .el-radio__label{
+ color: #409eff !important
+ }
+ .el-checkbox__inner{
+ background-color: #409eff;
+ &::after{
+ border-color: #fff !important
+ }
+ }
+ .el-radio__inner{
+ background-color: #409eff !important;
+ &::after{
+ background-color: #fff !important
+ }
+ }
+ }
+ }
+}
+</style>
\ No newline at end of file
--
Gitblit v1.9.2