| | |
| | | </el-table-column> |
| | | </el-table> |
| | | </el-form> |
| | | <el-upload |
| | | style="margin-top: 25px;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 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 {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 { useRoute } from 'vue-router' |
| | | import {getToken} from "@/utils/auth"; |
| | | import {getFiles} from "@/api/projectManage/siteCheckRcd"; |
| | | import {delAccessoryFile} from "@/api/projectManage/project"; |
| | | import {delAccessoryFile, getProjectDetail} from "@/api/projectManage/project"; |
| | | import axios from "axios"; |
| | | const route = useRoute() |
| | | const state = reactive({ |
| | |
| | | if(props.projectId){ |
| | | getWorksList(props.projectId) |
| | | getProcessFiles(props.projectId); |
| | | getPDetail(props.projectId) |
| | | } |
| | | isEnd.value = Cookies.get('end') |
| | | |
| | |
| | | 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 |
| | | }); |