八项作业前端更新

main
liujun 2023-12-13 14:35:16 +08:00
parent 7b4b531a50
commit 77945b86b6
12 changed files with 1369 additions and 770 deletions

View File

@ -8,7 +8,7 @@
<td colspan="4" style="border: none">
<div class="level-title mt-20">
<h1>高处安全作业票</h1>
<div class="level-btns">编号:{{ pd.CHECK_NO }}</div>
<div class="level-code">编号:{{ pd.CHECK_NO }}</div>
</div>
</td>
</tr>
@ -79,7 +79,7 @@
<td>{{ index + 1 }}</td>
<td>{{ item.PROTECTIVE_MEASURES }}</td>
<td>
<span v-if="item.STATUS=='1'"><input type="radio" disabled checked>&nbsp;&nbsp;&nbsp;&nbsp;</span>
<span v-if="item.STATUS=='1'"><input type="radio" disabled checked>&nbsp;&nbsp;&nbsp;</span>
<span v-if="item.STATUS=='-1'"><input type="radio" disabled checked>不涉及</span>
</td>
<td>
@ -123,10 +123,10 @@
<tr>
<td class="bbg">接受交底人</td>
<td colspan="10">
<div v-if="pd.ACCEPT_CONFESS_USER_SIGNER_PATH" style="text-align: right">
<div v-for="item in imgList" :key="item.ACCEPT_CONFESS_ID" style="text-align: right">
<span>签字</span>
<img v-viewer :src="config.fileUrl + pd.ACCEPT_CONFESS_USER_SIGNER_PATH" alt="" width="100" height="100">
<span>{{ pd.ACCEPT_CONFESS_USER_SIGNER_TIME }}</span>
<img v-viewer :src="config.fileUrl + item.ACCEPT_CONFESS_USER_SIGNER_PATH" alt="" width="100" height="100">
<span>{{ item.ACCEPT_CONFESS_USER_SIGNER_TIME }}</span>
</div>
</td>
</tr>
@ -170,13 +170,13 @@
</div>
</td>
</tr>
<tr v-if="pd.ACCEPT_USER_SIGNER_PATH">
<td colspan="4">
<tr v-if="imgList1.length>0">
<td colspan="10">
<div>完工验收{{ pd.ACCEPT_CONTENT }}</div>
<div style="text-align: right">
<div v-for="item in imgList1" :key="item.ACCEPT_CONFESS_ID" style="text-align: right">
<span>签字</span>
<img v-viewer :src="config.fileUrl + pd.ACCEPT_USER_SIGNER_PATH" alt="" width="100" height="100">
<span>{{ pd.ACCEPT_USER_SIGNER_TIME }}</span>
<img v-viewer :src="config.fileUrl + item.ACCEPT_USER_SIGNER_PATH" alt="" width="100" height="100">
<span>{{ item.ACCEPT_USER_SIGNER_TIME }}</span>
</div>
</td>
</tr>
@ -200,6 +200,8 @@ export default {
pd: [], //
measuresList: [],
otherProtectiveMeasures: [],
imgList: [],
imgList1: [],
hazardIdentification: []
}
},
@ -237,6 +239,8 @@ export default {
}
).then((data) => {
this.listLoading = false
this.imgList = data.imgList
this.imgList1 = data.imgList1
this.pd = data.pd // map
this.measuresList = data.measuresList // map
this.pd.CONFIRM_USER_MEASURES = data.pd.OTHER_PROTECTIVE_MEASURES.split(';_;')[0]
@ -269,6 +273,4 @@ export default {
img
width: 100%
height: 100%
.app-container
margin-bottom: 50px
</style>

View File

@ -127,6 +127,38 @@
</template>
</el-step>
</el-steps>
<div style="margin: 60px 60px 0 60px;display: flex;justify-content: space-between">
<div v-if="pd.GUARDIAN_USER_SIGNER_TIME">
<div style="color: #13ce66">
监护人{{ pd.GUARDIAN_USER_NAME }}已签字
</div>
</div>
<div v-if="!pd.GUARDIAN_USER_SIGNER_TIME">
<div style="color: red">
监护人{{ pd.GUARDIAN_USER_NAME }}未签字
</div>
</div>
<div v-if="pd.CONFESS_USER_SIGNER_TIME">
<div style="color: #13ce66">
安全交底人{{ pd.CONFESS_USER_NAME }}已签字
</div>
</div>
<div v-if="!pd.CONFESS_USER_SIGNER_TIME">
<div style="color: red">
安全交底人{{ pd.CONFESS_USER_NAME }}未签字
</div>
</div>
<div v-if="pd.ACCEPT_CONFESS_USER_SIGNER_TIME">
<div style="color: #13ce66">
接受交底人{{ pd.ACCEPT_CONFESS_USER_NAME }}已签字
</div>
</div>
<div v-if="!pd.ACCEPT_CONFESS_USER_SIGNER_TIME">
<div style="color: red">
接受交底人{{ pd.ACCEPT_CONFESS_USER_NAME }}未签字
</div>
</div>
</div>
<div slot="footer" class="dialog-footer">
<!-- <el-button @click="dialogFormShow = false"> </el-button>-->
<el-button type="primary" @click="dialogFormShow = false"> </el-button>

View File

@ -2,190 +2,190 @@
<div>
<div id="printTest" class="app-container print-work">
<el-page-header content="审批表详情" class="no-print" @back="goBack"/>
<table class="table-ui">
<thead>
<div v-for="pdf in 2" :key="pdf" :name="pdf === 2 ? 'pdf-box' : ''" class="pdf-content">
<table :class="['table-ui','table-ui' + pdf]">
<tr>
<td colspan="4" style="border: none">
<div class="level-title mt-20">
<h1>高处安全作业票</h1>
<div class="level-btns">编号:{{ pd.CHECK_NO }}</div>
<div class="level-code">编号:{{ pd.CHECK_NO }}</div>
</div>
</td>
</tr>
</thead>
<tr>
<td class="bbg" style="width: 20%">作业申请单位</td>
<td style="width: 30%">{{ pd.APPLY_DEPARTMENT_NAME }}</td>
<td class="bbg" style="width: 20%">作业申请时间</td>
<td style="width: 30%">{{ pd.CREATTIME }}</td>
</tr>
<tr>
<td class="bbg">作业地点</td>
<td>{{ pd.WORK_PLACE }}</td>
<td class="bbg">作业内容</td>
<td>{{ pd.WORK_CONTENT }}</td>
</tr>
<tr>
<td class="bbg">作业高度</td>
<td>{{ pd.WORK_HIGH }}</td>
<td class="bbg">高处作业级别</td>
<td>
{{ pd.WORK_LEVEL == '1' ? 'I级高处作业' : '' }}
{{ pd.WORK_LEVEL == '2' ? 'II级高处作业' : '' }}
{{ pd.WORK_LEVEL == '3' ? 'III级高处作业' : '' }}
{{ pd.WORK_LEVEL == '4' ? 'IV级高处作业' : '' }}
</td>
</tr>
<tr>
<td class="bbg">作业单位</td>
<td>{{ pd.CONSTRUCTION_DEPARTMENT_NAME }}</td>
<td class="bbg">监护人</td>
<td>
<div v-if="pd.GUARDIAN_USER_SIGNER_PATH" style="text-align: right">
<span>签字</span>
<img v-viewer :src="config.fileUrl + pd.GUARDIAN_USER_SIGNER_PATH" alt="" width="80" height="80">
<span style="width: 200px;display: inline-block">{{ pd.GUARDIAN_USER_SIGNER_TIME }}</span>
</div>
</td>
</tr>
<tr>
<td class="bbg">作业人</td>
<td>{{ pd.PROJECT_MANAGER }}</td>
<td class="bbg">作业负责人</td>
<td>{{ pd.CONSTRUCTION_USER_NAME }}</td>
</tr>
<tr>
<td class="bbg">关联的其他特殊作业及安全作业票编号</td>
<td colspan="3">{{ pd.SPECIAL_WORK }}</td>
</tr>
<tr>
<td class="bbg">风险辨识结果</td>
<td colspan="3">{{ pd.HAZARD_IDENTIFICATION }}</td>
</tr>
<tr>
<td class="bbg">作业实施时间</td>
<td colspan="3">{{ pd.WORK_START_DATE }}{{ pd.WORK_END_DATE }}</td>
</tr>
<tr>
<td colspan="4">
<table class="table-ui">
<tr>
<td>序号</td>
<td>安全措施</td>
<td style="width: 100px;">是否涉及</td>
<td style="width: 100px;">确认人</td>
</tr>
<tr v-for="(item,index) in measuresList" :key="index">
<td>{{ index + 1 }}</td>
<td>{{ item.PROTECTIVE_MEASURES }}</td>
<td>
<span v-if="item.STATUS=='1'"><input type="radio" disabled checked>&nbsp;&nbsp;&nbsp;&nbsp;</span>
<span v-if="item.STATUS=='-1'"><input type="radio" disabled checked>不涉及</span>
</td>
<td>
{{ item.CONFIRM_NAME }}
</td>
</tr>
<tr v-if="pd.CONFIRM_USER_MEASURES || pd.LEADER_USER_MEASURES || pd.AUDIT_USER_MEASURES || pd.APPROVE_USER_MEASURES ">
<td>{{ measuresList.length + 1 }}</td>
<td colspan="3">
<div v-if="pd.CONFIRM_USER_MEASURES" style="display: flex;justify-content: space-between;">
<span>其他安全措施{{ pd.CONFIRM_USER_MEASURES }}</span>
<span>编制人{{ pd.CONSTRUCTION_USER_NAME }}</span>
</div>
<div v-if="pd.LEADER_USER_ID && pd.CONFIRM_USER_MEASURES" style="display: flex;justify-content: space-between;margin-top: 10px;">
<span>其他安全措施{{ pd.LEADER_USER_MEASURES }}</span>
<span>编制人{{ pd.LEADER_USER_NAME }}</span>
</div>
<div v-if="pd.AUDIT_USER_ID && pd.AUDIT_USER_MEASURES" style="display: flex;justify-content: space-between;margin-top: 10px;">
<span>其他安全措施{{ pd.AUDIT_USER_MEASURES }}</span>
<span>编制人{{ pd.AUDIT_USER_NAME }}</span>
</div>
<div v-if="pd.APPROVE_USER_MEASURES" style="display: flex;justify-content: space-between;margin-top: 10px;">
<span>其他安全措施{{ pd.APPROVE_USER_MEASURES }}</span>
<span>编制人{{ pd.APPROVE_USER_NAME }}</span>
</div>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td class="bbg">安全交底人</td>
<td colspan="10">
<div v-if="pd.CONFESS_USER_SIGNER_PATH" style="text-align: right">
<span>签字</span>
<img v-viewer :src="config.fileUrl + pd.CONFESS_USER_SIGNER_PATH" alt="" width="100" height="100">
<span>{{ pd.CONFESS_USER_SIGNER_TIME }}</span>
</div>
</td>
</tr>
<tr>
<td class="bbg">接受交底人</td>
<td colspan="10">
<div v-if="pd.ACCEPT_CONFESS_USER_SIGNER_PATH" style="text-align: right">
<span>签字</span>
<img v-viewer :src="config.fileUrl + pd.ACCEPT_CONFESS_USER_SIGNER_PATH" alt="" width="100" height="100">
<span>{{ pd.ACCEPT_CONFESS_USER_SIGNER_TIME }}</span>
</div>
</td>
</tr>
<tr>
<td colspan="4">
<div>作业负责人意见{{ pd.CONSTRUCTION_CONTENT }}</div>
<div style="text-align: right">
<span>签字</span>
<img v-viewer :src="config.fileUrl + pd.CONSTRUCTION_USER_SIGNER_PATH" alt="" width="100" height="100">
<span>{{ pd.CONSTRUCTION_USER_SIGNER_TIME }}</span>
</div>
</td>
</tr>
<tr v-if="pd.LEADER_USER_ID">
<td colspan="4">
<div>所在单位意见{{ pd.LEADER_CONTENT }}</div>
<div style="text-align: right">
<span>签字</span>
<img v-viewer :src="config.fileUrl + pd.LEADER_USER_SIGNER_PATH" alt="" width="100" height="100">
<span>{{ pd.LEADER_USER_SIGNER_TIME }}</span>
</div>
</td>
</tr>
<tr v-if="pd.AUDIT_USER_ID">
<td colspan="4">
<div>审核部门意见{{ pd.AUDIT_CONTENT }}</div>
<div style="text-align: right">
<span>签字</span>
<img v-viewer :src="config.fileUrl + pd.AUDIT_USER_SIGNER_PATH" alt="" width="100" height="100">
<span>{{ pd.AUDIT_USER_SIGNER_TIME }}</span>
</div>
</td>
</tr>
<tr v-if="pd.APPROVE_USER_ID">
<td colspan="4">
<div>审批部门意见{{ pd.APPROVE_CONTENT }}</div>
<div style="text-align: right">
<span>签字</span>
<img v-viewer :src="config.fileUrl + pd.APPROVE_USER_SIGNER_PATH" alt="" width="100" height="100">
<span>{{ pd.APPROVE_USER_SIGNER_TIME }}</span>
</div>
</td>
</tr>
<tr>
<td colspan="4">
<div>完工验收{{ pd.ACCEPT_CONTENT }}</div>
<div style="text-align: right">
<span>签字</span>
<img v-viewer :src="config.fileUrl + pd.ACCEPT_USER_SIGNER_PATH" alt="" width="100" height="100">
<span>{{ pd.ACCEPT_USER_SIGNER_TIME }}</span>
</div>
</td>
</tr>
</table>
<tr>
<td class="bbg" style="width: 20%">作业申请单位</td>
<td style="width: 30%">{{ pd.APPLY_DEPARTMENT_NAME }}</td>
<td class="bbg" style="width: 20%">作业申请时间</td>
<td style="width: 30%">{{ pd.CREATTIME }}</td>
</tr>
<tr>
<td class="bbg">作业地点</td>
<td>{{ pd.WORK_PLACE }}</td>
<td class="bbg">作业内容</td>
<td>{{ pd.WORK_CONTENT }}</td>
</tr>
<tr>
<td class="bbg">作业高度</td>
<td>{{ pd.WORK_HIGH }}</td>
<td class="bbg">高处作业级别</td>
<td>
{{ pd.WORK_LEVEL == '1' ? 'I级高处作业' : '' }}
{{ pd.WORK_LEVEL == '2' ? 'II级高处作业' : '' }}
{{ pd.WORK_LEVEL == '3' ? 'III级高处作业' : '' }}
{{ pd.WORK_LEVEL == '4' ? 'IV级高处作业' : '' }}
</td>
</tr>
<tr>
<td class="bbg">作业单位</td>
<td>{{ pd.CONSTRUCTION_DEPARTMENT_NAME }}</td>
<td class="bbg">监护人</td>
<td>
<div v-if="pd.GUARDIAN_USER_SIGNER_PATH" style="text-align: right">
<span>签字</span>
<img v-viewer :src="config.fileUrl + pd.GUARDIAN_USER_SIGNER_PATH" alt="" width="80" height="80">
<span style="width: 200px;display: inline-block">{{ pd.GUARDIAN_USER_SIGNER_TIME }}</span>
</div>
</td>
</tr>
<tr>
<td class="bbg">作业人</td>
<td>{{ pd.PROJECT_MANAGER }}</td>
<td class="bbg">作业负责人</td>
<td>{{ pd.CONSTRUCTION_USER_NAME }}</td>
</tr>
<tr>
<td class="bbg">关联的其他特殊作业及安全作业票编号</td>
<td colspan="3">{{ pd.SPECIAL_WORK }}</td>
</tr>
<tr>
<td class="bbg">风险辨识结果</td>
<td colspan="3">{{ pd.HAZARD_IDENTIFICATION }}</td>
</tr>
<tr>
<td class="bbg">作业实施时间</td>
<td colspan="3">{{ pd.WORK_START_DATE }}{{ pd.WORK_END_DATE }}</td>
</tr>
<tr>
<td colspan="4">
<table class="table-ui">
<tr>
<td>序号</td>
<td>安全措施</td>
<td style="width: 100px;">是否涉及</td>
<td style="width: 100px;">确认人</td>
</tr>
<tr v-for="(item,index) in measuresList" :key="index">
<td>{{ index + 1 }}</td>
<td>{{ item.PROTECTIVE_MEASURES }}</td>
<td>
<span v-if="item.STATUS=='1'"><input type="radio" disabled checked>&nbsp;&nbsp;&nbsp;</span>
<span v-if="item.STATUS=='-1'"><input type="radio" disabled checked>涉及</span>
</td>
<td>
{{ item.CONFIRM_NAME }}
</td>
</tr>
<tr v-if="pd.CONFIRM_USER_MEASURES || pd.LEADER_USER_MEASURES || pd.AUDIT_USER_MEASURES || pd.APPROVE_USER_MEASURES ">
<td>{{ measuresList.length + 1 }}</td>
<td colspan="3">
<div v-if="pd.CONFIRM_USER_MEASURES" style="display: flex;justify-content: space-between;">
<span>其他安全措施{{ pd.CONFIRM_USER_MEASURES }}</span>
<span>编制人{{ pd.CONSTRUCTION_USER_NAME }}</span>
</div>
<div v-if="pd.LEADER_USER_ID && pd.CONFIRM_USER_MEASURES" style="display: flex;justify-content: space-between;margin-top: 10px;">
<span>其他安全措施{{ pd.LEADER_USER_MEASURES }}</span>
<span>编制人{{ pd.LEADER_USER_NAME }}</span>
</div>
<div v-if="pd.AUDIT_USER_ID && pd.AUDIT_USER_MEASURES" style="display: flex;justify-content: space-between;margin-top: 10px;">
<span>其他安全措施{{ pd.AUDIT_USER_MEASURES }}</span>
<span>编制人{{ pd.AUDIT_USER_NAME }}</span>
</div>
<div v-if="pd.APPROVE_USER_MEASURES" style="display: flex;justify-content: space-between;margin-top: 10px;">
<span>其他安全措施{{ pd.APPROVE_USER_MEASURES }}</span>
<span>编制人{{ pd.APPROVE_USER_NAME }}</span>
</div>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td class="bbg">安全交底人</td>
<td colspan="10">
<div v-if="pd.CONFESS_USER_SIGNER_PATH" style="text-align: right">
<span>签字</span>
<img v-viewer :src="config.fileUrl + pd.CONFESS_USER_SIGNER_PATH" alt="" width="100" height="100">
<span>{{ pd.CONFESS_USER_SIGNER_TIME }}</span>
</div>
</td>
</tr>
<tr>
<td class="bbg">接受交底人</td>
<td colspan="10">
<div v-for="item in imgList" :key="item.ACCEPT_CONFESS_ID" style="text-align: right">
<span>签字</span>
<img v-viewer :src="config.fileUrl + item.ACCEPT_CONFESS_USER_SIGNER_PATH" alt="" width="100" height="100">
<span>{{ item.ACCEPT_CONFESS_USER_SIGNER_TIME }}</span>
</div>
</td>
</tr>
<tr>
<td colspan="4">
<div>作业负责人意见{{ pd.CONSTRUCTION_CONTENT }}</div>
<div style="text-align: right">
<span>签字</span>
<img v-viewer :src="config.fileUrl + pd.CONSTRUCTION_USER_SIGNER_PATH" alt="" width="100" height="100">
<span>{{ pd.CONSTRUCTION_USER_SIGNER_TIME }}</span>
</div>
</td>
</tr>
<tr v-if="pd.LEADER_USER_ID">
<td colspan="4">
<div>所在单位意见{{ pd.LEADER_CONTENT }}</div>
<div style="text-align: right">
<span>签字</span>
<img v-viewer :src="config.fileUrl + pd.LEADER_USER_SIGNER_PATH" alt="" width="100" height="100">
<span>{{ pd.LEADER_USER_SIGNER_TIME }}</span>
</div>
</td>
</tr>
<tr v-if="pd.AUDIT_USER_ID">
<td colspan="4">
<div>审核部门意见{{ pd.AUDIT_CONTENT }}</div>
<div style="text-align: right">
<span>签字</span>
<img v-viewer :src="config.fileUrl + pd.AUDIT_USER_SIGNER_PATH" alt="" width="100" height="100">
<span>{{ pd.AUDIT_USER_SIGNER_TIME }}</span>
</div>
</td>
</tr>
<tr v-if="pd.APPROVE_USER_ID">
<td colspan="4">
<div>审批部门意见{{ pd.APPROVE_CONTENT }}</div>
<div style="text-align: right">
<span>签字</span>
<img v-viewer :src="config.fileUrl + pd.APPROVE_USER_SIGNER_PATH" alt="" width="100" height="100">
<span>{{ pd.APPROVE_USER_SIGNER_TIME }}</span>
</div>
</td>
</tr>
<tr v-if="imgList1.length>0">
<td colspan="10">
<div>完工验收{{ pd.ACCEPT_CONTENT }}</div>
<div v-for="item in imgList1" :key="item.ACCEPT_CONFESS_ID" style="text-align: right">
<span>签字</span>
<img v-viewer :src="config.fileUrl + item.ACCEPT_USER_SIGNER_PATH" alt="" width="100" height="100">
<span>{{ item.ACCEPT_USER_SIGNER_TIME }}</span>
</div>
</td>
</tr>
</table>
</div>
</div>
<div style="padding-top: 100px"/>
<!-- <div class="ui-height" />-->
<div class="ui-foot">
<el-button v-print="'#printTest'" icon="el-icon-printer" type="primary"> </el-button>
<!-- <el-button v-print="'#printTest'" icon="el-icon-printer" type="primary"> </el-button>-->
<el-button type="primary" icon="el-icon-printer" @click="handle2PDF">PDF</el-button>
<el-button icon="el-icon-arrow-left" @click="goBack"> </el-button>
</div>
</div>
@ -194,6 +194,8 @@
<script>
import { requestFN } from '@/utils/request'
import dateformat from '@/utils/dateformat'
import JsPDF from 'jspdf'
import html2Canvas from 'html2canvas'
export default {
data() {
return {
@ -201,6 +203,8 @@ export default {
HIGHWORK_ID: this.$parent.HIGHWORK_ID, // ID
pd: [], //
measuresList: [],
imgList: [],
imgList1: [],
otherProtectiveMeasures: [],
hazardIdentification: []
}
@ -209,6 +213,85 @@ export default {
this.getData()
},
methods: {
handle2PDF() {
const loading = this.$loading({
lock: true,
text: '正在生成,请稍候...',
spinner: 'el-icon-loading',
background: 'rgba(0, 0, 0, 0.7)'
})
const elements = document.querySelectorAll('div[name="pdf-box"]')
console.log(elements)
this.html2pdf(this.pd.CHECK_NO + '审批表详情', elements, loading)
},
html2pdf(filename, els, loading) {
const flagArr = []
for (let i = 0, len = els.length; i < len; i++) {
flagArr.push(0)
}
console.log(flagArr)
runself(0)
const pdf = new JsPDF('', 'pt', 'a4') // A4
function runself(index) {
const html = els[index]
html2Canvas(html, {
allowTaint: true,
taintTest: false,
logging: false,
useCORS: true,
scale: 2 //
}).then(canvas => {
// eslint-disable-next-line one-var
var ctx = canvas.getContext('2d'),
a4w = 532.28, a4h = 781.89, // A4210mm x 297mm10mm190x277 pt:592.28 * 841.89
renderedHeight = 0
const allTrs = html.querySelectorAll('tr')
while (renderedHeight < canvas.height) {
let imgHeight = Math.floor(a4h * canvas.width / a4w) // A4
for (let i = 0; i < allTrs.length; i++) {
const tr = allTrs[i]
const trHeight = tr.offsetHeight + tr.offsetTop
console.log('offsetHeight:' + tr.offsetHeight + 'offsetTop:' + tr.offsetTop + 'offsetParent:' + tr.offsetParent.offsetTop)
if (trHeight * 2 > (imgHeight + renderedHeight)) {
const btr = allTrs[i - 1]
const btrHeight = btr.offsetHeight + btr.offsetTop
console.log('i:' + (i - 1) + 'btrHeight:' + btrHeight)
imgHeight = btrHeight * 2 - renderedHeight
break
}
}
var page = document.createElement('canvas')
page.width = canvas.width
page.height = Math.min(imgHeight, canvas.height - renderedHeight)//
// getImageDatacanvas
page.getContext('2d').putImageData(ctx.getImageData(0, renderedHeight, canvas.width, Math.min(imgHeight, canvas.height - renderedHeight)), 0, 0)
pdf.addImage(page.toDataURL('image/jpeg', 1.0), 'JPEG', 30, 30, a4w, Math.min(a4h, a4w * page.height / page.width)) // 10mm
renderedHeight += imgHeight
if (renderedHeight < canvas.height) {
pdf.addPage()//
}
}
if (index < els.length - 1) {
pdf.addPage()
}
return 1
}).then(item => {
flagArr[index] = item
if (flagArr.every(f => f === 1)) {
pdf.save(filename)
}
index++
if (index < els.length) {
runself(index)
} else {
loading.close()
}
})
}
},
validStr(str) {
if (str != null && str != '' && typeof (str) != 'undefined' && str != 0) { return true }
return false
@ -239,6 +322,8 @@ export default {
}
).then((data) => {
this.listLoading = false
this.imgList = data.imgList
this.imgList1 = data.imgList1
this.pd = data.pd // map
this.measuresList = data.measuresList // map
this.pd.CONFIRM_USER_MEASURES = data.pd.OTHER_PROTECTIVE_MEASURES.split(';_;')[0]
@ -271,3 +356,27 @@ export default {
width: 100%
height: 100%
</style>
<style scoped lang="scss">
.table-ui td{
line-height: unset;
}
.pdf-content[name=pdf-box]{
position: absolute;
left: -999999px;
.level-title {
h1{
font-size: 20px;
}
.level-code{
font-size: 20px;
}
}
td{
font-size: 20px;
}
.bbg {
width: 180px;
}
}
</style>

View File

@ -8,7 +8,7 @@
<td colspan="6" style="border: none">
<div class="level-title mt-20">
<h1>吊装安全作业票</h1>
<div class="level-btns">编号:{{ pd.CHECK_NO }}</div>
<div class="level-code">编号:{{ pd.CHECK_NO }}</div>
</div>
</td>
</tr>
@ -56,6 +56,11 @@
</span>
</td>
</tr>
<tr>
<td class="bbg">关联的其他特殊作业及安全作业票编号</td>
<td colspan="5">{{ pd.SPECIAL_WORK }}</td>
</tr>
<tr/>
<tr>
<td class="bbg">风险辨识结果</td>
<td colspan="5">{{ pd.HAZARD_IDENTIFICATION }}</td>
@ -79,7 +84,7 @@
</td>
<td>
<span v-if="item.STATUS=='1'"><input type="radio" disabled checked>&nbsp;&nbsp;&nbsp;&nbsp;</span>
<span v-if="item.STATUS=='1'"><input type="radio" disabled checked>&nbsp;&nbsp;&nbsp;</span>
<span v-if="item.STATUS=='-1'"><input type="radio" disabled checked>不涉及</span>
</td>
<td>
@ -123,10 +128,10 @@
<tr>
<td class="bbg">接受交底人</td>
<td colspan="10">
<div v-if="pd.ACCEPT_CONFESS_USER_SIGNER_PATH" style="text-align: right">
<div v-for="item in imgList" :key="item.ACCEPT_CONFESS_ID" style="text-align: right">
<span>签字</span>
<img v-viewer :src="config.fileUrl + pd.ACCEPT_CONFESS_USER_SIGNER_PATH" alt="" width="100" height="100">
<span>{{ pd.ACCEPT_CONFESS_USER_SIGNER_TIME }}</span>
<img v-viewer :src="config.fileUrl + item.ACCEPT_CONFESS_USER_SIGNER_PATH" alt="" width="100" height="100">
<span>{{ item.ACCEPT_CONFESS_USER_SIGNER_TIME }}</span>
</div>
</td>
</tr>
@ -170,13 +175,13 @@
</div>
</td>
</tr>
<tr v-if="pd.ACCEPT_USER_SIGNER_PATH">
<td colspan="6">
<tr v-if="imgList1.length>0">
<td colspan="10">
<div>完工验收{{ pd.ACCEPT_CONTENT }}</div>
<div style="text-align: right">
<div v-for="item in imgList1" :key="item.ACCEPT_CONFESS_ID" style="text-align: right">
<span>签字</span>
<img v-viewer :src="config.fileUrl + pd.ACCEPT_USER_SIGNER_PATH" alt="" width="100" height="100">
<span>{{ pd.ACCEPT_USER_SIGNER_TIME }}</span>
<img v-viewer :src="config.fileUrl + item.ACCEPT_USER_SIGNER_PATH" alt="" width="100" height="100">
<span>{{ item.ACCEPT_USER_SIGNER_TIME }}</span>
</div>
</td>
</tr>
@ -200,6 +205,8 @@ export default {
HOISTING_ID: this.$parent.HOISTING_ID, // ID
pd: [], //
measuresList: [],
imgList: [],
imgList1: [],
otherProtectiveMeasures: []
}
},
@ -265,6 +272,8 @@ export default {
).then((data) => {
this.listLoading = false
this.pd = data.pd // map
this.imgList = data.imgList
this.imgList1 = data.imgList1
this.measuresList = this.handleStr(data.measuresList) // map
this.pd.LEADER_USER_MEASURES = this.pd.OTHER_PROTECTIVE_MEASURES.split(';_;')[0]
this.pd.CONFIRM_USER_MEASURES = this.pd.OTHER_PROTECTIVE_MEASURES.split(';_;')[1]
@ -295,6 +304,4 @@ export default {
img
width: 100%
height: 100%
.app-container
margin-bottom: 50px
</style>

View File

@ -127,6 +127,38 @@
</template>
</el-step>
</el-steps>
<div style="margin: 60px 60px 0 60px;display: flex;justify-content: space-between">
<div v-if="pd.GUARDIAN_USER_SIGNER_TIME">
<div style="color: #13ce66">
监护人{{ pd.GUARDIAN_USER_NAME }}已签字
</div>
</div>
<div v-if="!pd.GUARDIAN_USER_SIGNER_TIME">
<div style="color: red">
监护人{{ pd.GUARDIAN_USER_NAME }}未签字
</div>
</div>
<div v-if="pd.CONFESS_USER_SIGNER_TIME">
<div style="color: #13ce66">
安全交底人{{ pd.CONFESS_USER_NAME }}已签字
</div>
</div>
<div v-if="!pd.CONFESS_USER_SIGNER_TIME">
<div style="color: red">
安全交底人{{ pd.CONFESS_USER_NAME }}未签字
</div>
</div>
<div v-if="pd.ACCEPT_CONFESS_USER_SIGNER_TIME">
<div style="color: #13ce66">
接受交底人{{ pd.ACCEPT_CONFESS_USER_NAME }}已签字
</div>
</div>
<div v-if="!pd.ACCEPT_CONFESS_USER_SIGNER_TIME">
<div style="color: red">
接受交底人{{ pd.ACCEPT_CONFESS_USER_NAME }}未签字
</div>
</div>
</div>
<div slot="footer" class="dialog-footer">
<!-- <el-button @click="dialogFormShow = false"> </el-button>-->
<el-button type="primary" @click="dialogFormShow = false"> </el-button>

View File

@ -2,188 +2,192 @@
<div>
<div id="printTest" class="app-container print-work">
<el-page-header content="审批表详情" class="no-print" @back="goBack"/>
<table class="table-ui">
<thead>
<div v-for="pdf in 2" :key="pdf" :name="pdf === 2 ? 'pdf-box' : ''" class="pdf-content">
<table :class="['table-ui','table-ui' + pdf]">
<tr>
<td colspan="6" style="border: none">
<div class="level-title mt-20">
<h1>吊装安全作业票</h1>
<div class="level-btns">编号:{{ pd.CHECK_NO }}</div>
<div class="level-code">编号:{{ pd.CHECK_NO }}</div>
</div>
</td>
</tr>
</thead>
<tr>
<td class="bbg">作业申请单位</td>
<td>{{ pd.APPLY_DEPARTMENT_NAME }}</td>
<td class="bbg">作业单位</td>
<td>{{ pd.LEADER_DEPARTMENT_NAME }}</td>
<td class="bbg">作业申请时间</td>
<td>{{ pd.CREATTIME }}</td>
</tr>
<tr>
<td class="bbg">吊装地点</td>
<td>{{ pd.WORK_PLACE }}</td>
<td class="bbg">吊具名称</td>
<td>{{ pd.TOOL_NAME }}</td>
<td class="bbg">吊物内容</td>
<td>{{ pd.WORK_CONTENT }}</td>
</tr>
<tr>
<td class="bbg">吊装作业人</td>
<td>{{ pd.WORK_USER }}</td>
<td class="bbg">司索人</td>
<td>{{ pd.SISUO_USER }}</td>
<td class="bbg">监护人</td>
<td>
<div v-if="pd.GUARDIAN_USER_SIGNER_PATH" style="text-align: right">
<span>签字</span>
<img v-viewer :src="config.fileUrl + pd.GUARDIAN_USER_SIGNER_PATH" alt="" width="100" height="100">
<span>{{ pd.GUARDIAN_USER_SIGNER_TIME }}</span>
</div>
</td>
</tr>
<tr>
<td class="bbg">指挥人员</td>
<td>{{ pd.PROJECT_MANAGER }}</td>
<td class="bbg" colspan="2">吊物质量t及作业级别</td>
<td colspan="2">
<span>{{ pd.PART_WEIGHT }}t</span>
<span style="margin-left: 20px;">
{{ pd.WORK_LEVEL == '1' ? '一级作业级别' : '' }}
{{ pd.WORK_LEVEL == '2' ? '二级作业级别' : '' }}
{{ pd.WORK_LEVEL == '3' ? '三级作业级别' : '' }}
</span>
</td>
</tr>
<tr>
<td class="bbg">风险辨识结果</td>
<td colspan="5">{{ pd.HAZARD_IDENTIFICATION }}</td>
</tr>
<tr>
<td class="bbg">作业实施时间</td>
<td colspan="5">{{ pd.WORK_START_DATE }}{{ pd.WORK_END_DATE }}</td>
</tr>
<tr>
<td colspan="6">
<table class="table-ui">
<tr>
<td>序号</td>
<td>安全措施</td>
<td>是否涉及</td>
<td>确认人</td>
</tr>
<tr v-for="(item,index) in measuresList" :key="index">
<td>{{ index + 1 }}</td>
<td>{{ item.PROTECTIVE_MEASURES }}</td>
<td>
<span v-if="item.STATUS=='1'"><input type="radio" disabled checked>&nbsp;&nbsp;&nbsp;&nbsp;</span>
<span v-if="item.STATUS=='-1'"><input type="radio" disabled checked>不涉及</span>
</td>
<td>
{{ item.CONFIRM_NAME }}
</td>
</tr>
<tr v-if="pd.LEADER_USER_MEASURES || pd.CONFIRM_USER_MEASURES || pd.AUDIT_USER_MEASURES || pd.APPROVE_USER_MEASURES">
<td>{{ measuresList.length + 1 }}</td>
<td colspan="2">
<div v-if="pd.LEADER_USER_MEASURES" style="display: flex;justify-content: space-between;">
<span>其他安全措施{{ pd.LEADER_USER_MEASURES }}</span>
<span>编制人{{ pd.LEADER_USER_NAME }}</span>
</div>
<div v-if="pd.CONSTRUCTION_USER_ID && pd.CONFIRM_USER_MEASURES" style="display: flex;justify-content: space-between;margin-top: 10px;">
<span>其他安全措施{{ pd.CONFIRM_USER_MEASURES }}</span>
<span>编制人{{ pd.CONSTRUCTION_USER_NAME }}</span>
</div>
<div v-if="pd.AUDIT_USER_ID && pd.AUDIT_USER_MEASURES" style="display: flex;justify-content: space-between;margin-top: 10px;">
<span>其他安全措施{{ pd.AUDIT_USER_MEASURES }}</span>
<span>编制人{{ pd.AUDIT_USER_NAME }}</span>
</div>
<div v-if="pd.APPROVE_USER_ID && pd.APPROVE_USER_MEASURES" style="display: flex;justify-content: space-between;margin-top: 10px;">
<span>其他安全措施{{ pd.APPROVE_USER_MEASURES }}</span>
<span>编制人{{ pd.APPROVE_USER_NAME }}</span>
</div>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td class="bbg">安全交底人</td>
<td colspan="10">
<div v-if="pd.CONFESS_USER_SIGNER_PATH" style="text-align: right">
<span>签字</span>
<img v-viewer :src="config.fileUrl + pd.CONFESS_USER_SIGNER_PATH" alt="" width="100" height="100">
<span>{{ pd.CONFESS_USER_SIGNER_TIME }}</span>
</div>
</td>
</tr>
<tr>
<td class="bbg">接受交底人</td>
<td colspan="10">
<div v-if="pd.ACCEPT_CONFESS_USER_SIGNER_PATH" style="text-align: right">
<span>签字</span>
<img v-viewer :src="config.fileUrl + pd.ACCEPT_CONFESS_USER_SIGNER_PATH" alt="" width="100" height="100">
<span>{{ pd.ACCEPT_CONFESS_USER_SIGNER_TIME }}</span>
</div>
</td>
</tr>
<tr>
<td colspan="6">
<div>作业指挥意见{{ pd.LEADER_CONTENT }}</div>
<div style="text-align: right">
<span>签字</span>
<img v-viewer :src="config.fileUrl + pd.LEADER_USER_SIGNER_PATH" alt="" width="100" height="100">
<span>{{ pd.LEADER_USER_SIGNER_TIME }}</span>
</div>
</td>
</tr>
<tr v-if="pd.CONSTRUCTION_USER_ID">
<td colspan="6">
<div>所在单位意见{{ pd.CONSTRUCTION_CONTENT }}</div>
<div style="text-align: right">
<span>签字</span>
<img v-viewer :src="config.fileUrl + pd.CONSTRUCTION_USER_SIGNER_PATH" alt="" width="100" height="100">
<span>{{ pd.CONSTRUCTION_USER_SIGNER_TIME }}</span>
</div>
</td>
</tr>
<tr v-if="pd.AUDIT_USER_ID">
<td colspan="6">
<div>审核部门意见{{ pd.AUDIT_CONTENT }}</div>
<div style="text-align: right">
<span>签字</span>
<img v-viewer :src="config.fileUrl + pd.AUDIT_USER_SIGNER_PATH" alt="" width="100" height="100">
<span>{{ pd.AUDIT_USER_SIGNER_TIME }}</span>
</div>
</td>
</tr>
<tr v-if="pd.APPROVE_USER_ID">
<td colspan="6">
<div>审批部门意见{{ pd.APPROVE_CONTENT }}</div>
<div style="text-align: right">
<span>签字</span>
<img v-viewer :src="config.fileUrl + pd.APPROVE_USER_SIGNER_PATH" alt="" width="100" height="100">
<span>{{ pd.APPROVE_USER_SIGNER_TIME }}</span>
</div>
</td>
</tr>
<tr>
<td colspan="6">
<div>完工验收{{ pd.ACCEPT_CONTENT }}</div>
<div style="text-align: right">
<span>签字</span>
<img v-viewer :src="config.fileUrl + pd.ACCEPT_USER_SIGNER_PATH" alt="" width="100" height="100">
<span>{{ pd.ACCEPT_USER_SIGNER_TIME }}</span>
</div>
</td>
</tr>
</table>
<tr>
<td class="bbg">作业申请单位</td>
<td>{{ pd.APPLY_DEPARTMENT_NAME }}</td>
<td class="bbg">作业单位</td>
<td>{{ pd.LEADER_DEPARTMENT_NAME }}</td>
<td class="bbg">作业申请时间</td>
<td>{{ pd.CREATTIME }}</td>
</tr>
<tr>
<td class="bbg">吊装地点</td>
<td>{{ pd.WORK_PLACE }}</td>
<td class="bbg">吊具名称</td>
<td>{{ pd.TOOL_NAME }}</td>
<td class="bbg">吊物内容</td>
<td>{{ pd.WORK_CONTENT }}</td>
</tr>
<tr>
<td class="bbg">吊装作业人</td>
<td>{{ pd.WORK_USER }}</td>
<td class="bbg">司索人</td>
<td>{{ pd.SISUO_USER }}</td>
<td class="bbg">监护人</td>
<td>
<div v-if="pd.GUARDIAN_USER_SIGNER_PATH" style="text-align: right">
<span>签字</span>
<img v-viewer :src="config.fileUrl + pd.GUARDIAN_USER_SIGNER_PATH" alt="" width="100" height="100">
<span>{{ pd.GUARDIAN_USER_SIGNER_TIME }}</span>
</div>
</td>
</tr>
<tr>
<td class="bbg">指挥人员</td>
<td>{{ pd.PROJECT_MANAGER }}</td>
<td class="bbg" colspan="2">吊物质量t及作业级别</td>
<td colspan="2">
<span>{{ pd.PART_WEIGHT }}t</span>
<span style="margin-left: 20px;">
{{ pd.WORK_LEVEL == '1' ? '一级作业级别' : '' }}
{{ pd.WORK_LEVEL == '2' ? '二级作业级别' : '' }}
{{ pd.WORK_LEVEL == '3' ? '三级作业级别' : '' }}
</span>
</td>
</tr>
<tr>
<td class="bbg">关联的其他特殊作业及安全作业票编号</td>
<td colspan="5">{{ pd.SPECIAL_WORK }}</td>
</tr>
<tr/><tr>
<td class="bbg">风险辨识结果</td>
<td colspan="5">{{ pd.HAZARD_IDENTIFICATION }}</td>
</tr>
<tr>
<td class="bbg">作业实施时间</td>
<td colspan="5">{{ pd.WORK_START_DATE }}{{ pd.WORK_END_DATE }}</td>
</tr>
<tr>
<td colspan="6">
<table class="table-ui">
<tr>
<td>序号</td>
<td>安全措施</td>
<td>是否涉及</td>
<td>确认人</td>
</tr>
<tr v-for="(item,index) in measuresList" :key="index">
<td>{{ index + 1 }}</td>
<td>{{ item.PROTECTIVE_MEASURES }}</td>
<td>
<span v-if="item.STATUS=='1'"><input type="radio" disabled checked>&nbsp;&nbsp;&nbsp;</span>
<span v-if="item.STATUS=='-1'"><input type="radio" disabled checked>不涉及</span>
</td>
<td>
{{ item.CONFIRM_NAME }}
</td>
</tr>
<tr v-if="pd.LEADER_USER_MEASURES || pd.CONFIRM_USER_MEASURES || pd.AUDIT_USER_MEASURES || pd.APPROVE_USER_MEASURES">
<td>{{ measuresList.length + 1 }}</td>
<td colspan="3">
<div v-if="pd.LEADER_USER_MEASURES" style="display: flex;justify-content: space-between;">
<span>其他安全措施{{ pd.LEADER_USER_MEASURES }}</span>
<span>编制人{{ pd.LEADER_USER_NAME }}</span>
</div>
<div v-if="pd.CONSTRUCTION_USER_ID && pd.CONFIRM_USER_MEASURES" style="display: flex;justify-content: space-between;margin-top: 10px;">
<span>其他安全措施{{ pd.CONFIRM_USER_MEASURES }}</span>
<span>编制人{{ pd.CONSTRUCTION_USER_NAME }}</span>
</div>
<div v-if="pd.AUDIT_USER_ID && pd.AUDIT_USER_MEASURES" style="display: flex;justify-content: space-between;margin-top: 10px;">
<span>其他安全措施{{ pd.AUDIT_USER_MEASURES }}</span>
<span>编制人{{ pd.AUDIT_USER_NAME }}</span>
</div>
<div v-if="pd.APPROVE_USER_ID && pd.APPROVE_USER_MEASURES" style="display: flex;justify-content: space-between;margin-top: 10px;">
<span>其他安全措施{{ pd.APPROVE_USER_MEASURES }}</span>
<span>编制人{{ pd.APPROVE_USER_NAME }}</span>
</div>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td class="bbg">安全交底人</td>
<td colspan="10">
<div v-if="pd.CONFESS_USER_SIGNER_PATH" style="text-align: right">
<span>签字</span>
<img v-viewer :src="config.fileUrl + pd.CONFESS_USER_SIGNER_PATH" alt="" width="100" height="100">
<span>{{ pd.CONFESS_USER_SIGNER_TIME }}</span>
</div>
</td>
</tr>
<tr>
<td class="bbg">接受交底人</td>
<td colspan="10">
<div v-for="item in imgList" :key="item.ACCEPT_CONFESS_ID" style="text-align: right">
<span>签字</span>
<img v-viewer :src="config.fileUrl + item.ACCEPT_CONFESS_USER_SIGNER_PATH" alt="" width="100" height="100">
<span>{{ item.ACCEPT_CONFESS_USER_SIGNER_TIME }}</span>
</div>
</td>
</tr>
<tr>
<td colspan="6">
<div>作业指挥意见{{ pd.LEADER_CONTENT }}</div>
<div style="text-align: right">
<span>签字</span>
<img v-viewer :src="config.fileUrl + pd.LEADER_USER_SIGNER_PATH" alt="" width="100" height="100">
<span>{{ pd.LEADER_USER_SIGNER_TIME }}</span>
</div>
</td>
</tr>
<tr v-if="pd.CONSTRUCTION_USER_ID">
<td colspan="6">
<div>所在单位意见{{ pd.CONSTRUCTION_CONTENT }}</div>
<div style="text-align: right">
<span>签字</span>
<img v-viewer :src="config.fileUrl + pd.CONSTRUCTION_USER_SIGNER_PATH" alt="" width="100" height="100">
<span>{{ pd.CONSTRUCTION_USER_SIGNER_TIME }}</span>
</div>
</td>
</tr>
<tr v-if="pd.AUDIT_USER_ID">
<td colspan="6">
<div>审核部门意见{{ pd.AUDIT_CONTENT }}</div>
<div style="text-align: right">
<span>签字</span>
<img v-viewer :src="config.fileUrl + pd.AUDIT_USER_SIGNER_PATH" alt="" width="100" height="100">
<span>{{ pd.AUDIT_USER_SIGNER_TIME }}</span>
</div>
</td>
</tr>
<tr v-if="pd.APPROVE_USER_ID">
<td colspan="6">
<div>审批部门意见{{ pd.APPROVE_CONTENT }}</div>
<div style="text-align: right">
<span>签字</span>
<img v-viewer :src="config.fileUrl + pd.APPROVE_USER_SIGNER_PATH" alt="" width="100" height="100">
<span>{{ pd.APPROVE_USER_SIGNER_TIME }}</span>
</div>
</td>
</tr>
<tr v-if="imgList1.length>0">
<td colspan="10">
<div>完工验收{{ pd.ACCEPT_CONTENT }}</div>
<div v-for="item in imgList1" :key="item.ACCEPT_CONFESS_ID" style="text-align: right">
<span>签字</span>
<img v-viewer :src="config.fileUrl + item.ACCEPT_USER_SIGNER_PATH" alt="" width="100" height="100">
<span>{{ item.ACCEPT_USER_SIGNER_TIME }}</span>
</div>
</td>
</tr>
</table>
</div>
</div>
<div style="padding-top: 100px"/>
<!-- <div class="ui-height" />-->
<div class="ui-foot">
<el-button v-print="'#printTest'" icon="el-icon-printer" type="primary"> </el-button>
<!-- <el-button v-print="'#printTest'" icon="el-icon-printer" type="primary"> </el-button>-->
<el-button type="primary" icon="el-icon-printer" @click="handle2PDF">PDF</el-button>
<el-button icon="el-icon-arrow-left" @click="goBack"> </el-button>
</div>
</div>
@ -192,6 +196,8 @@
<script>
import { requestFN } from '@/utils/request'
import dateformat from '@/utils/dateformat'
import JsPDF from 'jspdf'
import html2Canvas from 'html2canvas'
export default {
data() {
return {
@ -199,6 +205,8 @@ export default {
HOISTING_ID: this.$parent.HOISTING_ID, // ID
pd: [], //
measuresList: [],
imgList: [],
imgList1: [],
otherProtectiveMeasures: []
}
},
@ -206,6 +214,85 @@ export default {
this.getData()
},
methods: {
handle2PDF() {
const loading = this.$loading({
lock: true,
text: '正在生成,请稍候...',
spinner: 'el-icon-loading',
background: 'rgba(0, 0, 0, 0.7)'
})
const elements = document.querySelectorAll('div[name="pdf-box"]')
console.log(elements)
this.html2pdf(this.pd.CHECK_NO + '审批表详情', elements, loading)
},
html2pdf(filename, els, loading) {
const flagArr = []
for (let i = 0, len = els.length; i < len; i++) {
flagArr.push(0)
}
console.log(flagArr)
runself(0)
const pdf = new JsPDF('', 'pt', 'a4') // A4
function runself(index) {
const html = els[index]
html2Canvas(html, {
allowTaint: true,
taintTest: false,
logging: false,
useCORS: true,
scale: 2 //
}).then(canvas => {
// eslint-disable-next-line one-var
var ctx = canvas.getContext('2d'),
a4w = 532.28, a4h = 781.89, // A4210mm x 297mm10mm190x277 pt:592.28 * 841.89
renderedHeight = 0
const allTrs = html.querySelectorAll('tr')
while (renderedHeight < canvas.height) {
let imgHeight = Math.floor(a4h * canvas.width / a4w) // A4
for (let i = 0; i < allTrs.length; i++) {
const tr = allTrs[i]
const trHeight = tr.offsetHeight + tr.offsetTop
console.log('offsetHeight:' + tr.offsetHeight + 'offsetTop:' + tr.offsetTop + 'offsetParent:' + tr.offsetParent.offsetTop)
if (trHeight * 2 > (imgHeight + renderedHeight)) {
const btr = allTrs[i - 1]
const btrHeight = btr.offsetHeight + btr.offsetTop
console.log('i:' + (i - 1) + 'btrHeight:' + btrHeight)
imgHeight = btrHeight * 2 - renderedHeight
break
}
}
var page = document.createElement('canvas')
page.width = canvas.width
page.height = Math.min(imgHeight, canvas.height - renderedHeight)//
// getImageDatacanvas
page.getContext('2d').putImageData(ctx.getImageData(0, renderedHeight, canvas.width, Math.min(imgHeight, canvas.height - renderedHeight)), 0, 0)
pdf.addImage(page.toDataURL('image/jpeg', 1.0), 'JPEG', 30, 30, a4w, Math.min(a4h, a4w * page.height / page.width)) // 10mm
renderedHeight += imgHeight
if (renderedHeight < canvas.height) {
pdf.addPage()//
}
}
if (index < els.length - 1) {
pdf.addPage()
}
return 1
}).then(item => {
flagArr[index] = item
if (flagArr.every(f => f === 1)) {
pdf.save(filename)
}
index++
if (index < els.length) {
runself(index)
} else {
loading.close()
}
})
}
},
handleStr(measuresList) {
for (let i = 0; i < measuresList.length; i++) {
//
@ -264,6 +351,8 @@ export default {
).then((data) => {
this.listLoading = false
this.pd = data.pd // map
this.imgList = data.imgList
this.imgList1 = data.imgList1
this.measuresList = this.handleStr(data.measuresList)// map
this.pd.LEADER_USER_MEASURES = this.pd.OTHER_PROTECTIVE_MEASURES.split(';_;')[0]
this.pd.CONFIRM_USER_MEASURES = this.pd.OTHER_PROTECTIVE_MEASURES.split(';_;')[1]
@ -295,3 +384,27 @@ export default {
width: 100%
height: 100%
</style>
<style scoped lang="scss">
.table-ui td{
line-height: unset;
}
.pdf-content[name=pdf-box]{
position: absolute;
left: -999999px;
.level-title {
h1{
font-size: 20px;
}
.level-code{
font-size: 20px;
}
}
td{
font-size: 20px;
}
.bbg {
width: 180px;
}
}
</style>

View File

@ -90,7 +90,7 @@
<!-- </template>-->
</td>
<td>
<span v-if="item.STATUS=='1'"><input type="radio" disabled checked>&nbsp;&nbsp;&nbsp;&nbsp;</span>
<span v-if="item.STATUS=='1'"><input type="radio" disabled checked>&nbsp;&nbsp;&nbsp;</span>
<span v-if="item.STATUS=='-1'"><input type="radio" disabled checked>不涉及</span>
</td>
<td>
@ -138,10 +138,10 @@
<tr>
<td class="bbg">接受交底人</td>
<td colspan="10">
<div v-if="pd.ACCEPT_CONFESS_USER_SIGNER_PATH" style="text-align: right">
<div v-for="item in imgList" :key="item.ACCEPT_CONFESS_ID" style="text-align: right">
<span>签字</span>
<img v-viewer :src="config.fileUrl + pd.ACCEPT_CONFESS_USER_SIGNER_PATH" alt="" width="100" height="100">
<span>{{ pd.ACCEPT_CONFESS_USER_SIGNER_TIME }}</span>
<img v-viewer :src="config.fileUrl + item.ACCEPT_CONFESS_USER_SIGNER_PATH" alt="" width="100" height="100">
<span>{{ item.ACCEPT_CONFESS_USER_SIGNER_TIME }}</span>
</div>
</td>
</tr>
@ -205,13 +205,13 @@
</div>
</td>
</tr>
<tr v-if="pd.ACCEPT_USER_SIGNER_PATH">
<td colspan="6">
<tr v-if="imgList1.length>0">
<td colspan="10">
<div>完工验收{{ pd.ACCEPT_CONTENT }}</div>
<div style="text-align: right">
<div v-for="item in imgList1" :key="item.ACCEPT_CONFESS_ID" style="text-align: right">
<span>签字</span>
<img v-viewer :src="config.fileUrl + pd.ACCEPT_USER_SIGNER_PATH" alt="" width="100" height="100">
<span>{{ pd.ACCEPT_USER_SIGNER_TIME }}</span>
<img v-viewer :src="config.fileUrl + item.ACCEPT_USER_SIGNER_PATH" alt="" width="100" height="100">
<span>{{ item.ACCEPT_USER_SIGNER_TIME }}</span>
</div>
</td>
</tr>
@ -236,6 +236,8 @@ export default {
pd: [], //
measuresList: [],
gasList: [],
imgList: [],
imgList1: [],
otherProtectiveMeasures: []
}
},
@ -274,6 +276,8 @@ export default {
).then((data) => {
this.listLoading = false
this.pd = data.pd // map
this.imgList = data.imgList
this.imgList1 = data.imgList1
for (let i = 0; i < data.measuresList.length; i++) {
//
const PROTECTIVE_MEASURES = data.measuresList[i].PROTECTIVE_MEASURES.split('')

View File

@ -63,6 +63,8 @@
<span v-else-if="row.APPLY_STATUS==-6">动火审批人审核打回</span>
<span v-else-if="row.APPLY_STATUS==-7">班长验票打回</span>
<span v-else-if="row.APPLY_STATUS==-8">验收打回</span>
<span v-else-if="row.APPLY_STATUS==-99">已作废班长未验票</span>
<span v-else-if="row.APPLY_STATUS==-98">已作废未进行气体检测</span>
</template>
</el-table-column>
<el-table-column label="操作" align="center" width="230">
@ -133,6 +135,38 @@
</template>
</el-step>
</el-steps>
<div style="margin: 60px 60px 0 60px;display: flex;justify-content: space-between">
<div v-if="pd.GUARDIAN_USER_SIGNER_TIME">
<div style="color: #13ce66">
监护人{{ pd.GUARDIAN_USER_NAME }}已签字
</div>
</div>
<div v-if="!pd.GUARDIAN_USER_SIGNER_TIME">
<div style="color: red">
监护人{{ pd.GUARDIAN_USER_NAME }}未签字
</div>
</div>
<div v-if="pd.CONFESS_USER_SIGNER_TIME">
<div style="color: #13ce66">
安全交底人{{ pd.CONFESS_USER_NAME }}已签字
</div>
</div>
<div v-if="!pd.CONFESS_USER_SIGNER_TIME">
<div style="color: red">
安全交底人{{ pd.CONFESS_USER_NAME }}未签字
</div>
</div>
<div v-if="pd.ACCEPT_CONFESS_USER_SIGNER_TIME">
<div style="color: #13ce66">
接受交底人{{ pd.ACCEPT_CONFESS_USER_NAME }}已签字
</div>
</div>
<div v-if="!pd.ACCEPT_CONFESS_USER_SIGNER_TIME">
<div style="color: red">
接受交底人{{ pd.ACCEPT_CONFESS_USER_NAME }}未签字
</div>
</div>
</div>
<div slot="footer" class="dialog-footer">
<!-- <el-button @click="dialogFormShow = false"> </el-button>-->
<el-button type="primary" @click="dialogFormShow = false"> </el-button>
@ -189,7 +223,9 @@ export default {
{ ID: '-5', NAME: '安全管理部门审核打回' },
{ ID: '-6', NAME: '动火审批人审核打回' },
{ ID: '-7', NAME: '班长验票打回' },
{ ID: '-8', NAME: '验收打回' }
{ ID: '-8', NAME: '验收打回' },
{ ID: '-99', NAME: '已作废(班长未验票)' },
{ ID: '-98', NAME: '已作废(未进行气体检测)' }
],
STATUS: '',
DEPTIDS: ''
@ -334,6 +370,20 @@ export default {
OPERATTIME: this.pd.OPERATTIME
}
}
if (this.pd.APPLY_STATUS == '-99') {
obj = {
title: '已作废(班长未验票)',
AUSER_NAME: '',
OPERATTIME: this.pd.OPERATTIME
}
}
if (this.pd.APPLY_STATUS == '-98') {
obj = {
title: '已作废(未进行气体检测)',
AUSER_NAME: '',
OPERATTIME: this.pd.OPERATTIME
}
}
return obj
},
getIsPase(col) {

View File

@ -2,8 +2,8 @@
<div>
<div id="printTest" class="app-container print-work">
<el-page-header content="审批表详情" class="no-print" @back="goBack"/>
<table class="table-ui">
<thead>
<div v-for="pdf in 2" :key="pdf" :name="pdf === 2 ? 'pdf-box' : ''" class="pdf-content">
<table :class="['table-ui','table-ui' + pdf]">
<tr>
<td colspan="4" style="border: none">
<div class="level-title mt-20">
@ -12,215 +12,216 @@
</div>
</td>
</tr>
</thead>
<tr>
<td class="bbg">作业申请单位</td>
<td>{{ pd.APPLY_DEPARTMENT_NAME }}</td>
<td class="bbg">作业申请时间</td>
<td>{{ pd.CREATTIME }}</td>
</tr>
<tr>
<td class="bbg">作业内容</td>
<td>{{ pd.WORK_CONTENT }}</td>
<td class="bbg">动火地点及动火部位</td>
<td>{{ pd.WORK_PLACE }}</td>
</tr>
<tr>
<td class="bbg">动火作业级别</td>
<td>{{ pd.WORK_LEVEL }}</td>
<td class="bbg">动火方式</td>
<td>{{ pd.WORK_FUNCTION }}</td>
</tr>
<tr>
<td class="bbg">动火人及证书编号</td>
<td colspan="3">{{ pd.WORK_USER }}</td>
</tr>
<tr>
<td class="bbg">作业单位</td>
<td>{{ pd.CONFIRM_DEPARTMENT_NAME }}</td>
<td class="bbg">作业负责人</td>
<td>{{ pd.CONFIRM_USER_NAME }}</td>
</tr>
<template v-for="(item,index) in gasList">
<tr :key="index">
<td class="bbg">气体取样分析时间</td>
<td>{{ item.ANALYZE_TIME }}</td>
<td class="bbg">代表性气体</td>
<td>{{ item.ANALYZE_PLACE }}</td>
<tr>
<td class="bbg">作业申请单位</td>
<td>{{ pd.APPLY_DEPARTMENT_NAME }}</td>
<td class="bbg">作业申请时间</td>
<td>{{ pd.CREATTIME }}</td>
</tr>
<tr :key="index">
<td class="bbg">分析结果/%</td>
<td>{{ item.ANALYZE_RESULT }}</td>
<td class="bbg">分析人</td>
<td>{{ item.ANALYZE_USER }}</td>
<tr>
<td class="bbg">作业内容</td>
<td>{{ pd.WORK_CONTENT }}</td>
<td class="bbg">动火地点及动火部位</td>
<td>{{ pd.WORK_PLACE }}</td>
</tr>
</template>
<tr>
<td class="bbg">动火作业级别</td>
<td>{{ pd.WORK_LEVEL }}</td>
<td class="bbg">动火方式</td>
<td>{{ pd.WORK_FUNCTION }}</td>
</tr>
<tr>
<td class="bbg">动火人及证书编号</td>
<td colspan="3">{{ pd.WORK_USER }}</td>
</tr>
<tr>
<td class="bbg">作业单位</td>
<td>{{ pd.CONFIRM_DEPARTMENT_NAME }}</td>
<td class="bbg">作业负责人</td>
<td>{{ pd.CONFIRM_USER_NAME }}</td>
</tr>
<template v-for="(item,index) in gasList">
<tr :key="index">
<td class="bbg">气体取样分析时间</td>
<td>{{ item.ANALYZE_TIME }}</td>
<td class="bbg">代表性气体</td>
<td>{{ item.ANALYZE_PLACE }}</td>
<tr>
<td class="bbg">关联的其他特殊作业及安全作业票编号</td>
<td colspan="3">{{ pd.SPECIAL_WORK }}</td>
</tr>
<tr>
<td class="bbg">风险辨识结果</td>
<td colspan="3">{{ pd.RISK_IDENTIFICATION }}</td>
</tr>
<tr>
<td class="bbg">动火作业实施时间</td>
<td colspan="3">{{ pd.WORK_START_DATE }}{{ pd.WORK_END_DATE }}</td>
</tr>
<tr>
<td colspan="4">
<table class="table-ui">
<tr>
<td>序号</td>
<td>安全措施</td>
<td style="width: 100px;">是否涉及</td>
<td style="width: 100px;">确认人</td>
</tr>
<tr v-for="(item,index) in measuresList" :key="index">
<td>{{ index + 1 }}</td>
<td>
{{ item.PROTECTIVE_MEASURES }}
<!-- <template v-if="item.QUESTION1">-->
<!-- {{ item.QUESTION1 }}({{ item.ANSWER1 }})-->
<!-- </template>-->
<!-- <template v-if="item.QUESTION2">-->
<!-- {{ item.QUESTION2 }}({{ item.ANSWER2 }}) {{ item.QUESTION3 }}({{ item.ANSWER3 }})-->
<!-- </template>-->
</td>
<td>
<span v-if="item.STATUS=='1'"><input type="radio" disabled checked>&nbsp;&nbsp;&nbsp;&nbsp;</span>
<span v-if="item.STATUS=='-1'"><input type="radio" disabled checked>不涉及</span>
</td>
<td>
{{ item.CONFIRM_NAME }}
</td>
</tr>
<tr v-if="pd.CONFIRM_USER_MEASURES || pd.LEADER_USER_MEASURES || pd.AUDIT_USER_MEASURES || pd.APPROVE_USER_MEASURES || pd.MONITOR_USER_MEASURES">
<td>{{ measuresList.length + 1 }}</td>
<td colspan="3">
<div v-if="pd.CONFIRM_USER_MEASURES" style="display: flex;justify-content: space-between;">
<span>其他安全措施{{ pd.CONFIRM_USER_MEASURES }}</span>
<span>编制人{{ pd.CONFIRM_USER_NAME }}</span>
</div>
<div v-if="pd.LEADER_USER_MEASURES" style="display: flex;justify-content: space-between;margin-top: 10px;">
<span>其他安全措施{{ pd.LEADER_USER_MEASURES }}</span>
<span>编制人{{ pd.LEADER_USER_NAME }}</span>
</div>
<div v-if="pd.AUDIT_USER_MEASURES" style="display: flex;justify-content: space-between;margin-top: 10px;">
<span>其他安全措施{{ pd.AUDIT_USER_MEASURES }}</span>
<span>编制人{{ pd.AUDIT_USER_NAME }}</span>
</div>
<div v-if="pd.APPROVE_USER_MEASURES" style="display: flex;justify-content: space-between;margin-top: 10px;">
<span>其他安全措施{{ pd.APPROVE_USER_MEASURES }}</span>
<span>编制人{{ pd.APPROVE_USER_NAME }}</span>
</div>
<div v-if="pd.MONITOR_USER_MEASURES" style="display: flex;justify-content: space-between;margin-top: 10px;">
<span>其他安全措施{{ pd.MONITOR_USER_MEASURES }}</span>
<span>编制人{{ pd.MONITOR_USER_NAME }}</span>
</div>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td class="bbg">安全交底人</td>
<td colspan="10">
<div v-if="pd.CONFESS_USER_SIGNER_PATH" style="text-align: right">
<span>签字</span>
<img v-viewer :src="config.fileUrl + pd.CONFESS_USER_SIGNER_PATH" alt="" width="100" height="100">
<span>{{ pd.CONFESS_USER_SIGNER_TIME }}</span>
</div>
</td>
</tr>
<tr>
<td class="bbg">接受交底人</td>
<td colspan="10">
<div v-if="pd.ACCEPT_CONFESS_USER_SIGNER_PATH" style="text-align: right">
<span>签字</span>
<img v-viewer :src="config.fileUrl + pd.ACCEPT_CONFESS_USER_SIGNER_PATH" alt="" width="100" height="100">
<span>{{ pd.ACCEPT_CONFESS_USER_SIGNER_TIME }}</span>
</div>
</td>
</tr>
<tr>
<td class="bbg">监护人</td>
<td colspan="3">
<div v-if="pd.GUARDIAN_USER_SIGNER_PATH" style="text-align: right">
<span>签字</span>
<img v-viewer :src="config.fileUrl + pd.GUARDIAN_USER_SIGNER_PATH" alt="" width="100" height="100">
<span>{{ pd.GUARDIAN_USER_SIGNER_TIME }}</span>
</div>
</td>
</tr>
<tr v-if="pd.CONFIRM_USER_SIGNER_PATH">
<td colspan="6">
<div>作业负责人意见{{ pd.CONFIRM_CONTENT }}</div>
<div style="text-align: right">
<span>签字</span>
<img v-viewer :src="config.fileUrl + pd.CONFIRM_USER_SIGNER_PATH" alt="" width="100" height="100">
<span>{{ pd.CONFIRM_USER_SIGNER_TIME }}</span>
</div>
</td>
</tr>
<tr v-if="pd.LEADER_USER_SIGNER_PATH">
<td colspan="6">
<div>所在单位意见{{ pd.LEADER_CONTENT }}</div>
<div style="text-align: right">
<span>签字</span>
<img v-viewer :src="config.fileUrl + pd.LEADER_USER_SIGNER_PATH" alt="" width="100" height="100">
<span>{{ pd.LEADER_USER_SIGNER_TIME }}</span>
</div>
</td>
</tr>
<tr v-if="pd.AUDIT_USER_SIGNER_PATH">
<td colspan="6">
<div>安全管理部门意见{{ pd.AUDIT_CONTENT }}</div>
<div style="text-align: right">
<span>签字</span>
<img v-viewer :src="config.fileUrl + pd.AUDIT_USER_SIGNER_PATH" alt="" width="100" height="100">
<span>{{ pd.AUDIT_USER_SIGNER_TIME }}</span>
</div>
</td>
</tr>
<tr v-if="pd.APPROVE_USER_SIGNER_PATH">
<td colspan="6">
<div>动火审批人意见{{ pd.APPROVE_CONTENT }}</div>
<div style="text-align: right">
<span>签字</span>
<img v-viewer :src="config.fileUrl + pd.APPROVE_USER_SIGNER_PATH" alt="" width="100" height="100">
<span>{{ pd.APPROVE_USER_SIGNER_TIME }}</span>
</div>
</td>
</tr>
<tr v-if="pd.MONITOR_USER_SIGNER_PATH">
<td colspan="6">
<div>动火前岗位当班班长验票情况{{ pd.MONITOR_CONTENT }}</div>
<div style="text-align: right">
<span>签字</span>
<img v-viewer :src="config.fileUrl + pd.MONITOR_USER_SIGNER_PATH" alt="" width="100" height="100">
<span>{{ pd.MONITOR_USER_SIGNER_TIME }}</span>
</div>
</td>
</tr>
<tr v-if="pd.ACCEPT_USER_SIGNER_PATH">
<td colspan="6">
<div>完工验收{{ pd.ACCEPT_CONTENT }}</div>
<div style="text-align: right">
<span>签字</span>
<img v-viewer :src="config.fileUrl + pd.ACCEPT_USER_SIGNER_PATH" alt="" width="100" height="100">
<span>{{ pd.ACCEPT_USER_SIGNER_TIME }}</span>
</div>
</td>
</tr>
</table>
</tr>
<tr :key="index">
<td class="bbg">分析结果/%</td>
<td>{{ item.ANALYZE_RESULT }}</td>
<td class="bbg">分析人</td>
<td>{{ item.ANALYZE_USER }}</td>
</tr>
</template>
<tr>
<td class="bbg">关联的其他特殊作业及安全作业票编号</td>
<td colspan="3">{{ pd.SPECIAL_WORK }}</td>
</tr>
<tr>
<td class="bbg">风险辨识结果</td>
<td colspan="3">{{ pd.RISK_IDENTIFICATION }}</td>
</tr>
<tr>
<td class="bbg">动火作业实施时间</td>
<td colspan="3">{{ pd.WORK_START_DATE }}{{ pd.WORK_END_DATE }}</td>
</tr>
<tr>
<td colspan="4">
<table class="table-ui">
<tr>
<td>序号</td>
<td>安全措施</td>
<td style="width: 100px;">是否涉及</td>
<td style="width: 100px;">确认人</td>
</tr>
<tr v-for="(item,index) in measuresList" :key="index">
<td>{{ index + 1 }}</td>
<td>
{{ item.PROTECTIVE_MEASURES }}
<!-- <template v-if="item.QUESTION1">-->
<!-- {{ item.QUESTION1 }}({{ item.ANSWER1 }})-->
<!-- </template>-->
<!-- <template v-if="item.QUESTION2">-->
<!-- {{ item.QUESTION2 }}({{ item.ANSWER2 }}) {{ item.QUESTION3 }}({{ item.ANSWER3 }})-->
<!-- </template>-->
</td>
<td>
<span v-if="item.STATUS=='1'"><input type="radio" disabled checked>&nbsp;&nbsp;&nbsp;</span>
<span v-if="item.STATUS=='-1'"><input type="radio" disabled checked>不涉及</span>
</td>
<td>
{{ item.CONFIRM_NAME }}
</td>
</tr>
<tr v-if="pd.CONFIRM_USER_MEASURES || pd.LEADER_USER_MEASURES || pd.AUDIT_USER_MEASURES || pd.APPROVE_USER_MEASURES || pd.MONITOR_USER_MEASURES">
<td>{{ measuresList.length + 1 }}</td>
<td colspan="3">
<div v-if="pd.CONFIRM_USER_MEASURES" style="display: flex;justify-content: space-between;">
<span>其他安全措施{{ pd.CONFIRM_USER_MEASURES }}</span>
<span>编制人{{ pd.CONFIRM_USER_NAME }}</span>
</div>
<div v-if="pd.LEADER_USER_MEASURES" style="display: flex;justify-content: space-between;margin-top: 10px;">
<span>其他安全措施{{ pd.LEADER_USER_MEASURES }}</span>
<span>编制人{{ pd.LEADER_USER_NAME }}</span>
</div>
<div v-if="pd.AUDIT_USER_MEASURES" style="display: flex;justify-content: space-between;margin-top: 10px;">
<span>其他安全措施{{ pd.AUDIT_USER_MEASURES }}</span>
<span>编制人{{ pd.AUDIT_USER_NAME }}</span>
</div>
<div v-if="pd.APPROVE_USER_MEASURES" style="display: flex;justify-content: space-between;margin-top: 10px;">
<span>其他安全措施{{ pd.APPROVE_USER_MEASURES }}</span>
<span>编制人{{ pd.APPROVE_USER_NAME }}</span>
</div>
<div v-if="pd.MONITOR_USER_MEASURES" style="display: flex;justify-content: space-between;margin-top: 10px;">
<span>其他安全措施{{ pd.MONITOR_USER_MEASURES }}</span>
<span>编制人{{ pd.MONITOR_USER_NAME }}</span>
</div>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td class="bbg">安全交底人</td>
<td colspan="10">
<div v-if="pd.CONFESS_USER_SIGNER_PATH" style="text-align: right">
<span>签字</span>
<img v-viewer :src="config.fileUrl + pd.CONFESS_USER_SIGNER_PATH" alt="" width="100" height="100">
<span>{{ pd.CONFESS_USER_SIGNER_TIME }}</span>
</div>
</td>
</tr>
<tr>
<td class="bbg">接受交底人</td>
<td colspan="10">
<div v-for="item in imgList" :key="item.ACCEPT_CONFESS_ID" style="text-align: right">
<span>签字</span>
<img v-viewer :src="config.fileUrl + item.ACCEPT_CONFESS_USER_SIGNER_PATH" alt="" width="100" height="100">
<span>{{ item.ACCEPT_CONFESS_USER_SIGNER_TIME }}</span>
</div>
</td>
</tr>
<tr>
<td class="bbg">监护人</td>
<td colspan="3">
<div v-if="pd.GUARDIAN_USER_SIGNER_PATH" style="text-align: right">
<span>签字</span>
<img v-viewer :src="config.fileUrl + pd.GUARDIAN_USER_SIGNER_PATH" alt="" width="100" height="100">
<span>{{ pd.GUARDIAN_USER_SIGNER_TIME }}</span>
</div>
</td>
</tr>
<tr v-if="pd.CONFIRM_USER_SIGNER_PATH">
<td colspan="6">
<div>作业负责人意见{{ pd.CONFIRM_CONTENT }}</div>
<div style="text-align: right">
<span>签字</span>
<img v-viewer :src="config.fileUrl + pd.CONFIRM_USER_SIGNER_PATH" alt="" width="100" height="100">
<span>{{ pd.CONFIRM_USER_SIGNER_TIME }}</span>
</div>
</td>
</tr>
<tr v-if="pd.LEADER_USER_SIGNER_PATH">
<td colspan="6">
<div>所在单位意见{{ pd.LEADER_CONTENT }}</div>
<div style="text-align: right">
<span>签字</span>
<img v-viewer :src="config.fileUrl + pd.LEADER_USER_SIGNER_PATH" alt="" width="100" height="100">
<span>{{ pd.LEADER_USER_SIGNER_TIME }}</span>
</div>
</td>
</tr>
<tr v-if="pd.AUDIT_USER_SIGNER_PATH">
<td colspan="6">
<div>安全管理部门意见{{ pd.AUDIT_CONTENT }}</div>
<div style="text-align: right">
<span>签字</span>
<img v-viewer :src="config.fileUrl + pd.AUDIT_USER_SIGNER_PATH" alt="" width="100" height="100">
<span>{{ pd.AUDIT_USER_SIGNER_TIME }}</span>
</div>
</td>
</tr>
<tr v-if="pd.APPROVE_USER_SIGNER_PATH">
<td colspan="6">
<div>动火审批人意见{{ pd.APPROVE_CONTENT }}</div>
<div style="text-align: right">
<span>签字</span>
<img v-viewer :src="config.fileUrl + pd.APPROVE_USER_SIGNER_PATH" alt="" width="100" height="100">
<span>{{ pd.APPROVE_USER_SIGNER_TIME }}</span>
</div>
</td>
</tr>
<tr v-if="pd.MONITOR_USER_SIGNER_PATH">
<td colspan="6">
<div>动火前岗位当班班长验票情况{{ pd.MONITOR_CONTENT }}</div>
<div style="text-align: right">
<span>签字</span>
<img v-viewer :src="config.fileUrl + pd.MONITOR_USER_SIGNER_PATH" alt="" width="100" height="100">
<span>{{ pd.MONITOR_USER_SIGNER_TIME }}</span>
</div>
</td>
</tr>
<tr v-if="imgList1.length>0">
<td colspan="10">
<div>完工验收{{ pd.ACCEPT_CONTENT }}</div>
<div v-for="item in imgList1" :key="item.ACCEPT_CONFESS_ID" style="text-align: right">
<span>签字</span>
<img v-viewer :src="config.fileUrl + item.ACCEPT_USER_SIGNER_PATH" alt="" width="100" height="100">
<span>{{ item.ACCEPT_USER_SIGNER_TIME }}</span>
</div>
</td>
</tr>
</table>
</div>
</div>
<div style="padding-top: 100px"/>
<!-- <div class="ui-height" />-->
<div class="ui-foot">
<el-button v-print="'#printTest'" icon="el-icon-printer" type="primary"> </el-button>
<!-- <el-button v-print="'#printTest'" icon="el-icon-printer" type="primary"> </el-button>-->
<el-button type="primary" icon="el-icon-printer" @click="handle2PDF">PDF</el-button>
<el-button icon="el-icon-arrow-left" @click="goBack"> </el-button>
</div>
</div>
@ -229,6 +230,8 @@
<script>
import { requestFN } from '@/utils/request'
import dateformat from '@/utils/dateformat'
import JsPDF from 'jspdf'
import html2Canvas from 'html2canvas'
export default {
data() {
return {
@ -237,6 +240,8 @@ export default {
pd: [], //
measuresList: [],
gasList: [],
imgList: [],
imgList1: [],
otherProtectiveMeasures: []
}
},
@ -244,6 +249,85 @@ export default {
this.getData()
},
methods: {
handle2PDF() {
const loading = this.$loading({
lock: true,
text: '正在生成,请稍候...',
spinner: 'el-icon-loading',
background: 'rgba(0, 0, 0, 0.7)'
})
const elements = document.querySelectorAll('div[name="pdf-box"]')
console.log(elements)
this.html2pdf(this.pd.CHECK_NO + '审批表详情', elements, loading)
},
html2pdf(filename, els, loading) {
const flagArr = []
for (let i = 0, len = els.length; i < len; i++) {
flagArr.push(0)
}
console.log(flagArr)
runself(0)
const pdf = new JsPDF('', 'pt', 'a4') // A4
function runself(index) {
const html = els[index]
html2Canvas(html, {
allowTaint: true,
taintTest: false,
logging: false,
useCORS: true,
scale: 2 //
}).then(canvas => {
// eslint-disable-next-line one-var
var ctx = canvas.getContext('2d'),
a4w = 532.28, a4h = 781.89, // A4210mm x 297mm10mm190x277 pt:592.28 * 841.89
renderedHeight = 0
const allTrs = html.querySelectorAll('tr')
while (renderedHeight < canvas.height) {
let imgHeight = Math.floor(a4h * canvas.width / a4w) // A4
for (let i = 0; i < allTrs.length; i++) {
const tr = allTrs[i]
const trHeight = tr.offsetHeight + tr.offsetTop
console.log('offsetHeight:' + tr.offsetHeight + 'offsetTop:' + tr.offsetTop + 'offsetParent:' + tr.offsetParent.offsetTop)
if (trHeight * 2 > (imgHeight + renderedHeight)) {
const btr = allTrs[i - 1]
const btrHeight = btr.offsetHeight + btr.offsetTop
console.log('i:' + (i - 1) + 'btrHeight:' + btrHeight)
imgHeight = btrHeight * 2 - renderedHeight
break
}
}
var page = document.createElement('canvas')
page.width = canvas.width
page.height = Math.min(imgHeight, canvas.height - renderedHeight)//
// getImageDatacanvas
page.getContext('2d').putImageData(ctx.getImageData(0, renderedHeight, canvas.width, Math.min(imgHeight, canvas.height - renderedHeight)), 0, 0)
pdf.addImage(page.toDataURL('image/jpeg', 1.0), 'JPEG', 30, 30, a4w, Math.min(a4h, a4w * page.height / page.width)) // 10mm
renderedHeight += imgHeight
if (renderedHeight < canvas.height) {
pdf.addPage()//
}
}
if (index < els.length - 1) {
pdf.addPage()
}
return 1
}).then(item => {
flagArr[index] = item
if (flagArr.every(f => f === 1)) {
pdf.save(filename)
}
index++
if (index < els.length) {
runself(index)
} else {
loading.close()
}
})
}
},
validStr(str) {
if (str != null && str != '' && typeof (str) != 'undefined' && str != 0) { return true }
return false
@ -275,6 +359,9 @@ export default {
).then((data) => {
this.listLoading = false
this.pd = data.pd // map
console.log(this.pd)
this.imgList = data.imgList
this.imgList1 = data.imgList1
for (let i = 0; i < data.measuresList.length; i++) {
//
const PROTECTIVE_MEASURES = data.measuresList[i].PROTECTIVE_MEASURES.split('')
@ -334,3 +421,23 @@ export default {
width: 100%
height: 100%
</style>
<style scoped lang="scss">
.table-ui td{
line-height: unset;
}
.pdf-content[name=pdf-box]{
position: absolute;
left: -999999px;
.level-title {
h1{
font-size: 20px;
}
.level-code{
font-size: 20px;
}
}
td{
font-size: 20px;
}
}
</style>

View File

@ -8,7 +8,7 @@
<td colspan="6" style="border: none">
<div class="level-title mt-20">
<h1>断路安全作业票</h1>
<div class="level-btns">编号:{{ pd.CHECK_NO }}</div>
<div class="level-code">编号:{{ pd.CHECK_NO }}</div>
</div>
</td>
</tr>
@ -75,7 +75,7 @@
<td>{{ index + 1 }}</td>
<td>{{ item.PROTECTIVE_MEASURES }}</td>
<td>
<span v-if="item.STATUS=='1'"><input type="radio" disabled checked>&nbsp;&nbsp;&nbsp;&nbsp;</span>
<span v-if="item.STATUS=='1'"><input type="radio" disabled checked>&nbsp;&nbsp;&nbsp;</span>
<span v-if="item.STATUS=='-1'"><input type="radio" disabled checked>不涉及</span>
</td>
<td>
@ -123,10 +123,10 @@
<tr>
<td class="bbg">接受交底人</td>
<td colspan="10">
<div v-if="pd.ACCEPT_CONFESS_USER_SIGNER_PATH" style="text-align: right">
<div v-for="item in imgList" :key="item.ACCEPT_CONFESS_ID" style="text-align: right">
<span>签字</span>
<img v-viewer :src="config.fileUrl + pd.ACCEPT_CONFESS_USER_SIGNER_PATH" alt="" width="100" height="100">
<span>{{ pd.ACCEPT_CONFESS_USER_SIGNER_TIME }}</span>
<img v-viewer :src="config.fileUrl + item.ACCEPT_CONFESS_USER_SIGNER_PATH" alt="" width="100" height="100">
<span>{{ item.ACCEPT_CONFESS_USER_SIGNER_TIME }}</span>
</div>
</td>
</tr>
@ -170,13 +170,13 @@
</div>
</td>
</tr>
<tr v-if="pd.ACCEPT_USER_SIGNER_PATH">
<td colspan="6">
<tr v-if="imgList1.length>0">
<td colspan="10">
<div>完工验收{{ pd.ACCEPT_CONTENT }}</div>
<div style="text-align: right">
<div v-for="item in imgList1" :key="item.ACCEPT_CONFESS_ID" style="text-align: right">
<span>签字</span>
<img v-viewer :src="config.fileUrl + pd.ACCEPT_USER_SIGNER_PATH" alt="" width="100" height="100">
<span>{{ pd.ACCEPT_USER_SIGNER_TIME }}</span>
<img v-viewer :src="config.fileUrl + item.ACCEPT_USER_SIGNER_PATH" alt="" width="100" height="100">
<span>{{ item.ACCEPT_USER_SIGNER_TIME }}</span>
</div>
</td>
</tr>
@ -200,6 +200,8 @@ export default {
pd: [], //
measuresList: [],
otherProtectiveMeasures: [],
imgList: [],
imgList1: [],
hazardIdentification: []
}
},
@ -239,6 +241,8 @@ export default {
this.listLoading = false
this.pd = data.pd // map
this.measuresList = data.measuresList // map
this.imgList = data.imgList
this.imgList1 = data.imgList1
this.pd.APPLY_USER_MEASURES = this.pd.OTHER_PROTECTIVE_MEASURES.split(';_;')[0]
this.pd.CONSTRUCTION_USER_MEASURES = this.pd.OTHER_PROTECTIVE_MEASURES.split(';_;')[1]
this.pd.PRODUCTION_USER_MEASURES = this.pd.OTHER_PROTECTIVE_MEASURES.split(';_;')[2]
@ -270,6 +274,4 @@ export default {
img
width: 100%
height: 100%
.app-container
margin-bottom: 50px
</style>

View File

@ -127,6 +127,38 @@
</template>
</el-step>
</el-steps>
<div style="margin: 60px 60px 0 60px;display: flex;justify-content: space-between">
<div v-if="pd.GUARDIAN_USER_SIGNER_TIME">
<div style="color: #13ce66">
监护人{{ pd.GUARDIAN_USER_NAME }}已签字
</div>
</div>
<div v-if="!pd.GUARDIAN_USER_SIGNER_TIME">
<div style="color: red">
监护人{{ pd.GUARDIAN_USER_NAME }}未签字
</div>
</div>
<div v-if="pd.CONFESS_USER_SIGNER_TIME">
<div style="color: #13ce66">
安全交底人{{ pd.CONFESS_USER_NAME }}已签字
</div>
</div>
<div v-if="!pd.CONFESS_USER_SIGNER_TIME">
<div style="color: red">
安全交底人{{ pd.CONFESS_USER_NAME }}未签字
</div>
</div>
<div v-if="pd.ACCEPT_CONFESS_USER_SIGNER_TIME">
<div style="color: #13ce66">
接受交底人{{ pd.ACCEPT_CONFESS_USER_NAME }}已签字
</div>
</div>
<div v-if="!pd.ACCEPT_CONFESS_USER_SIGNER_TIME">
<div style="color: red">
接受交底人{{ pd.ACCEPT_CONFESS_USER_NAME }}未签字
</div>
</div>
</div>
<div slot="footer" class="dialog-footer">
<!-- <el-button @click="dialogFormShow = false"> </el-button>-->
<el-button type="primary" @click="dialogFormShow = false"> </el-button>

View File

@ -2,190 +2,190 @@
<div>
<div id="printTest" class="app-container print-work">
<el-page-header content="审批表详情" class="no-print" @back="goBack"/>
<table class="table-ui">
<thead>
<div v-for="pdf in 2" :key="pdf" :name="pdf === 2 ? 'pdf-box' : ''" class="pdf-content">
<table :class="['table-ui','table-ui' + pdf]">
<tr>
<td colspan="6" style="border: none">
<div class="level-title mt-20">
<h1>断路安全作业票</h1>
<div class="level-btns">编号:{{ pd.CHECK_NO }}</div>
<div class="level-code">编号:{{ pd.CHECK_NO }}</div>
</div>
</td>
</tr>
</thead>
<tr>
<td class="bbg">申请单位</td>
<td>{{ pd.APPLY_DEPARTMENT_NAME }}</td>
<td class="bbg">作业单位</td>
<td>{{ pd.CONSTRUCTION_DEPARTMENT_NAME }}</td>
<td class="bbg">作业负责人</td>
<td>{{ pd.CONSTRUCTION_USER_NAME }}</td>
</tr>
<tr>
<td class="bbg">涉及相关单位部门</td>
<td colspan="3">{{ pd.OTHER_DEPT }}</td>
<td class="bbg">监护人</td>
<td>
<div v-if="pd.GUARDIAN_USER_SIGNER_PATH" style="text-align: right">
<span>签字</span>
<img v-viewer :src="config.fileUrl + pd.GUARDIAN_USER_SIGNER_PATH" alt="" width="50" height="50">
<span>{{ pd.GUARDIAN_USER_SIGNER_TIME }}</span>
</div>
</td>
</tr>
<tr>
<td class="bbg">断路原因</td>
<td colspan="5">{{ pd.WORK_REASON }}</td>
</tr>
<tr>
<td class="bbg">关联的其他特殊作业及安全作业票编号</td>
<td colspan="5">{{ pd.SPECIAL_WORK }}</td>
</tr>
<tr>
<td colspan="6">
<div>断路地段示意图可另附图及相关说明{{ pd.WORK_CONTENT }}</div>
<div style="display: flex;justify-content: space-between;margin-top: 20px;">
<img v-viewer :src="config.fileUrl + pd.CONTENT_IMG_PATH" alt="" width="100" height="100">
<div>
编制人
<img v-viewer :src="config.fileUrl + pd.APPLY_USER_SIGNER_PATH" alt="" width="100" height="100">
{{ pd.APPLY_USER_SIGNER_TIME }}
<tr>
<td class="bbg">申请单位</td>
<td>{{ pd.APPLY_DEPARTMENT_NAME }}</td>
<td class="bbg">作业单位</td>
<td>{{ pd.CONSTRUCTION_DEPARTMENT_NAME }}</td>
<td class="bbg">作业负责人</td>
<td>{{ pd.CONSTRUCTION_USER_NAME }}</td>
</tr>
<tr>
<td class="bbg">涉及相关单位部门</td>
<td colspan="3">{{ pd.OTHER_DEPT }}</td>
<td class="bbg">监护人</td>
<td>
<div v-if="pd.GUARDIAN_USER_SIGNER_PATH" style="text-align: right">
<span>签字</span>
<img v-viewer :src="config.fileUrl + pd.GUARDIAN_USER_SIGNER_PATH" alt="" width="50" height="50">
<span>{{ pd.GUARDIAN_USER_SIGNER_TIME }}</span>
</div>
</div>
</td>
</tr>
<tr>
<td class="bbg">风险辨识结果</td>
<td colspan="5">{{ pd.HAZARD_IDENTIFICATION }}</td>
</tr>
<tr>
<td class="bbg">作业实施时间</td>
<td colspan="5">{{ pd.WORK_START_DATE }}{{ pd.WORK_END_DATE }}</td>
</tr>
<tr>
<td colspan="6">
<table class="table-ui">
<tr>
<td>序号</td>
<td>安全措施</td>
<td style="width: 100px">是否涉及</td>
<td style="width: 100px">确认人</td>
</tr>
<tr v-for="(item,index) in measuresList" :key="index">
<td>{{ index + 1 }}</td>
<td>{{ item.PROTECTIVE_MEASURES }}</td>
<td>
<span v-if="item.STATUS=='1'"><input type="radio" disabled checked>&nbsp;&nbsp;&nbsp;&nbsp;</span>
<span v-if="item.STATUS=='-1'"><input type="radio" disabled checked>不涉及</span>
</td>
<td>
{{ item.CONFIRM_NAME }}
</td>
</tr>
<tr v-if="pd.APPLY_USER_MEASURES || pd.CONSTRUCTION_USER_MEASURES || pd.PRODUCTION_USER_MEASURES || pd.SAFETY_USER_MEASURES || pd.LEADER_USER_MEASURES ">
<td>{{ measuresList.length + 1 }}</td>
<td colspan="3">
<div v-if="pd.APPLY_USER_MEASURES" style="display: flex;justify-content: space-between;">
<span>其他安全措施{{ pd.APPLY_USER_MEASURES }}</span>
<span>编制人{{ pd.APPLY_USER_NAME }}</span>
</div>
<div v-if="pd.CONSTRUCTION_USER_MEASURES" style="display: flex;justify-content: space-between;margin-top: 10px;">
<span>其他安全措施{{ pd.CONSTRUCTION_USER_MEASURES }}</span>
<span>编制人{{ pd.CONSTRUCTION_USER_NAME }}</span>
</div>
<div v-if="pd.PRODUCTION_USER_ID && pd.PRODUCTION_USER_MEASURES" style="display: flex;justify-content: space-between;margin-top: 10px;">
<span>其他安全措施{{ pd.PRODUCTION_USER_MEASURES }}</span>
<span>编制人{{ pd.PRODUCTION_USER_NAME }}</span>
</div>
<div v-if="pd.SAFETY_USER_ID && pd.SAFETY_USER_MEASURES" style="display: flex;justify-content: space-between;margin-top: 10px;">
<span>其他安全措施{{ pd.SAFETY_USER_MEASURES }}</span>
<span>编制人{{ pd.SAFETY_USER_NAME }}</span>
</div>
<div v-if="pd.LEADER_USER_ID && pd.LEADER_USER_MEASURES" style="display: flex;justify-content: space-between;margin-top: 10px;">
<span>其他安全措施{{ pd.LEADER_USER_MEASURES }}</span>
<span>编制人{{ pd.LEADER_USER_NAME }}</span>
</div>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td class="bbg">安全交底人</td>
<td colspan="10">
<div v-if="pd.CONFESS_USER_SIGNER_PATH" style="text-align: right">
<span>签字</span>
<img v-viewer :src="config.fileUrl + pd.CONFESS_USER_SIGNER_PATH" alt="" width="100" height="100">
<span>{{ pd.CONFESS_USER_SIGNER_TIME }}</span>
</div>
</td>
</tr>
<tr>
<td class="bbg">接受交底人</td>
<td colspan="10">
<div v-if="pd.ACCEPT_CONFESS_USER_SIGNER_PATH" style="text-align: right">
<span>签字</span>
<img v-viewer :src="config.fileUrl + pd.ACCEPT_CONFESS_USER_SIGNER_PATH" alt="" width="100" height="100">
<span>{{ pd.ACCEPT_CONFESS_USER_SIGNER_TIME }}</span>
</div>
</td>
</tr>
<tr>
<td colspan="6">
<div>作业负责人意见{{ pd.CONSTRUCTION_CONTENT }}</div>
<div style="text-align: right">
<span>签字</span>
<img v-viewer :src="config.fileUrl + pd.CONSTRUCTION_USER_SIGNER_PATH" alt="" width="100" height="100">
<span>{{ pd.CONSTRUCTION_USER_SIGNER_TIME }}</span>
</div>
</td>
</tr>
<tr v-if="pd.PRODUCTION_USER_ID">
<td colspan="6">
<div>所在单位意见{{ pd.PRODUCTION_CONTENT }}</div>
<div style="text-align: right">
<span>签字</span>
<img v-viewer :src="config.fileUrl + pd.PRODUCTION_USER_SIGNER_PATH" alt="" width="100" height="100">
<span>{{ pd.PRODUCTION_USER_SIGNER_TIME }}</span>
</div>
</td>
</tr>
<tr v-if="pd.SAFETY_USER_ID">
<td colspan="6">
<div>消防安全管理部门意见{{ pd.SAFETY_CONTENT }}</div>
<div style="text-align: right">
<span>签字</span>
<img v-viewer :src="config.fileUrl + pd.SAFETY_USER_SIGNER_PATH" alt="" width="100" height="100">
<span>{{ pd.SAFETY_USER_SIGNER_TIME }}</span>
</div>
</td>
</tr>
<tr v-if="pd.LEADER_USER_ID">
<td colspan="6">
<div>审批部门意见{{ pd.LEADER_CONTENT }}</div>
<div style="text-align: right">
<span>签字</span>
<img v-viewer :src="config.fileUrl + pd.LEADER_USER_SIGNER_PATH" alt="" width="100" height="100">
<span>{{ pd.LEADER_USER_SIGNER_TIME }}</span>
</div>
</td>
</tr>
<tr>
<td colspan="6">
<div>完工验收{{ pd.ACCEPT_CONTENT }}</div>
<div style="text-align: right">
<span>签字</span>
<img v-viewer :src="config.fileUrl + pd.ACCEPT_USER_SIGNER_PATH" alt="" width="100" height="100">
<span>{{ pd.ACCEPT_USER_SIGNER_TIME }}</span>
</div>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td class="bbg">断路原因</td>
<td colspan="5">{{ pd.WORK_REASON }}</td>
</tr>
<tr>
<td class="bbg">关联的其他特殊作业及安全作业票编号</td>
<td colspan="5">{{ pd.SPECIAL_WORK }}</td>
</tr>
<tr>
<td colspan="6">
<div>断路地段示意图可另附图及相关说明{{ pd.WORK_CONTENT }}</div>
<div style="display: flex;justify-content: space-between;margin-top: 20px;">
<img v-viewer :src="config.fileUrl + pd.CONTENT_IMG_PATH" alt="" width="100" height="100">
<div>
编制人
<img v-viewer :src="config.fileUrl + pd.APPLY_USER_SIGNER_PATH" alt="" width="100" height="100">
{{ pd.APPLY_USER_SIGNER_TIME }}
</div>
</div>
</td>
</tr>
<tr>
<td class="bbg">风险辨识结果</td>
<td colspan="5">{{ pd.HAZARD_IDENTIFICATION.split(";_;")[0] }}</td>
</tr>
<tr>
<td class="bbg">作业实施时间</td>
<td colspan="5">{{ pd.WORK_START_DATE }}{{ pd.WORK_END_DATE }}</td>
</tr>
<tr>
<td colspan="6">
<table class="table-ui">
<tr>
<td>序号</td>
<td>安全措施</td>
<td style="width: 100px">是否涉及</td>
<td style="width: 100px">确认人</td>
</tr>
<tr v-for="(item,index) in measuresList" :key="index">
<td>{{ index + 1 }}</td>
<td>{{ item.PROTECTIVE_MEASURES }}</td>
<td>
<span v-if="item.STATUS=='1'"><input type="radio" disabled checked>&nbsp;&nbsp;&nbsp;</span>
<span v-if="item.STATUS=='-1'"><input type="radio" disabled checked>不涉及</span>
</td>
<td>
{{ item.CONFIRM_NAME }}
</td>
</tr>
<tr v-if="pd.APPLY_USER_MEASURES || pd.CONSTRUCTION_USER_MEASURES || pd.PRODUCTION_USER_MEASURES || pd.SAFETY_USER_MEASURES || pd.LEADER_USER_MEASURES ">
<td>{{ measuresList.length + 1 }}</td>
<td colspan="3">
<div v-if="pd.APPLY_USER_MEASURES" style="display: flex;justify-content: space-between;">
<span>其他安全措施{{ pd.APPLY_USER_MEASURES }}</span>
<span>编制人{{ pd.APPLY_USER_NAME }}</span>
</div>
<div v-if="pd.CONSTRUCTION_USER_MEASURES" style="display: flex;justify-content: space-between;margin-top: 10px;">
<span>其他安全措施{{ pd.CONSTRUCTION_USER_MEASURES }}</span>
<span>编制人{{ pd.CONSTRUCTION_USER_NAME }}</span>
</div>
<div v-if="pd.PRODUCTION_USER_ID && pd.PRODUCTION_USER_MEASURES" style="display: flex;justify-content: space-between;margin-top: 10px;">
<span>其他安全措施{{ pd.PRODUCTION_USER_MEASURES }}</span>
<span>编制人{{ pd.PRODUCTION_USER_NAME }}</span>
</div>
<div v-if="pd.SAFETY_USER_ID && pd.SAFETY_USER_MEASURES" style="display: flex;justify-content: space-between;margin-top: 10px;">
<span>其他安全措施{{ pd.SAFETY_USER_MEASURES }}</span>
<span>编制人{{ pd.SAFETY_USER_NAME }}</span>
</div>
<div v-if="pd.LEADER_USER_ID && pd.LEADER_USER_MEASURES" style="display: flex;justify-content: space-between;margin-top: 10px;">
<span>其他安全措施{{ pd.LEADER_USER_MEASURES }}</span>
<span>编制人{{ pd.LEADER_USER_NAME }}</span>
</div>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td class="bbg">安全交底人</td>
<td colspan="10">
<div v-if="pd.CONFESS_USER_SIGNER_PATH" style="text-align: right">
<span>签字</span>
<img v-viewer :src="config.fileUrl + pd.CONFESS_USER_SIGNER_PATH" alt="" width="100" height="100">
<span>{{ pd.CONFESS_USER_SIGNER_TIME }}</span>
</div>
</td>
</tr>
<tr>
<td class="bbg">接受交底人</td>
<td colspan="10">
<div v-for="item in imgList" :key="item.ACCEPT_CONFESS_ID" style="text-align: right">
<span>签字</span>
<img v-viewer :src="config.fileUrl + item.ACCEPT_CONFESS_USER_SIGNER_PATH" alt="" width="100" height="100">
<span>{{ item.ACCEPT_CONFESS_USER_SIGNER_TIME }}</span>
</div>
</td>
</tr>
<tr>
<td colspan="6">
<div>作业负责人意见{{ pd.CONSTRUCTION_CONTENT }}</div>
<div style="text-align: right">
<span>签字</span>
<img v-viewer :src="config.fileUrl + pd.CONSTRUCTION_USER_SIGNER_PATH" alt="" width="100" height="100">
<span>{{ pd.CONSTRUCTION_USER_SIGNER_TIME }}</span>
</div>
</td>
</tr>
<tr v-if="pd.PRODUCTION_USER_ID">
<td colspan="6">
<div>所在单位意见{{ pd.PRODUCTION_CONTENT }}</div>
<div style="text-align: right">
<span>签字</span>
<img v-viewer :src="config.fileUrl + pd.PRODUCTION_USER_SIGNER_PATH" alt="" width="100" height="100">
<span>{{ pd.PRODUCTION_USER_SIGNER_TIME }}</span>
</div>
</td>
</tr>
<tr v-if="pd.SAFETY_USER_ID">
<td colspan="6">
<div>消防安全管理部门意见{{ pd.SAFETY_CONTENT }}</div>
<div style="text-align: right">
<span>签字</span>
<img v-viewer :src="config.fileUrl + pd.SAFETY_USER_SIGNER_PATH" alt="" width="100" height="100">
<span>{{ pd.SAFETY_USER_SIGNER_TIME }}</span>
</div>
</td>
</tr>
<tr v-if="pd.LEADER_USER_ID">
<td colspan="6">
<div>审批部门意见{{ pd.LEADER_CONTENT }}</div>
<div style="text-align: right">
<span>签字</span>
<img v-viewer :src="config.fileUrl + pd.LEADER_USER_SIGNER_PATH" alt="" width="100" height="100">
<span>{{ pd.LEADER_USER_SIGNER_TIME }}</span>
</div>
</td>
</tr>
<tr v-if="imgList1.length>0">
<td colspan="10">
<div>完工验收{{ pd.ACCEPT_CONTENT }}</div>
<div v-for="item in imgList1" :key="item.ACCEPT_CONFESS_ID" style="text-align: right">
<span>签字</span>
<img v-viewer :src="config.fileUrl + item.ACCEPT_USER_SIGNER_PATH" alt="" width="100" height="100">
<span>{{ item.ACCEPT_USER_SIGNER_TIME }}</span>
</div>
</td>
</tr>
</table>
</div>
</div>
<div style="padding-top: 100px"/>
<!-- <div class="ui-height" />-->
<div class="ui-foot">
<el-button v-print="'#printTest'" icon="el-icon-printer" type="primary"> </el-button>
<!-- <el-button v-print="'#printTest'" icon="el-icon-printer" type="primary"> </el-button>-->
<el-button type="primary" icon="el-icon-printer" @click="handle2PDF">PDF</el-button>
<el-button icon="el-icon-arrow-left" @click="goBack"> </el-button>
</div>
</div>
@ -194,6 +194,8 @@
<script>
import { requestFN } from '@/utils/request'
import dateformat from '@/utils/dateformat'
import JsPDF from 'jspdf'
import html2Canvas from 'html2canvas'
export default {
data() {
return {
@ -201,6 +203,8 @@ export default {
CUTROAD_ID: this.$parent.CUTROAD_ID, // ID
pd: [], //
measuresList: [],
imgList: [],
imgList1: [],
otherProtectiveMeasures: [],
hazardIdentification: []
}
@ -209,6 +213,85 @@ export default {
this.getData()
},
methods: {
handle2PDF() {
const loading = this.$loading({
lock: true,
text: '正在生成,请稍候...',
spinner: 'el-icon-loading',
background: 'rgba(0, 0, 0, 0.7)'
})
const elements = document.querySelectorAll('div[name="pdf-box"]')
console.log(elements)
this.html2pdf(this.pd.CHECK_NO + '审批表详情', elements, loading)
},
html2pdf(filename, els, loading) {
const flagArr = []
for (let i = 0, len = els.length; i < len; i++) {
flagArr.push(0)
}
console.log(flagArr)
runself(0)
const pdf = new JsPDF('', 'pt', 'a4') // A4
function runself(index) {
const html = els[index]
html2Canvas(html, {
allowTaint: true,
taintTest: false,
logging: false,
useCORS: true,
scale: 2 //
}).then(canvas => {
// eslint-disable-next-line one-var
var ctx = canvas.getContext('2d'),
a4w = 532.28, a4h = 781.89, // A4210mm x 297mm10mm190x277 pt:592.28 * 841.89
renderedHeight = 0
const allTrs = html.querySelectorAll('tr')
while (renderedHeight < canvas.height) {
let imgHeight = Math.floor(a4h * canvas.width / a4w) // A4
for (let i = 0; i < allTrs.length; i++) {
const tr = allTrs[i]
const trHeight = tr.offsetHeight + tr.offsetTop
console.log('offsetHeight:' + tr.offsetHeight + 'offsetTop:' + tr.offsetTop + 'offsetParent:' + tr.offsetParent.offsetTop)
if (trHeight * 2 > (imgHeight + renderedHeight)) {
const btr = allTrs[i - 1]
const btrHeight = btr.offsetHeight + btr.offsetTop
console.log('i:' + (i - 1) + 'btrHeight:' + btrHeight)
imgHeight = btrHeight * 2 - renderedHeight
break
}
}
var page = document.createElement('canvas')
page.width = canvas.width
page.height = Math.min(imgHeight, canvas.height - renderedHeight)//
// getImageDatacanvas
page.getContext('2d').putImageData(ctx.getImageData(0, renderedHeight, canvas.width, Math.min(imgHeight, canvas.height - renderedHeight)), 0, 0)
pdf.addImage(page.toDataURL('image/jpeg', 1.0), 'JPEG', 30, 30, a4w, Math.min(a4h, a4w * page.height / page.width)) // 10mm
renderedHeight += imgHeight
if (renderedHeight < canvas.height) {
pdf.addPage()//
}
}
if (index < els.length - 1) {
pdf.addPage()
}
return 1
}).then(item => {
flagArr[index] = item
if (flagArr.every(f => f === 1)) {
pdf.save(filename)
}
index++
if (index < els.length) {
runself(index)
} else {
loading.close()
}
})
}
},
validStr(str) {
if (str != null && str != '' && typeof (str) != 'undefined' && str != 0) { return true }
return false
@ -240,6 +323,8 @@ export default {
).then((data) => {
this.listLoading = false
this.pd = data.pd // map
this.imgList = data.imgList
this.imgList1 = data.imgList1
this.measuresList = data.measuresList // map
this.pd.APPLY_USER_MEASURES = this.pd.OTHER_PROTECTIVE_MEASURES.split(';_;')[0]
this.pd.CONSTRUCTION_USER_MEASURES = this.pd.OTHER_PROTECTIVE_MEASURES.split(';_;')[1]
@ -272,3 +357,27 @@ export default {
width: 100%
height: 100%
</style>
<style scoped lang="scss">
.table-ui td{
line-height: unset;
}
.pdf-content[name=pdf-box]{
position: absolute;
left: -999999px;
.level-title {
h1{
font-size: 20px;
}
.level-code{
font-size: 20px;
}
}
td{
font-size: 20px;
}
.bbg {
width: 180px;
}
}
</style>