外箱标签扫描对接

This commit is contained in:
赵正易 2025-04-11 17:13:42 +08:00
parent 63252ec2c7
commit 112a586e75
10 changed files with 1259 additions and 26 deletions

View File

@ -87,7 +87,7 @@ export function BoxLabelAndProductLabel(params) {
})
}
// 校验箱子标签TODO 2025-04-09 新报工接口)
// 校验箱子标签TODO 2025-04-09 U16线U13线新报工接口)
export function CheckBoxInspectionLabel(params) {
return request({
url: '/mes/Mobile/PrintAndReportWork2/CheckBoxInspectionLabel',
@ -96,7 +96,7 @@ export function CheckBoxInspectionLabel(params) {
})
}
// 获取首件检验标签TODO 2025-04-09 新报工接口)
// 获取首件检验标签TODO 2025-04-09 U16线U13线新报工接口)
export function GetFirstInspectionLabel(params) {
return request({
url: '/mes/Mobile/PrintAndReportWork2/firstInspectionLabel',
@ -105,7 +105,7 @@ export function GetFirstInspectionLabel(params) {
})
}
// 校验首标签TODO 2025-04-09 新报工接口)
// 校验首标签TODO 2025-04-09 U16线U13线新报工接口)
export function CheckFirstInspectionLabel(params) {
return request({
url: '/mes/Mobile/PrintAndReportWork2/CheckfirstInspectionLabel',
@ -114,7 +114,7 @@ export function CheckFirstInspectionLabel(params) {
})
}
// 获取末件检验标签TODO 2025-04-09 新报工接口)
// 获取末件检验标签TODO 2025-04-09 U16线U13线新报工接口)
export function GetEndInspectionLabel(params) {
return request({
url: '/mes/Mobile/PrintAndReportWork2/getendinspectionlabel',
@ -123,11 +123,56 @@ export function GetEndInspectionLabel(params) {
})
}
// 校验末件标签TODO 2025-04-09 新报工接口)
// 校验末件标签TODO 2025-04-09 U16线U13线新报工接口)
export function CheckEndInspectionLabel(params) {
return request({
url: '/mes/Mobile/PrintAndReportWork2/CheckEndInspectionLabel',
method: 'get',
params
})
}
// 校验箱子标签TODO 2025-04-11 U03U05线新报工接口
export function CheckBoxInspectionLabel2(params) {
return request({
url: '/mes/Mobile/PrintAndReportWork3/CheckBoxInspectionLabel',
method: 'get',
params
})
}
// 获取首件检验标签TODO 2025-04-11 U03U05线新报工接口
export function GetFirstInspectionLabel2(params) {
return request({
url: '/mes/Mobile/PrintAndReportWork3/firstInspectionLabel',
method: 'get',
params
})
}
// 校验首标签TODO 2025-04-11 U03U05线新报工接口
export function CheckFirstInspectionLabel2(params) {
return request({
url: '/mes/Mobile/PrintAndReportWork3/CheckfirstInspectionLabel',
method: 'get',
params
})
}
// 获取末件检验标签TODO 2025-04-11 U03U05线新报工接口
export function GetEndInspectionLabel2(params) {
return request({
url: '/mes/Mobile/PrintAndReportWork3/getendinspectionlabel',
method: 'get',
params
})
}
// 校验末件标签TODO 2025-04-11 U03U05线新报工接口
export function CheckEndInspectionLabel2(params) {
return request({
url: '/mes/Mobile/PrintAndReportWork3/CheckEndInspectionLabel',
method: 'get',
params
})
}

View File

@ -127,6 +127,20 @@
"navigationBarTitleText" : "工单列表"
}
},
{
"path" : "pages/produceManagement/workorder/workorder02",
"style" :
{
"navigationBarTitleText" : "工单列表"
}
},
{
"path" : "pages/produceManagement/workorder/workorder03",
"style" :
{
"navigationBarTitleText" : "工单列表"
}
},
{
"path" : "pages/produceManagement/reportWorkOrder/reportWorkOrder",
"style" :
@ -173,7 +187,14 @@
"path" : "pages/produceManagement/checkLabel/checkLabel",
"style" :
{
"navigationBarTitleText" : "校验标签"
"navigationBarTitleText" : "U16,U13线报工"
}
},
{
"path" : "pages/produceManagement/checkLabel2/checkLabel2",
"style" :
{
"navigationBarTitleText" : "U03,U05线报工"
}
}
],

View File

@ -61,10 +61,20 @@ export default {
//
produceOptions: [
{
name: '产线报工',
name: '产线报工(通用)',
icon: 'folder-add-filled',
url: '/pages/produceManagement/workorder/workorder'
},
{
name: '产线报工\n(U13线U16线)',
icon: 'folder-add-filled',
url: '/pages/produceManagement/workorder/workorder02'
},
{
name: '产线报工\n(U03线U05线)',
icon: 'folder-add-filled',
url: '/pages/produceManagement/workorder/workorder03'
},
{
name: '安灯报警',
icon: 'notification-filled',

View File

@ -87,7 +87,7 @@
<script>
// Api
import { CheckBoxInspectionLabel,GetFirstInspectionLabel, GetEndInspectionLabel, CheckFirstInspectionLabel, CheckEndInspectionLabel } from '@/api/workorder/index.js';
import { CheckBoxInspectionLabel, GetFirstInspectionLabel, GetEndInspectionLabel, CheckFirstInspectionLabel, CheckEndInspectionLabel } from '@/api/workorder/index.js';
export default {
props: {
formData: {
@ -103,24 +103,24 @@ export default {
content: '',
type: 'warn'
},
deleteIndex: null,
deleteIndex: -1,
deleteDialogRef: null,
//
packageLabel: {
label: '',
title: '标题',
content: '内容'
title: '',
content: '外箱标签'
},
//
firstPartsLabel: {
label: '',
title: '标题',
content: '内容'
title: '',
content: '首标签'
},
endPartsLabel: {
label: '',
title: '标题',
content: '内容'
title: '',
content: '末标签'
}
};
},
@ -144,11 +144,12 @@ export default {
}
let parmas = {
workorder: this.formData.fkWorkorder,
first_label: _value
box_label: _value
};
let res = await CheckBoxInspectionLabel(parmas);
if (res.code === 200 && res.data) {
if (res.code === 200 && res.data === '合格') {
this.packageLabel.label = _value;
this.packageLabel.title = _value;
} else {
this.dialog.content = '外箱标签校验异常:' + res.data;
this.dialog.type = 'warn';
@ -178,6 +179,7 @@ export default {
let res = await CheckFirstInspectionLabel(parmas);
if (res.code === 200 && res.data === '合格') {
this.firstPartsLabel.label = _value;
this.firstPartsLabel.title = _value;
} else {
this.dialog.content = '首标签校验异常:' + res.data;
this.dialog.type = 'warn';
@ -207,6 +209,7 @@ export default {
let res = await CheckEndInspectionLabel(parmas);
if (res.code === 200 && res.data === '合格') {
this.endPartsLabel.label = _value;
this.endPartsLabel.title = _value;
} else {
this.dialog.content = '末标签校验异常:' + res.data;
this.dialog.type = 'warn';
@ -221,14 +224,16 @@ export default {
getFirstLabel(workorder) {
GetFirstInspectionLabel({ workorder }).then((res) => {
if (res.code === 200 && res.data) {
this.firstPartsLabel = res.data;
this.firstPartsLabel.label = res.data;
this.firstPartsLabel.title = res.data;
}
});
},
getEndLabel(workorder) {
GetEndInspectionLabel({ workorder }).then((res) => {
if (res.code === 200 && res.data) {
this.endPartsLabel = res.data;
this.endPartsLabel.label = res.data;
this.endPartsLabel.title = res.data;
}
});
},
@ -238,16 +243,19 @@ export default {
},
confirmDelete() {
if (this.deleteIndex === 0) {
this.firstPartsLabel = {};
this.deleteIndex = 0;
this.packageLabel.label = '';
this.packageLabel.title = '';
this.deleteIndex = -1;
}
if (this.deleteIndex === 1) {
this.firstPartsLabel = {};
this.deleteIndex = 0;
this.firstPartsLabel.label = '';
this.firstPartsLabel.title = '';
this.deleteIndex = -1;
}
if (this.deleteIndex === 2) {
this.endPartsLabel = {};
this.deleteIndex = 0;
this.endPartsLabel.label = '';
this.endPartsLabel.title = '';
this.deleteIndex = -1;
}
this.$refs.deleteDialogRef.close();
},

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,338 @@
<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 { CheckBoxInspectionLabel2,GetFirstInspectionLabel2, GetEndInspectionLabel2, CheckFirstInspectionLabel2, CheckEndInspectionLabel2 } 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 CheckBoxInspectionLabel2(parmas);
if (res.code === 200 && res.data) {
this.packageLabel.label = _value;
this.packageLabel.content = _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 CheckFirstInspectionLabel2(parmas);
if (res.code === 200 && res.data === '合格') {
this.firstPartsLabel.label = _value;
this.firstPartsLabel.content = _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 CheckEndInspectionLabel2(parmas);
if (res.code === 200 && res.data === '合格') {
this.endPartsLabel.label = _value;
this.endPartsLabel.content = _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) {
GetFirstInspectionLabel2({ workorder }).then((res) => {
if (res.code === 200 && res.data) {
this.firstPartsLabel = res.data;
}
});
},
getEndLabel(workorder) {
GetEndInspectionLabel2({ 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

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

View File

@ -0,0 +1,236 @@
<template>
<view>
<!-- U13,U16线工单列表 -->
<view class="query-card">
<uni-forms style="width: 100%" ref="form">
<uni-forms-item label="日期">
<uni-datetime-picker type="date" :clear-icon="false" v-model="query.dateTime" />
</uni-forms-item>
<!-- <uni-forms-item label="线别">
<uni-data-select v-model="query.lineCode" :localdata="lineOptions" :clear="false"></uni-data-select>
</uni-forms-item> -->
<uni-forms-item label="组别">
<uni-data-select v-model="query.groupCode" :localdata="groupOptions" :clear="false"></uni-data-select>
</uni-forms-item>
<button type="primary" plain @click="getList()">
<uni-icons color="#2979ff" type="search" size="18"></uni-icons>
查询工单
</button>
</uni-forms>
</view>
<uni-segmented-control :current="current" activeColor="#007aff" :values="selectItems" @clickItem="onClickSelect" />
<scroll-view class="scroll-view" scroll-y="true">
<uni-list style="width: 100%">
<uni-list-item
:class="getWorkOrderClass(item)"
v-for="(item, index) in dataList"
:key="index"
:title="item.title"
:note="item.note"
:rightText="item.rightText"
link
@click="onListItemClick(item)"
></uni-list-item>
</uni-list>
</scroll-view>
<view class="bottom-box">
<button type="primary" @click="scanToReport">
<uni-icons color="#fff" type="scan" size="18"></uni-icons>
修改报工
</button>
</view>
</view>
</template>
<script>
//
import { getAllRoute, getAllGroup, getWorkOrderList } from '@/api/workorder/index.js';
//
// import { getReportWorkOrderList,getWorkOrderStatusList } from '@/api/workorder/proreportwork.js';
import { tansParams } from '@/utils/common';
export default {
data() {
return {
//
query: {
lineCode: '',
groupCode: '1',
status: 1,
dateTime: this.$dayjs().format('YYYY-MM-DD')
},
current: 0,
selectItems: ['未开始', '进行中', '已完成'],
value: '',
// 线
lineOptions: [],
//
groupOptions: [],
//
dataList: [],
workOrderSelect: '',
sessionKey: '_WorkorderSearch'
};
},
created() {
this.init();
},
onShow: function () {
this.getSessionStorage();
this.current = this.query.status - 1;
//this.getList();
},
methods: {
init() {
//
this.getSelectOptions();
},
getWorkOrderClass(item) {
if (item.status === 1) {
return '';
}
if (item.status === 2) {
return 'bg-blue';
}
if (item.status === 3) {
return 'bg-green';
}
},
onClickSelect(e) {
this.query.status = e.currentIndex + 1;
this.getList();
},
async getSelectOptions() {
uni.showLoading();
const res1 = await getAllRoute();
if (res1.code === 200) {
this.lineOptions = res1.data.map((item) => {
return {
id: item.id,
text: `${item.name}`,
value: `${item.code}`
};
});
}
const res2 = await getAllGroup();
if (res2.code === 200) {
this.groupOptions = res2.data.map((item) => {
return {
id: item.id,
text: `${item.groupName}`,
value: `${item.groupCode}`
};
});
}
uni.hideLoading();
},
setSessionStorage(query) {
try {
const _query = JSON.stringify(query);
return uni.setStorageSync(this.sessionKey, _query);
} catch (e) {
return;
}
},
getSessionStorage() {
try {
const _query = JSON.parse(uni.getStorageSync(this.sessionKey));
if (_query != '' && _query != null) {
this.query = _query;
}
} catch (e) {
return;
}
},
//
getList() {
this.dataList = [];
const params = {
group_code: this.query.groupCode,
status: this.query.status,
handleDate: this.query.dateTime
};
getWorkOrderList(params).then((res) => {
let that = this;
if (res.code === 200) {
this.setSessionStorage(this.query);
this.dataList = res.data.map((item) => {
let statusStr = that.getWorkOrderStatus(item.status);
return {
id: item.id,
workOrderInfo: item,
status: item.status,
title: `${item.fkWorkorder} -- ${statusStr}`,
note: `${item.productionName} ${item.productionCode}`,
rightText: `${item.finishedNum ?? 0} 扫码报工`
};
});
}
});
},
getWorkOrderStatus(status = 0) {
try {
const list = ['', '未开始', '进行中', '已完成'];
return list[status * 1];
} catch (e) {
return '';
}
},
WorkOrderStatusColor(status) {
const list = ['', '未开始', '已开始', '已完成'];
const colorList = ['#fff', '#8f939c', '#2979ff', '#18bc37'];
return colorList[status * 1];
},
//
onListItemClick(item) {
const params = item.workOrderInfo;
uni.navigateTo({
url: '/pages/produceManagement/checkLabel/checkLabel?' + tansParams(params)
});
},
//
scanToReport() {
const params = this.query;
uni.navigateTo({
url: '/pages/produceManagement/scanWorkOrder/scanWorkOrder?' + tansParams(params)
});
}
}
};
</script>
<style scoped>
.content {
width: 100%;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
.query-card {
background-color: #fff;
padding: 10px;
}
.row {
background-color: #fff;
width: 100%;
display: flex;
flex-direction: row;
align-items: center;
justify-content: center;
}
.card-box {
width: 100%;
}
.scroll-view {
height: 800rpx;
padding-bottom: 40rpx;
}
.bg-blue {
background-color: rgb(197.7, 225.9, 255) !important;
}
.bg-green {
background-color: rgb(209.4, 236.7, 195.9) !important;
}
</style>

View File

@ -0,0 +1,236 @@
<template>
<view>
<!-- U03,U05线工单列表 -->
<view class="query-card">
<uni-forms style="width: 100%" ref="form">
<uni-forms-item label="日期">
<uni-datetime-picker type="date" :clear-icon="false" v-model="query.dateTime" />
</uni-forms-item>
<!-- <uni-forms-item label="线别">
<uni-data-select v-model="query.lineCode" :localdata="lineOptions" :clear="false"></uni-data-select>
</uni-forms-item> -->
<uni-forms-item label="组别">
<uni-data-select v-model="query.groupCode" :localdata="groupOptions" :clear="false"></uni-data-select>
</uni-forms-item>
<button type="primary" plain @click="getList()">
<uni-icons color="#2979ff" type="search" size="18"></uni-icons>
查询工单
</button>
</uni-forms>
</view>
<uni-segmented-control :current="current" activeColor="#007aff" :values="selectItems" @clickItem="onClickSelect" />
<scroll-view class="scroll-view" scroll-y="true">
<uni-list style="width: 100%">
<uni-list-item
:class="getWorkOrderClass(item)"
v-for="(item, index) in dataList"
:key="index"
:title="item.title"
:note="item.note"
:rightText="item.rightText"
link
@click="onListItemClick(item)"
></uni-list-item>
</uni-list>
</scroll-view>
<view class="bottom-box">
<button type="primary" @click="scanToReport">
<uni-icons color="#fff" type="scan" size="18"></uni-icons>
修改报工
</button>
</view>
</view>
</template>
<script>
//
import { getAllRoute, getAllGroup, getWorkOrderList } from '@/api/workorder/index.js';
//
// import { getReportWorkOrderList,getWorkOrderStatusList } from '@/api/workorder/proreportwork.js';
import { tansParams } from '@/utils/common';
export default {
data() {
return {
//
query: {
lineCode: '',
groupCode: '1',
status: 1,
dateTime: this.$dayjs().format('YYYY-MM-DD')
},
current: 0,
selectItems: ['未开始', '进行中', '已完成'],
value: '',
// 线
lineOptions: [],
//
groupOptions: [],
//
dataList: [],
workOrderSelect: '',
sessionKey: '_WorkorderSearch'
};
},
created() {
this.init();
},
onShow: function () {
this.getSessionStorage();
this.current = this.query.status - 1;
//this.getList();
},
methods: {
init() {
//
this.getSelectOptions();
},
getWorkOrderClass(item) {
if (item.status === 1) {
return '';
}
if (item.status === 2) {
return 'bg-blue';
}
if (item.status === 3) {
return 'bg-green';
}
},
onClickSelect(e) {
this.query.status = e.currentIndex + 1;
this.getList();
},
async getSelectOptions() {
uni.showLoading();
const res1 = await getAllRoute();
if (res1.code === 200) {
this.lineOptions = res1.data.map((item) => {
return {
id: item.id,
text: `${item.name}`,
value: `${item.code}`
};
});
}
const res2 = await getAllGroup();
if (res2.code === 200) {
this.groupOptions = res2.data.map((item) => {
return {
id: item.id,
text: `${item.groupName}`,
value: `${item.groupCode}`
};
});
}
uni.hideLoading();
},
setSessionStorage(query) {
try {
const _query = JSON.stringify(query);
return uni.setStorageSync(this.sessionKey, _query);
} catch (e) {
return;
}
},
getSessionStorage() {
try {
const _query = JSON.parse(uni.getStorageSync(this.sessionKey));
if (_query != '' && _query != null) {
this.query = _query;
}
} catch (e) {
return;
}
},
//
getList() {
this.dataList = [];
const params = {
group_code: this.query.groupCode,
status: this.query.status,
handleDate: this.query.dateTime
};
getWorkOrderList(params).then((res) => {
let that = this;
if (res.code === 200) {
this.setSessionStorage(this.query);
this.dataList = res.data.map((item) => {
let statusStr = that.getWorkOrderStatus(item.status);
return {
id: item.id,
workOrderInfo: item,
status: item.status,
title: `${item.fkWorkorder} -- ${statusStr}`,
note: `${item.productionName} ${item.productionCode}`,
rightText: `${item.finishedNum ?? 0} 扫码报工`
};
});
}
});
},
getWorkOrderStatus(status = 0) {
try {
const list = ['', '未开始', '进行中', '已完成'];
return list[status * 1];
} catch (e) {
return '';
}
},
WorkOrderStatusColor(status) {
const list = ['', '未开始', '已开始', '已完成'];
const colorList = ['#fff', '#8f939c', '#2979ff', '#18bc37'];
return colorList[status * 1];
},
//
onListItemClick(item) {
const params = item.workOrderInfo;
uni.navigateTo({
url: '/pages/produceManagement/checkLabel2/checkLabel2?' + tansParams(params)
});
},
//
scanToReport() {
const params = this.query;
uni.navigateTo({
url: '/pages/produceManagement/scanWorkOrder/scanWorkOrder?' + tansParams(params)
});
}
}
};
</script>
<style scoped>
.content {
width: 100%;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
.query-card {
background-color: #fff;
padding: 10px;
}
.row {
background-color: #fff;
width: 100%;
display: flex;
flex-direction: row;
align-items: center;
justify-content: center;
}
.card-box {
width: 100%;
}
.scroll-view {
height: 800rpx;
padding-bottom: 40rpx;
}
.bg-blue {
background-color: rgb(197.7, 225.9, 255) !important;
}
.bg-green {
background-color: rgb(209.4, 236.7, 195.9) !important;
}
</style>