标签打印样式功能转移

This commit is contained in:
赵正易 2025-04-09 18:12:00 +08:00
parent da0282f2c0
commit 63252ec2c7
10 changed files with 733 additions and 7 deletions

View File

@ -85,4 +85,49 @@ export function BoxLabelAndProductLabel(params) {
method: 'get',
params
})
}
// 校验箱子标签TODO 2025-04-09 新报工接口)
export function CheckBoxInspectionLabel(params) {
return request({
url: '/mes/Mobile/PrintAndReportWork2/CheckBoxInspectionLabel',
method: 'get',
params
})
}
// 获取首件检验标签TODO 2025-04-09 新报工接口)
export function GetFirstInspectionLabel(params) {
return request({
url: '/mes/Mobile/PrintAndReportWork2/firstInspectionLabel',
method: 'get',
params
})
}
// 校验首标签TODO 2025-04-09 新报工接口)
export function CheckFirstInspectionLabel(params) {
return request({
url: '/mes/Mobile/PrintAndReportWork2/CheckfirstInspectionLabel',
method: 'get',
params
})
}
// 获取末件检验标签TODO 2025-04-09 新报工接口)
export function GetEndInspectionLabel(params) {
return request({
url: '/mes/Mobile/PrintAndReportWork2/getendinspectionlabel',
method: 'get',
params
})
}
// 校验末件标签TODO 2025-04-09 新报工接口)
export function CheckEndInspectionLabel(params) {
return request({
url: '/mes/Mobile/PrintAndReportWork2/CheckEndInspectionLabel',
method: 'get',
params
})
}

View File

@ -2,8 +2,8 @@
"name" : "DOAN总装车间PDA",
"appid" : "__UNI__EFA389B",
"description" : "DOAN总装车间PDA",
"versionName" : "1.4.0",
"versionCode" : 140,
"versionName" : "1.5.0",
"versionCode" : 150,
"transformPx" : false,
"app-plus" : {
"usingComponents" : true,

View File

@ -168,6 +168,13 @@
{
"navigationBarTitleText" : "标签扫码报工"
}
},
{
"path" : "pages/produceManagement/checkLabel/checkLabel",
"style" :
{
"navigationBarTitleText" : "校验标签"
}
}
],
"tabBar": {

View File

@ -17,9 +17,9 @@
</uni-forms-item>
</uni-forms>
</uni-card>
<view>
<!-- <view>
<button type="primary" @click="showSystemAlertAndVibrate">弹出信息与震动</button>
</view>
</view> -->
<view class="bottom-box">
<button :disabled="loading" type="primary" @click="submit">提交安灯报警信息</button>
</view>

View File

@ -0,0 +1,164 @@
<template>
<!--XXX 2025-04-06 工单报工打印标签后扫标签报工版本 -->
<view>
<uni-card>
<view class="report-form-item">
<view class="report-form-label">工单号</view>
<view class="report-form-value">{{ formData.fkWorkorder }}</view>
</view>
<view class="report-form-item">
<view class="report-form-label">产品编号</view>
<view class="report-form-value">{{ formData.productionCode }}</view>
</view>
<view class="report-form-item">
<view class="report-form-label">产品名称</view>
<view class="report-form-value">{{ formData.productionName }}</view>
</view>
<view class="report-form-item">
<view class="report-form-label">规格</view>
<view class="report-form-value">{{ formData.specification }}</view>
</view>
</uni-card>
<!-- 模板显示 -->
<step1Vue ref="step1Ref" v-if="step === 1" :formData="formData" @next="next"></step1Vue>
<step2Vue ref="step2Ref" v-if="step === 2" :formData="formData" @submit="submit"></step2Vue>
<!-- 初次进入校验 -->
<view>
<uni-popup ref="dialogRef" type="dialog">
<uni-popup-dialog
:title="dialog.title"
:content="dialog.content"
:type="dialog.type"
cancelText="关闭"
confirmText="确认"
@confirm="dialogConfirm"
@close="dialogClose"
></uni-popup-dialog>
</uni-popup>
</view>
</view>
</template>
<script>
import step1Vue from './step1.vue';
import step2Vue from './step2.vue';
// Api
export default {
components:{
step1Vue,
step2Vue
},
onLoad: function (option) {
this.$nextTick(() => {
this.formData = JSON.parse(JSON.stringify(option));
if(this.step === 1 && this.formData.fkWorkorder){
this.$refs.step1Ref.getFirstLabel(this.formData.fkWorkorder)
this.$refs.step1Ref.getEndLabel(this.formData.fkWorkorder)
}
});
},
data() {
return {
loading: false,
step1Ref:null,
step2Ref:null,
dialogRef: null,
dialog: {
title: '操作提醒',
content: '',
type: 'warn'
},
//
formData: {
id: null,
finishNum: 0
},
//
step: 1
};
},
methods: {
next() {
this.step = 2;
},
submit() {
this.step = 1;
},
dialogConfirm() {
this.dialogClose();
},
dialogClose() {
this.$refs.dialogRef.close();
}
}
};
</script>
<style scoped>
.report-form-item {
display: flex;
}
.report-form-label {
width: 80px;
font-size: 14px;
}
.report-form-value {
font-size: 16px;
}
.report-box {
height: 30vh;
display: flex;
flex-direction: column;
align-items: center;
}
.report-box-title {
font-size: 18px;
font-weight: 700;
text-align: center;
}
.report-box-parts-list {
width: 86vw;
height: 48vh;
display: flex;
flex-direction: column;
align-items: center;
overflow-y: auto;
will-change: scroll-position;
}
.reprot-box-parts-list-item {
padding: 5px;
margin: 0px; /* 添加外边距 */
width: calc(100% - 10px); /* 调整宽度以适应内边距 */
height: 50px;
border: 1px solid #c1c1c1; /* 调整边框颜色为更柔和的灰色 */
display: flex;
flex-direction: row;
transition: background-color 0.3s ease; /* 添加过渡效果 */
}
.reprot-box-parts-list-item:hover {
background-color: #f5f5f5; /* 添加悬停效果 */
}
.reprot-box-parts-list-item-left {
width: 75%;
height: 100%;
display: flex;
flex-direction: column;
}
.reprot-box-parts-list-item-title {
font-size: 18px;
font-weight: 600;
}
.reprot-box-parts-list-item-content {
font-size: 14px;
}
.reprot-box-parts-list-item-right {
width: 25%;
height: 100%;
display: flex;
flex-direction: row;
justify-content: space-between;
align-items: center;
}
</style>

View File

@ -0,0 +1,335 @@
<template>
<!--XXX 2025-04-06 工单报工打印标签后扫标签报工版本 -->
<view>
<uni-card class="report-box">
<view class="report-box-title">外箱标签检验</view>
<view class="report-box-parts-list">
<view v-if="packageLabel.label" class="reprot-box-parts-list-item">
<view class="reprot-box-parts-list-item-left">
<view class="reprot-box-parts-list-item-title">{{ packageLabel.title }}</view>
<view class="reprot-box-parts-list-item-content">{{ packageLabel.content }}</view>
</view>
<view class="reprot-box-parts-list-item-right">
<uni-icons type="trash-filled" color="red" size="30" @click="remove(0)"></uni-icons>
</view>
</view>
<view v-else>
<ScanInput @scanConfirm="scanConfirmByPackageLabel" placeholder="请扫外箱标签"></ScanInput>
</view>
</view>
</uni-card>
<uni-card class="report-box">
<view class="report-box-title">首标签检验</view>
<view class="report-box-parts-list">
<view v-if="firstPartsLabel.label" class="reprot-box-parts-list-item">
<view class="reprot-box-parts-list-item-left">
<view class="reprot-box-parts-list-item-title">{{ firstPartsLabel.title }}</view>
<view class="reprot-box-parts-list-item-content">{{ firstPartsLabel.content }}</view>
</view>
<view class="reprot-box-parts-list-item-right">
<uni-icons type="trash-filled" color="red" size="30" @click="remove(1)"></uni-icons>
</view>
</view>
<view v-else>
<ScanInput @scanConfirm="scanConfirmByFirstLabel" placeholder="请扫首标签"></ScanInput>
</view>
</view>
</uni-card>
<uni-card class="report-box">
<view class="report-box-title">末标签检验</view>
<view class="report-box-parts-list">
<view v-if="endPartsLabel.label" class="reprot-box-parts-list-item">
<view class="reprot-box-parts-list-item-left">
<view class="reprot-box-parts-list-item-title">{{ endPartsLabel.title }}</view>
<view class="reprot-box-parts-list-item-content">{{ endPartsLabel.content }}</view>
</view>
<view class="reprot-box-parts-list-item-right">
<uni-icons type="trash-filled" color="red" size="30" @click="remove(2)"></uni-icons>
</view>
</view>
<view v-else>
<ScanInput @scanConfirm="scanConfirmByEndLabel" placeholder="请扫末标签"></ScanInput>
</view>
</view>
</uni-card>
<view class="bottom-box">
<button :disabled="!canNext" type="primary" @click="next">下一步报工</button>
</view>
<!-- 初次进入校验 -->
<view>
<uni-popup ref="dialogRef" type="dialog">
<uni-popup-dialog
:title="dialog.title"
:content="dialog.content"
:type="dialog.type"
cancelText="关闭"
confirmText="确认"
@confirm="dialogConfirm"
@close="dialogClose"
></uni-popup-dialog>
</uni-popup>
</view>
<!-- 删除确认对话框 -->
<view>
<uni-popup ref="deleteDialogRef" type="dialog">
<uni-popup-dialog
title="确认删除"
content="确定要删除该标签吗?"
cancelText="取消"
confirmText="删除"
@confirm="confirmDelete"
@close="closeDeleteDialog"
></uni-popup-dialog>
</uni-popup>
</view>
</view>
</template>
<script>
// Api
import { CheckBoxInspectionLabel,GetFirstInspectionLabel, GetEndInspectionLabel, CheckFirstInspectionLabel, CheckEndInspectionLabel } from '@/api/workorder/index.js';
export default {
props: {
formData: {
type: Object
}
},
data() {
return {
loading: false,
dialogRef: null,
dialog: {
title: '操作提醒',
content: '',
type: 'warn'
},
deleteIndex: null,
deleteDialogRef: null,
//
packageLabel: {
label: '',
title: '标题',
content: '内容'
},
//
firstPartsLabel: {
label: '',
title: '标题',
content: '内容'
},
endPartsLabel: {
label: '',
title: '标题',
content: '内容'
}
};
},
computed: {
canNext() {
return this.firstPartsLabel.label && this.endPartsLabel.label && this.packageLabel.label;
}
},
methods: {
//
async scanConfirmByPackageLabel(val) {
try {
this.loading = true;
const _value = val;
if (_value === '' || _value === null) {
this.loading = false;
this.dialog.content = '扫码结果为空!';
this.dialog.type = 'warn';
this.$refs.dialogRef.open();
return;
}
let parmas = {
workorder: this.formData.fkWorkorder,
first_label: _value
};
let res = await CheckBoxInspectionLabel(parmas);
if (res.code === 200 && res.data) {
this.packageLabel.label = _value;
} else {
this.dialog.content = '外箱标签校验异常:' + res.data;
this.dialog.type = 'warn';
this.$refs.dialogRef.open();
}
this.loading = false;
} catch (e) {
this.loading = false;
console.log(e);
}
},
async scanConfirmByFirstLabel(val) {
try {
this.loading = true;
const _value = val;
if (_value === '' || _value === null) {
this.loading = false;
this.dialog.content = '扫码结果为空!';
this.dialog.type = 'warn';
this.$refs.dialogRef.open();
return;
}
let parmas = {
workorder: this.formData.fkWorkorder,
first_label: _value
};
let res = await CheckFirstInspectionLabel(parmas);
if (res.code === 200 && res.data === '合格') {
this.firstPartsLabel.label = _value;
} else {
this.dialog.content = '首标签校验异常:' + res.data;
this.dialog.type = 'warn';
this.$refs.dialogRef.open();
}
this.loading = false;
} catch (e) {
this.loading = false;
console.log(e);
}
},
async scanConfirmByEndLabel(val) {
try {
this.loading = true;
const _value = val;
if (_value === '' || _value === null) {
this.loading = false;
this.dialog.content = '扫码结果为空!';
this.dialog.type = 'warn';
this.$refs.dialogRef.open();
return;
}
let parmas = {
workorder: this.formData.fkWorkorder,
end_label: _value
};
let res = await CheckEndInspectionLabel(parmas);
if (res.code === 200 && res.data === '合格') {
this.endPartsLabel.label = _value;
} else {
this.dialog.content = '末标签校验异常:' + res.data;
this.dialog.type = 'warn';
this.$refs.dialogRef.open();
}
this.loading = false;
} catch (e) {
this.loading = false;
console.log(e);
}
},
getFirstLabel(workorder) {
GetFirstInspectionLabel({ workorder }).then((res) => {
if (res.code === 200 && res.data) {
this.firstPartsLabel = res.data;
}
});
},
getEndLabel(workorder) {
GetEndInspectionLabel({ workorder }).then((res) => {
if (res.code === 200 && res.data) {
this.endPartsLabel = res.data;
}
});
},
remove(index) {
this.deleteIndex = index;
this.$refs.deleteDialogRef.open();
},
confirmDelete() {
if (this.deleteIndex === 0) {
this.firstPartsLabel = {};
this.deleteIndex = 0;
}
if (this.deleteIndex === 1) {
this.firstPartsLabel = {};
this.deleteIndex = 0;
}
if (this.deleteIndex === 2) {
this.endPartsLabel = {};
this.deleteIndex = 0;
}
this.$refs.deleteDialogRef.close();
},
closeDeleteDialog() {
this.deleteIndex = null;
},
next() {
this.$emit('next');
},
dialogConfirm() {
this.dialogClose();
},
dialogClose() {
this.$refs.dialogRef.close();
}
}
};
</script>
<style scoped>
.report-form-item {
display: flex;
}
.report-form-label {
width: 80px;
font-size: 14px;
}
.report-form-value {
font-size: 16px;
}
.report-box {
height: 20vh;
display: flex;
flex-direction: column;
align-items: center;
}
.report-box-title {
font-size: 18px;
font-weight: 700;
text-align: center;
}
.report-box-parts-list {
width: 86vw;
height: 48vh;
display: flex;
flex-direction: column;
align-items: center;
overflow-y: auto;
will-change: scroll-position;
}
.reprot-box-parts-list-item {
padding: 5px;
margin: 0px; /* 添加外边距 */
width: calc(100% - 10px); /* 调整宽度以适应内边距 */
height: 50px;
border: 1px solid #c1c1c1; /* 调整边框颜色为更柔和的灰色 */
display: flex;
flex-direction: row;
transition: background-color 0.3s ease; /* 添加过渡效果 */
}
.reprot-box-parts-list-item:hover {
background-color: #f5f5f5; /* 添加悬停效果 */
}
.reprot-box-parts-list-item-left {
width: 75%;
height: 100%;
display: flex;
flex-direction: column;
}
.reprot-box-parts-list-item-title {
font-size: 18px;
font-weight: 600;
}
.reprot-box-parts-list-item-content {
font-size: 14px;
}
.reprot-box-parts-list-item-right {
width: 25%;
height: 100%;
display: flex;
flex-direction: row;
justify-content: space-between;
align-items: center;
}
</style>

View File

@ -0,0 +1,175 @@
<template>
<!--XXX 2025-04-06 工单报工打印标签后扫标签报工版本 -->
<view>
<!-- TODO 暂时报工逻辑 -->
<uni-card>
<uni-forms label-width="80px" label-align="right">
<uni-forms-item label="报工数" name="finishedNum">
<uni-easyinput type="number" v-model.number="finishedNum" placeholder="请输入报工数" />
</uni-forms-item>
</uni-forms>
</uni-card>
<view class="bottom-box">
<button :disabled="loading" type="primary" @click="submit">工单报工</button>
</view>
<view>
<uni-popup ref="dialogRef" type="dialog">
<uni-popup-dialog
:title="dialog.title"
:content="dialog.content"
:type="dialog.type"
cancelText="关闭"
confirmText="确认"
@confirm="dialogConfirm"
@close="dialogClose"
></uni-popup-dialog>
</uni-popup>
</view>
</view>
</template>
<script>
// Api
import {
InspectionBoxLabel,
InspectionProductLabel,
BoxLabelAndProductLabel,
getWorkOrderDetail,
doStartWorkOrder,
updateReport,
doFinishWorkOrder
} from '@/api/workorder/index.js';
export default {
props: {
formData: {
type: Object
}
},
data() {
return {
loading: false,
dialogRef: null,
dialog: {
title: '操作提醒',
content: '',
type: 'warn'
},
finishedNum: 0
};
},
methods: {
submit() {
let that = this;
this.loading = true;
const _workorder = this.formData.fkWorkorder;
//
const params = {
workorder: _workorder,
reportNum: this.finishedNum
};
updateReport(params)
.then((res) => {
if (res.code === 200) {
uni.showToast({
icon: 'success',
title: '报工成功',
duration: 2000,
success() {
const params2 = {
workorder: _workorder
};
doFinishWorkOrder(params2).then((res) => {
if (res.code === 200) {
uni.showToast({
icon: 'success',
title: '完成工单'
});
that.loading = false;
}
this.$emit('submit');
});
}
});
}
})
.finally(() => {
this.loading = true;
});
},
dialogConfirm() {
this.dialogClose();
},
dialogClose() {
this.$refs.dialogRef.close();
}
}
};
</script>
<style scoped>
.report-form-item {
display: flex;
}
.report-form-label {
width: 80px;
font-size: 14px;
}
.report-form-value {
font-size: 16px;
}
.report-box {
height: 30vh;
display: flex;
flex-direction: column;
align-items: center;
}
.report-box-title {
font-size: 18px;
font-weight: 700;
text-align: center;
}
.report-box-parts-list {
width: 86vw;
height: 48vh;
display: flex;
flex-direction: column;
align-items: center;
overflow-y: auto;
will-change: scroll-position;
}
.reprot-box-parts-list-item {
padding: 5px;
margin: 0px; /* 添加外边距 */
width: calc(100% - 10px); /* 调整宽度以适应内边距 */
height: 50px;
border: 1px solid #c1c1c1; /* 调整边框颜色为更柔和的灰色 */
display: flex;
flex-direction: row;
transition: background-color 0.3s ease; /* 添加过渡效果 */
}
.reprot-box-parts-list-item:hover {
background-color: #f5f5f5; /* 添加悬停效果 */
}
.reprot-box-parts-list-item-left {
width: 75%;
height: 100%;
display: flex;
flex-direction: column;
}
.reprot-box-parts-list-item-title {
font-size: 18px;
font-weight: 600;
}
.reprot-box-parts-list-item-content {
font-size: 14px;
}
.reprot-box-parts-list-item-right {
width: 25%;
height: 100%;
display: flex;
flex-direction: row;
justify-content: space-between;
align-items: center;
}
</style>

View File

@ -102,7 +102,7 @@ export default {
dialog: {
title: '操作提醒',
content: '',
type: 'warning'
type: 'warn'
},
deleteIndex: null,
deleteDialogRef: null,

View File

@ -71,7 +71,7 @@
ref="inputClose2"
title="操作提醒"
content="工单已完成报工,是否继续报工!"
type="warning"
type="warn"
cancelText="关闭" confirmText="继续"
@confirm="dialogConfirm2"
@close="dialogClose2"

View File

@ -186,7 +186,7 @@ export default {
onListItemClick(item) {
const params = item.workOrderInfo;
uni.navigateTo({
url: '/pages/produceManagement/scanLabelReport/scanLabelReport?' + tansParams(params)
url: '/pages/produceManagement/checkLabel/checkLabel?' + tansParams(params)
});
},
//