| | |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <!-- <el-row :gutter="30">--> |
| | | <!-- <el-col :span="6">--> |
| | | <!-- <el-form-item label="附件上传">--> |
| | | <!-- <el-upload--> |
| | | <!-- accept="image/*"--> |
| | | <!-- :action="state.uploadUrl"--> |
| | | <!-- :headers="state.header"--> |
| | | <!-- method="post"--> |
| | | <!-- :on-success="(response, file, fileList) => handleAvatarSuccess(response, file, fileList, 1)"--> |
| | | <!-- :on-preview="handlePictureCardPreview"--> |
| | | <!-- v-model:file-list="state.socialList"--> |
| | | <!-- list-type="picture-card"--> |
| | | <!-- :before-upload="picSize"--> |
| | | <!-- :on-remove="(file, file_list)=>{handleRemove(file, file_list, 1)}"--> |
| | | <!-- >--> |
| | | <!-- <el-icon><Plus /></el-icon>--> |
| | | <!-- <template #tip>--> |
| | | <!-- <div class="el-upload__tip">上传jpg/png图片尺寸小于5M</div>--> |
| | | <!-- </template>--> |
| | | <!-- </el-upload>--> |
| | | <!-- </el-form-item>--> |
| | | <!-- </el-col>--> |
| | | <!-- </el-row>--> |
| | | <el-row> |
| | | <el-col :span="18"> |
| | | <div style="display: flex;align-items: center">项目组成员<el-icon style="margin-left: 10px;margin-right: 4px"><InfoFilled /></el-icon><span style="font-size: 13px">金属、非金属矿及其他矿采选业:安全、机械、电气、采矿、通风、地质、水工结构</span></div> |
| | |
| | | </el-row> |
| | | <el-table :data="state.planPersons" :border="true" style="margin: 20px 0"> |
| | | <el-table-column label="序号" width="60" align="center" type="index"></el-table-column> |
| | | <el-table-column label="评价组成员" prop="person.name" header-align="center" :show-overflow-tooltip="true"/> |
| | | <el-table-column label="资格证书" prop="person.certificateNo" header-align="center" :show-overflow-tooltip="true"/> |
| | | <el-table-column label="专业能力" prop="person.major" header-align="center" :show-overflow-tooltip="true"/> |
| | | <el-table-column label="承担工作" header-align="center" class-name="small-padding fixed-width"> |
| | | <el-table-column label="评价组成员" prop="person.name" align="center" :show-overflow-tooltip="true"> |
| | | <template #default="scope"> |
| | | <el-select v-model="scope.row.work" multiple placeholder="承担工作" style="width: 100%" size="large" disabled> |
| | | <el-option v-for="item in state.workList" :key="item.value" :label="item.label" :value="item.value"/> |
| | | </el-select> |
| | | <span v-if="scope.row.jobType === 2">{{ scope.row.person.name }} (组长)</span> |
| | | <span v-else>{{scope.row.person.name}}</span> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="承诺后期前往现场勘验" header-align="center" class-name="small-padding fixed-width"> |
| | | <el-table-column label="专业能力/资格证书" prop="person.certificateNo" align="center" :show-overflow-tooltip="true"> |
| | | <template #default="scope"> |
| | | <el-radio-group v-model="scope.row.laterPromise" size="large" disabled> |
| | | <el-radio :label="1" size="large">是</el-radio> |
| | | <el-radio :label="0" size="large">否</el-radio> |
| | | </el-radio-group> |
| | | {{ getCertNo(scope.row) }} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="未到现场勘验原因" header-align="center" class-name="small-padding fixed-width"> |
| | | <el-table-column label="承担工作" prop="work" align="center" class-name="small-padding fixed-width"></el-table-column> |
| | | <el-table-column label="承诺后期前往现场勘验" prop="laterPromise" align="center" class-name="small-padding fixed-width"> |
| | | <template #default="scope"> |
| | | <el-input v-model="scope.row.reason" maxlength="30" show-word-limit type="text" size="large" readonly/> |
| | | {{(scope.row.laterPromise==1 || scope.row.laterPromise==true)?'是':'否'}} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="是否已告知" header-align="center" class-name="small-padding fixed-width"> |
| | | <el-table-column label="未到现场勘验原因" prop="reason" align="center" class-name="small-padding fixed-width"></el-table-column> |
| | | <el-table-column label="是否已告知" align="center" class-name="small-padding fixed-width"> |
| | | <template #default="scope"> |
| | | <el-radio-group v-model="scope.row.informed" size="large"> |
| | | <el-radio-group v-model="scope.row.informed" size="large" @change="(value)=>changePerson(value,scope.row)" :disabled="projectType==='view'"> |
| | | <el-radio :label="1" size="large">是</el-radio> |
| | | <el-radio :label="0" size="large">否</el-radio> |
| | | </el-radio-group> |
| | |
| | | </el-table-column> |
| | | </el-table> |
| | | </el-form> |
| | | <div style="display: flex;margin-top: 25px;"> |
| | | <el-button type="primary" style="margin-right: 20px" @click="exportWord">导出从业告知书word</el-button> |
| | | <el-upload |
| | | style="width: 250px" |
| | | :disabled="projectType === 'view' || isEnd" |
| | | accept=".pdf" |
| | | :action="state.uploadUrl" |
| | | :data="{moduleType: 12,projectId: props.projectId}" |
| | | :headers="state.header" |
| | | method="post" |
| | | :limit="state.imgLimit" |
| | | :before-upload="beforeUpload" |
| | | :on-success="handleAvatarSuccess" |
| | | v-model:file-list="state.fileList" |
| | | :on-preview="handlePreview" |
| | | :on-remove="handleRemove"> |
| | | <el-button type="primary">上传从业告知书pdf</el-button> |
| | | <template #tip> |
| | | <div class="el-upload__tip">只能上传pdf类型,最多上传1份</div> |
| | | </template> |
| | | </el-upload> |
| | | </div> |
| | | </div> |
| | | </template> |
| | | <script setup> |
| | | |
| | | import {defineEmits, onMounted, reactive, ref} from "vue" |
| | | import {ElMessage} from "element-plus" |
| | | import {defineEmits, defineProps, onMounted, reactive, ref, watchEffect} from "vue" |
| | | import {generateWordDocument} from "@/views/safetyReview/projectManage/components/exportWord"; |
| | | import {ElMessage, ElMessageBox} from "element-plus" |
| | | import {Search} from '@element-plus/icons-vue' |
| | | import {addRisk, editRisk, getRiskDetail} from "@/api/projectManage/riskAnalysis" |
| | | import {addWorkRecord, editWorkRecord, getWorkDetail} from "@/api/projectManage/employNoticeRcd" |
| | | import {getWorks, editWorks} from "@/api/projectManage/evaPlan" |
| | | import Cookies from "js-cookie" |
| | | const props = defineProps(['projectId']) |
| | | const emit = defineEmits(["getNextStatus"]) |
| | | |
| | | import { useRoute } from 'vue-router' |
| | | import {getToken} from "@/utils/auth"; |
| | | import {getFiles} from "@/api/projectManage/siteCheckRcd"; |
| | | import {delAccessoryFile, getProjectDetail} from "@/api/projectManage/project"; |
| | | import axios from "axios"; |
| | | const route = useRoute() |
| | | const state = reactive({ |
| | | formData: { |
| | | id: null, |
| | | projectId: null, |
| | | timeRange: [], |
| | | serviceStartDate: '', |
| | | serviceEndDate: '', |
| | | investigationPlanDate: '' |
| | | }, |
| | | projectId: null, |
| | | planPersons: [], |
| | | rules: { |
| | | timeRange: [{required: true, message: '请选择技术服务期限', trigger: 'blur'}], |
| | | investigationPlanDate: [{required: true, message: '请选择计划现场勘验时间', trigger: 'blur'}], |
| | | } |
| | | investigationPlanDate: [{required: true, message: '请选择计划现场勘验时间', trigger: 'blur'}] |
| | | }, |
| | | imgLimit: 1, |
| | | uploadUrl: import.meta.env.VITE_APP_BASE_API + '/manage/accessory-file/uploadFile', |
| | | header: { |
| | | Authorization: getToken() |
| | | }, |
| | | fileList: [] |
| | | }) |
| | | |
| | | const isEnd = ref('') |
| | | const isAmin = ref(false) |
| | | const formRef = ref() |
| | | onMounted(() => { |
| | |
| | | if(userInfo.identity === 0){ |
| | | isAmin.value = true; |
| | | } |
| | | if(props.projectId){ |
| | | getWorksList(props.projectId) |
| | | getProcessFiles(props.projectId); |
| | | getPDetail(props.projectId) |
| | | } |
| | | isEnd.value = Cookies.get('end') |
| | | |
| | | }); |
| | | |
| | | const projectType = ref(''); |
| | | const riskOpen = async (type,val) => { |
| | | console.log("type",type,val) |
| | | state.formData.projectId = val |
| | | state.projectId = val |
| | | projectType.value = route.query.type; |
| | | isEnd.value = Cookies.get('end') |
| | | // await getWorksList(val) |
| | | if(type === 'detail' || type === 'edit' ){ |
| | | const res = await getRiskDetail({projectId: val}); |
| | | const res = await getWorkDetail({projectId: val}) |
| | | if(res.code == 200){ |
| | | state.formData = res.data; |
| | | state.formData.project.business = parseInt(res.data.project.business); |
| | | state.formData.project.area = [res.data.project.province,res.data.project.city]; |
| | | state.formData = JSON.parse(JSON.stringify(res.data)) |
| | | state.formData.timeRange = [state.formData.serviceStartDate,state.formData.serviceEndDate] |
| | | // state.fileList = res.data.accessoryFiles.map(item => { |
| | | // return { |
| | | // ...item, |
| | | // name: item.originName, |
| | | // } |
| | | // }) |
| | | }else { |
| | | ElMessage.warning(res.message) |
| | | } |
| | |
| | | state.formData.serviceStartDate = state.formData.timeRange[0] |
| | | state.formData.serviceEndDate = state.formData.timeRange[1] |
| | | if(type === 'add'){ |
| | | const {projectId,timeRange, ...data} = JSON.parse(JSON.stringify(state.formData)) |
| | | const res = await addRisk(data); |
| | | const {timeRange,id,...data} = JSON.parse(JSON.stringify(state.formData)) |
| | | const res = await addWorkRecord(data) |
| | | if (res.code == 200) { |
| | | ElMessage.success('保存成功') |
| | | formRef.value.clearValidate(); |
| | | emit('getNextStatus', res.data); |
| | | |
| | | emit('getNextStatus', state.projectId); |
| | | } else { |
| | | ElMessage.warning(res.message) |
| | | } |
| | | |
| | | }else if(type === 'clickEdit'){ |
| | | const {timeRange, ...data} = JSON.parse(JSON.stringify(state.formData)) |
| | | const res = await editRisk(data); |
| | | const res = await editWorkRecord(data); |
| | | if (res.code == 200) { |
| | | ElMessage.success('变更成功') |
| | | formRef.value.clearValidate(); |
| | |
| | | } |
| | | } |
| | | |
| | | const getWorksList = async (id) =>{ |
| | | const works = await getWorks({projectId: id ? id : props.projectId}) |
| | | if(works.code == 200){ |
| | | state.planPersons = works.data |
| | | }else { |
| | | ElMessage.warning(works.message) |
| | | } |
| | | } |
| | | |
| | | const getCertNo = (row)=>{ |
| | | const obj = JSON.parse(row.person.certificateNo) |
| | | const noArr = Object.values(obj) |
| | | return row.person.majorNames.map((item,index)=>{ |
| | | return item + '(' + noArr[index] + ')' |
| | | }).join(',') |
| | | } |
| | | |
| | | const changePerson = async (value,row)=>{ |
| | | const params = { |
| | | id: row.id, |
| | | projectId: row.projectId, |
| | | informed: value |
| | | } |
| | | const res = await editWorks(params) |
| | | if(res.code === 200){ |
| | | console.log(res.message) |
| | | }else{ |
| | | ElMessage.warning(res.message) |
| | | } |
| | | await getWorksList(props.projectId) |
| | | } |
| | | const beforeUpload = (file) => { |
| | | let fileType = file.name.substring(file.name.lastIndexOf(".") + 1); |
| | | if (fileType === 'pdf') { |
| | | } else { |
| | | ElMessage.error("文件类型必须为pdf格式") |
| | | return false |
| | | } |
| | | } |
| | | const handleAvatarSuccess = (res) => { |
| | | if(res.code === 200){ |
| | | getProcessFiles() |
| | | ElMessage({ |
| | | type: 'success', |
| | | message: '文件上传成功' |
| | | }) |
| | | }else { |
| | | state.fileList.splice(state.fileList.indexOf(uploadFile),1) |
| | | ElMessage({ |
| | | type: 'warning', |
| | | message: res.message |
| | | }) |
| | | } |
| | | } |
| | | const handleRemove = async (file, uploadFiles) => { |
| | | if (file && file.status === 'success') { |
| | | ElMessageBox.confirm( |
| | | '确定删除该附件?', |
| | | '提示', |
| | | { |
| | | confirmButtonText: '确定', |
| | | cancelButtonText: '取消', |
| | | type: 'warning', |
| | | }) |
| | | .then(async () => { |
| | | let accessoryFileId = ""; |
| | | if (file.id) { |
| | | accessoryFileId = file.id |
| | | } else { |
| | | accessoryFileId = file.response.data.id |
| | | } |
| | | const res = await delAccessoryFile(accessoryFileId) |
| | | if (res.code == 200) { |
| | | ElMessage({ |
| | | type: 'success', |
| | | message: '文件已删除' |
| | | }) |
| | | await getProcessFiles() |
| | | } else { |
| | | ElMessage({ |
| | | type: 'warning', |
| | | message: res.message |
| | | }) |
| | | } |
| | | }) |
| | | .catch(() => { |
| | | getProcessFiles() |
| | | }) |
| | | } |
| | | } |
| | | |
| | | const getProcessFiles = async (id)=>{ |
| | | const res = await getFiles({projectId: id ? id : props.projectId ,moduleType: 12}) |
| | | if(res.code == 200){ |
| | | if(res.data && res.data.length>0){ |
| | | state.fileList = res.data.map(i=>{ |
| | | return { |
| | | name: i.originName, |
| | | url: import.meta.env.VITE_APP_BASE_API + '/' + i.path, |
| | | id: i.id, |
| | | projectId: i.projectId, |
| | | moduleType: i.moduleType |
| | | } |
| | | }) |
| | | }else{ |
| | | state.fileList = [] |
| | | } |
| | | }else { |
| | | ElMessage.warning(res.message) |
| | | } |
| | | } |
| | | const handlePreview = (file) => { |
| | | const url = file.url |
| | | window.open(url) |
| | | } |
| | | |
| | | const templatePath = '/example.docx' |
| | | const exportWord = async () => { |
| | | const data = state.formData |
| | | for (let key in projectDeatil.value) { |
| | | if (projectDeatil.value.hasOwnProperty(key)) { |
| | | if(key != 'agency') |
| | | data[key] = projectDeatil.value[key]; |
| | | } |
| | | } |
| | | const agencyInfo = projectDeatil.value.agency |
| | | for (let key in agencyInfo) { |
| | | if (agencyInfo.hasOwnProperty(key)) { |
| | | if(key != 'address' && key != 'name' ) |
| | | data[key] = agencyInfo[key]; |
| | | } |
| | | } |
| | | data.leaderName = projectDeatil.value.leader.name |
| | | data.leaderPhone = projectDeatil.value.leader.phone |
| | | |
| | | data.type = '安全评价' |
| | | data.to = data.city + '应急管理局' |
| | | data.notice = '系统告知' |
| | | data.investigationPlanDate = state.formData.investigationPlanDate.substring(0,10) |
| | | data.serviceStartDate = state.formData.serviceStartDate.substring(0,10) |
| | | data.serviceEndDate = state.formData.serviceEndDate.substring(0,10) |
| | | data.tableData = state.planPersons.map(item => { |
| | | return { |
| | | ...item, |
| | | name: item.person.name |
| | | } |
| | | }) |
| | | console.log('res',data) |
| | | const date = new Date() |
| | | const options = { |
| | | year: 'numeric', |
| | | month: '2-digit', |
| | | day: '2-digit' |
| | | } |
| | | data.time = date.toLocaleDateString('zh-CN',options).replace(/\//g, '年') |
| | | .replace(/年(\d{2})年/, '年$1月') |
| | | .replace(/月(\d{2})$/, '月$1日') |
| | | try { |
| | | generateWordDocument(templatePath, data, '从业告知书.docx'); |
| | | } catch (error){ |
| | | ElMessage({ |
| | | type: 'warning', |
| | | message: '失败' |
| | | }); |
| | | } |
| | | } |
| | | |
| | | const projectDeatil = ref() |
| | | const getPDetail = async (val) => { |
| | | const res = await getProjectDetail(val) |
| | | if(res.code == 200){ |
| | | projectDeatil.value = res.data |
| | | |
| | | }else { |
| | | ElMessage.warning(res.message) |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | defineExpose({ |
| | | riskOpen |
| | | }); |