1172 lines
33 KiB
Vue
1172 lines
33 KiB
Vue
|
||
|
||
<template>
|
||
<Dialog title="打印预览" v-model="dialogVisible" width="1000" :before-close="(doClose) => beforeDialogClose(doClose)">
|
||
<!-- 打印预览 -->
|
||
<div class="print-wrap page" ref="print">
|
||
<table border="2" cellspacing="0" id="table">
|
||
<tbody>
|
||
<tr>
|
||
<td colspan="3">
|
||
<div style="width: 100px; text-align: center;">
|
||
<img :src="logoDataUrl" style="width:100%" alt="" />
|
||
</div>
|
||
</td>
|
||
<td colspan="12">
|
||
<span style="font-size: 20px; font-weight: 700">产品工艺流程卡</span>
|
||
</td>
|
||
<td colspan="4" style="padding: 5px 0">
|
||
<div style="border-bottom: 1px solid #666; padding-bottom: 5px">项目编号</div>
|
||
<div style="padding-top: 5px">{{ formData.projectCode }}</div>
|
||
</td>
|
||
</tr>
|
||
<tr>
|
||
<td colspan="19">
|
||
<div style="display: flex; justify-content: space-between;padding:0 5px">
|
||
<span>子项目编号:{{ formData.projectSubCode}}</span>
|
||
<span>项目交期:{{formatDate(new Date(formData.projectEndTime), 'YYYY-MM-DD')}}
|
||
</span>
|
||
</div>
|
||
</td>
|
||
</tr>
|
||
</tbody>
|
||
<tbody>
|
||
<tr>
|
||
<td colspan="1" :rowspan="2"> 序号 </td>
|
||
<td colspan="2" :rowspan="2">
|
||
<span>名称</span>
|
||
</td>
|
||
<!-- <td colspan="2">毛坯</td>
|
||
<td colspan="2">普铣</td>
|
||
<td colspan="4">常规</td>
|
||
<td colspan="2">数控 </td>
|
||
<td colspan="2">电加工 </td>
|
||
<td colspan="1">焊 </td>
|
||
<td colspan="2">钳工</td> -->
|
||
</tr>
|
||
<tr>
|
||
<!-- <td colspan="1">下料</td>
|
||
<td colspan="1">木模</td>
|
||
<td colspan="1">粗铣</td>
|
||
<td colspan="1">精铣</td>
|
||
<td colspan="1">车床</td>
|
||
<td colspan="1">热处理</td>
|
||
<td colspan="1">磨床</td>
|
||
<td colspan="1">线割</td>
|
||
<td colspan="1">开粗</td>
|
||
<td colspan="1">精加工</td>
|
||
<td colspan="1">火花</td>
|
||
<td colspan="1">刻字</td>
|
||
<td colspan="1">电焊</td>
|
||
<td colspan="1">钻孔</td>
|
||
<td colspan="1">抛光</td>
|
||
const procedureArrary = ['下料','电焊','编程','开粗','铣床','车床','磨床','数控1','数控2','刻字','网格','深钻孔','钻孔','热处理','火花']
|
||
-->
|
||
<td colspan="1">包装</td>
|
||
<td colspan="1">装配</td>
|
||
<td colspan="1">钻孔</td>
|
||
<td colspan="1"></td>
|
||
<td colspan="1"></td>
|
||
<td colspan="1"></td>
|
||
<td colspan="1"></td>
|
||
<td colspan="1"></td>
|
||
<td colspan="1"></td>
|
||
<td colspan="1"></td>
|
||
<td colspan="1"></td>
|
||
<td colspan="1"></td>
|
||
<td colspan="1"></td>
|
||
<td colspan="1"></td>
|
||
<td colspan="1"></td>
|
||
<td colspan="1"></td>
|
||
</tr>
|
||
<tr v-for="item in formDataprocess.tablename" :key="item">
|
||
<td colspan="1"> {{item.index}} </td>
|
||
<td colspan="2" v-if="item.date" id="lineTd">
|
||
<span style="float:left;margin-top:20px;"> {{item.name}}</span>
|
||
<span style="float:right;margin-top:0px;">{{item.date}}</span>
|
||
</td>
|
||
<td colspan="2" v-else>{{item.name}}</td>
|
||
<td colspan="1" class="hr-dotted"> {{item.layingoff}}</td>
|
||
<td colspan="1" class="hr-dotted">{{item.woodformer}}</td>
|
||
<td colspan="1" class="hr-dotted">{{item.roughmill}}</td>
|
||
<td colspan="1" class="hr-dotted">{{}}</td>
|
||
<td colspan="1" class="hr-dotted">{{}}</td>
|
||
<td colspan="1" class="hr-dotted">{{}}</td>
|
||
<td colspan="1" class="hr-dotted">{{}}</td>
|
||
<td colspan="1" class="hr-dotted">{{}}</td>
|
||
<td colspan="1" class="hr-dotted">{{}}</td>
|
||
<td colspan="1" class="hr-dotted">{{}}</td>
|
||
<td colspan="1" class="hr-dotted">{{}}</td>
|
||
<td colspan="1" class="hr-dotted">{{}}</td>
|
||
<td colspan="1" class="hr-dotted">{{}}</td>
|
||
<td colspan="1" class="hr-dotted">{{}}</td>
|
||
<td colspan="1" class="hr-dotted">{{}}</td>
|
||
<td colspan="1" class="hr-dotted">{{}}</td>
|
||
</tr>
|
||
</tbody>
|
||
<tbody>
|
||
<tr>
|
||
<td colspan="19">
|
||
<div style="display: flex; justify-content: left;">
|
||
<span style="font-size: 16px; font-weight: 700">
|
||
各工序工艺要点
|
||
</span>
|
||
</div>
|
||
</td>
|
||
</tr>
|
||
<tr v-for="item in summarylist" :key="item">
|
||
<td colspan="3" class="hr-dotted" v-if="item.name">{{item.name}}</td>
|
||
<td colspan="16" class="hr-dotted" v-if="item.data">{{item.data}}</td>
|
||
</tr>
|
||
</tbody>
|
||
<tbody>
|
||
<tr>
|
||
<td colspan="10">
|
||
<div>
|
||
说明:自检合格后签名方可结算工时,以此卡为准
|
||
</div>
|
||
</td>
|
||
<td colspan="4">
|
||
开单人/日期:
|
||
</td>
|
||
<td colspan="5">
|
||
{{formData.userNickname}}
|
||
{{ formatDate(new Date(formData.startTime), 'YYYY-MM-DD') }}
|
||
</td>
|
||
</tr>
|
||
</tbody>
|
||
</table>
|
||
</div>
|
||
<template #footer>
|
||
<!-- 【打印】 -->
|
||
<el-button @click="onPrint" type="primary">打印</el-button>
|
||
<el-button @click="outopen">取消</el-button>
|
||
</template>
|
||
</Dialog>
|
||
</template>
|
||
<script setup lang="ts">
|
||
// import { ref, reactive } from 'vue'
|
||
import { Check } from '@element-plus/icons-vue'
|
||
import urlimg from '@/assets/imgs/exlogo.png'
|
||
import { betweenDay, dateFormatter, formatDate } from '@/utils/formatTime'
|
||
import * as TaskDispatchApi from '@/api/heli/taskdispatch'
|
||
import * as ProcedureApi from '@/api/heli/procedure'
|
||
import * as UserApi from '@/api/system/user'
|
||
import { string } from 'vue-types'
|
||
import { log } from 'console'
|
||
import { getOperateLogPage } from '@/api/system/operatelog'
|
||
import {getTaskDispatchDetailListByDispatchIdAssembly} from "@/api/heli/taskdispatch";
|
||
const logoDataUrl = ref('') // 存储Logo的Base64编码数据URL
|
||
const dialogVisible = ref(false) // 弹窗的是否展示
|
||
const summarylist = ref([
|
||
{
|
||
name: undefined,
|
||
data: undefined
|
||
},
|
||
{
|
||
name: undefined,
|
||
data: undefined
|
||
},
|
||
{
|
||
name: undefined,
|
||
data: undefined
|
||
},
|
||
{
|
||
name: undefined,
|
||
data: undefined
|
||
},
|
||
{
|
||
name: undefined,
|
||
data: undefined
|
||
},
|
||
{
|
||
name: undefined,
|
||
data: undefined
|
||
},
|
||
{
|
||
name: undefined,
|
||
data: undefined
|
||
},
|
||
{
|
||
name: undefined,
|
||
data: undefined
|
||
},
|
||
{
|
||
name: undefined,
|
||
data: undefined
|
||
},
|
||
{
|
||
name: undefined,
|
||
data: undefined
|
||
},
|
||
{
|
||
name: undefined,
|
||
data: undefined
|
||
},
|
||
{
|
||
name: undefined,
|
||
data: undefined
|
||
},
|
||
{
|
||
name: undefined,
|
||
data: undefined
|
||
},
|
||
{
|
||
name: undefined,
|
||
data: undefined
|
||
}
|
||
])
|
||
const formDataprocess = ref({
|
||
tablename: [
|
||
{
|
||
index: 1,
|
||
name: '工序',
|
||
layingoff: undefined,
|
||
woodformer: undefined,
|
||
roughmill: undefined,
|
||
finishmill: undefined,
|
||
lathe: undefined,
|
||
treatment: undefined,
|
||
grindingmachine: undefined,
|
||
wire: undefined,
|
||
rough: undefined,
|
||
fashioning: undefined,
|
||
spark: undefined,
|
||
lettering: undefined,
|
||
electrowelding: undefined,
|
||
drill: undefined,
|
||
polishing: undefined,
|
||
cutting:undefined
|
||
},
|
||
{
|
||
index: 2,
|
||
name: '自检',
|
||
layingoff: undefined,
|
||
woodformer: undefined,
|
||
roughmill: undefined,
|
||
finishmill: undefined,
|
||
lathe: undefined,
|
||
treatment: undefined,
|
||
grindingmachine: undefined,
|
||
wire: undefined,
|
||
rough: undefined,
|
||
fashioning: undefined,
|
||
spark: undefined,
|
||
lettering: undefined,
|
||
electrowelding: undefined,
|
||
drill: undefined,
|
||
polishing: undefined,
|
||
cutting:undefined
|
||
},
|
||
{
|
||
index: 3,
|
||
name: '额定工时1',
|
||
layingoff: undefined,
|
||
woodformer: undefined,
|
||
roughmill: undefined,
|
||
finishmill: undefined,
|
||
lathe: undefined,
|
||
treatment: undefined,
|
||
grindingmachine: undefined,
|
||
wire: undefined,
|
||
rough: undefined,
|
||
fashioning: undefined,
|
||
spark: undefined,
|
||
lettering: undefined,
|
||
electrowelding: undefined,
|
||
drill: undefined,
|
||
polishing: undefined,
|
||
cutting:undefined
|
||
},
|
||
{
|
||
index: 4,
|
||
name: '额定工时2',
|
||
layingoff: undefined,
|
||
woodformer: undefined,
|
||
roughmill: undefined,
|
||
finishmill: undefined,
|
||
lathe: undefined,
|
||
treatment: undefined,
|
||
grindingmachine: undefined,
|
||
wire: undefined,
|
||
rough: undefined,
|
||
fashioning: undefined,
|
||
spark: undefined,
|
||
lettering: undefined,
|
||
electrowelding: undefined,
|
||
drill: undefined,
|
||
polishing: undefined,
|
||
cutting:undefined
|
||
},
|
||
{
|
||
index: 5,
|
||
name: '审核者',
|
||
layingoff: undefined,
|
||
woodformer: undefined,
|
||
roughmill: undefined,
|
||
finishmill: undefined,
|
||
lathe: undefined,
|
||
treatment: undefined,
|
||
grindingmachine: undefined,
|
||
wire: undefined,
|
||
rough: undefined,
|
||
fashioning: undefined,
|
||
spark: undefined,
|
||
lettering: undefined,
|
||
electrowelding: undefined,
|
||
drill: undefined,
|
||
polishing: undefined,
|
||
cutting:undefined
|
||
},
|
||
{
|
||
index: 6,
|
||
name: '加工工时1',
|
||
layingoff: undefined,
|
||
woodformer: undefined,
|
||
roughmill: undefined,
|
||
finishmill: undefined,
|
||
lathe: undefined,
|
||
treatment: undefined,
|
||
grindingmachine: undefined,
|
||
wire: undefined,
|
||
rough: undefined,
|
||
fashioning: undefined,
|
||
spark: undefined,
|
||
lettering: undefined,
|
||
electrowelding: undefined,
|
||
drill: undefined,
|
||
polishing: undefined,
|
||
cutting:undefined
|
||
},
|
||
{
|
||
index: 7,
|
||
name: '操作者1',
|
||
date: '日',
|
||
layingoff: undefined,
|
||
woodformer: undefined,
|
||
roughmill: undefined,
|
||
finishmill: undefined,
|
||
lathe: undefined,
|
||
treatment: undefined,
|
||
grindingmachine: undefined,
|
||
wire: undefined,
|
||
rough: undefined,
|
||
fashioning: undefined,
|
||
spark: undefined,
|
||
lettering: undefined,
|
||
electrowelding: undefined,
|
||
drill: undefined,
|
||
polishing: undefined,
|
||
cutting:undefined
|
||
},
|
||
{
|
||
index: 8,
|
||
name: '加工工时2',
|
||
layingoff: undefined,
|
||
woodformer: undefined,
|
||
roughmill: undefined,
|
||
finishmill: undefined,
|
||
lathe: undefined,
|
||
treatment: undefined,
|
||
grindingmachine: undefined,
|
||
wire: undefined,
|
||
rough: undefined,
|
||
fashioning: undefined,
|
||
spark: undefined,
|
||
lettering: undefined,
|
||
electrowelding: undefined,
|
||
drill: undefined,
|
||
polishing: undefined,
|
||
cutting:undefined
|
||
},
|
||
{
|
||
index: 9,
|
||
name: '操作者2',
|
||
date: '日',
|
||
layingoff: undefined,
|
||
woodformer: undefined,
|
||
roughmill: undefined,
|
||
finishmill: undefined,
|
||
lathe: undefined,
|
||
treatment: undefined,
|
||
grindingmachine: undefined,
|
||
wire: undefined,
|
||
rough: undefined,
|
||
fashioning: undefined,
|
||
spark: undefined,
|
||
lettering: undefined,
|
||
electrowelding: undefined,
|
||
drill: undefined,
|
||
polishing: undefined,
|
||
cutting:undefined
|
||
},
|
||
{
|
||
index: 10,
|
||
name: '质检1',
|
||
date: '日',
|
||
layingoff: undefined,
|
||
woodformer: undefined,
|
||
roughmill: undefined,
|
||
finishmill: undefined,
|
||
lathe: undefined,
|
||
treatment: undefined,
|
||
grindingmachine: undefined,
|
||
wire: undefined,
|
||
rough: undefined,
|
||
fashioning: undefined,
|
||
spark: undefined,
|
||
lettering: undefined,
|
||
electrowelding: undefined,
|
||
drill: undefined,
|
||
polishing: undefined,
|
||
cutting:undefined
|
||
},
|
||
{
|
||
index: 11,
|
||
name: '质检2',
|
||
date: '日',
|
||
layingoff: undefined,
|
||
woodformer: undefined,
|
||
roughmill: undefined,
|
||
finishmill: undefined,
|
||
lathe: undefined,
|
||
treatment: undefined,
|
||
grindingmachine: undefined,
|
||
wire: undefined,
|
||
rough: undefined,
|
||
fashioning: undefined,
|
||
spark: undefined,
|
||
lettering: undefined,
|
||
electrowelding: undefined,
|
||
drill: undefined,
|
||
polishing: undefined,
|
||
cutting:undefined
|
||
},
|
||
{
|
||
index: 12,
|
||
name: '备注'
|
||
}
|
||
]
|
||
})
|
||
|
||
const formData = ref({
|
||
id: undefined,
|
||
code: undefined,
|
||
dispatchType: undefined,
|
||
taskId: undefined,
|
||
planId: undefined,
|
||
projectId: undefined,
|
||
projectSubId: undefined,
|
||
bomDetailId: undefined,
|
||
dispatchStatus: undefined,
|
||
remark: undefined,
|
||
status: 1,
|
||
taskDispatchDetails: [],
|
||
operateLogs: undefined,
|
||
userNickname: undefined,
|
||
startTime: undefined,
|
||
active: undefined,
|
||
activeOpinion: ''
|
||
})
|
||
|
||
const onPrint = () => {
|
||
// 拿到打印页面dom节点
|
||
const printNode = document.querySelector('.print-wrap')
|
||
if (!printNode) return
|
||
// 页面文档创建一个空的内框架,用于挂载打印节点,并设置一定的样式
|
||
const newIframe: any = document.createElement('iframe')
|
||
newIframe.setAttribute(
|
||
'style',
|
||
'width:0px;height:0px;position:absolute;left:-9999px;top:-9999px;'
|
||
)
|
||
newIframe.setAttribute('align', 'center')
|
||
document.body.appendChild(newIframe)
|
||
// 将打印页面设置为内框架内容
|
||
let doc: any = null
|
||
doc = newIframe.contentWindow.document
|
||
doc.write(`
|
||
<style type="text/css">
|
||
/* 浏览器打印基本样式 */
|
||
.page {
|
||
width: 21cm;
|
||
min-height: 29.7cm;
|
||
padding: 10mm;
|
||
margin: 20px auto;
|
||
border: 1px #d3d3d3 solid;
|
||
border-radius: 5px;
|
||
background: white;
|
||
box-shadow: 0 0 5px rgba(0, 0, 0, 0.1);
|
||
position: relative;
|
||
font-size: 14px !important;
|
||
}
|
||
|
||
@page {
|
||
size: A4;
|
||
margin:1cm;
|
||
}
|
||
@media print {
|
||
.page {
|
||
margin: 10mm;
|
||
border: initial;
|
||
border-radius: initial;
|
||
width: initial;
|
||
min-height: initial;
|
||
box-shadow: initial;
|
||
background: initial;
|
||
page-break-after: always;
|
||
}
|
||
|
||
}
|
||
table {
|
||
width: 100%; /* 让表格宽度100%占满其父元素宽度 */
|
||
height: auto; /* 高度根据内容自适应 */
|
||
font-size: 14px;
|
||
text-align: center;
|
||
border-collapse: collapse;
|
||
margin-top: 5mm; /* 添加顶部外边距,替代原先的页内边距 */
|
||
tr{
|
||
td {
|
||
padding: 5px 0;
|
||
border: 1px solid #333;
|
||
}
|
||
td {
|
||
-webkit-print-color-adjust: exact;
|
||
print-color-adjust: exact;
|
||
}
|
||
}
|
||
}
|
||
.xh {
|
||
width: 50px !important;
|
||
}
|
||
.checkbox {
|
||
border: 2px solid #999;
|
||
width: 10px;
|
||
height: 10px;
|
||
display: flex;
|
||
justify-content: center;
|
||
align-items: center;
|
||
margin-left:10px ;
|
||
}
|
||
#lineTd {
|
||
background: #fff
|
||
url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxMDAlIiBoZWlnaHQ9IjEwMCUiPjxsaW5lIHgxPSIwIiB5MT0iMCIgeDI9IjEwMCUiIHkyPSIxMDAlIiBzdHJva2U9ImJsYWNrIiBzdHJva2Utd2lkdGg9IjEiLz48L3N2Zz4=)
|
||
no-repeat 100% center;
|
||
}
|
||
.hr-dotted {
|
||
border: 0;
|
||
border-top: 1px dotted #a2a9b6;
|
||
border-left: 1px dotted #a2a9b6;
|
||
}
|
||
</style>
|
||
<div>
|
||
${printNode.innerHTML}
|
||
</div>`)
|
||
doc.close()
|
||
// 浏览器打印页面打开渲染
|
||
setTimeout(() => {
|
||
newIframe.contentWindow.focus()
|
||
newIframe.contentWindow.print()
|
||
document.body.removeChild(newIframe) // 移除打印内框架,下次打印下次再挂载
|
||
dialogVisible.value = false
|
||
}, 100)
|
||
}
|
||
// / 关闭 Dialog 前的处理逻辑
|
||
function beforeDialogClose(doClose: (shouldClose: boolean) => void): void {
|
||
// console.log('-----');
|
||
outopen()
|
||
}
|
||
|
||
// 页面关闭重置
|
||
const outopen = () => {
|
||
dialogVisible.value = false
|
||
summarylist.value = [
|
||
{
|
||
name: undefined,
|
||
data: undefined
|
||
},
|
||
{
|
||
name: undefined,
|
||
data: undefined
|
||
},
|
||
{
|
||
name: undefined,
|
||
data: undefined
|
||
},
|
||
{
|
||
name: undefined,
|
||
data: undefined
|
||
},
|
||
{
|
||
name: undefined,
|
||
data: undefined
|
||
},
|
||
{
|
||
name: undefined,
|
||
data: undefined
|
||
},
|
||
{
|
||
name: undefined,
|
||
data: undefined
|
||
},
|
||
{
|
||
name: undefined,
|
||
data: undefined
|
||
},
|
||
{
|
||
name: undefined,
|
||
data: undefined
|
||
},
|
||
{
|
||
name: undefined,
|
||
data: undefined
|
||
},
|
||
{
|
||
name: undefined,
|
||
data: undefined
|
||
},
|
||
{
|
||
name: undefined,
|
||
data: undefined
|
||
}
|
||
]
|
||
formData.value = {
|
||
id: undefined,
|
||
code: undefined,
|
||
dispatchType: undefined,
|
||
taskId: undefined,
|
||
planId: undefined,
|
||
projectId: undefined,
|
||
projectSubId: undefined,
|
||
bomDetailId: undefined,
|
||
dispatchStatus: undefined,
|
||
remark: undefined,
|
||
status: 1,
|
||
taskDispatchDetails: [],
|
||
operateLogs: undefined,
|
||
userNickname: undefined,
|
||
startTime: undefined,
|
||
active: undefined,
|
||
activeOpinion: ''
|
||
}
|
||
formDataprocess.value = {
|
||
tablename: [
|
||
{
|
||
index: 1,
|
||
name: '工序',
|
||
layingoff: undefined,
|
||
woodformer: undefined,
|
||
roughmill: undefined,
|
||
finishmill: undefined,
|
||
lathe: undefined,
|
||
treatment: undefined,
|
||
grindingmachine: undefined,
|
||
wire: undefined,
|
||
rough: undefined,
|
||
fashioning: undefined,
|
||
spark: undefined,
|
||
lettering: undefined,
|
||
electrowelding: undefined,
|
||
drill: undefined,
|
||
polishing: undefined,
|
||
cutting:undefined
|
||
},
|
||
{
|
||
index: 2,
|
||
name: '自检',
|
||
layingoff: undefined,
|
||
woodformer: undefined,
|
||
roughmill: undefined,
|
||
finishmill: undefined,
|
||
lathe: undefined,
|
||
treatment: undefined,
|
||
grindingmachine: undefined,
|
||
wire: undefined,
|
||
rough: undefined,
|
||
fashioning: undefined,
|
||
spark: undefined,
|
||
lettering: undefined,
|
||
electrowelding: undefined,
|
||
drill: undefined,
|
||
polishing: undefined,
|
||
cutting:undefined
|
||
},
|
||
{
|
||
index: 3,
|
||
name: '额定工时1',
|
||
layingoff: undefined,
|
||
woodformer: undefined,
|
||
roughmill: undefined,
|
||
finishmill: undefined,
|
||
lathe: undefined,
|
||
treatment: undefined,
|
||
grindingmachine: undefined,
|
||
wire: undefined,
|
||
rough: undefined,
|
||
fashioning: undefined,
|
||
spark: undefined,
|
||
lettering: undefined,
|
||
electrowelding: undefined,
|
||
drill: undefined,
|
||
polishing: undefined,
|
||
cutting:undefined
|
||
},
|
||
{
|
||
index: 4,
|
||
name: '额定工时2',
|
||
layingoff: undefined,
|
||
woodformer: undefined,
|
||
roughmill: undefined,
|
||
finishmill: undefined,
|
||
lathe: undefined,
|
||
treatment: undefined,
|
||
grindingmachine: undefined,
|
||
wire: undefined,
|
||
rough: undefined,
|
||
fashioning: undefined,
|
||
spark: undefined,
|
||
lettering: undefined,
|
||
electrowelding: undefined,
|
||
drill: undefined,
|
||
polishing: undefined,
|
||
cutting:undefined
|
||
},
|
||
{
|
||
index: 5,
|
||
name: '审核者',
|
||
layingoff: undefined,
|
||
woodformer: undefined,
|
||
roughmill: undefined,
|
||
finishmill: undefined,
|
||
lathe: undefined,
|
||
treatment: undefined,
|
||
grindingmachine: undefined,
|
||
wire: undefined,
|
||
rough: undefined,
|
||
fashioning: undefined,
|
||
spark: undefined,
|
||
lettering: undefined,
|
||
electrowelding: undefined,
|
||
drill: undefined,
|
||
polishing: undefined,
|
||
cutting:undefined
|
||
},
|
||
{
|
||
index: 6,
|
||
name: '加工工时1',
|
||
layingoff: undefined,
|
||
woodformer: undefined,
|
||
roughmill: undefined,
|
||
finishmill: undefined,
|
||
lathe: undefined,
|
||
treatment: undefined,
|
||
grindingmachine: undefined,
|
||
wire: undefined,
|
||
rough: undefined,
|
||
fashioning: undefined,
|
||
spark: undefined,
|
||
lettering: undefined,
|
||
electrowelding: undefined,
|
||
drill: undefined,
|
||
polishing: undefined,
|
||
cutting:undefined
|
||
},
|
||
{
|
||
index: 7,
|
||
name: '操作者1',
|
||
date: '日',
|
||
layingoff: undefined,
|
||
woodformer: undefined,
|
||
roughmill: undefined,
|
||
finishmill: undefined,
|
||
lathe: undefined,
|
||
treatment: undefined,
|
||
grindingmachine: undefined,
|
||
wire: undefined,
|
||
rough: undefined,
|
||
fashioning: undefined,
|
||
spark: undefined,
|
||
lettering: undefined,
|
||
electrowelding: undefined,
|
||
drill: undefined,
|
||
polishing: undefined,
|
||
cutting:undefined
|
||
},
|
||
{
|
||
index: 8,
|
||
name: '加工工时2',
|
||
layingoff: undefined,
|
||
woodformer: undefined,
|
||
roughmill: undefined,
|
||
finishmill: undefined,
|
||
lathe: undefined,
|
||
treatment: undefined,
|
||
grindingmachine: undefined,
|
||
wire: undefined,
|
||
rough: undefined,
|
||
fashioning: undefined,
|
||
spark: undefined,
|
||
lettering: undefined,
|
||
electrowelding: undefined,
|
||
drill: undefined,
|
||
polishing: undefined,
|
||
cutting:undefined
|
||
},
|
||
{
|
||
index: 9,
|
||
name: '操作者2',
|
||
date: '日',
|
||
layingoff: undefined,
|
||
woodformer: undefined,
|
||
roughmill: undefined,
|
||
finishmill: undefined,
|
||
lathe: undefined,
|
||
treatment: undefined,
|
||
grindingmachine: undefined,
|
||
wire: undefined,
|
||
rough: undefined,
|
||
fashioning: undefined,
|
||
spark: undefined,
|
||
lettering: undefined,
|
||
electrowelding: undefined,
|
||
drill: undefined,
|
||
polishing: undefined,
|
||
cutting:undefined
|
||
},
|
||
{
|
||
index: 10,
|
||
name: '质检1',
|
||
date: '日',
|
||
layingoff: undefined,
|
||
woodformer: undefined,
|
||
roughmill: undefined,
|
||
finishmill: undefined,
|
||
lathe: undefined,
|
||
treatment: undefined,
|
||
grindingmachine: undefined,
|
||
wire: undefined,
|
||
rough: undefined,
|
||
fashioning: undefined,
|
||
spark: undefined,
|
||
lettering: undefined,
|
||
electrowelding: undefined,
|
||
drill: undefined,
|
||
polishing: undefined,
|
||
cutting:undefined
|
||
},
|
||
{
|
||
index: 11,
|
||
name: '质检2',
|
||
date: '日',
|
||
layingoff: undefined,
|
||
woodformer: undefined,
|
||
roughmill: undefined,
|
||
finishmill: undefined,
|
||
lathe: undefined,
|
||
treatment: undefined,
|
||
grindingmachine: undefined,
|
||
wire: undefined,
|
||
rough: undefined,
|
||
fashioning: undefined,
|
||
spark: undefined,
|
||
lettering: undefined,
|
||
electrowelding: undefined,
|
||
drill: undefined,
|
||
polishing: undefined,
|
||
cutting:undefined
|
||
},
|
||
{
|
||
index: 12,
|
||
name: '备注'
|
||
}
|
||
]
|
||
}
|
||
}
|
||
const queryParams = {
|
||
pageNo: 1,
|
||
pageSize: 99,
|
||
code: undefined,
|
||
name: undefined,
|
||
description: undefined,
|
||
status: 1,
|
||
creator: undefined,
|
||
createTime: [],
|
||
updater: undefined,
|
||
updateTime: [],
|
||
deleted: undefined,
|
||
tenantId: undefined,
|
||
isReport: undefined,
|
||
wid: undefined
|
||
}
|
||
|
||
/** 打开弹窗 */
|
||
const open = async (id?: number) => {
|
||
dialogVisible.value = true
|
||
// 在组件挂载后,将Logo图片转换为Base64编码数据URL
|
||
const logoImage = new Image()
|
||
logoImage.src = urlimg // 替换为Logo图片路径
|
||
logoImage.onload = () => {
|
||
const canvas = document.createElement('canvas')
|
||
canvas.width = logoImage.width
|
||
canvas.height = logoImage.height
|
||
const context = canvas.getContext('2d')
|
||
context.drawImage(logoImage, 0, 0)
|
||
const base64String = canvas.toDataURL('image/png')
|
||
logoDataUrl.value = base64String
|
||
}
|
||
// ===================工序详情============================
|
||
|
||
const Procedata = await ProcedureApi.getProcedurePage(queryParams)
|
||
|
||
// ================================ 任务单详情 =============================
|
||
|
||
// 获取数据
|
||
if (id) {
|
||
const data = await TaskDispatchApi.getTaskDispatch(id)
|
||
// 操作日志
|
||
|
||
formData.value.taskDispatchDetails =
|
||
await TaskDispatchApi.getTaskDispatchDetailListByDispatchIdAssembly(id)
|
||
// console.log(data, '任务单详情')
|
||
if (formData.value.taskDispatchDetails) {
|
||
formData.value.taskDispatchDetails.forEach(async (taskitem: any) => {
|
||
// 根据任务单详情子表的procedureId,找到工序详情中name
|
||
const Procedure = await ProcedureApi.getProcedure(taskitem.procedureId)
|
||
// 处理数据
|
||
console.log(taskitem.procedureId)
|
||
console.log(Procedure.name)
|
||
if (Procedure.name == '包装') {
|
||
summarylist.value[0].name = Procedure.name
|
||
console.log(';s')
|
||
if (!summarylist.value[0].data) {
|
||
summarylist.value[0].data = taskitem.summary
|
||
} else if (summarylist.value[0].data && taskitem.summary) {
|
||
summarylist.value[0].data = summarylist.value[0].data + ',' + taskitem.summary
|
||
}
|
||
if (!formDataprocess.value.tablename[0].layingoff) {
|
||
formDataprocess.value.tablename[0].layingoff = taskitem.sort
|
||
} else if (formDataprocess.value.tablename[0].layingoff && taskitem.sort) {
|
||
formDataprocess.value.tablename[0].layingoff =
|
||
formDataprocess.value.tablename[0].layingoff + ',' + taskitem.sort
|
||
}
|
||
if (taskitem.users){
|
||
const initialUser = await UserApi.getUser(taskitem.users)
|
||
formDataprocess.value.tablename[8].layingoff = initialUser.nickname
|
||
}
|
||
if (taskitem.workingHour){
|
||
formDataprocess.value.tablename[7].layingoff = taskitem.workingHour
|
||
}
|
||
if (taskitem.bgWorkTimes){
|
||
formDataprocess.value.tablename[10].layingoff = taskitem.bgWorkTimes
|
||
}
|
||
if(taskitem.owner){
|
||
const initialUser = await UserApi.getUser(taskitem.owner)
|
||
|
||
if (!formDataprocess.value.tablename[6].layingoff) {
|
||
formDataprocess.value.tablename[6].layingoff = initialUser.nickname
|
||
} else if (
|
||
formDataprocess.value.tablename[6].layingoff &&
|
||
!formDataprocess.value.tablename[8].layingoff
|
||
) {
|
||
formDataprocess.value.tablename[8].layingoff = initialUser.nickname
|
||
} else {
|
||
}
|
||
}
|
||
|
||
Procedata.list.forEach((item: any) => {
|
||
if (item.name == Procedure.name) {
|
||
formDataprocess.value.tablename[2].layingoff = item.standard1Time
|
||
formDataprocess.value.tablename[3].layingoff = item.standard2Time
|
||
}
|
||
})
|
||
|
||
|
||
if (taskitem.bgWorkTime){
|
||
formDataprocess.value.tablename[9].layingoff = taskitem.bgWorkTime
|
||
}
|
||
if (taskitem.workingHours){
|
||
formDataprocess.value.tablename[5].layingoff = taskitem.workingHours
|
||
}
|
||
} else if (Procedure.name == '装配') {
|
||
summarylist.value[1].name = Procedure.name
|
||
if (!summarylist.value[1].data) {
|
||
summarylist.value[1].data = taskitem.summary
|
||
} else if (summarylist.value[1].data && taskitem.summary) {
|
||
summarylist.value[1].data = summarylist.value[1].data + ',' + taskitem.summary
|
||
}
|
||
if (!formDataprocess.value.tablename[0].woodformer) {
|
||
formDataprocess.value.tablename[0].woodformer = taskitem.sort
|
||
} else if (formDataprocess.value.tablename[0].woodformer && taskitem.sort) {
|
||
formDataprocess.value.tablename[0].woodformer =
|
||
formDataprocess.value.tablename[0].woodformer + ',' + taskitem.sort
|
||
}
|
||
Procedata.list.forEach((item: any) => {
|
||
if (item.name == Procedure.name) {
|
||
formDataprocess.value.tablename[2].woodformer = item.standard1Time
|
||
formDataprocess.value.tablename[3].woodformer = item.standard2Time
|
||
}
|
||
})
|
||
if(taskitem.owner){
|
||
const initialUser = await UserApi.getUser(taskitem.owner)
|
||
if (!formDataprocess.value.tablename[6].woodformer) {
|
||
formDataprocess.value.tablename[6].woodformer = initialUser.nickname
|
||
} else if (
|
||
formDataprocess.value.tablename[6].woodformer &&
|
||
!formDataprocess.value.tablename[8].woodformer
|
||
) {
|
||
formDataprocess.value.tablename[8].woodformer = initialUser.nickname
|
||
} else {
|
||
}
|
||
}
|
||
if (taskitem.users){
|
||
const initialUser = await UserApi.getUser(taskitem.users)
|
||
formDataprocess.value.tablename[8].woodformer = initialUser.nickname
|
||
}
|
||
if (taskitem.workingHour){
|
||
formDataprocess.value.tablename[7].woodformer = taskitem.workingHour
|
||
}
|
||
if (taskitem.bgWorkTimes){
|
||
formDataprocess.value.tablename[10].woodformer = taskitem.bgWorkTimes
|
||
}
|
||
if (taskitem.bgWorkTime){
|
||
formDataprocess.value.tablename[9].woodformer = taskitem.bgWorkTime
|
||
}
|
||
if (taskitem.workingHours){
|
||
formDataprocess.value.tablename[5].woodformer = taskitem.workingHours
|
||
}
|
||
} else if (Procedure.name == '钻孔') {
|
||
summarylist.value[2].name = Procedure.name
|
||
if (!summarylist.value[2].data) {
|
||
summarylist.value[2].data = taskitem.summary
|
||
} else if (summarylist.value[2].data && taskitem.summary) {
|
||
summarylist.value[2].data = summarylist.value[2].data + ',' + taskitem.summary
|
||
}
|
||
if (!formDataprocess.value.tablename[0].roughmill) {
|
||
formDataprocess.value.tablename[0].roughmill = taskitem.sort
|
||
} else if (formDataprocess.value.tablename[0].roughmill && taskitem.sort) {
|
||
formDataprocess.value.tablename[0].roughmill =
|
||
formDataprocess.value.tablename[0].roughmill + ',' + taskitem.sort
|
||
}
|
||
Procedata.list.forEach((item: any) => {
|
||
if (item.name == Procedure.name) {
|
||
formDataprocess.value.tablename[2].roughmill = item.standard1Time
|
||
formDataprocess.value.tablename[3].roughmill = item.standard2Time
|
||
}
|
||
})
|
||
if (taskitem.users){
|
||
const initialUser = await UserApi.getUser(taskitem.users)
|
||
formDataprocess.value.tablename[8].roughmill = initialUser.nickname
|
||
}
|
||
if (taskitem.workingHour){
|
||
formDataprocess.value.tablename[7].roughmill = taskitem.workingHour
|
||
}
|
||
if (taskitem.bgWorkTimes){
|
||
formDataprocess.value.tablename[10].roughmill = taskitem.bgWorkTimes
|
||
}
|
||
if(taskitem.owner){
|
||
const initialUser = await UserApi.getUser(taskitem.owner)
|
||
if (!formDataprocess.value.tablename[6].roughmill) {
|
||
formDataprocess.value.tablename[6].roughmill = initialUser.nickname
|
||
} else if (
|
||
formDataprocess.value.tablename[6].roughmill &&
|
||
!formDataprocess.value.tablename[8].roughmill
|
||
) {
|
||
formDataprocess.value.tablename[8].roughmill = initialUser.nickname
|
||
} else {
|
||
}
|
||
}
|
||
if (taskitem.bgWorkTime){
|
||
formDataprocess.value.tablename[9].roughmill = taskitem.bgWorkTime
|
||
}
|
||
if (taskitem.workingHours){
|
||
formDataprocess.value.tablename[5].roughmill = taskitem.workingHours
|
||
}
|
||
}
|
||
})
|
||
}
|
||
formData.value = data
|
||
|
||
//获取日志 找到操作人和操作时间
|
||
let logParams = {
|
||
pageNo: 1,
|
||
pageSize: 1,
|
||
businessId: id,
|
||
businessType: 'TASK_DISPATCH'
|
||
}
|
||
const operateLogs = (await getOperateLogPage(logParams)).list[0]
|
||
formData.value.userNickname = operateLogs.userNickname
|
||
formData.value.startTime = operateLogs.startTime
|
||
console.log(formDataprocess.value.tablename)
|
||
}
|
||
}
|
||
defineExpose({ open }) // 提供 open 方法,用于打开弹窗
|
||
</script>
|
||
|
||
<style scoped lang="scss">
|
||
.page {
|
||
width: 22cm;
|
||
min-height: 29.7cm;
|
||
padding: 10mm;
|
||
margin: 20px auto;
|
||
border: 1px #d3d3d3 solid;
|
||
border-radius: 5px;
|
||
background: white;
|
||
box-shadow: 0 0 5px rgba(0, 0, 0, 0.1);
|
||
position: relative;
|
||
font-size: 14px !important;
|
||
}
|
||
|
||
@page {
|
||
size: A4;
|
||
margin: 0;
|
||
}
|
||
@media print {
|
||
.page {
|
||
margin: 0;
|
||
border: initial;
|
||
border-radius: initial;
|
||
width: initial;
|
||
min-height: initial;
|
||
box-shadow: initial;
|
||
background: initial;
|
||
page-break-after: always;
|
||
}
|
||
}
|
||
table {
|
||
width: 100%; /* 让表格宽度100%占满其父元素宽度 */
|
||
height: auto; /* 高度根据内容自适应 */
|
||
font-size: 14px;
|
||
text-align: center;
|
||
border-collapse: collapse;
|
||
margin-top: 5mm; /* 添加顶部外边距,替代原先的页内边距 */
|
||
tr {
|
||
td {
|
||
padding: 2px 0;
|
||
border: 1px solid #333;
|
||
}
|
||
}
|
||
}
|
||
|
||
.checkbox {
|
||
border: 2px solid #999;
|
||
width: 15px;
|
||
height: 15px;
|
||
display: flex;
|
||
justify-content: center;
|
||
align-items: center;
|
||
margin-left: 10px;
|
||
}
|
||
#lineTd {
|
||
background: #fff
|
||
url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxMDAlIiBoZWlnaHQ9IjEwMCUiPjxsaW5lIHgxPSIwIiB5MT0iMCIgeDI9IjEwMCUiIHkyPSIxMDAlIiBzdHJva2U9ImJsYWNrIiBzdHJva2Utd2lkdGg9IjEiLz48L3N2Zz4=)
|
||
no-repeat 100% center;
|
||
}
|
||
.hr-dotted {
|
||
border: 0;
|
||
border-top: 1px dotted #a2a9b6;
|
||
border-left: 1px dotted #a2a9b6;
|
||
}
|
||
/*
|
||
A4的大小:21cm*29.7cm(width:794px;)。
|
||
单位换算:1 inch = 2.54 cm 1mm = 96 px 1 cm = 37.79528 px*/
|
||
</style>
|