| | |
| | | </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.name" align="center" :show-overflow-tooltip="true"> |
| | | <template #default="scope"> |
| | | <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="专业能力/资格证书" prop="person.certificateNo" align="center" :show-overflow-tooltip="true"> |
| | | <template #default="scope"> |
| | | {{ getCertNo(scope.row) }} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="承担工作" prop="work" header-align="center" class-name="small-padding fixed-width"></el-table-column> |
| | | <el-table-column label="承诺后期前往现场勘验" prop="laterPromise" 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"> |
| | | {{(scope.row.laterPromise==1 || scope.row.laterPromise==true)?'是':'否'}} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="未到现场勘验原因" prop="reason" header-align="center" class-name="small-padding fixed-width"></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" @change="(value)=>changePerson(value,scope.row)"> |
| | | <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, defineProps, onMounted, reactive, ref, watchEffect} from "vue" |
| | | import {ElMessage} from "element-plus" |
| | | import {generateWordDocument} from "@/views/safetyReview/projectManage/components/exportWord"; |
| | | import {ElMessage, ElMessageBox} from "element-plus" |
| | | import {Search} from '@element-plus/icons-vue' |
| | | 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, |
| | |
| | | rules: { |
| | | timeRange: [{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; |
| | | } |
| | | // getWorksList(props.projectId) |
| | | 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) => { |
| | | state.formData.projectId = val |
| | | state.projectId = val |
| | | await getWorksList(val) |
| | | projectType.value = route.query.type; |
| | | isEnd.value = Cookies.get('end') |
| | | // await getWorksList(val) |
| | | if(type === 'detail' || type === 'edit' ){ |
| | | const res = await getWorkDetail({projectId: val}) |
| | | if(res.code == 200){ |
| | | 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) |
| | | } |
| | |
| | | if (res.code == 200) { |
| | | ElMessage.success('保存成功') |
| | | formRef.value.clearValidate(); |
| | | emit('getNextStatus', res.data); |
| | | emit('getNextStatus', state.projectId); |
| | | } 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 |