536 lines
20 KiB
Vue
536 lines
20 KiB
Vue
<template>
|
||
<el-config-provider :locale="zhCn">
|
||
<el-container class="content">
|
||
<div class="work-area">
|
||
<fieldset class="title-area">
|
||
<legend>
|
||
工作台
|
||
</legend>
|
||
<div class="title-div">
|
||
<span class="title-text">Kitting备料完成</span>
|
||
</div>
|
||
<div class="station-div">
|
||
<span class="station-text">工作站:</span>
|
||
</div>
|
||
<div class="station-no-div">
|
||
<el-popover placement="top-start" title="提示" :width="250" trigger="hover"
|
||
content="点击此处打印上次确认过的标签" popper-style="background-color: #F0FFFF;">
|
||
<template #reference>
|
||
<span class="station-no-text" @click="requestPrintOld()">
|
||
<Printer style="display: none;" />
|
||
{{ standId }}
|
||
</span>
|
||
</template>
|
||
</el-popover>
|
||
</div>
|
||
</fieldset>
|
||
<fieldset class="main-area">
|
||
<legend>
|
||
备料完成
|
||
</legend>
|
||
<el-form ref="workFormRef" :model="workFormEntity" :label-position="labelPosition"
|
||
label-width="150px" style="max-width: 100%;" :rules="rules" status-icon>
|
||
<div style="display: flex;">
|
||
<div style="display: block; margin: 5px;">
|
||
<div
|
||
style="display: inline-flex; justify-content: center; height: 60px; width: 700px; margin: 5px; padding: 5px; background-color: #00AAE8;">
|
||
<span style="align-self: center; font-weight: bold;font-size: 25px;">
|
||
{{ workFormEntity.tip }}
|
||
</span>
|
||
</div>
|
||
<div style="display: flex; margin-top: 5px; margin-top: 15px">
|
||
<div
|
||
style="display: inline-flex; justify-content: center; width: 160px; margin: 5px; padding: 5px; background-color: #CCCCCC;">
|
||
<span
|
||
style="align-self: center; font-weight: bold;font-size: 20px;">计划完成:</span>
|
||
</div>
|
||
<div
|
||
style="display: inline-flex; justify-content: center; width: 240px; margin: 5px; padding: 5px; background-color: #CCCCCC;">
|
||
<span style="align-self: center; font-weight: bold;font-size: 20px;">
|
||
{{ workFormEntity.planRows }}
|
||
</span>
|
||
</div>
|
||
<div
|
||
style="display: inline-flex; justify-content: center; width: 80px; margin: 5px; padding: 5px; background-color: #CCCCCC;">
|
||
<span style="align-self: center; font-weight: bold;font-size: 20px;">行</span>
|
||
</div>
|
||
</div>
|
||
<div style="display: flex; margin-top: 5px; margin-top: 15px">
|
||
<div
|
||
style="display: inline-flex; justify-content: center; width: 160px; margin: 5px; padding: 5px; background-color: #CCCCCC;">
|
||
<span
|
||
style="align-self: center; font-weight: bold;font-size: 20px;">实际完成:</span>
|
||
</div>
|
||
<div
|
||
style="display: inline-flex; justify-content: center; width: 240px; margin: 5px; padding: 5px; background-color: #CCCCCC;">
|
||
<span style="align-self: center; font-weight: bold;font-size: 20px;">
|
||
{{ workFormEntity.actualRows }}
|
||
</span>
|
||
</div>
|
||
<div
|
||
style="display: inline-flex; justify-content: center; width: 80px; margin: 5px; padding: 5px; background-color: #CCCCCC;">
|
||
<span style="align-self: center; font-weight: bold;font-size: 20px;">行</span>
|
||
</div>
|
||
</div>
|
||
<div style="display: flex; margin-top: 5px; margin-top: 15px">
|
||
<div
|
||
style="display: inline-flex; justify-content: center; width: 160px; margin: 5px; padding: 5px; background-color: #CCCCCC;">
|
||
<span
|
||
style="align-self: center; font-weight: bold;font-size: 20px;">实际备料:</span>
|
||
</div>
|
||
<div
|
||
style="display: inline-flex; justify-content: center; width: 240px; margin: 5px; padding: 5px; background-color: #CCCCCC;">
|
||
<span style="align-self: center; font-weight: bold;font-size: 20px;">
|
||
{{ workFormEntity.actualCounts }}
|
||
</span>
|
||
</div>
|
||
<div
|
||
style="display: inline-flex; justify-content: center; width: 80px; margin: 5px; padding: 5px; background-color: #CCCCCC;">
|
||
<span style="align-self: center; font-weight: bold;font-size: 20px;">PC</span>
|
||
</div>
|
||
</div>
|
||
<div style="display: flex; margin-top: 15px">
|
||
<div
|
||
style="display: inline-flex; justify-content: center; width: 160px; margin: 5px; padding: 5px; background-color: #CCCCCC;">
|
||
<span style="align-self: center; font-weight: bold;font-size: 25px;">备注</span>
|
||
</div>
|
||
<div
|
||
style="display: inline-flex; justify-content: center; width: 520px; margin: 5px; padding: 5px; background-color: #00AAE8;">
|
||
<span style="align-self: center; font-weight: bold;font-size: 25px;">
|
||
{{ workFormEntity.remark }}
|
||
</span>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<div style="margin: 10px;">
|
||
<div class="arrow" @click="requestPrint()">
|
||
<Printer style="display: none;" />
|
||
<span
|
||
style="margin-left: 25px; align-self: center; font-weight: bold;font-size: 45px; writing-mode: vertical-lr;">打印标签</span>
|
||
</div>
|
||
</div>
|
||
<div style="margin: 10px;">
|
||
<div class="arrow" @click="confirmWork()">
|
||
<span
|
||
style="margin-left: 25px; align-self: center; font-weight: bold;font-size: 45px; writing-mode: vertical-lr;">完成确认</span>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</el-form>
|
||
</fieldset>
|
||
<div style="width: 0;height: 0;overflow: hidden">
|
||
<button ref="printBtn" style="display: none;" v-print="printObj"></button>
|
||
<!-- <div> -->
|
||
<div id="printArea" class="objectDialogFlowPrint">
|
||
<!-- <div class="myPrint"> -->
|
||
<div class="pageWarp" v-for="item in printTabs">
|
||
<div class="print-tab-left">
|
||
<div class="print-disp">
|
||
小盒子号:{{ item.sequenceNo }}</div>
|
||
<div class="print-disp"> 小工位:{{ item.smallWorkCenter }}</div>
|
||
<div class="print-disp"> 料号数量:{{ item.goodsCount }}</div>
|
||
<div class="print-disp"> 配料人员:{{ item.opUser }}</div>
|
||
</div>
|
||
<div class="print-tab-right">
|
||
<div class="print-disp"> 机器序列号:{{ item.machineNo }}</div>
|
||
<div class="print-disp"> 工单:{{ item.workOrder }}</div>
|
||
<div class="print-disp"> 零件数量:{{ item.goodsNumCount }}</div>
|
||
<div class="print-disp"> 配料日期:{{ item.opTime }}</div>
|
||
</div>
|
||
</div>
|
||
<!-- </div> -->
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</el-container>
|
||
</el-config-provider>
|
||
</template>
|
||
|
||
<script setup>
|
||
import store from '@/store'
|
||
import { getFinishedWorkInfo, confirmFinishedWork, requestPrintData, requestOldPrintData } from '@/api/task'
|
||
import { ElMessageBox, ElMessage } from 'element-plus'
|
||
import { errorBox } from '@/utils/myMessageBox.js'
|
||
import { reactive, ref } from 'vue'
|
||
import loading from '@/utils/loading.js'
|
||
import zhCn from 'element-plus/dist/locale/zh-cn.mjs'
|
||
</script>
|
||
|
||
<script>
|
||
export default {
|
||
name: 'finishKitting',
|
||
data() {
|
||
return {
|
||
standId: store.getters.getStandId,
|
||
// timer: '',
|
||
labelPosition: 'top',
|
||
workFormRef: ref(),
|
||
workFormEntity: reactive({
|
||
tip: '',
|
||
remark: '',
|
||
planRows: 0,
|
||
actualRows: 0,
|
||
planCounts: 0,
|
||
actualCounts: 0
|
||
}),
|
||
rules: reactive({
|
||
goodsId: [
|
||
{ required: true, message: '请输入料号' }
|
||
]
|
||
}),
|
||
printTabs: [],
|
||
printObj: {
|
||
id: "printArea", // 这里是要打印元素的ID
|
||
popTitle: " ", // 打印的标题
|
||
extraCss: "", // 打印可引入外部的一个 css 文件
|
||
extraHead: "", // 打印头部文字
|
||
preview: false, // 是否启动预览模式,默认是false
|
||
previewTitle: '打印客户账单', // 打印预览的标题
|
||
previewPrintBtnLabel: '预览结束,开始打印', // 打印预览的标题下方的按钮文本,点击可进入打印
|
||
zIndex: 10002, // 预览窗口的z-index,默认是20002,最好比默认值更高
|
||
previewBeforeOpenCallback() {
|
||
// console.log('正在加载预览窗口!');
|
||
}, // 预览窗口打开之前的callback
|
||
previewOpenCallback() { console.log('已经加载完预览窗口,预览打开了!') }, // 预览窗口打开时的callback
|
||
beforeOpenCallback() {
|
||
// console.log('开始打印之前!')
|
||
}, // 开始打印之前的callback
|
||
openCallback() {
|
||
// console.log('执行打印了!')
|
||
}, // 调用打印时的callback
|
||
closeCallback() {
|
||
// console.log('关闭了打印工具!')
|
||
}, // 关闭打印的callback(无法区分确认or取消)
|
||
clickMounted() {
|
||
// console.log('点击v-print绑定的按钮了!')
|
||
},
|
||
},
|
||
|
||
}
|
||
},
|
||
mounted() {
|
||
this.getFinishedWorkInfo()
|
||
// this.timer = setInterval(() => {
|
||
// this.getFinishedWorkInfo()
|
||
// }, 2000)
|
||
},
|
||
beforeUnmount() {
|
||
// clearInterval(this.timer)
|
||
},
|
||
methods: {
|
||
getFinishedWorkInfo() {
|
||
const request = {
|
||
standId: this.standId,
|
||
userName: store.getters.getUserName
|
||
}
|
||
getFinishedWorkInfo(request).then(res => {
|
||
const response = res.data
|
||
if (response.code == 0) {
|
||
this.workFormEntity.tip = response.returnData.tip
|
||
this.workFormEntity.remark = response.returnData.remark
|
||
this.workFormEntity.planRows = response.returnData.planRows
|
||
this.workFormEntity.actualRows = response.returnData.actualRows
|
||
this.workFormEntity.planCounts = response.returnData.planCounts
|
||
this.workFormEntity.actualCounts = response.returnData.actualCounts
|
||
} else {
|
||
this.resetForms()
|
||
}
|
||
}).catch(err => {
|
||
console.log(err)
|
||
this.resetForms()
|
||
errorBox('查询工作信息错误')
|
||
})
|
||
},
|
||
resetForms() {
|
||
this.workFormEntity = reactive({
|
||
tip: '',
|
||
remark: '',
|
||
planRows: 0,
|
||
actualRows: 0,
|
||
planCounts: 0,
|
||
actualCounts: 0
|
||
})
|
||
},
|
||
confirmWork() {
|
||
console.log('完成确认')
|
||
if (this.standId == '') {
|
||
errorBox('站台号不可缺少')
|
||
return
|
||
}
|
||
const confirmParams = {
|
||
standId: this.standId,
|
||
userName: store.getters.getUserName
|
||
}
|
||
confirmFinishedWork(confirmParams).then(res => {
|
||
const response = res.data
|
||
if (response.code == 0) {
|
||
ElMessage.success(response.message)
|
||
this.resetForms()
|
||
} else {
|
||
errorBox(response.message)
|
||
}
|
||
}).catch(err => {
|
||
console.log(err)
|
||
errorBox('确认时发生异常')
|
||
})
|
||
},
|
||
requestPrint() {
|
||
loading.open('请求数据中,请稍等...')
|
||
// 获取打印标签的数据
|
||
const printParams = {
|
||
standId: this.standId,
|
||
userName: store.getters.getUserName
|
||
}
|
||
requestPrintData(printParams).then(res => {
|
||
loading.close()
|
||
if (res.data.code == 0) {
|
||
this.printTabs = res.data.returnData
|
||
this.$nextTick(() => {
|
||
this.$refs.printBtn.click()
|
||
});
|
||
} else {
|
||
errorBox(res.data.message)
|
||
}
|
||
}).catch(err => {
|
||
loading.close()
|
||
console.log(err)
|
||
errorBox('获取标签数据时异常')
|
||
})
|
||
},
|
||
requestPrintOld() {
|
||
loading.open('请求数据中,请稍等...')
|
||
// 获取打印标签的数据
|
||
const printParams = {
|
||
standId: this.standId,
|
||
userName: store.getters.getUserName
|
||
}
|
||
requestOldPrintData(printParams).then(res => {
|
||
loading.close()
|
||
if (res.data.code == 0) {
|
||
this.printTabs = res.data.returnData
|
||
this.$nextTick(() => {
|
||
this.$refs.printBtn.click()
|
||
});
|
||
} else {
|
||
errorBox(res.data.message)
|
||
}
|
||
}).catch(err => {
|
||
loading.close()
|
||
console.log(err)
|
||
errorBox('获取标签数据(确认过)时异常')
|
||
})
|
||
}
|
||
}
|
||
}
|
||
</script>
|
||
|
||
<style scoped>
|
||
.content {
|
||
display: flex;
|
||
width: 100%;
|
||
}
|
||
|
||
.work-area {
|
||
width: 100%;
|
||
/* padding: 5px; */
|
||
}
|
||
|
||
.main-area {
|
||
margin: auto;
|
||
min-height: fit-content;
|
||
max-height: 90%;
|
||
margin-bottom: 10px;
|
||
min-width: inherit;
|
||
border: solid 1px;
|
||
border-radius: 10px;
|
||
box-shadow: 0px 15px 10px -15px #000;
|
||
overflow: auto;
|
||
}
|
||
|
||
.title-area {
|
||
display: flex;
|
||
/* min-height: 10%; */
|
||
max-height: max-content;
|
||
margin-bottom: 10px;
|
||
min-width: inherit;
|
||
border: solid 1px;
|
||
border-radius: 10px;
|
||
box-shadow: 0px 15px 10px -15px #000;
|
||
overflow: auto;
|
||
}
|
||
|
||
.arrow {
|
||
background: linear-gradient(-105deg,
|
||
transparent 50%,
|
||
#309330 50%,
|
||
#309330 100%) top right,
|
||
linear-gradient(-75deg,
|
||
transparent 50%,
|
||
#309330 50%,
|
||
#309330 100%) bottom right;
|
||
background-size: 100% 50%;
|
||
height: 321px;
|
||
width: 250px;
|
||
background-repeat: no-repeat;
|
||
display: inline-flex;
|
||
cursor: pointer;
|
||
}
|
||
|
||
:deep(.el-input) {
|
||
height: 130px;
|
||
font-size: 25px;
|
||
}
|
||
|
||
:deep(.el-input-number) {
|
||
height: 130px;
|
||
font-size: 25px;
|
||
}
|
||
|
||
.title-div {
|
||
display: inline-flex;
|
||
width: -webkit-fill-available;
|
||
margin-right: 5px;
|
||
padding: 5px;
|
||
background-color: #CCCCCC;
|
||
}
|
||
|
||
.title-text {
|
||
align-self: center;
|
||
font-weight: bold;
|
||
font-size: 25px;
|
||
}
|
||
|
||
.station-div {
|
||
display: inline-flex;
|
||
justify-content: center;
|
||
width: 150px;
|
||
margin-left: 5px;
|
||
margin-right: 5px;
|
||
padding: 5px;
|
||
background-color: #FFFAAA;
|
||
}
|
||
|
||
.station-text {
|
||
align-self: center;
|
||
font-weight: bold;
|
||
font-size: 25px;
|
||
}
|
||
|
||
.station-no-div {
|
||
display: inline-flex;
|
||
justify-content: center;
|
||
width: 200px;
|
||
padding: 5px;
|
||
border: 5px double #000000;
|
||
}
|
||
|
||
.station-no-text {
|
||
align-self: center;
|
||
font-weight: bold;
|
||
font-size: 25px;
|
||
cursor: pointer;
|
||
background-color: white;
|
||
border: white;
|
||
}
|
||
|
||
.display-title-div {
|
||
display: inline-flex;
|
||
justify-content: center;
|
||
width: 280px;
|
||
height: 80px;
|
||
margin: 5px;
|
||
padding: 5px;
|
||
background-color: #FFFAAA;
|
||
}
|
||
|
||
.display-title-text {
|
||
align-self: center;
|
||
font-weight: bold;
|
||
font-size: 25px;
|
||
}
|
||
|
||
.display-form-div {
|
||
display: inline-flex;
|
||
justify-content: center;
|
||
width: 270px;
|
||
margin: 5px;
|
||
padding: 5px;
|
||
border: 5px double #000000;
|
||
margin-top: 25px;
|
||
}
|
||
|
||
.display-form-div-left {
|
||
display: inline-flex;
|
||
justify-content: center;
|
||
width: 170px;
|
||
margin: 5px;
|
||
padding: 5px;
|
||
border: 5px double #000000;
|
||
}
|
||
|
||
.display-form-div-right {
|
||
display: inline-flex;
|
||
justify-content: center;
|
||
width: 80px;
|
||
margin: 5px;
|
||
padding: 5px;
|
||
background-color: #CCCCCC;
|
||
}
|
||
|
||
.display-form-text-right {
|
||
align-self: center;
|
||
font-weight: bold;
|
||
font-size: 25px;
|
||
}
|
||
|
||
/* @media print {
|
||
@page {
|
||
size: auto;
|
||
}
|
||
|
||
body,
|
||
html {
|
||
width: 90mm !important;
|
||
height: 25mm !important;
|
||
}
|
||
} */
|
||
|
||
.objectDialogFlowPrint {
|
||
width: 100% !important;
|
||
height: 100% !important;
|
||
}
|
||
|
||
.objectDialogFlowPrint .pageWarp {
|
||
/*这句话很重要,控制时候强制分页 https://www.w3school.com.cn/cssref/pr_page-break-after.asp*/
|
||
page-break-after: always;
|
||
width: 98%;
|
||
height: 98%;
|
||
/* margin: 5px; */
|
||
text-align: center;
|
||
padding: 0;
|
||
/* border: #000 solid 1px; */
|
||
display: flex;
|
||
print-color-adjust: exact;
|
||
}
|
||
|
||
.print-tab-left {
|
||
margin: 5px;
|
||
width: 50%;
|
||
border-right: #156082 dashed 1px;
|
||
align-content: center;
|
||
}
|
||
|
||
.print-tab-right {
|
||
margin: 5px;
|
||
width: 50%;
|
||
align-content: center;
|
||
}
|
||
|
||
.print-disp {
|
||
margin: 2px;
|
||
padding-left: 5px;
|
||
font-size: 12px;
|
||
font-weight: bold;
|
||
text-align: left;
|
||
}
|
||
</style> |