后道逻辑修改
This commit is contained in:
@@ -14,8 +14,8 @@
|
||||
<div class="order-modules">
|
||||
<div class="order-module" v-for="(module, index) in orderModules" :key="index">
|
||||
<h2>{{ module.title }}</h2>
|
||||
<div class="scroll-list">
|
||||
<ul>
|
||||
<div class="scroll-list" ref="scrollLists">
|
||||
<ul :class="{ 'animate-scroll': shouldAnimate(index) }">
|
||||
<li v-for="order in module.orders" :key="order.id">
|
||||
<el-card :class="getOrderClass(module.title)" class="order-card">
|
||||
<div class="order-info">
|
||||
@@ -43,11 +43,11 @@ export default {
|
||||
currentTime: dayjs().format('YYYY-MM-DD HH:mm:ss'),
|
||||
orderModules: [
|
||||
{
|
||||
title: '未完成工单',
|
||||
title: '未上线工单',
|
||||
orders: [],
|
||||
},
|
||||
{
|
||||
title: '进行中工单',
|
||||
title: '已上线工单',
|
||||
orders: [],
|
||||
},
|
||||
{
|
||||
@@ -64,11 +64,22 @@ export default {
|
||||
this.refreshInterval = setInterval(() => {
|
||||
this.fetchOrders()
|
||||
}, 5 * 60 * 1000)
|
||||
// 初始检查
|
||||
this.$nextTick(() => {
|
||||
this.checkScroll()
|
||||
})
|
||||
},
|
||||
beforeUnmount() {
|
||||
// 使用更现代的生命周期钩子
|
||||
clearInterval(this.refreshInterval)
|
||||
},
|
||||
watch: {
|
||||
// 监听工单数据变化,重新检查滚动条件
|
||||
'orderModules.orders': {
|
||||
handler: 'checkScroll',
|
||||
deep: true,
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
/**
|
||||
* 更新当前时间
|
||||
@@ -92,6 +103,9 @@ export default {
|
||||
this.orderModules[0].orders = noStartOrders.data
|
||||
this.orderModules[1].orders = inProgressOrders.data
|
||||
this.orderModules[2].orders = finishedOrders.data
|
||||
this.$nextTick(() => {
|
||||
this.checkScroll()
|
||||
})
|
||||
} catch (error) {
|
||||
console.error('获取工单数据失败:', error)
|
||||
}
|
||||
@@ -137,10 +151,10 @@ export default {
|
||||
* @returns {string} 对应的类名
|
||||
*/
|
||||
getOrderClass(title) {
|
||||
if (title === '未完成工单') {
|
||||
if (title === '未上线工单') {
|
||||
return 'unfinished-order'
|
||||
}
|
||||
if (title === '进行中工单') {
|
||||
if (title === '已上线工单') {
|
||||
return 'in-progress-order'
|
||||
}
|
||||
if (title === '已完成工单') {
|
||||
@@ -148,6 +162,19 @@ export default {
|
||||
}
|
||||
return ''
|
||||
},
|
||||
checkScroll() {
|
||||
this.$nextTick(() => {
|
||||
this.$refs.scrollLists.forEach((list, index) => {
|
||||
const ul = list.querySelector('ul')
|
||||
const containerHeight = list.offsetHeight
|
||||
const listHeight = ul.offsetHeight
|
||||
this.orderModules[index].shouldAnimate = listHeight > containerHeight
|
||||
})
|
||||
})
|
||||
},
|
||||
shouldAnimate(index) {
|
||||
return this.orderModules[index].shouldAnimate
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
@@ -251,6 +278,9 @@ export default {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
width: 100%; /* 让 ul 宽度撑满容器 */
|
||||
}
|
||||
|
||||
.scroll-list ul.animate-scroll {
|
||||
animation: scroll 30s linear infinite;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
<template>
|
||||
<div>
|
||||
<!-- 特殊标签打印 -->
|
||||
<!-- 特殊标签打印对话框 -->
|
||||
<el-dialog class="dialogBox" :visible.sync="show" title="特殊标签打印" width="60%" append-to-body :close-on-click-modal="false">
|
||||
<el-form label-width="auto" :inline="true">
|
||||
<!-- 工单基本信息 -->
|
||||
<div>
|
||||
<el-form-item label="工单号">
|
||||
<div class="number-text">{{ formData.workOrder }}</div>
|
||||
@@ -14,6 +15,7 @@
|
||||
<div class="number-text">{{ formData.description }}</div>
|
||||
</el-form-item>
|
||||
</div>
|
||||
<!-- 打印相关统计信息 -->
|
||||
<div>
|
||||
<el-form-item label="已扫零件数">
|
||||
<div class="number-text">{{ printDetail.scannedPartCount }}</div>
|
||||
@@ -31,22 +33,27 @@
|
||||
<div class="number-text">{{ printDetail.currentBoxLabelSequence }}</div>
|
||||
</el-form-item>
|
||||
</div>
|
||||
<!-- 补打箱标签操作 -->
|
||||
<div>
|
||||
<el-form-item label="打印操作">
|
||||
<el-button type="warning" @click="submit(1)">补打箱标签</el-button>
|
||||
</el-form-item>
|
||||
</div>
|
||||
<!-- 零头产品数信息 -->
|
||||
<div>
|
||||
<el-form-item label="零头产品数">
|
||||
<el-input-number :min="0" class="number-text" v-model="packageNum"></el-input-number>
|
||||
<div class="number-text">{{ printDetail.packageNum }}</div>
|
||||
<!-- <el-input-number :min="0" class="number-text" v-model="packageNum"></el-input-number> -->
|
||||
</el-form-item>
|
||||
</div>
|
||||
<div>
|
||||
<!-- 快速操作(当前隐藏) -->
|
||||
<div v-if="false">
|
||||
<el-form-item label="快速操作">
|
||||
<el-button type="primary" icon="el-icon-minus" @click="openReduceDialog">减少</el-button>
|
||||
<el-button type="primary" icon="el-icon-plus" @click="openAddDialog">增加</el-button>
|
||||
</el-form-item>
|
||||
</div>
|
||||
<!-- 打印零头箱操作 -->
|
||||
<el-form-item label="打印操作">
|
||||
<el-button type="danger" @click="submit(2)">打印零头箱</el-button>
|
||||
</el-form-item>
|
||||
@@ -95,18 +102,21 @@
|
||||
import * as QcBackEndApi from '@/api/qualityManagement/BackEnd/qcBackEndService'
|
||||
|
||||
export default {
|
||||
name: 'GenerateLabelDialog',
|
||||
// 修正组件名称
|
||||
name: 'SpecialPrintDialog',
|
||||
data() {
|
||||
return {
|
||||
// 加载状态
|
||||
loading: false,
|
||||
// 对话框显示状态
|
||||
show: false,
|
||||
|
||||
// 增加对话框显示状态
|
||||
addDialogVisible: false,
|
||||
// 减少对话框显示状态
|
||||
reduceDialogVisible: false,
|
||||
// 变更数量
|
||||
changeAmount: 1,
|
||||
|
||||
packageNum: 0,
|
||||
|
||||
// 工单数据
|
||||
formData: {
|
||||
workOrder: '',
|
||||
partNumber: '',
|
||||
@@ -138,75 +148,104 @@ export default {
|
||||
remainderBoxPrintCount: 0,
|
||||
// 箱标签当前序号
|
||||
currentBoxLabelSequence: 0,
|
||||
// 当前零头数
|
||||
packageNum: 0,
|
||||
},
|
||||
// 团队信息
|
||||
team: '',
|
||||
// 站点编号
|
||||
siteNo: '',
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
// 需求数量,当前固定返回 1
|
||||
requireNumber() {
|
||||
return 1
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
/**
|
||||
* 打开减少合格数对话框
|
||||
*/
|
||||
openReduceDialog() {
|
||||
this.reduceDialogVisible = true
|
||||
this.changeAmount = 1
|
||||
},
|
||||
/**
|
||||
* 打开增加合格数对话框
|
||||
*/
|
||||
openAddDialog() {
|
||||
this.addDialogVisible = true
|
||||
this.changeAmount = 1
|
||||
},
|
||||
/**
|
||||
* 确认减少合格数
|
||||
*/
|
||||
confirmReduce() {
|
||||
if (this.changeAmount > 0 && this.changeAmount <= this.packageNum) {
|
||||
this.packageNum -= this.changeAmount
|
||||
if (this.changeAmount > 0 && this.changeAmount <= this.printDetail.packageNum) {
|
||||
this.printDetail.packageNum -= this.changeAmount
|
||||
this.reduceDialogVisible = false
|
||||
} else {
|
||||
this.$message.error('请输入有效的减少数量')
|
||||
}
|
||||
},
|
||||
/**
|
||||
* 获取打印信息
|
||||
*/
|
||||
async getPrintInfo() {
|
||||
try {
|
||||
const params = {
|
||||
workOrder: this.formData.workOrder,
|
||||
}
|
||||
let res = await QcBackEndApi.SearchWorkOrderLabelDetail(params)
|
||||
if (res.code === 200) {
|
||||
this.printDetail = res.data
|
||||
const response = await QcBackEndApi.SearchWorkOrderLabelDetail(params)
|
||||
if (response.code === 200) {
|
||||
this.printDetail = response.data
|
||||
}
|
||||
} catch (error) {}
|
||||
} catch (error) {
|
||||
console.error('获取打印信息失败:', error)
|
||||
this.$message.error('获取打印信息失败,请重试')
|
||||
}
|
||||
},
|
||||
/**
|
||||
* 确认增加合格数
|
||||
*/
|
||||
confirmAdd() {
|
||||
if (this.changeAmount > 0) {
|
||||
this.packageNum += this.changeAmount
|
||||
this.printDetail.packageNum += this.changeAmount
|
||||
this.addDialogVisible = false
|
||||
} else {
|
||||
this.$message.error('请输入有效的增加数量')
|
||||
}
|
||||
},
|
||||
/**
|
||||
* 提交打印请求
|
||||
* @param {number} specialPrintType - 特殊打印类型,1 为补打箱标签,2 为打印零头箱
|
||||
*/
|
||||
async submit(specialPrintType = 1) {
|
||||
try {
|
||||
this.loading = true
|
||||
const params = {
|
||||
specialPrintType,
|
||||
packageNum: this.packageNum,
|
||||
packageNum: this.printDetail.packageNum,
|
||||
}
|
||||
let res = await QcBackEndApi.PrintSpecialPacakgeLabel(this.formData, params)
|
||||
if (res.code === 200 && res.data === 'ok') {
|
||||
const response = await QcBackEndApi.PrintSpecialPacakgeLabel(this.formData, params)
|
||||
if (response.code === 200 && response.data === 'ok') {
|
||||
this.$message.success('打印成功')
|
||||
this.getPrintInfo()
|
||||
await this.getPrintInfo()
|
||||
} else {
|
||||
this.$message.error('打印异常:' + res.data)
|
||||
this.$message.error(`打印异常: ${response.data}`)
|
||||
}
|
||||
|
||||
//this.emitSuccess()
|
||||
//this.close()
|
||||
} catch (error) {
|
||||
this.$message.error('打印失败,请重试' + error)
|
||||
console.error('打印失败:', error)
|
||||
this.$message.error(`打印失败,请重试: ${error.message || error}`)
|
||||
} finally {
|
||||
this.loading = false
|
||||
}
|
||||
},
|
||||
/**
|
||||
* 打开特殊标签打印对话框
|
||||
* @param {Object} data - 包含工单数据、团队信息和站点编号的对象
|
||||
*/
|
||||
open(data) {
|
||||
this.show = true
|
||||
this.loading = false
|
||||
@@ -215,12 +254,18 @@ export default {
|
||||
this.siteNo = data.siteNo
|
||||
this.getPrintInfo()
|
||||
},
|
||||
/**
|
||||
* 关闭特殊标签打印对话框
|
||||
*/
|
||||
close() {
|
||||
this.show = false
|
||||
this.resetFormData()
|
||||
},
|
||||
/**
|
||||
* 重置表单数据
|
||||
*/
|
||||
resetFormData() {
|
||||
this.packageNum = 0
|
||||
this.printDetail.packageNum = 0
|
||||
this.changeAmount = 1
|
||||
this.formData = {
|
||||
workOrder: '',
|
||||
@@ -247,6 +292,7 @@ export default {
|
||||
rePrintCount: 0,
|
||||
remainderBoxPrintCount: 0,
|
||||
currentBoxLabelSequence: 0,
|
||||
packageNum: 0,
|
||||
}
|
||||
this.team = ''
|
||||
this.siteNo = ''
|
||||
|
||||
@@ -252,7 +252,7 @@ export default {
|
||||
const workorder = this.formData.workOrder
|
||||
const checkRes1 = await QcBackEndApi.CheckPackageIsFullAndNeedScanPackageLabel({ workorder })
|
||||
// 需要扫箱标签
|
||||
if (checkRes1.code === 200 && checkRes1.data) {
|
||||
if (checkRes1.code === 200 && checkRes1.data === true) {
|
||||
const obj = {
|
||||
workOrder: workorder,
|
||||
team: this.team,
|
||||
@@ -263,6 +263,9 @@ export default {
|
||||
|
||||
//this.$refs.ScanPackageLabelDialogRef.handleScanPackageLabel(LabelCode, ComNo)
|
||||
return
|
||||
} else if (typeof checkRes1.data === 'string' && checkRes1.data.includes('功能异常')) {
|
||||
this.showErrorMessage(3, res.data)
|
||||
return
|
||||
}
|
||||
// 扫内标签模式
|
||||
this.handleScanInnerLabel(LabelCode, ComNo)
|
||||
|
||||
Reference in New Issue
Block a user