From 36e71978a92ee64375b2c339e5e05d47b6b23fba Mon Sep 17 00:00:00 2001 From: 马宇豪 <978517621@qq.com> Date: 星期五, 14 四月 2023 15:18:58 +0800 Subject: [PATCH] 修改接口和页面 --- src/api/analyse/assessApply/index.ts | 40 + src/views/analyse/applyReview/components/reportDialog.vue | 583 ++++++++++++++ src/views/analyse/assessApply/index.vue | 35 src/views/analyse/evaluate/components/evaluateDialog.vue | 75 + src/views/experiment/developing/index.vue | 2 src/views/analyse/applyReview/index.ts | 22 src/api/analyse/plan/index.ts | 8 src/views/analyse/plan/components/planDialog.vue | 13 src/stores/userInfo.ts | 2 src/views/analyse/plan/index.vue | 214 ++++- src/views/analyse/plan/index.ts | 12 src/views/loginPage/component/accountLogin.vue | 1 src/views/experiment/project/index.vue | 2 src/layout/navMenu/vertical.vue | 4 src/theme/element.scss | 8 src/views/analyse/identify/index.vue | 2 src/views/analyse/assessApply/index.ts | 26 src/views/analyse/applyReview/index.vue | 375 +++++++++ src/views/analyse/evaluate/index.vue | 11 src/theme/app.scss | 5 src/views/analyse/assessApply/components/reportDialog.vue | 329 +++++--- src/views/analyse/applyReview/components/selectDanger.vue | 191 ++++ src/views/analyse/assessApply/components/riskDialog.vue | 6 src/views/analyse/assessApply/components/riskUnitDialog.vue | 318 ++++---- src/views/analyse/assessApply/components/selectDanger.vue | 51 25 files changed, 1,913 insertions(+), 422 deletions(-) diff --git a/src/api/analyse/assessApply/index.ts b/src/api/analyse/assessApply/index.ts index 5da7169..ef094b5 100644 --- a/src/api/analyse/assessApply/index.ts +++ b/src/api/analyse/assessApply/index.ts @@ -9,5 +9,45 @@ data: params }); }, + + getRiskReportPage: (params: object) => { + return request({ + url: import.meta.env.VITE_API_URL + '/report/select/selectRiskReportPage', + method: 'post', + data: params + }); + }, + + toRiskReport: (params: object) => { + return request({ + url: import.meta.env.VITE_API_URL + '/report/insert/insertRiskReport', + method: 'post', + data: params + }); + }, + + updateRiskReport: (params: object) => { + return request({ + url: import.meta.env.VITE_API_URL + '/report/update/updateRiskReport', + method: 'post', + data: params + }); + }, + + updateRiskReportInfo: (params: object) => { + return request({ + url: import.meta.env.VITE_API_URL + '/report/update/updateRiskReportInfo', + method: 'post', + data: params + }); + }, + + uploadReport: (params: object) => { + return request({ + url: import.meta.env.VITE_API_URL + '/report/update/report', + method: 'post', + data: params + }); + }, }; } diff --git a/src/api/analyse/plan/index.ts b/src/api/analyse/plan/index.ts index 2e01c70..ebfbbc2 100644 --- a/src/api/analyse/plan/index.ts +++ b/src/api/analyse/plan/index.ts @@ -72,6 +72,14 @@ method: 'post', data: params }); + }, + + reSendJob: (params: object)=>{ + return request({ + url: import.meta.env.VITE_API_URL + '/risk/update/appoint', + method: 'post', + data: params + }); } }; } diff --git a/src/layout/navMenu/vertical.vue b/src/layout/navMenu/vertical.vue index bfd7d2d..df202f8 100644 --- a/src/layout/navMenu/vertical.vue +++ b/src/layout/navMenu/vertical.vue @@ -2,10 +2,12 @@ <el-menu router :default-active="defaultActive" - background-color="transparent" :collapse="isCollapse" :unique-opened="true" :collapse-transition="false" + active-text-color="#6ff8ff" + background-color="transparent" + text-color="#fff" > <template v-for="val in menuLists"> <el-sub-menu :index="val.path" v-if="val.children && val.children.length > 0" :key="val.path"> diff --git a/src/stores/userInfo.ts b/src/stores/userInfo.ts index edbe1ed..b91560b 100644 --- a/src/stores/userInfo.ts +++ b/src/stores/userInfo.ts @@ -25,7 +25,7 @@ async setUserInfos(value: any) { this.userInfos.userName = value.realName; this.userInfos.uid = value.uid; - this.userInfos.roles = value.role; + this.userInfos.roles = value.roles; this.userInfos.depId = value.depId // const userName = Cookies.get('userName'); // // 模拟数据 diff --git a/src/theme/app.scss b/src/theme/app.scss index 4c75296..431c504 100644 --- a/src/theme/app.scss +++ b/src/theme/app.scss @@ -47,7 +47,8 @@ width: 100%; height: 100%; .layout-aside { - background: var(--next-bg-menuBar); + //background: var(--next-bg-menuBar); + background: #384358; box-shadow: 2px 0 6px rgb(0 21 41 / 1%); height: inherit; position: relative; @@ -86,6 +87,8 @@ .layout-aside-pc-220 { width: 220px !important; transition: width 0.3s ease; + border-radius: 0 8px 8px 0; + box-shadow: 5px 0 10px rgba(0,0,0,.15); } .layout-aside-pc-64 { width: 64px !important; diff --git a/src/theme/element.scss b/src/theme/element.scss index 6e71c98..979f6a8 100644 --- a/src/theme/element.scss +++ b/src/theme/element.scss @@ -62,10 +62,12 @@ .el-menu { border-right: none !important; width: 220px; + padding: 0 5px 0 0; } .el-menu-item { height: 56px !important; line-height: 56px !important; + border-radius: 8px !important;; } .el-menu-item, .el-sub-menu__title { @@ -91,6 +93,12 @@ @include generalIcon; } // 水平菜单、横向菜单高亮 背景色,鼠标 hover 时,有子级菜单的背景色 +.el-menu-item.is-active{ + padding: 0 10px; + box-sizing: border-box; + border-radius: 8px; + border: 1px solid rgba(111,248,255,.2); +} .el-menu-item.is-active, .el-sub-menu.is-active .el-sub-menu__title, .el-sub-menu:not(.is-opened):hover .el-sub-menu__title { diff --git a/src/views/analyse/applyReview/components/reportDialog.vue b/src/views/analyse/applyReview/components/reportDialog.vue new file mode 100644 index 0000000..5724dfa --- /dev/null +++ b/src/views/analyse/applyReview/components/reportDialog.vue @@ -0,0 +1,583 @@ +<template> + <div class="system-menu-dialog-container"> + <el-dialog :title="reportDialogState.title" v-model="reportDialogState.reportDialogVisible" width="80%"> + <div style="text-align: center;font-size: 20px;font-weight: bolder;color: #0c4995">{{reportDialogState.reportForm.experimentName}}实验安全风险评估报告表(带<span style="color: red">*</span>为填写内容)</div> + <el-form ref="reportFormRef" :rules="reportDialogState.reportFormRules" :model="reportDialogState.reportForm" size="default" label-width="0"> + <table class="report-table"> + <th class="m-color b-font" style="text-align: center">实验基本信息</th> + <tr> + <td class="w-25 m-color">实验名称</td> + <td class="w-75 m-color"> + <el-form-item prop="experimentName"> + <el-input readonly v-model="reportDialogState.reportForm.experimentName" placeholder="请输入实验名称" /> + </el-form-item> + </td> + </tr> + <tr> + <td class="w-25 m-color">实验类型</td> + <td class="w-75" style="text-align: left;padding-left: 11px"> +<!-- <el-radio-group style="text-align: center" disabled v-model="reportDialogState.reportForm.experimentType">--> +<!-- <el-radio :label="1">化学类</el-radio>--> +<!-- <el-radio :label="2">生物类</el-radio>--> +<!-- <el-radio :label="3">辐射类</el-radio>--> +<!-- <el-radio :label="4">机电类</el-radio>--> +<!-- <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}} + </td> + </tr> + <tr> + <td class="w-25 m-color">负责人</td> + <td class="w-25 m-color"> +<!-- <el-select style="width: 100%" disabled v-model="reportDialogState.reportForm.liabilityUserId" clearable filterable @change="getLiabilityUserPhone($event)">--> +<!-- <el-option--> +<!-- v-for="item in reportDialogState.systemPersonList"--> +<!-- :key="item.id"--> +<!-- :value="item.id"--> +<!-- :label="item.realName"--> +<!-- ></el-option>--> +<!-- </el-select>--> + <el-input readonly v-model="reportDialogState.reportForm.personUser" /> + </td> + <td class="w-25 m-color">电话</td> + <td class="w-25 m-color"> + <el-input disabled v-model="reportDialogState.reportForm.personUserPhone" /> + </td> + </tr> + <tr> + <td class="w-25 m-color">安全负责人</td> + <td class="w-25 m-color"> +<!-- <el-select v-if="reportDialogState.reportForm.safeLiabilityUserId" style="width: 100%" disabled v-model="reportDialogState.reportForm.safeLiabilityUserId" @change="getSafeLiabilityUserPhone($event)" 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 v-model="reportDialogState.reportForm.safePersonUser" /> + </td> + <td class="w-25 m-color">电话</td> + <td class="w-25 m-color"> + <el-input readonly v-model="reportDialogState.reportForm.safePersonUserPhone" /> + </td> + </tr> + <tr> + <td class="w-25 m-color">部门</td> + <td class="w-75 m-color"> + <el-input readonly v-model="reportDialogState.reportForm.dep" /> + </td> + </tr> + <tr class="m-color b-font" style="text-align: center">实验场所</tr> + <tr> + <td class="w-14 m-color">场所名称</td> + <td class="w-14 m-color">所在楼栋</td> + <td class="w-14 m-color">房间</td> + <td class="w-14 m-color">有无消防设施</td> + <td class="w-14 m-color">有无隔断</td> + <td class="w-14 m-color">场所性质</td> + </tr> + <tr v-for="(item,index) in reportDialogState.reportForm.experimentSite" :key="index"> + <td class="w-14"> +<!-- <el-select disabled filterable v-model="item.siteId">--> +<!-- <el-option--> +<!-- v-for="item in reportDialogState.allRoomList"--> +<!-- :key="item.id"--> +<!-- :value="item.id"--> +<!-- :label="item.siteName"--> +<!-- >--> +<!-- </el-option>--> +<!-- </el-select>--> + <el-input disabled v-model="item.siteName" /> + </td> + <td class="w-14"> + <el-input disabled v-model="item.floor" /> + </td> + <td class="w-14"> + <el-input disabled v-model="item.room" /> + </td> + <td class="w-14"> + <div>{{item.fireFacilities== 1 ? '有' : item.fireFacilities== 2 ? '无' : ''}}</div> + </td> + <td class="w-14"> + <div>{{item.partitionStatus == 1 ? '有' : item.partitionStatus == 2 ? '无' : ''}}</div> + </td> + <td class="w-14"> + <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="(简要描述实验原理、实验步骤、所用试剂或材料设备等)" /> + </tr> + <tr class="m-color b-font" style="text-align: center">实验涉及的危险源</tr> + <tr> + <td class="w-25 m-color">危险源种类</td> + <td class="w-75 m-color"> +<!-- <el-radio-group disabled v-model="reportDialogState.reportForm.dangerSource">--> +<!-- <el-radio :label="1">化学安全</el-radio>--> +<!-- <el-radio :label="2">辐射安全</el-radio>--> +<!-- <el-radio :label="3">特种设备安全</el-radio>--> +<!-- <el-radio :label="4">机电安全</el-radio>--> +<!-- <el-radio :label="5">电气安全</el-radio>--> +<!-- <el-radio :label="6">生物安全</el-radio>--> +<!-- <el-radio :label="7">激光安全</el-radio>--> +<!-- <el-radio :label="8">其他安全</el-radio>--> +<!-- </el-radio-group>--> + <el-checkbox-group disabled> + <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" style="text-align: center">拟采取的防护和应急措施</tr> + <tr> + <el-input type="textarea" :autosize="{ minRows: 3}" disabled v-model="reportDialogState.reportForm.emergencyMeasure" placeholder="" /> + </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> + </el-radio-group> + </td> + </tr> + <tr> + <el-input type="textarea" :autosize="{ minRows: 3}" :disabled="reportDialogState.disabled" v-model="reportDialogState.reportForm.description" placeholder="评定依据(必填)" /> + </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" 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">{{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> + </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> + </span> + </template> + </el-dialog> + </div> +</template> + +<script setup lang="ts"> +import {defineAsyncComponent, nextTick, onMounted, reactive, ref} from "vue"; +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 SelectDanger = defineAsyncComponent(() => import('./selectDanger.vue')) +const selectDangerRef = ref() +const reportFormRef = ref() +const reportDialogState = reactive<ReportDialogType>({ + title: '', + disabled: false, + reportDialogVisible: false, + reportForm: { + id: null, + experimentName: "", + experimentType: null, + personUser: '', + personUserId: null, + personUserPhone: '', + safePersonUserId: null, + safePersonUser: '', + safePersonUserPhone: '', + dep: "", + experimentSite: [], + experimentDesc: '', + emergencyMeasure: '', + assessPerson:'', + safeRiskAnalysis: '', + assessLevel:null, + riskSource: [], + riskSourceType: [], + description: '', + person: [] + }, + reportFormRules: { + assessPerson: [{ required: true, message: '请填写评估人员', trigger: 'blur' }], + safeRiskAnalysis: [{ required: true, message: '请填写安全风险分析', trigger: 'blur' }], + assessLevel: [{ required: true, message: '请选择风险等级评定', trigger: 'blur' }], + description: [{ required: true, message: '请填写风险等级评定依据', trigger: 'blur' }], + }, + allPersonList: [], + allRoomList: [], + systemPersonList: [], + experimentTypeList: [ + {id: 1, name: '化学类'}, + {id: 2, name: '生物类'}, + {id: 3, name: '辐射类'}, + {id: 4, name: '机电类'}, + {id: 5, name: '特种设备类'}, + {id: 6, name: '其它类'} + ] +}) + +const showReportDialog = (title: string, value: ProjectType, allRoomList: RoomType []) => { + getReportData(value.experimentId) + reportDialogState.reportDialogVisible = true; + reportDialogState.allRoomList = allRoomList + setTimeout(() => { + reportFormRef.value.clearValidate(); + }); + if(title === '提交'){ + reportDialogState.title = '提交报告'; + reportDialogState.disabled = false + // for(let i in reportDialogState.reportForm) { + // if(isValidKey(i, reportDialogState.reportForm)) { + // reportDialogState.reportForm[i] = value[i]; + // } + // } + }else if(title === '修改'){ + reportDialogState.title = '修改报告'; + reportDialogState.disabled = false + }else{ + reportDialogState.title = '查看'; + reportDialogState.disabled = true + // for(let i in reportDialogState.reportForm) { + // if(isValidKey(i, reportDialogState.reportForm)) { + // reportDialogState.reportForm[i] = value[i]; + // } + // } + } +}; + +const isValidKey = (key: string | number | symbol, object:object): key is keyof typeof object =>{ + return key in object; +}; + +const getReportData = async (id:number|null|undefined) => { + let res = await assessApplyApi().getRiskReportPage({ + experimentId: id, + pageIndex: 1, + pageSize: 10, + tag: 3 + }); + if(res.data.code === 100){ + for(let i in reportDialogState.reportForm) { + if(isValidKey(i, reportDialogState.reportForm)) { + reportDialogState.reportForm[i] = res.data.data[0][i]; + } + } + console.log(reportDialogState.reportForm,'reportDialogState.reportForm') + }else{ + ElMessage({ + type: 'warning', + message: res.data.msg + }); + } +}; + +// const getLiabilityUserPhone = (value: number)=>{ +// const data = reportDialogState.systemPersonList.find(item => item.id === value) as AllPersonListType +// reportDialogState.reportForm.liabilityUserPhone = data.phone +// } +// +// const getSafeLiabilityUserPhone = (value: number)=>{ +// const data = reportDialogState.allPersonList.find(item => item.id === value) as AllPersonListType +// reportDialogState.reportForm.safeLiabilityUserPhone = data.phone +// } + +// const hasSafeSystem = (value: number) =>{ +// if(value == 2){ +// reportDialogState.reportForm.safeInformationSystem = '' +// } +// } + +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 } + if(reportDialogState.title === '提交报告'){ + let res = await assessApplyApi().updateRiskReport(data); + if(res.data.code === 100){ + emit('refresh') + reportDialogState.reportDialogVisible = false; + ElMessage({ + type: 'success', + message: '提交报告成功' + }) + }else{ + ElMessage({ + type: 'warning', + message: res.data.msg, + }); + } + }else{ + let res = await assessApplyApi().updateRiskReportInfo(data) + if(res.data.code === 100){ + emit('refresh') + reportDialogState.reportDialogVisible = false; + ElMessage({ + type: 'success', + message: '修改报告成功' + }) + }else{ + ElMessage({ + type: 'warning', + message: res.data.msg, + }); + } + } + }else{ + ElMessage({ + type: 'warning', + message: '请完善基本信息', + }); + } + }) +}; + +const getPersonList = async () => { + let res = await userApi().getUserList({ + roleId: 1, + usePage: false, + pageIndex: 1, + pageSize: 10 + }); + if(res.data.code === 100){ + reportDialogState.systemPersonList = JSON.parse(JSON.stringify(res.data.data)); + }else{ + ElMessage({ + type: 'warning', + message: res.data.msg + }) + } +}; + +const getAllPersonList = async () => { + let res = await personApi().getAllPerson(); + if(res.data.code === 100){ + reportDialogState.allPersonList = JSON.parse(JSON.stringify(res.data.data)); + }else{ + ElMessage({ + type: 'warning', + message: res.data.msg + }) + } +}; + +const emit = defineEmits(['refresh']); + +defineExpose({ + showReportDialog, +}); + +onMounted(() => { + getAllPersonList(); + getPersonList() +}); +</script> + +<style scoped lang="scss"> +.site-layout-background { + background: #fff; +} + +.report-table { + width: 100%; + border-collapse: collapse; + border: 1px solid #337ecc; + margin: 20px 0; + +th { + padding: 10px 0; + border: 1px solid #337ecc; + border-left: none; +} + +tr { + width: 100%; + height: 44px; + line-height: 42px; + border-bottom: 1px solid #ccc; + + &.required { + &::before { + content: "*"; + display: inline-block; + color: red; + } + } + +&:last-of-type { + border-bottom: none; + } + + td { + border-right: 1px solid #ccc; + display: inline-block; + height: 44px; + vertical-align: middle; + text-align: center; + line-height: 42px; + + :deep(.el-input__wrapper ){ + box-shadow: none; + margin-top: 6px; + } + + &:last-of-type { + border-right: none; + } + + &.required { + &::before { + content: "*"; + display: inline-block; + color: red; + } + } + + &.w-14 { + width: calc((100/7)/100 * 100%); + } + + &.w-16 { + width: calc((100/6)/100 * 100%); + } + + &.w-18 { + width: 16.59%; + } + + &.w-20 { + width: 20%; + } + + &.w-25 { + width: 25%; + } + + &.w-50 { + width: 50%; + } + + &.w-75 { + width: 75%; + } + + &.autoheight { + min-height: 44px; + height: auto; + } + + &.l-border{ + border-left: 1px solid #ccc; + } + + .ant-input { + height: 100%; + border: none; + background: #f5f7fa; + } + + .ant-picker { + width: 100%; + height: 100%; + } + } +} + +.b-font { + font-size: 16px; + font-weight: bolder; +} +} + +.m-color { + color: #0c4995; +} + +.roomSelect{ + ::v-deep(.el-popper){ + .el-select-dropdown__item{ + height: auto; + padding: 0; + + .roomTable{ + width: 100%; + display: flex; + border-bottom: 1px solid #ebeef5; + + &:last-of-type{ + border-bottom: none; + } + + &>div{ + width: 25%; + border-right: 1px dashed #ebeef5; + &:last-of-type{ + border-right: none; + } + + div{ + width: 100%; + } + .roomTit{ + border-bottom: 1px solid #ebeef5; + } + } + } + } + .el-select-dropdown__item.selected{ + .roomTit{ + color: #606266; + font-weight: normal; + } + } + } +} + +:deep(.el-dialog__footer){ + padding-top: 20px; + display: flex; + justify-content: center; +} + + +</style> diff --git a/src/views/analyse/applyReview/components/selectDanger.vue b/src/views/analyse/applyReview/components/selectDanger.vue new file mode 100644 index 0000000..3094ea6 --- /dev/null +++ b/src/views/analyse/applyReview/components/selectDanger.vue @@ -0,0 +1,191 @@ +<template> + <tr class="m-color b-font" style="text-align: center">主要危险源或有害因素</tr> + <tr> + <td class="w-20 m-color">序号</td> + <td class="w-20 m-color">危险源或有害因素</td> + <td class="w-20 m-color">危险特性</td> + <td class="w-20 m-color">数量</td> + <td class="w-20 m-color">其他说明</td> +<!-- <td class="w-18 m-color">操作</td>--> + </tr> + <tr v-for="(item,index) in dangerSourceState.dangerList" :key="index"> + <td class="w-20"> + {{ index + 1 }} + </td> + <td class="w-20"> + <el-input disabled v-model="item.riskSource"></el-input> + </td> + <td class="w-20"> + <el-input disabled v-model="item.riskCharacteristic"></el-input> + </td> + <td class="w-20"> + <el-input disabled type="number" v-model="item.number"></el-input> + </td> + <td class="w-20"> + <el-input disabled v-model="item.description"></el-input> + </td> +<!-- <td class="w-18">--> +<!-- <el-button disabled type="danger" @click="deleteDangerItem(index)">删除</el-button>--> +<!-- </td>--> + </tr> +<!-- <tr style="text-align: center">--> +<!-- <el-button :disabled="dangerSourceState.disabled" type="primary" shape="round" @click="addDangerItem()">--> +<!-- 添加行--> +<!-- </el-button>--> +<!-- </tr>--> +</template> + +<script setup lang="ts"> +import {reactive, watchEffect} from "vue"; + +let props = defineProps({ + disabled: Boolean, + data: Array<DangerListType> +}); + +const dangerSourceState = reactive<DangerSourceType>({ + disabled: false, + dangerList: [], + classifyList:[ + {id:1, name: '有机'}, + {id:2, name: '酸'}, + {id:3, name: '碱性'}, + {id:4, name: '固体废弃物'}, + {id:5, name: '医疗废弃物'}, + {id:6, name: '过期化学品'}, + {id:7, name: '其他'} + ], + wasteStorageList: [ + {id:1, name: '吨袋'}, + {id:2, name: '吨桶'}, + {id:3, name: '小桶'}, + {id:4, name: '托盘'}, + {id:5, name: '其他'}, + ] +}) + +watchEffect(() => { + dangerSourceState.dangerList = props.data as Array<DangerListType> + dangerSourceState.disabled = props.disabled +}); + +const addDangerItem = () => { + dangerSourceState.dangerList.push({riskSource: '', riskCharacteristic: '', number: null, description: ''}); +}; + +const deleteDangerItem = (index: number) => { + dangerSourceState.dangerList.splice(index,1); +}; + +const formatList = (formatList: Array<DangerListType>) => { + dangerSourceState.dangerList = formatList +} + +defineExpose({ + formatList, + dataList: dangerSourceState.dangerList, +}); + +</script> + +<style scoped lang="scss"> +.site-layout-background { + background: #fff; +} + +.report-table { + width: 100%; + border-collapse: collapse; + border: 1px solid #337ecc; + margin: 20px 0; + + th { + padding: 10px 0; + border: 1px solid #337ecc; + border-left: none; + } + + tr { + width: 100%; + height: 44px; + line-height: 42px; + border-bottom: 1px solid #ccc; + + &:last-of-type { + border-bottom: none; + } + + td { + border-right: 1px solid #ccc; + display: inline-block; + height: 44px; + vertical-align: middle; + text-align: center; + line-height: 42px; + + &:last-of-type { + border-right: none; + } + + &.required { + &::before { + content: "*"; + display: inline-block; + color: red; + } + } + + &.w-14 { + width: calc((100/7)/100 * 100%); + } + + &.w-16 { + width: calc((100/6)/100 * 100%); + } + + &.w-18 { + width: 16.59%; + } + + &.w-20 { + width: 20%; + } + + &.w-25 { + width: 25%; + } + + &.w-50 { + width: 50%; + } + + &.w-75 { + width: 75%; + } + + .ant-input { + height: 100%; + border: none; + background: #f5f7fa; + } + + .ant-picker { + width: 100%; + height: 100%; + } + } + } + + .b-font { + font-size: 16px; + font-weight: bolder; + } +} + +.m-color { + color: #0c4995; +} +:deep(.el-input__wrapper ){ + box-shadow: none; +} +</style> diff --git a/src/views/analyse/applyReview/index.ts b/src/views/analyse/applyReview/index.ts new file mode 100644 index 0000000..54ff4ce --- /dev/null +++ b/src/views/analyse/applyReview/index.ts @@ -0,0 +1,22 @@ +declare interface reportReviewStateType { + developData?: Array<ProjectType> + searchQuery: { + pageIndex: number | null, + pageSize: number | null, + tag: number | null, + experimentName: string, + experimentType: null | number, + }, + total: 0, + experimentTypeList: Type [] + allRoomList: RoomType [], + reviewDialogVisible: boolean, + reviewForm:{ + id: number | null + approveStatus: null | number + approveDesc: string + }, + rules:object, + isManage: boolean + isLeader: boolean +} \ No newline at end of file diff --git a/src/views/analyse/applyReview/index.vue b/src/views/analyse/applyReview/index.vue new file mode 100644 index 0000000..3ece568 --- /dev/null +++ b/src/views/analyse/applyReview/index.vue @@ -0,0 +1,375 @@ +<template> + <div class="home-container"> + <div style="height: 100%"> + <el-row class="homeCard"> + <div class="basic-line"> + <span>实验名称:</span> + <el-input v-model="developState.searchQuery.experimentName" clearable filterable class="input-box" placeholder="实验名称"> + </el-input> + </div> +<!-- <div class="basic-line">--> +<!-- <span>实验类型:</span>--> +<!-- <el-select v-model="developState.searchQuery.experimentType" clearable filterable class="input-box" placeholder="实验类型">--> +<!-- <el-option v-for="item in developState.experimentTypeList" :key="item.id" :label="item.name" :value="item.id"></el-option>--> +<!-- </el-select>--> +<!-- </div>--> + <div style="padding-bottom: 10px"> + <el-button type="primary" @click="getReportData">查询</el-button> + <el-button plain @click="reset">重置</el-button> + </div> + </el-row> + <div class="homeCard"> + <div class="main-card"> + <el-row class="cardTop"> + </el-row> + <el-table ref="multipleTableRef" :data="developState.developData" style="width: 100%" height="calc(100% - 100px)" :header-cell-style="{ background: '#fafafa' }"> + <el-table-column prop="experimentCode" label="实验编号"/> + <el-table-column prop="experimentName" label="实验名称"/> + <el-table-column prop="createExperimentTime" label="评价时间"> + <template #default="scope"> + <span>{{scope.row.evaluateTime?scope.row.evaluateTime.substring(0,16):'--'}}</span> + </template> + </el-table-column> + <el-table-column prop="startTime" label="报告提交时间" show-overflow-tooltip> + <template #default="scope"> + <span>{{scope.row.updateTime?scope.row.updateTime.substring(0,16):'--'}}</span> + </template> + </el-table-column> +<!-- <el-table-column prop="experimentSite" label="实验场所" show-overflow-tooltip>--> +<!-- <template #default="scope">--> +<!-- <span>{{scope.row.experimentSite?.map(i=>i.siteName).join(',')}}</span>--> +<!-- </template>--> +<!-- </el-table-column>--> +<!-- <el-table-column prop="experimentType" label="实验类别">--> +<!-- <template #default="scope">--> +<!-- <span>{{developState.experimentTypeList.find(i=>i.id == scope.row.experimentType)?.name}}</span>--> +<!-- </template>--> +<!-- </el-table-column>--> + <el-table-column label="操作" width="250" fixed="right"> + <template #default="scope"> + <el-button size="small" text type="primary" v-if="(developState.isManage == true && !scope.row.person?.find(i=>i.approveIndex == 1))||(developState.isLeader == true && !scope.row.person?.find(i=>i.approveIndex == 2))" :icon="Edit" @click="openRiskDialog(scope.row)">审批</el-button> + <el-button size="small" text type="primary" :icon="Edit" @click="openReportDialog('查看',scope.row)">查看评估报告</el-button> + </template> + </el-table-column> + </el-table> + <div class="pageBtn"> + <el-pagination @size-change="onHandleSizeChange" @current-change="onHandleCurrentChange" :pager-count="5" :page-sizes="[10, 20, 30]" v-model:current-page="developState.searchQuery.pageIndex" background v-model:page-size="developState.searchQuery.pageSize" layout="total, sizes, prev, pager, next, jumper" :total="developState.total" class="page-position"> </el-pagination> + </div> + </div> + </div> + </div> + <report-dialog ref="ReportDialogRef" @refresh="getReportData"></report-dialog> + <el-dialog title="报告审批" v-model="developState.reviewDialogVisible" width="50%"> + <el-form ref="ruleFormRef" :rules="developState.rules" :model="developState.reviewForm" label-width="120px"> + <el-form-item label="审批结果" prop="approveStatus"> + <el-radio-group style="text-align: center" v-model="developState.reviewForm.approveStatus"> + <el-radio :label="2">通过</el-radio> + <el-radio :label="3">不通过</el-radio> + </el-radio-group> + </el-form-item> + <el-form-item label="意见填报" prop="approveDesc"> + <el-input v-model="developState.reviewForm.approveDesc" type="textarea" :autosize="{ minRows: 3 }" /> + </el-form-item> + </el-form> + <template #footer> + <span class="dialog-footer" style="padding-top:10px;text-align: center !important;"> + <el-button @click="developState.reviewDialogVisible = !developState.reviewDialogVisible" size="default">取 消</el-button> + <el-button type="primary" @click="onSubmitReview(ruleFormRef)" size="default">提交审批</el-button> + </span> + </template> + </el-dialog> + </div> +</template> + +<script setup lang="ts"> +import {defineAsyncComponent, onMounted, reactive, ref} from "vue"; +import {projectApi} from "/@/api/experiment/project"; +import {ElMessage, ElMessageBox} from "element-plus"; +import type { FormInstance, FormRules } from 'element-plus' +import { View,Edit, Plus, RefreshLeft } from '@element-plus/icons-vue'; +import {roomApi} from "/@/api/basic/room"; +import {assessApplyApi} from "/@/api/analyse/assessApply"; +import {useUserInfo} from "/@/stores/userInfo"; +import {storeToRefs} from "pinia"; +const userInfo = useUserInfo(); +const { userInfos } = storeToRefs(userInfo); +const ReportDialog = defineAsyncComponent(() => import('./components/reportDialog.vue')); + +const ReportDialogRef = ref(); +const ruleFormRef = ref<FormInstance>() +const developState = reactive<reportReviewStateType>({ + developData: [], + searchQuery: { + pageIndex: 1, + pageSize: 10, + experimentName: '', + experimentType: null, + tag: 2 + }, + total: 0, + experimentTypeList: [ + {id: 1, name: '化学类'}, + {id: 2, name: '生物类'}, + {id: 3, name: '辐射类'}, + {id: 4, name: '机电类'}, + {id: 5, name: '特种设备类'}, + {id: 6, name: '其它类'}, + ], + allRoomList: [], + reviewDialogVisible: false, + reviewForm:{ + id: null, + approveStatus: null, + approveDesc: '' + }, + isManage: false, + isLeader: false, + rules: { + approveDesc: [{ required: true, message: '请输入审批意见', trigger: 'blur' }], + approveStatus: [{ required: true, message: '请选择审批结果', trigger: 'blur' }] + } +}) + +const getReportData = async () => { + let res = await assessApplyApi().getRiskReportPage(developState.searchQuery); + if(res.data.code === 100){ + developState.developData = res.data.data; + developState.total = res.data.total; + }else{ + ElMessage({ + type: 'warning', + message: res.data.msg + }); + } +}; + + +const getAllRoom = async () => { + let res = await roomApi().getAllRoom(); + if(res.data.code === 100){ + developState.allRoomList = JSON.parse(JSON.stringify(res.data.data)); + }else{ + ElMessage({ + type: 'warning', + message: res.data.msg + }) + } +}; + +const openReportDialog = (title: string,value: ProjectType) =>{ + ReportDialogRef.value.showReportDialog(title, value, developState.allRoomList); +} + +const onSubmitReview = async (formEl: FormInstance | undefined) => { + if (!formEl) return + await formEl.validate(async(valid, fields) => { + if (valid) { + let res = await assessApplyApi().uploadReport(developState.reviewForm); + if(res.data.code === 100){ + ElMessage({ + type: 'success', + message: '审批提交成功' + }); + }else{ + ElMessage({ + type: 'warning', + message: res.data.msg + }); + } + developState.reviewForm = { + id: null, + approveStatus: null, + approveDesc: '' + }, + developState.reviewDialogVisible = false + getReportData() + } else { + console.log('error submit!', fields) + } + }) +} + +const openRiskDialog = (val)=>{ + developState.reviewForm.id = val.id + developState.reviewDialogVisible = true +} + +const onHandleSizeChange = (val: number) => { + developState.searchQuery.pageSize = val; + getReportData(); +}; + +const onHandleCurrentChange = (val: number) => { + developState.searchQuery.pageIndex = val; + getReportData(); +}; + +const reset = () => { + developState.searchQuery = { + pageIndex: 1, + pageSize: 10, + experimentName: '', + experimentType: null, + tag: 2 + } +}; + +onMounted(() => { + getReportData() + getAllRoom() + if(userInfos.value.roles?.find(i=>i.roleId == '4')){ + developState.isManage = true + } + if(userInfos.value.roles?.find(i=>i.roleId == '6')){ + developState.isLeader = true + } + console.log(developState.isManage,userInfos.value.roles) +}) + +</script> + +<style scoped lang="scss"> +$homeNavLengh: 8; +.home-container { + height: calc(100vh - 144px); + box-sizing: border-box; + overflow: hidden; + .homeCard { + width: 100%; + padding: 20px; + box-sizing: border-box; + background: #fff; + border-radius: 4px; + + .main-card { + width: 100%; + height: 100%; + .cardTop { + display: flex; + align-items: center; + justify-content: space-between; + margin-bottom: 20px; + .mainCardBtn { + margin: 0; + } + } + .pageBtn { + height: 60px; + display: flex; + align-items: center; + justify-content: right; + + .demo-pagination-block + .demo-pagination-block { + margin-top: 10px; + } + .demo-pagination-block .demonstration { + margin-bottom: 16px; + } + } + } + &:last-of-type { + height: calc(100% - 100px); + } + } + .el-row { + display: flex; + align-items: center; + margin-bottom: 20px; + &:last-child { + margin-bottom: 0; + } + .grid-content { + align-items: center; + min-height: 36px; + } + + .topInfo { + display: flex; + align-items: center; + font-size: 16px; + font-weight: bold; + + & > div { + white-space: nowrap; + margin-right: 20px; + } + } + } +} +.stepItem { + width: 100%; + display: flex; + align-items: flex-start; + margin-bottom: 30px; + margin-left: 30px; + padding-bottom: 30px; + border-left: 2px solid #ccc; + &:first-of-type { + margin-top: 30px; + } + &:last-of-type { + margin-bottom: 0; + border-left: none; + } + .stepNum { + width: 30px; + height: 30px; + border-radius: 15px; + box-sizing: border-box; + color: #333; + border: 1px solid #999; + line-height: 28px; + text-align: center; + margin-right: 10px; + margin-left: -16px; + margin-top: -30px; + } + .stepCard { + width: 100%; + margin-top: -30px; + + .box-card { + width: 100%; + &:deep(.el-card__header) { + padding: 10px 15px; + } + .card-header { + width: 100%; + display: flex; + justify-content: space-between; + align-items: center; + & > div:first-of-type { + margin-right: 80px; + font-size: 18px; + font-weight: bold; + } + } + } + } + &:hover .card-header { + color: #0098f5; + } + &:hover .stepNum { + border: 2px solid #0098f5; + color: #0098f5; + } +} + +:deep(.el-date-editor) { + width: 100%; +} +.el-select { + width: 100%; +} +:deep(.el-textarea.is-disabled .el-textarea__inner) { + background-color: var(--el-card-bg-color); + color: var(--el-input-text-color, var(--el-text-color-regular)); +} +:deep(.el-input.is-disabled .el-input__inner) { + color: var(--el-input-text-color, var(--el-text-color-regular)); +} +:deep(.el-input.is-disabled .el-input__wrapper) { + background-color: var(--el-card-bg-color); + box-shadow: none; +} +</style> diff --git a/src/views/analyse/assessApply/components/reportDialog.vue b/src/views/analyse/assessApply/components/reportDialog.vue index ae84a4e..95b484d 100644 --- a/src/views/analyse/assessApply/components/reportDialog.vue +++ b/src/views/analyse/assessApply/components/reportDialog.vue @@ -1,11 +1,12 @@ <template> <div class="system-menu-dialog-container"> <el-dialog :title="reportDialogState.title" v-model="reportDialogState.reportDialogVisible" width="80%"> + <div style="text-align: center;font-size: 20px;font-weight: bolder;color: #0c4995">{{reportDialogState.reportForm.experimentName}}实验安全风险评估报告表(带<span style="color: red">*</span>为填写内容)</div> <el-form ref="reportFormRef" :rules="reportDialogState.reportFormRules" :model="reportDialogState.reportForm" size="default" label-width="0"> <table class="report-table"> <th class="m-color b-font" style="text-align: center">实验基本信息</th> <tr> - <td class="w-25 m-color required">实验名称</td> + <td class="w-25 m-color">实验名称</td> <td class="w-75 m-color"> <el-form-item prop="experimentName"> <el-input readonly v-model="reportDialogState.reportForm.experimentName" placeholder="请输入实验名称" /> @@ -13,79 +14,82 @@ </td> </tr> <tr> - <td class="w-25 m-color required">实验类型</td> - <td class="w-75 m-color"> - <el-radio-group style="text-align: center" disabled v-model="reportDialogState.reportForm.experimentType"> - <el-radio :label="1">化学类</el-radio> - <el-radio :label="2">生物类</el-radio> - <el-radio :label="3">辐射类</el-radio> - <el-radio :label="4">机电类</el-radio> - <el-radio :label="5">特种设备类</el-radio> - <el-radio :label="6">其他类</el-radio> - </el-radio-group> + <td class="w-25 m-color">实验类型</td> + <td class="w-75" style="text-align: left;padding-left: 11px"> +<!-- <el-radio-group style="text-align: center" disabled v-model="reportDialogState.reportForm.experimentType">--> +<!-- <el-radio :label="1">化学类</el-radio>--> +<!-- <el-radio :label="2">生物类</el-radio>--> +<!-- <el-radio :label="3">辐射类</el-radio>--> +<!-- <el-radio :label="4">机电类</el-radio>--> +<!-- <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}} </td> </tr> <tr> - <td class="w-25 m-color required">负责人</td> + <td class="w-25 m-color">负责人</td> <td class="w-25 m-color"> - <el-select style="width: 100%" disabled v-model="reportDialogState.reportForm.liabilityUserId" clearable filterable @change="getLiabilityUserPhone($event)"> - <el-option - v-for="item in reportDialogState.systemPersonList" - :key="item.id" - :value="item.id" - :label="item.realName" - ></el-option> - </el-select> +<!-- <el-select style="width: 100%" disabled v-model="reportDialogState.reportForm.liabilityUserId" clearable filterable @change="getLiabilityUserPhone($event)">--> +<!-- <el-option--> +<!-- v-for="item in reportDialogState.systemPersonList"--> +<!-- :key="item.id"--> +<!-- :value="item.id"--> +<!-- :label="item.realName"--> +<!-- ></el-option>--> +<!-- </el-select>--> + <el-input readonly v-model="reportDialogState.reportForm.personUser" /> </td> - <td class="w-25 m-color required">电话</td> + <td class="w-25 m-color">电话</td> <td class="w-25 m-color"> - <el-input readonly v-model="reportDialogState.reportForm.liabilityUserPhone" /> + <el-input disabled v-model="reportDialogState.reportForm.personUserPhone" /> </td> </tr> <tr> - <td class="w-25 m-color required">安全负责人</td> + <td class="w-25 m-color">安全负责人</td> <td class="w-25 m-color"> - <el-select v-if="reportDialogState.reportForm.safeLiabilityUserId" style="width: 100%" disabled v-model="reportDialogState.reportForm.safeLiabilityUserId" @change="getSafeLiabilityUserPhone($event)" 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 v-else disabled v-model="reportDialogState.reportForm.safeLiabilityUser" /> +<!-- <el-select v-if="reportDialogState.reportForm.safeLiabilityUserId" style="width: 100%" disabled v-model="reportDialogState.reportForm.safeLiabilityUserId" @change="getSafeLiabilityUserPhone($event)" 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 v-model="reportDialogState.reportForm.safePersonUser" /> </td> - <td class="w-25 m-color required">电话</td> + <td class="w-25 m-color">电话</td> <td class="w-25 m-color"> - <el-input readonly v-model="reportDialogState.reportForm.safeLiabilityUserPhone" /> + <el-input readonly v-model="reportDialogState.reportForm.safePersonUserPhone" /> </td> </tr> <tr> - <td class="w-25 m-color required">部门</td> + <td class="w-25 m-color">部门</td> <td class="w-75 m-color"> <el-input readonly v-model="reportDialogState.reportForm.dep" /> </td> </tr> <tr class="m-color b-font" style="text-align: center">实验场所</tr> <tr> - <td class="w-14 m-color required">场所名称</td> + <td class="w-14 m-color">场所名称</td> <td class="w-14 m-color">所在楼栋</td> <td class="w-14 m-color">房间</td> <td class="w-14 m-color">有无消防设施</td> <td class="w-14 m-color">有无隔断</td> <td class="w-14 m-color">场所性质</td> </tr> - <tr v-for="(item,index) in reportDialogState.reportForm.siteList" :key="index"> + <tr v-for="(item,index) in reportDialogState.reportForm.experimentSite" :key="index"> <td class="w-14"> - <el-select disabled filterable v-model="item.siteId"> - <el-option - v-for="item in reportDialogState.allRoomList" - :key="item.id" - :value="item.id" - :label="item.siteName" - > - </el-option> - </el-select> +<!-- <el-select disabled filterable v-model="item.siteId">--> +<!-- <el-option--> +<!-- v-for="item in reportDialogState.allRoomList"--> +<!-- :key="item.id"--> +<!-- :value="item.id"--> +<!-- :label="item.siteName"--> +<!-- >--> +<!-- </el-option>--> +<!-- </el-select>--> + <el-input disabled v-model="item.siteName" /> </td> <td class="w-14"> <el-input disabled v-model="item.floor" /> @@ -105,71 +109,75 @@ </tr> <tr> <td class="w-25 m-color required">评估人</td> - <td class="w-25 m-color"> - <el-select style="width: 100%" :disabled="reportDialogState.disabled" v-model="reportDialogState.reportForm.assessUserId" clearable filterable> - <el-option - v-for="item in reportDialogState.allPersonList" - :key="item.id" - :value="item.id" - :label="item.personName" - ></el-option> - </el-select> + <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> +<!-- <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="reportDialogState.disabled" v-model="reportDialogState.reportForm.experimentDesc" placeholder="(简要描述实验原理、实验步骤、所用试剂或材料设备等)" /> + <el-input type="textarea" :autosize="{ minRows: 3}" disabled v-model="reportDialogState.reportForm.experimentDesc" placeholder="(简要描述实验原理、实验步骤、所用试剂或材料设备等)" /> </tr> <tr class="m-color b-font" style="text-align: center">实验涉及的危险源</tr> <tr> - <td class="w-25 m-color required">危险源种类</td> + <td class="w-25 m-color">危险源种类</td> <td class="w-75 m-color"> - <el-radio-group :disabled="reportDialogState.disabled" v-model="reportDialogState.reportForm.dangerSource"> - <el-radio :label="1">化学安全</el-radio> - <el-radio :label="2">辐射安全</el-radio> - <el-radio :label="3">特种设备安全</el-radio> - <el-radio :label="4">机电安全</el-radio> - <el-radio :label="5">电气安全</el-radio> - <el-radio :label="6">生物安全</el-radio> - <el-radio :label="7">激光安全</el-radio> - <el-radio :label="8">其他安全</el-radio> - </el-radio-group> +<!-- <el-radio-group disabled v-model="reportDialogState.reportForm.dangerSource">--> +<!-- <el-radio :label="1">化学安全</el-radio>--> +<!-- <el-radio :label="2">辐射安全</el-radio>--> +<!-- <el-radio :label="3">特种设备安全</el-radio>--> +<!-- <el-radio :label="4">机电安全</el-radio>--> +<!-- <el-radio :label="5">电气安全</el-radio>--> +<!-- <el-radio :label="6">生物安全</el-radio>--> +<!-- <el-radio :label="7">激光安全</el-radio>--> +<!-- <el-radio :label="8">其他安全</el-radio>--> +<!-- </el-radio-group>--> + <el-checkbox-group disabled> + <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" style="text-align: center">安全风险分析(总结)</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.实验过程中是否有爆炸、火灾、腐蚀、中毒风险、产生危险废弃物等(根据危险源清单,分析实验过程中可能对人身安全、人体健康、实验室环境和周边环境等带来的负面影响)" /> </tr> <tr class="m-color b-font" style="text-align: center">拟采取的防护和应急措施</tr> <tr> - <el-input type="textarea" :autosize="{ minRows: 3}" :disabled="reportDialogState.disabled" v-model="reportDialogState.reportForm.emergencyMeasure" placeholder="" /> + <el-input type="textarea" :autosize="{ minRows: 3}" disabled v-model="reportDialogState.reportForm.emergencyMeasure" placeholder="" /> </tr> - <tr class="m-color b-font" style="text-align: center">实验和实验项目综合风险等级评定</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="4">重大风险(一级)</el-radio> - <el-radio :label="3">较大风险(二级)</el-radio> - <el-radio :label="2">一般风险(三级)</el-radio> - <el-radio :label="1">低风险(四级)</el-radio> + <el-radio :label="1">低风险(一级)</el-radio> + <el-radio :label="2">一般风险(二级)</el-radio> + <el-radio :label="3">较大风险(三级)</el-radio> + <el-radio :label="4">重大风险(四级)</el-radio> </el-radio-group> </td> </tr> <tr> - <el-input type="textarea" :autosize="{ minRows: 3}" :disabled="reportDialogState.disabled" v-model="reportDialogState.reportForm.reskLevelReason" placeholder="请输入评定依据" /> + <el-input type="textarea" :autosize="{ minRows: 3}" :disabled="reportDialogState.disabled" v-model="reportDialogState.reportForm.description" placeholder="评定依据(必填)" /> </tr> </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="onSubmitProject()" size="default">提交审批</el-button> </span> </template> </el-dialog> @@ -183,6 +191,7 @@ 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 SelectDanger = defineAsyncComponent(() => import('./selectDanger.vue')) const selectDangerRef = ref() @@ -191,30 +200,49 @@ title: '', disabled: false, reportDialogVisible: false, - reportForm: { + reportForm: { id: null, experimentName: "", experimentType: null, - liabilityUserId: null, - liabilityUserPhone: '', - safeLiabilityUserId: null, - safeLiabilityUser: '', - safeLiabilityUserPhone: '', + personUser: '', + personUserId: null, + personUserPhone: '', + safePersonUserId: null, + safePersonUser: '', + safePersonUserPhone: '', dep: "", - siteList: [], + experimentSite: [], experimentDesc: '', - safeRiskAnalysis: '', emergencyMeasure: '', + assessPerson:'', + safeRiskAnalysis: '', assessLevel:null, - riskSource: [] + riskSource: [], + riskSourceType: [], + description: '', + person:[] }, - reportFormRules: {}, + reportFormRules: { + assessPerson: [{ required: true, message: '请填写评估人员', trigger: 'blur' }], + safeRiskAnalysis: [{ required: true, message: '请填写安全风险分析', trigger: 'blur' }], + assessLevel: [{ required: true, message: '请选择风险等级评定', trigger: 'blur' }], + description: [{ required: true, message: '请填写风险等级评定依据', trigger: 'blur' }], + }, allPersonList: [], allRoomList: [], systemPersonList: [], + experimentTypeList: [ + {id: 1, name: '化学类'}, + {id: 2, name: '生物类'}, + {id: 3, name: '辐射类'}, + {id: 4, name: '机电类'}, + {id: 5, name: '特种设备类'}, + {id: 6, name: '其它类'} + ] }) const showReportDialog = (title: string, value: ProjectType, allRoomList: RoomType []) => { + getReportData(value.id) reportDialogState.reportDialogVisible = true; reportDialogState.allRoomList = allRoomList setTimeout(() => { @@ -223,19 +251,22 @@ if(title === '提交'){ reportDialogState.title = '提交报告'; reportDialogState.disabled = false - for(let i in reportDialogState.reportForm) { - if(isValidKey(i, reportDialogState.reportForm)) { - reportDialogState.reportForm[i] = value[i]; - } - } + // for(let i in reportDialogState.reportForm) { + // if(isValidKey(i, reportDialogState.reportForm)) { + // reportDialogState.reportForm[i] = value[i]; + // } + // } + }else if(title === '修改'){ + reportDialogState.title = '修改报告'; + reportDialogState.disabled = false }else{ reportDialogState.title = '查看'; reportDialogState.disabled = true - for(let i in reportDialogState.reportForm) { - if(isValidKey(i, reportDialogState.reportForm)) { - reportDialogState.reportForm[i] = value[i]; - } - } + // for(let i in reportDialogState.reportForm) { + // if(isValidKey(i, reportDialogState.reportForm)) { + // reportDialogState.reportForm[i] = value[i]; + // } + // } } }; @@ -243,33 +274,85 @@ return key in object; }; -const getLiabilityUserPhone = (value: number)=>{ - const data = reportDialogState.systemPersonList.find(item => item.id === value) as AllPersonListType - reportDialogState.reportForm.liabilityUserPhone = data.phone -} - -const getSafeLiabilityUserPhone = (value: number)=>{ - const data = reportDialogState.allPersonList.find(item => item.id === value) as AllPersonListType - reportDialogState.reportForm.safeLiabilityUserPhone = data.phone -} - -const hasSafeSystem = (value: number) =>{ - if(value == 2){ - reportDialogState.reportForm.safeInformationSystem = '' +const getReportData = async (id:number|null|undefined) => { + let res = await assessApplyApi().getRiskReportPage({ + experimentId: id, + pageIndex: 1, + pageSize: 10, + tag: 3 + }); + if(res.data.code === 100){ + reportDialogState.reportForm = { + id: null, + experimentName: "", + experimentType: null, + personUser: '', + personUserId: null, + personUserPhone: '', + safePersonUserId: null, + safePersonUser: '', + safePersonUserPhone: '', + dep: "", + experimentSite: [], + experimentDesc: '', + emergencyMeasure: '', + assessPerson:'', + safeRiskAnalysis: '', + assessLevel:null, + riskSource: [], + riskSourceType: [], + description: '', + person:[] + } + if(res.data.data&&res.data.data.length==0){ + ElMessage({ + type: 'warning', + message: '暂时无法获取实验信息,可能与用户身份有关' + }); + }else{ + for(let i in reportDialogState.reportForm) { + if(isValidKey(i, reportDialogState.reportForm)) { + reportDialogState.reportForm[i] = res.data.data[0][i]; + } + } + } + }else{ + ElMessage({ + type: 'warning', + message: res.data.msg + }); } -} +}; + +// const getLiabilityUserPhone = (value: number)=>{ +// const data = reportDialogState.systemPersonList.find(item => item.id === value) as AllPersonListType +// reportDialogState.reportForm.liabilityUserPhone = data.phone +// } +// +// const getSafeLiabilityUserPhone = (value: number)=>{ +// const data = reportDialogState.allPersonList.find(item => item.id === value) as AllPersonListType +// reportDialogState.reportForm.safeLiabilityUserPhone = data.phone +// } + +// const hasSafeSystem = (value: number) =>{ +// if(value == 2){ +// reportDialogState.reportForm.safeInformationSystem = '' +// } +// } const onSubmitProject = () => { reportFormRef.value.validate(async(valid: boolean) => { if(valid){ - if(reportDialogState.title === '新增'){ - let res = await projectApi().addDevelop(reportDialogState.reportForm); + const { id,assessPerson,safeRiskAnalysis,assessLevel,description } = reportDialogState.reportForm + const data = { id,assessPerson,safeRiskAnalysis,assessLevel,description } + if(reportDialogState.title === '提交报告'){ + let res = await assessApplyApi().updateRiskReport(data); if(res.data.code === 100){ emit('refresh') reportDialogState.reportDialogVisible = false; ElMessage({ type: 'success', - message: '新增成功' + message: '提交报告成功' }) }else{ ElMessage({ @@ -278,13 +361,13 @@ }); } }else{ - let res = await projectApi().modProject(reportDialogState.reportForm) + let res = await assessApplyApi().updateRiskReportInfo(data) if(res.data.code === 100){ emit('refresh') reportDialogState.reportDialogVisible = false; ElMessage({ type: 'success', - message: '整改已提交' + message: '修改报告成功' }) }else{ ElMessage({ @@ -366,6 +449,14 @@ line-height: 42px; border-bottom: 1px solid #ccc; + &.required { + &::before { + content: "*"; + display: inline-block; + color: red; + } + } + &:last-of-type { border-bottom: none; } diff --git a/src/views/analyse/assessApply/components/riskDialog.vue b/src/views/analyse/assessApply/components/riskDialog.vue index 76d9b06..bbe6901 100644 --- a/src/views/analyse/assessApply/components/riskDialog.vue +++ b/src/views/analyse/assessApply/components/riskDialog.vue @@ -64,15 +64,15 @@ assessApplyDialogState.assessApplyDialogVisible = true; assessApplyDialogState.id = <number>value.id assessApplyDialogState.liabilityUserId = <number>value.liabilityUserId - getRiskData(<number>value.id) + getRiskData() }; const addUnit = (id: number, value: RiskUnitType) => { riskUnitDialogRef.value.showRiskUnitDialog(assessApplyDialogState.id, assessApplyDialogState.liabilityUserId, assessApplyDialogState.basicUnitList, assessApplyDialogState.allPersonList, assessApplyDialogState.allRiskTypeList); }; -const getRiskData = async (id: number|null) => { - let res = await riskUnitApi().getRiskUnitByList({pageIndex: 1,pageSize: 9999,riskCode: '',riskName: '',experimentId: id}); +const getRiskData = async () => { + let res = await riskUnitApi().getRiskUnitByList({pageIndex: 1,pageSize: 9999,riskCode: '',riskName: '',experimentId: assessApplyDialogState.id}); if(res.data.code === 100){ assessApplyDialogState.riskUnitData = JSON.parse(JSON.stringify(res.data.data)); }else{ diff --git a/src/views/analyse/assessApply/components/riskUnitDialog.vue b/src/views/analyse/assessApply/components/riskUnitDialog.vue index 22aee6c..fe72aae 100644 --- a/src/views/analyse/assessApply/components/riskUnitDialog.vue +++ b/src/views/analyse/assessApply/components/riskUnitDialog.vue @@ -1,59 +1,59 @@ <template> - <div class="system-menu-dialog-container"> - <el-dialog :title="riskUnitDialogState.title" v-model="riskUnitDialogState.riskUnitDialogVisible" width="600px"> - <el-form ref="riskUnitFormRef" :rules="riskUnitDialogState.riskUnitFormRules" :model="riskUnitDialogState.riskUnitForm" size="default" label-width="120px"> - <el-row :gutter="35"> - <el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" class="mb20"> - <el-form-item label="风险单元编号" prop="riskCode"> - <el-input v-model="riskUnitDialogState.riskUnitForm.riskCode" placeholder="风险单元编号" clearable class="input-length"></el-input> - </el-form-item> - </el-col> - <el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" class="mb20"> - <el-form-item label="风险单元名称" prop="riskName"> - <el-input v-model="riskUnitDialogState.riskUnitForm.riskName" placeholder="风险单元名称" clearable class="input-length"></el-input> - </el-form-item> - </el-col> - <el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" class="mb20"> - <el-form-item label="风险单元类型" prop="riskUnitTypeId"> - <el-select v-model="riskUnitDialogState.riskUnitForm.riskUnitTypeId" placeholder="风险单元类型" clearable class="input-length"> - <el-option v-for="item in riskUnitDialogState.riskTypeList" :key="item.id" :label="item.riskType" :value="item.id"></el-option> - </el-select> - </el-form-item> - </el-col> - <el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" class="mb20"> - <el-form-item label="负责人" prop="liabilityUserId"> - <el-select v-model="riskUnitDialogState.riskUnitForm.liabilityUserId" placeholder="负责人" clearable class="input-length"> - <el-option v-for="item in riskUnitDialogState.allPersonList" :key="item.id" :label="item.personName" :value="item.id"></el-option> - </el-select> - </el-form-item> - </el-col> - <el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" class="mb20"> - <el-form-item label="负责部门" prop="liabilityDep"> - <el-input v-model="riskUnitDialogState.riskUnitForm.liabilityDep" placeholder="负责部门" clearable class="input-length"></el-input> - </el-form-item> - </el-col> - <el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" class="mb20" v-if="riskUnitDialogState.experimentType === 1"> - <el-form-item label="基础风险单元" prop="basicRiskUnitId"> - <el-select v-model="riskUnitDialogState.riskUnitForm.basicRiskUnitId" placeholder="基础风险单元" clearable class="input-length"> - <el-option v-for="item in riskUnitDialogState.basicUnitList" :key="item.id" :label="item.riskName" :value="item.id"></el-option> - </el-select> - </el-form-item> - </el-col> - <el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" class="mb20"> - <el-form-item label="风险单元描述"> - <el-input type="textarea" :rows="3" v-model="riskUnitDialogState.riskUnitForm.description" placeholder="风险单元描述" clearable class="input-length"></el-input> - </el-form-item> - </el-col> - </el-row> - </el-form> - <template #footer> + <div class="system-menu-dialog-container"> + <el-dialog :title="riskUnitDialogState.title" v-model="riskUnitDialogState.riskUnitDialogVisible" width="600px"> + <el-form ref="riskUnitFormRef" :rules="riskUnitDialogState.riskUnitFormRules" :model="riskUnitDialogState.riskUnitForm" size="default" label-width="120px"> + <el-row :gutter="35"> + <el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" class="mb20"> + <el-form-item label="风险单元编号" prop="riskCode"> + <el-input v-model="riskUnitDialogState.riskUnitForm.riskCode" placeholder="风险单元编号" clearable class="input-length"></el-input> + </el-form-item> + </el-col> + <el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" class="mb20"> + <el-form-item label="风险单元名称" prop="riskName"> + <el-input v-model="riskUnitDialogState.riskUnitForm.riskName" placeholder="风险单元名称" clearable class="input-length"></el-input> + </el-form-item> + </el-col> + <el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" class="mb20"> + <el-form-item label="风险单元类型" prop="riskUnitTypeId"> + <el-select v-model="riskUnitDialogState.riskUnitForm.riskUnitTypeId" placeholder="风险单元类型" clearable class="input-length"> + <el-option v-for="item in riskUnitDialogState.riskTypeList" :key="item.id" :label="item.riskType" :value="item.id"></el-option> + </el-select> + </el-form-item> + </el-col> + <el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" class="mb20"> + <el-form-item label="负责人" prop="liabilityUserId"> + <el-select v-model="riskUnitDialogState.riskUnitForm.liabilityUserId" placeholder="负责人" clearable class="input-length"> + <el-option v-for="item in riskUnitDialogState.allPersonList" :key="item.id" :label="item.personName" :value="item.id"></el-option> + </el-select> + </el-form-item> + </el-col> + <el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" class="mb20"> + <el-form-item label="负责部门" prop="liabilityDep"> + <el-input v-model="riskUnitDialogState.riskUnitForm.liabilityDep" placeholder="负责部门" clearable class="input-length"></el-input> + </el-form-item> + </el-col> + <el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" class="mb20" v-if="riskUnitDialogState.experimentType === 1"> + <el-form-item label="基础风险单元" prop="basicRiskUnitId"> + <el-select v-model="riskUnitDialogState.riskUnitForm.basicRiskUnitId" placeholder="基础风险单元" clearable class="input-length"> + <el-option v-for="item in riskUnitDialogState.basicUnitList" :key="item.id" :label="item.riskName" :value="item.id"></el-option> + </el-select> + </el-form-item> + </el-col> + <el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" class="mb20"> + <el-form-item label="风险单元描述"> + <el-input type="textarea" :rows="3" v-model="riskUnitDialogState.riskUnitForm.description" placeholder="风险单元描述" clearable class="input-length"></el-input> + </el-form-item> + </el-col> + </el-row> + </el-form> + <template #footer> <span class="dialog-footer"> <el-button @click="riskUnitDialogState.riskUnitDialogVisible = !riskUnitDialogState.riskUnitDialogVisible" size="default">取 消</el-button> <el-button type="primary" @click="onSubmitRiskUnit" size="default">确定</el-button> </span> - </template> - </el-dialog> - </div> + </template> + </el-dialog> + </div> </template> <script setup lang="ts"> @@ -65,128 +65,128 @@ const riskUnitFormRef = ref() const riskUnitDialogState = reactive<RiskUnitDialogType>({ - title: '新增', - experimentType: 2, - riskUnitDialogVisible: false, - riskUnitForm: { - experimentId: null, - riskCode: '', - riskName: '', - riskUnitTypeId: null, - liabilityUserId: null, - liabilityDep: '', - description: '', - basicRiskUnitId: null, - }, - riskUnitFormRules: { - riskCode: [{ required: true, message: '请填写风险单元编号', trigger: 'blur' }], - riskName: [{ required: true, message: '请填写风险单元名称', trigger: 'blur' }], - riskUnitTypeId: [{ required: true, message: '请选择风险单元类型', trigger: 'blur' }], - liabilityUserId: [{ required: true, message: '请选择负责人', trigger: 'change' }], - basicRiskUnitId: [{ required: true, message: '请选择基础风险单元', trigger: 'change' }] - }, - specialDeviceList: [], - deviceUnitList: [ - {id:1, name: '台'}, - {id:2, name: '个'}, - {id:3, name: '件'} - ], - riskTypeList: [], - basicUnitList: [], - allPersonList: [], - allExperimentList: [], - experimentTypeList: [ - {id: 2, name: '实验风险'}, - {id: 1, name: '固有风险'}, - ], + title: '新增', + experimentType: 2, + riskUnitDialogVisible: false, + riskUnitForm: { + experimentId: null, + riskCode: '', + riskName: '', + riskUnitTypeId: null, + liabilityUserId: null, + liabilityDep: '', + description: '', + basicRiskUnitId: null, + }, + riskUnitFormRules: { + riskCode: [{ required: true, message: '请填写风险单元编号', trigger: 'blur' }], + riskName: [{ required: true, message: '请填写风险单元名称', trigger: 'blur' }], + riskUnitTypeId: [{ required: true, message: '请选择风险单元类型', trigger: 'blur' }], + liabilityUserId: [{ required: true, message: '请选择负责人', trigger: 'change' }], + basicRiskUnitId: [{ required: true, message: '请选择基础风险单元', trigger: 'change' }] + }, + specialDeviceList: [], + deviceUnitList: [ + {id:1, name: '台'}, + {id:2, name: '个'}, + {id:3, name: '件'} + ], + riskTypeList: [], + basicUnitList: [], + allPersonList: [], + allExperimentList: [], + experimentTypeList: [ + {id: 2, name: '实验风险'}, + {id: 1, name: '固有风险'}, + ], }) const showRiskUnitDialog = (id: number, liabilityUserId: number, basicUnitList: UnitType [], allPersonList: AllPersonListType [], allRiskTypeList: RiskType []) => { - riskUnitDialogState.riskUnitDialogVisible = true; - riskUnitDialogState.basicUnitList = basicUnitList - riskUnitDialogState.allPersonList = allPersonList - riskUnitDialogState.riskTypeList = allRiskTypeList - setTimeout(() => { - riskUnitFormRef.value.clearValidate(); - }); - riskUnitDialogState.riskUnitForm = { - experimentId: id, - riskCode: '', - riskName: '', - riskUnitTypeId: null, - liabilityUserId: liabilityUserId, - liabilityDep: '', - description: '', - basicRiskUnitId: null, - }; + riskUnitDialogState.riskUnitDialogVisible = true; + riskUnitDialogState.basicUnitList = basicUnitList + riskUnitDialogState.allPersonList = allPersonList + riskUnitDialogState.riskTypeList = allRiskTypeList + setTimeout(() => { + riskUnitFormRef.value.clearValidate(); + }); + riskUnitDialogState.riskUnitForm = { + experimentId: id, + riskCode: '', + riskName: '', + riskUnitTypeId: null, + liabilityUserId: liabilityUserId, + liabilityDep: '', + description: '', + basicRiskUnitId: null, + }; }; const onSubmitRiskUnit = () => { - riskUnitFormRef.value.validate(async(valid: boolean) => { - if(valid){ - if(riskUnitDialogState.title === '新增' && riskUnitDialogState.experimentType === 1){ - let { experimentId,basicRiskUnitId} = riskUnitDialogState.riskUnitForm - let query = { experimentId,basicRiskUnitId } - let res = await riskUnitApi().addBasicRiskUnit(query); - if(res.data.code === 100){ - emit('refresh') - riskUnitDialogState.riskUnitDialogVisible = false; - ElMessage({ - type: 'success', - message: '新增成功' - }) - }else{ - ElMessage({ - type: 'warning', - message: res.data.msg, - }); - } - }else if(riskUnitDialogState.title === '新增' && riskUnitDialogState.experimentType === 2){ - let { basicRiskUnitId, ...query} = riskUnitDialogState.riskUnitForm - let res = await riskUnitApi().addRiskUnit(query); - if(res.data.code === 100){ - emit('refresh') - riskUnitDialogState.riskUnitDialogVisible = false; - ElMessage({ - type: 'success', - message: '新增成功' - }) - }else{ - ElMessage({ - type: 'warning', - message: res.data.msg, - }); - } - }else{ - let res = await riskUnitApi().modRiskUnit(riskUnitDialogState.riskUnitForm) - if(res.data.code === 100){ - emit('refresh') - riskUnitDialogState.riskUnitDialogVisible = false; - ElMessage({ - type: 'success', - message: '编辑成功' - }) - }else{ - ElMessage({ - type: 'warning', - message: res.data.msg, - }); - } - } + riskUnitFormRef.value.validate(async(valid: boolean) => { + if(valid){ + if(riskUnitDialogState.title === '新增' && riskUnitDialogState.experimentType === 1){ + let { experimentId,basicRiskUnitId} = riskUnitDialogState.riskUnitForm + let query = { experimentId,basicRiskUnitId } + let res = await riskUnitApi().addBasicRiskUnit(query); + if(res.data.code === 100){ + emit('refresh') + riskUnitDialogState.riskUnitDialogVisible = false; + ElMessage({ + type: 'success', + message: '新增成功' + }) }else{ - ElMessage({ - type: 'warning', - message: '请完善基本信息', - }); + ElMessage({ + type: 'warning', + message: res.data.msg, + }); } - }) + }else if(riskUnitDialogState.title === '新增' && riskUnitDialogState.experimentType === 2){ + let { basicRiskUnitId, ...query} = riskUnitDialogState.riskUnitForm + let res = await riskUnitApi().addRiskUnit(query); + if(res.data.code === 100){ + emit('refresh') + riskUnitDialogState.riskUnitDialogVisible = false; + ElMessage({ + type: 'success', + message: '新增成功' + }) + }else{ + ElMessage({ + type: 'warning', + message: res.data.msg, + }); + } + }else{ + let res = await riskUnitApi().modRiskUnit(riskUnitDialogState.riskUnitForm) + if(res.data.code === 100){ + emit('refresh') + riskUnitDialogState.riskUnitDialogVisible = false; + ElMessage({ + type: 'success', + message: '编辑成功' + }) + }else{ + ElMessage({ + type: 'warning', + message: res.data.msg, + }); + } + } + }else{ + ElMessage({ + type: 'warning', + message: '请完善基本信息', + }); + } + }) } const emit = defineEmits(['refresh']) defineExpose({ - showRiskUnitDialog + showRiskUnitDialog }) </script> diff --git a/src/views/analyse/assessApply/components/selectDanger.vue b/src/views/analyse/assessApply/components/selectDanger.vue index 67739bb..3094ea6 100644 --- a/src/views/analyse/assessApply/components/selectDanger.vue +++ b/src/views/analyse/assessApply/components/selectDanger.vue @@ -1,38 +1,38 @@ <template> <tr class="m-color b-font" style="text-align: center">主要危险源或有害因素</tr> <tr> - <td class="w-18 m-color">序号</td> - <td class="w-18 m-color required">危险源或有害因素</td> - <td class="w-18 m-color required">危险特性</td> - <td class="w-18 m-color required">数量</td> - <td class="w-18 m-color required">其他说明</td> - <td class="w-18 m-color">操作</td> + <td class="w-20 m-color">序号</td> + <td class="w-20 m-color">危险源或有害因素</td> + <td class="w-20 m-color">危险特性</td> + <td class="w-20 m-color">数量</td> + <td class="w-20 m-color">其他说明</td> +<!-- <td class="w-18 m-color">操作</td>--> </tr> <tr v-for="(item,index) in dangerSourceState.dangerList" :key="index"> - <td class="w-18"> + <td class="w-20"> {{ index + 1 }} </td> - <td class="w-18"> - <el-input :disabled="dangerSourceState.disabled" v-model="item.dangerFactor"></el-input> + <td class="w-20"> + <el-input disabled v-model="item.riskSource"></el-input> </td> - <td class="w-18"> - <el-input :disabled="dangerSourceState.disabled" v-model="item.feature"></el-input> + <td class="w-20"> + <el-input disabled v-model="item.riskCharacteristic"></el-input> </td> - <td class="w-18"> - <el-input :disabled="dangerSourceState.disabled" type="number" v-model="item.amount"></el-input> + <td class="w-20"> + <el-input disabled type="number" v-model="item.number"></el-input> </td> - <td class="w-18"> - <el-input :disabled="dangerSourceState.disabled" v-model="item.info"></el-input> + <td class="w-20"> + <el-input disabled v-model="item.description"></el-input> </td> - <td class="w-18"> - <el-button :disabled="dangerSourceState.disabled" type="danger" @click="deleteDangerItem(index)">删除</el-button> - </td> +<!-- <td class="w-18">--> +<!-- <el-button disabled type="danger" @click="deleteDangerItem(index)">删除</el-button>--> +<!-- </td>--> </tr> - <tr style="text-align: center"> - <el-button :disabled="dangerSourceState.disabled" type="primary" shape="round" @click="addDangerItem()"> - 添加行 - </el-button> - </tr> +<!-- <tr style="text-align: center">--> +<!-- <el-button :disabled="dangerSourceState.disabled" type="primary" shape="round" @click="addDangerItem()">--> +<!-- 添加行--> +<!-- </el-button>--> +<!-- </tr>--> </template> <script setup lang="ts"> @@ -45,8 +45,7 @@ const dangerSourceState = reactive<DangerSourceType>({ disabled: false, - dangerList: [ - ], + dangerList: [], classifyList:[ {id:1, name: '有机'}, {id:2, name: '酸'}, @@ -71,7 +70,7 @@ }); const addDangerItem = () => { - dangerSourceState.dangerList.push({dangerFactor: '', feature: '', amount: null, info: ''}); + dangerSourceState.dangerList.push({riskSource: '', riskCharacteristic: '', number: null, description: ''}); }; const deleteDangerItem = (index: number) => { diff --git a/src/views/analyse/assessApply/index.ts b/src/views/analyse/assessApply/index.ts index 7948ebb..6eeeb97 100644 --- a/src/views/analyse/assessApply/index.ts +++ b/src/views/analyse/assessApply/index.ts @@ -6,11 +6,33 @@ title: string disabled: boolean reportDialogVisible: boolean - reportForm: object + reportForm: { + id: null | number, + experimentName: string, + experimentType: null | number, + personUser: string, + personUserId: null | number, + personUserPhone: string, + safePersonUserId: null | number, + safePersonUser: string, + safePersonUserPhone: string, + dep: string, + experimentSite: [], + experimentDesc: string, + emergencyMeasure: string, + assessPerson: string, + safeRiskAnalysis: string, + assessLevel: null | number, + riskSource: [], + riskSourceType: [], + description: string, + person: [] + } reportFormRules: object allPersonList: Array<AllPersonListType> systemPersonList: Array<AllPersonListType> - allRoomList: Array<RoomType> + allRoomList: Array<RoomType>, + experimentTypeList: Array<Type> } declare interface DangerSourceType { diff --git a/src/views/analyse/assessApply/index.vue b/src/views/analyse/assessApply/index.vue index 3f6b536..aca3df3 100644 --- a/src/views/analyse/assessApply/index.vue +++ b/src/views/analyse/assessApply/index.vue @@ -58,15 +58,17 @@ <el-table-column prop="stage" label="评估状态"> <template #default="scope"> <el-tag :type="scope.row.stage == 4?'success':scope.row.stage == 1?'info':''"> - {{scope.row.stage == 1?'未评估':scope.row.status == 2?'评估中':scope.row.status == 3?'评估完成':scope.row.status == 4?'生成报告':'--'}} + {{scope.row.stage == 1?'未评估':scope.row.stage == 2?'评估中':scope.row.stage == 3?'评估完成':scope.row.stage == 4?'生成报告':'--'}} </el-tag> </template> </el-table-column> <el-table-column label="操作" width="250" fixed="right"> <template #default="scope"> + <el-button size="small" v-if="scope.row.stage == 3" text type="primary" :icon="Edit" @click="toReport(scope.row)">生成评估报告</el-button> <el-button size="small" text type="primary" :icon="Edit" @click="openRiskDialog(scope.row)">管理实验现实风险</el-button> - <el-button size="small" text type="primary" :icon="View" @click="openReportDialog('提交', scope.row)">提交综合评估报告审批</el-button> - <el-button size="small" :disabled="scope.row.status == 2 ? true : false" text type="primary" :icon="Edit" @click="openReportDialog('查看',scope.row)">查看评估报告</el-button> + <el-button size="small" v-if="scope.row.stage == 4 && !scope.row.assessPerson" text type="primary" :icon="View" @click="openReportDialog('提交', scope.row)">提交审批</el-button> + <el-button size="small" v-if="scope.row.stage == 4 && scope.row.assessPerson" text type="primary" :icon="View" @click="openReportDialog('修改', scope.row)">修改</el-button> + <el-button size="small" v-if="scope.row.stage == 4 && scope.row.assessPerson" text type="primary" :icon="Edit" @click="openReportDialog('查看',scope.row)">查看</el-button> </template> </el-table-column> </el-table> @@ -130,6 +132,32 @@ } }; +const toReport = (val: ProjectType)=>{ + ElMessageBox.confirm(`此操作将对该实验生成风险评估报告:“${val.experimentName}”,是否继续?`, '提示', { + confirmButtonText: '确认', + cancelButtonText: '取消', + type: 'warning' + }) + .then(async () => { + let res = await assessApplyApi().toRiskReport({ id: val.id }); + if (res.data.code === 100) { + ElMessage({ + type: 'success', + duration: 2000, + message: '生成报告成功' + }); + await getAssessData(); + } else { + ElMessage({ + type: 'warning', + message: res.data.msg + }); + } + }) + .catch((error) => { + }); +} + const getAllRoom = async () => { let res = await roomApi().getAllRoom(); if(res.data.code === 100){ @@ -157,7 +185,6 @@ type: 'warning' }) .then(async () => { - debugger let res = await projectApi().deleteProjectById({ id: val.id }); if (res.data.code === 100) { ElMessage({ diff --git a/src/views/analyse/evaluate/components/evaluateDialog.vue b/src/views/analyse/evaluate/components/evaluateDialog.vue index 966aac5..3844ef9 100644 --- a/src/views/analyse/evaluate/components/evaluateDialog.vue +++ b/src/views/analyse/evaluate/components/evaluateDialog.vue @@ -148,7 +148,7 @@ <el-option v-for="item in evaluateDialogState.evaluateMethodList" :key="item.id" :label="item.name" :value="item.id"></el-option> </el-select> </el-form-item> - <el-button size="default" type="primary" @click="openChangeMethod()">修改评价方法</el-button> + <el-button :disabled="evaluateDialogState.disabled" size="default" type="primary" @click="openChangeMethod()">修改评价方法</el-button> </el-col> <div class="evaluateCard"> @@ -618,6 +618,7 @@ import {isValidKey, numFloat} from "/@/utils/methods"; import { BigNumber } from 'bignumber.js'; import {identifyApi} from "/@/api/analyse/identify"; +import {ElMessageBox} from "element-plus/es"; const evaluateFormRef = ref() @@ -801,21 +802,15 @@ setTimeout(() => { evaluateFormRef.value.clearValidate(); }); - if( value.riskValue){ + if( title === '评价'){ + if(value.riskValue){ evaluateDialogState.title = '编辑评价'; for(let i in evaluateDialogState.evaluateForm){ - if(isValidKey(i, evaluateDialogState.evaluateForm)){ - evaluateDialogState.evaluateForm[i] = value[i] - } + if(isValidKey(i, evaluateDialogState.evaluateForm)){ + evaluateDialogState.evaluateForm[i] = value[i] + } } - }else if(title === '查看'){ - evaluateDialogState.disabled = true - for(let i in evaluateDialogState.evaluateForm){ - if(isValidKey(i, evaluateDialogState.evaluateForm)){ - evaluateDialogState.evaluateForm[i] = value[i] - } - } - }else{ + }else{ evaluateDialogState.title = '评价' evaluateDialogState.evaluateForm = { id: null, @@ -868,6 +863,15 @@ adviseEmergencyMeasure: '', evaluateDesc: '' }; + } + }else { + evaluateDialogState.title = '查看' + evaluateDialogState.disabled = true + for(let i in evaluateDialogState.evaluateForm){ + if(isValidKey(i, evaluateDialogState.evaluateForm)){ + evaluateDialogState.evaluateForm[i] = value[i] + } + } } evaluateDialogState.evaluateForm.id = value.id as number evaluateDialogState.evaluateForm.evaluateMethod = value.evaluateMethod as number @@ -880,24 +884,33 @@ } const conFirmChange = async () =>{ - let res = await evaluateApi().modEvaluateMethod({ - id: evaluateDialogState.evaluateForm.id, - evaluateMethodId: evaluateDialogState.evaluateForm.evaluateMethod - }); - if(res.data.code === 100){ - ElMessage({ - type: 'success', - message: '评价方法修改成功' - }) - emit('refresh') - }else{ - ElMessage({ - type: 'warning', - message: res.data.msg - }) - } - evaluateDialogState.evaluateMethodVisible = false - evaluateDialogState.evaluateDialogVisible = false + ElMessageBox.confirm(`此操作将修改该评价计划的评价方法并清除之前的所有评价信息,是否继续?`, '提示', { + confirmButtonText: '确认', + cancelButtonText: '取消', + type: 'warning' + }) + .then(async () => { + let res = await evaluateApi().modEvaluateMethod({ + id: evaluateDialogState.evaluateForm.id, + evaluateMethodId: evaluateDialogState.evaluateForm.evaluateMethod + }); + if(res.data.code === 100){ + ElMessage({ + type: 'success', + message: '评价方法修改成功' + }) + emit('refresh') + }else{ + ElMessage({ + type: 'warning', + message: res.data.msg + }) + } + evaluateDialogState.evaluateMethodVisible = false + evaluateDialogState.evaluateDialogVisible = false + }) + .catch((error) => { + }); } const onSubmitEvaluate = () => { diff --git a/src/views/analyse/evaluate/index.vue b/src/views/analyse/evaluate/index.vue index 1833e58..5266682 100644 --- a/src/views/analyse/evaluate/index.vue +++ b/src/views/analyse/evaluate/index.vue @@ -57,10 +57,11 @@ <el-table-column v-if="scope.row.identificationMethod == 5" prop="analogyReference" label="类比参照" show-overflow-tooltip align="center"></el-table-column> <el-table-column v-if="scope.row.identificationMethod == 5" prop="analogyRiskFactor" label="存在风险因素" show-overflow-tooltip align="center"></el-table-column> <el-table-column v-if="scope.row.identificationMethod == 5" prop="analogyResult" label="可能存在后果" show-overflow-tooltip align="center"></el-table-column> - <el-table-column label="操作" width="250"> - <template #default="scope"> - <el-button size="small" text type="primary" :icon="Plus" @click="openEvaluateDialog('评价', scope.row)">评价</el-button> - </template> + <el-table-column label="操作" width="250" > + <template #default="scope2"> + <el-button size="small" v-if="scope.row.planExecStatus === 3" text type="primary" :icon="Plus" @click="openEvaluateDialog('评价', scope2.row)">评价</el-button> + <el-button size="small" v-if="scope2.row.riskValue" text type="primary" :icon="View" @click="openEvaluateDialog('查看', scope2.row)">查看</el-button> + </template> </el-table-column> </el-table> </template> @@ -241,7 +242,7 @@ }; const accessEvaluate = (val: IdentifyType) => { - ElMessageBox.confirm(`此操作将提交该评价计划:“${val.assessPlanName}”,是否继续?`, '提示', { + ElMessageBox.confirm(`此操作将提交该评价计划:“${val.assessPlanName}”的评价信息,是否继续?`, '提示', { confirmButtonText: '确认', cancelButtonText: '取消', type: 'warning' diff --git a/src/views/analyse/identify/index.vue b/src/views/analyse/identify/index.vue index eb0ce8e..ab50465 100644 --- a/src/views/analyse/identify/index.vue +++ b/src/views/analyse/identify/index.vue @@ -203,7 +203,7 @@ const accessIdentify = (val: IdentifyType) => { if(val.factorQueryDTOList?.length > 0){ - ElMessageBox.confirm(`此操作将派发该计划:“${val.assessPlanName}”,是否继续?`, '提示', { + ElMessageBox.confirm(`此操作将提交该计划:“${val.assessPlanName}”的辨识信息,是否继续?`, '提示', { confirmButtonText: '确认', cancelButtonText: '取消', type: 'warning' diff --git a/src/views/analyse/plan/components/planDialog.vue b/src/views/analyse/plan/components/planDialog.vue index 3aed91e..a8b570f 100644 --- a/src/views/analyse/plan/components/planDialog.vue +++ b/src/views/analyse/plan/components/planDialog.vue @@ -121,35 +121,34 @@ }else if(title === '查看'){ planDialogState.title = '查看'; planDialogState.disabled = true - planDialogState.planForm.assessTime = [value.assessStartTime, value.assessEndTime] for(let i in planDialogState.planForm){ if(isValidKey(i, planDialogState.planForm)){ planDialogState.planForm[i] = value[i] } } + planDialogState.planForm.assessTime=[value.assessStartTime, value.assessEndTime] + console.log(value,planDialogState.planForm.assessTime,'time') }else{ planDialogState.title = '编辑'; planDialogState.planForm.id = value.id - planDialogState.planForm.assessTime=[value.assessStartTime, value.assessEndTime] - console.log(planDialogState.planForm.assessTime,'5') - formatTime() - console.log(planDialogState.planForm.assessTime,'6 ') for(let i in planDialogState.planForm){ if(isValidKey(i, planDialogState.planForm)){ planDialogState.planForm[i] = value[i] } } + planDialogState.planForm.assessTime=[value.assessStartTime, value.assessEndTime] } }; const formatTime = () => { - planDialogState.planForm.assessStartTime = planDialogState.planForm.assessTime === null ? '' : planDialogState.planForm.assessTime[0] - planDialogState.planForm.assessEndTime = planDialogState.planForm.assessTime === null ? '' : planDialogState.planForm.assessTime[1] + planDialogState.planForm.assessStartTime = planDialogState.planForm.assessTime == [] ? '' : planDialogState.planForm.assessTime[0] + planDialogState.planForm.assessEndTime = planDialogState.planForm.assessTime == [] ? '' : planDialogState.planForm.assessTime[1] }; const onSubmitPlan = () => { planFormRef.value.validate(async(valid: boolean) => { if(valid){ + formatTime() delete planDialogState.planForm.assessTime if(planDialogState.title === '新增'){ let res = await planApi().addPlan(planDialogState.planForm); diff --git a/src/views/analyse/plan/index.ts b/src/views/analyse/plan/index.ts index 7f8001a..c64f94f 100644 --- a/src/views/analyse/plan/index.ts +++ b/src/views/analyse/plan/index.ts @@ -11,7 +11,15 @@ identificationMethodList: Array<Type>, evaluateMethodList: Array<Type> riskUnitList: Array<RiskUnitType> - personList: Array<SystemPersonType> + personList: Array<SystemPersonType>, + reSendTitle:string + reSendDialogVisible: boolean + reSendForm: { + id: null | number, + identificationUserId: null | number, + evaluateUserId: null | number, + }, + rules: object } declare interface SystemPersonType { @@ -46,7 +54,7 @@ riskUnitId: number | null, planUserId: number | null, assessPlanName: string, - assessTime?: string[], + assessTime: string[], assessStartTime: string, assessEndTime: string, identificationUserId: number | null, diff --git a/src/views/analyse/plan/index.vue b/src/views/analyse/plan/index.vue index 2417088..3aa9c99 100644 --- a/src/views/analyse/plan/index.vue +++ b/src/views/analyse/plan/index.vue @@ -70,7 +70,9 @@ <el-button v-if="scope.row.planSellStatus === 1" size="small" text type="primary" :icon="Edit" @click="openPlanDialog('修改', scope.row)">编辑</el-button> <el-button v-if="scope.row.identificationUserId == planState.user" size="small" text type="primary" :icon="Edit" @click="refuseIdentify(scope.row)">拒绝辨识</el-button> <el-button v-if="scope.row.evaluateUserId == planState.user" size="small" text type="primary" :icon="Edit" @click="refuseEvaluate(scope.row)">拒绝评价</el-button> - <el-button v-if="scope.row.sceneUserId == planState.user" size="small" text type="primary" :icon="Edit" @click="refuseScene(scope.row)">拒绝现场</el-button> +<!-- <el-button v-if="scope.row.sceneUserId == planState.user" size="small" text type="primary" :icon="Edit" @click="refuseScene(scope.row)">拒绝现场</el-button>--> + <el-button v-if="scope.row.identificationUserId == null" size="small" text type="primary" :icon="Edit" @click="reSendJob(scope.row,'identification')">重新指派辨识</el-button> + <el-button v-if="scope.row.evaluateUserId == null" size="small" text type="primary" :icon="Edit" @click="reSendJob(scope.row,'evaluate')">重新指派评价</el-button> <el-button v-if="scope.row.planSellStatus === 1" size="small" text type="danger" :icon="Delete" @click="onDelPlan(scope.row)">删除</el-button> </template> </el-table-column> @@ -82,19 +84,42 @@ </div> </div> <plan-dialog ref="planDialogRef" @refresh="getPlanData"></plan-dialog> + + <el-dialog :title="planState.reSendTitle" v-model="planState.reSendDialogVisible" width="50%"> + <el-form ref="ruleFormRef" :rules="planState.rules" :model="planState.reSendForm" label-width="120px"> + <el-form-item v-if="planState.reSendTitle == '指派辨识专家'" label="选择辨识专家" prop="identificationUserId"> + <el-select v-model="planState.reSendForm.identificationUserId" style="width:100%" placeholder="辨识专家" clearable> + <el-option v-for="item in planState.personList" :key="item.id" :label="item.realName" :value="item.id"></el-option> + </el-select> + </el-form-item> + <el-form-item v-if="planState.reSendTitle == '指派评价专家'" label="选择评价专家" prop="evaluateUserId"> + <el-select v-model="planState.reSendForm.evaluateUserId" style="width:100%" placeholder="评价专家" clearable> + <el-option v-for="item in planState.personList" :key="item.id" :label="item.realName" :value="item.id"></el-option> + </el-select> + </el-form-item> + </el-form> + <template #footer> + <span class="dialog-footer" style="padding-top:10px;text-align: center !important;"> + <el-button @click="planState.reSendDialogVisible = !planState.reSendDialogVisible" size="default">取 消</el-button> + <el-button type="primary" @click="onSubmitReSend(ruleFormRef)" size="default">确认指派</el-button> + </span> + </template> + </el-dialog> + </div> </template> <script setup lang="ts"> import {defineAsyncComponent, onMounted, reactive, ref} from "vue"; import {planApi} from "/@/api/analyse/plan"; -import {ElMessage, ElMessageBox} from "element-plus"; +import {ElMessage, ElMessageBox, FormInstance} from "element-plus"; import { Edit, View, Plus, Delete } from '@element-plus/icons-vue'; import {riskUnitApi} from "/@/api/analyse/riskUnit"; import {personApi} from "/@/api/basic/person"; import {useUserInfo} from "/@/stores/userInfo"; import { storeToRefs } from 'pinia'; import {userApi} from "/@/api/systemManage/user"; +import {assessApplyApi} from "/@/api/analyse/assessApply"; const PlanDialog = defineAsyncComponent(() => import('./components/planDialog.vue')); @@ -102,7 +127,7 @@ const planDialogRef = ref(); const userInfo = useUserInfo(); const { userInfos } = storeToRefs(userInfo); - +const ruleFormRef = ref<FormInstance>() const planState = reactive<PlanStateType>({ planData: [], user: null, @@ -117,18 +142,29 @@ ], personList: [], identificationMethodList: [ - {id:1, name: 'PHA'}, - {id:2, name: 'JHA'}, - {id:3, name: 'SCL'}, - {id:4, name: 'HAZOP'}, - {id:5, name: '类比法'}, -], - evaluateMethodList: [ - {id:1, name: 'LEC'}, - {id:2, name: 'LS'}, - {id:3, name: 'MES'}, - {id:4, name: 'RS'}, -] + {id:1, name: 'PHA'}, + {id:2, name: 'JHA'}, + {id:3, name: 'SCL'}, + {id:4, name: 'HAZOP'}, + {id:5, name: '类比法'}, + ], + evaluateMethodList: [ + {id:1, name: 'LEC'}, + {id:2, name: 'LS'}, + {id:3, name: 'MES'}, + {id:4, name: 'RS'}, + ], + reSendTitle:'', + reSendDialogVisible: false, + reSendForm: { + id: null, + identificationUserId: null, + evaluateUserId: null + }, + rules: { + identificationUserId: [{ required: true, message: '请选择辨识专家', trigger: 'blur' }], + evaluateUserId: [{ required: true, message: '请选择评价专家', trigger: 'blur' }] + } // deviceUnitList: [ // {id:1, name: '台'}, // {id:2, name: '个'}, @@ -183,55 +219,117 @@ }; const refuseIdentify = async(val: PlanType)=>{ - let res = await planApi().refuseIdentify({ id: val.id }); - if (res.data.code === 100) { - ElMessage({ - type: 'success', - duration: 2000, - message: '拒绝成功' - }); - await getPlanData(); - } else { - ElMessage({ - type: 'warning', - message: res.data.msg - }); + ElMessageBox.confirm(`此操作将拒绝作为该计划:“${val.assessPlanName}”的辨识专家,是否继续?`, '提示', { + confirmButtonText: '确认', + cancelButtonText: '取消', + type: 'warning' + }) + .then(async () => { + let res = await planApi().refuseIdentify({ id: val.id }); + if (res.data.code === 100) { + ElMessage({ + type: 'success', + duration: 2000, + message: '拒绝成功' + }); + await getPlanData(); + } else { + ElMessage({ + type: 'warning', + message: res.data.msg + }); + } + }) + .catch((error) => { + }); +} + +const reSendJob= async(val: PlanType,type:string)=>{ + planState.reSendForm = { + id: val.id, + identificationUserId: null, + evaluateUserId: null } + if(type=='identification'){ + planState.reSendTitle = '指派辨识专家' + }else{ + planState.reSendTitle = '指派评价专家' + } + planState.reSendDialogVisible = true +} + +const onSubmitReSend = async (formEl: FormInstance | undefined) => { + if (!formEl) return + await formEl.validate(async(valid, fields) => { + if (valid) { + let res = await planApi().reSendJob(planState.reSendForm); + if(res.data.code === 100){ + ElMessage({ + type: 'success', + message: '重新指派成功' + }); + }else{ + ElMessage({ + type: 'warning', + message: res.data.msg + }); + } + + planState.reSendForm = { + id: null, + identificationUserId: null, + evaluateUserId: null + }, + planState.reSendDialogVisible = false + getPlanData() + } else { + console.log('error submit!', fields) + } + }) } const refuseEvaluate = async(val: PlanType)=>{ - let res = await planApi().refuseEvaluate({ id: val.id }); - if (res.data.code === 100) { - ElMessage({ - type: 'success', - duration: 2000, - message: '拒绝成功' - }); - await getPlanData(); - } else { - ElMessage({ - type: 'warning', - message: res.data.msg - }); - } + ElMessageBox.confirm(`此操作将拒绝作为该计划:“${val.assessPlanName}”的评价专家,是否继续?`, '提示', { + confirmButtonText: '确认', + cancelButtonText: '取消', + type: 'warning' + }) + .then(async () => { + let res = await planApi().refuseEvaluate({ id: val.id }); + if (res.data.code === 100) { + ElMessage({ + type: 'success', + duration: 2000, + message: '拒绝成功' + }); + await getPlanData(); + } else { + ElMessage({ + type: 'warning', + message: res.data.msg + }); + } + }) + .catch((error) => { + }); } -const refuseScene = async(val: PlanType)=>{ - let res = await planApi().refuseScene({ id: val.id }); - if (res.data.code === 100) { - ElMessage({ - type: 'success', - duration: 2000, - message: '拒绝成功' - }); - await getPlanData(); - } else { - ElMessage({ - type: 'warning', - message: res.data.msg - }); - } -} +// const refuseScene = async(val: PlanType)=>{ +// let res = await planApi().refuseScene({ id: val.id }); +// if (res.data.code === 100) { +// ElMessage({ +// type: 'success', +// duration: 2000, +// message: '拒绝成功' +// }); +// await getPlanData(); +// } else { +// ElMessage({ +// type: 'warning', +// message: res.data.msg +// }); +// } +// } const onDelPlan = (val: PlanType) => { ElMessageBox.confirm(`此操作将永久删除该计划:“${val.assessPlanName}”,是否继续?`, '提示', { diff --git a/src/views/experiment/developing/index.vue b/src/views/experiment/developing/index.vue index 624062d..8ee6f9d 100644 --- a/src/views/experiment/developing/index.vue +++ b/src/views/experiment/developing/index.vue @@ -64,7 +64,7 @@ <el-table-column prop="stage" label="评估状态"> <template #default="scope"> <el-tag :type="scope.row.stage == 4?'success':scope.row.stage == 1?'info':''"> - {{scope.row.stage == 1?'未评估':scope.row.status == 2?'评估中':scope.row.status == 3?'评估完成':scope.row.status == 4?'生成报告':'--'}} + {{scope.row.stage == 1?'未评估':scope.row.stage == 2?'评估中':scope.row.stage == 3?'评估完成':scope.row.stage == 4?'生成报告':'--'}} </el-tag> </template> </el-table-column> diff --git a/src/views/experiment/project/index.vue b/src/views/experiment/project/index.vue index 74c5922..c56d58a 100644 --- a/src/views/experiment/project/index.vue +++ b/src/views/experiment/project/index.vue @@ -64,7 +64,7 @@ <el-table-column prop="stage" label="评估状态"> <template #default="scope"> <el-tag :type="scope.row.stage == 4?'success':scope.row.stage == 1?'info':''"> - {{scope.row.stage == 1?'未评估':scope.row.status == 2?'评估中':scope.row.status == 3?'评估完成':scope.row.status == 4?'生成报告':'--'}} + {{scope.row.stage == 1?'未评估':scope.row.stage == 2?'评估中':scope.row.stage == 3?'评估完成':scope.row.stage == 4?'生成报告':'--'}} </el-tag> </template> </el-table-column> diff --git a/src/views/loginPage/component/accountLogin.vue b/src/views/loginPage/component/accountLogin.vue index e0c49dd..8f5c014 100644 --- a/src/views/loginPage/component/accountLogin.vue +++ b/src/views/loginPage/component/accountLogin.vue @@ -189,6 +189,7 @@ // 存储 token 到浏览器缓存 let res = await useLoginApi().signIn(state.ruleForm); if (res.data.code === 100) { + console.log(res.data.data,'user') await userInfo.setUserInfos(res.data.data); Cookies.set('token', res.data.data.tk); Cookies.set('uid', res.data.data.uid); -- Gitblit v1.9.2