fix(彩包托盘码生成):后端联调

This commit is contained in:
chengzhaofeng 2024-11-10 21:44:36 +08:00
parent f032798ce2
commit 072db4495d

View File

@ -1,10 +1,5 @@
<template>
<div class="mobile-home">
<!-- 错误弹出框 -->
<el-dialog :visible.sync="errorShow" width="30%" :close-on-click-modal="false" custom-class="error-content">
<p>{{ errorMsg }}</p>
<el-button @click="closeErrorDailog">关闭</el-button>
</el-dialog>
<!-- U8料号弹出框 -->
<input-select-dialog :modal-obj.sync="u8DialogObj"
:modal-show.sync="u8DialogVisible"
@ -24,17 +19,17 @@
<div class="flex-auto">
<el-form :model="formObj" ref="formObj" label-width="90px" class="form-css-set">
<el-form-item label="包装类型">
<el-form-item label="包装类型" :required="true">
<el-select v-model="formObj.typeValue" placeholder="选择包装类型">
<el-option
v-for="item in dictList.typeList"
:key="item.value"
:label="item.text"
:value="item.value"
v-for="item in dictList.typeList"
:key="item.value"
:label="item.text"
:value="item.value"
></el-option>
</el-select>
</el-form-item>
<el-form-item label="U8料号">
<el-form-item label="U8料号" :required="true">
<el-input ref="ueightCode" v-model="formObj.ueightCode" @change="doU8CodeScan">
<template>
<i slot="suffix" class="el-input__icon el-icon-search" @click.stop="showU8Dialog()"></i>
@ -60,49 +55,49 @@
<el-form-item label="卷数" :required="true">
<el-input v-model="formObj.volumeQty" @input="calculateTotalLength"/>
</el-form-item>
<el-form-item label="总米数" :required="true">
<el-form-item label="总米数">
<el-input v-model="formObj.length"/>
</el-form-item>
<el-form-item label="等级">
<el-form-item label="等级" :required="true">
<el-select v-model="formObj.grade" placeholder="请选择等级">
<el-option
v-for="item in dictList.gradeList"
:key="item.value"
:label="item.text"
:value="item.value"
v-for="item in dictList.gradeList"
:key="item.value"
:label="item.text"
:value="item.value"
></el-option>
</el-select>
</el-form-item>
<el-form-item label="重量">
<el-input v-model="formObj.weight"></el-input>
</el-form-item>
<el-form-item label="阶段">
<el-form-item label="阶段" :required="true">
<el-select v-model="formObj.stage" placeholder="选择阶段">
<el-option
v-for="item in dictList.stageList"
:key="item.value"
:label="item.text"
:value="item.value"
v-for="item in dictList.stageList"
:key="item.value"
:label="item.text"
:value="item.value"
></el-option>
</el-select>
</el-form-item>
<el-form-item label="打印机">
<el-form-item label="打印机" :required="true">
<el-select v-model="printer" placeholder="请选择打印机">
<el-option
v-for="item in printerList"
:key="item.value"
:label="item.text"
:value="item.value"
v-for="item in printerList"
:key="item.value"
:label="item.text"
:value="item.value"
></el-option>
</el-select>
</el-form-item>
<el-form-item label="备注">
<el-input
ref="customerRemarks"
type="textarea"
v-model="formObj.customerRemarks"
placeholder="请输入客户备注"
:rows="4"
ref="customerRemarks"
type="textarea"
v-model="formObj.customerRemarks"
placeholder="请输入客户备注"
:rows="4"
></el-input>
</el-form-item>
</el-form>
@ -129,9 +124,7 @@ export default {
data() {
return {
site: getStore({name: 'tenantId'}),
isLoading: null,
errorMsg: '',
errorShow: false,
initData: {
ueightCode: "",
ueightDesc: "",
@ -169,13 +162,7 @@ export default {
typeText: "",
typeValue: ""
},
show: {
stage: false,
grade: false,
printer: false,
type: false,
ueightCode: false
},
dictList: {
stageList: [
{
@ -218,8 +205,7 @@ export default {
ueightCode: false,
customerRemarks: true
},
u8CodeList: [],
customerList: [],
// U8料号弹出框对象
u8DialogObj: {
title: '请选择U8料号',
@ -263,7 +249,6 @@ export default {
this.formObj.ueightDesc = row.ueightDesc;
this.formObj.sapItemDesc = row.sapItemDesc;
},
doU8CodeScan() {
let me = this;
showLoading()
@ -294,37 +279,18 @@ export default {
this.$refs.u8Code.focus();
});
},
customerCodeDialogSelected(row) {
this.formObj.customerCode = row.customerCode;
},
showU8Dialog() {
this.u8DialogObj.queryParam = {"site": this.site};
this.u8DialogVisible = true;
},
customerCodeDialogSelected(row) {
this.formObj.customerCode = row.customerCode;
},
showCustomerCodeDialog() {
this.customerCodeDialogObj.queryParam = {"site": this.site};
this.customerCodeDialogVisible = true;
},
showErrorDailog(msg) {
this.errorShow = true;
this.errorMsg = msg;
},
closeErrorDailog(e) {
this.errorShow = false;
this.focusUeightCodeInput();
},
focusUeightCodeInput() {
this.isLoading = null;
this.inputFocus("ueightCode");
},
checkPackageType() {
if (isBlank(this.formObj.type)) {
this.$message.error('请选择包装类型!');
return false;
}
return true;
},
calculateTotalLength() {
if (this.formObj.singleVolumeLength && this.formObj.volumeQty) {
this.formObj.length = (this.formObj.singleVolumeLength * this.formObj.volumeQty).toFixed(6);
@ -332,32 +298,26 @@ export default {
this.formObj.length = "";
}
},
selectType(index) {
this.formObj.type = this.dictList.typeList[index].value;
this.formObj.typeText = this.dictList.typeList[index].text;
if (this.dictList.typeList[index].value === "B") {
this.formObj.typeValue = '23';
}
if (this.dictList.typeList[index].value === "C") {
this.formObj.typeValue = '91';
}
},
loadData(urlParam) {
loadData() {
let me = this;
me.formObj = Object.assign({}, me.initData);
showLoading()
fetchPrinterList(me.site).then(res => {
hideLoading()
// 获取打印机
showLoading();
fetchPrinterList(this.site)
.then((res) => {
hideLoading();
if (res.data.code !== 0) {
this.$message.error(res.data.msg);
return;
}
let data = res.data.data;
data.forEach(item => {
me.printerList.push({text: item.printerName, value: item.printerName});
});
}).catch(e => {
hideLoading()
this.printerList = res.data.data.map((item) => ({
label: item.printerName,
value: item.printerName
}));
})
.catch((e) => {
hideLoading();
});
},
bind() {
@ -412,40 +372,28 @@ export default {
ext1: me.printer,
ext2: me.formObj.customerRemarks
};
if (me.errorShow || me.isLoading) {
me.$set(me, "ueightCode", "");
return;
}
showLoading()
function fn() {
try {
generateColorPackageNumber(param).then(res => {
hideLoading()
if (res.data.code !== 0) {
this.$message.error(res.data.msg);
hideLoading()
this.inputFocus("ueightCode");
return;
}
me.formObj.singleVolumeLength = '';
me.formObj.volumeQty = '';
me.formObj.length = '';
me.formObj.weight = '';
this.inputFocus("ueightCode");
me.showErrorDailog("托盘码[" + res.data.data.packageNumber + "]生成成功");
return;
}).catch(e => {
me.$set(me, "ueightCode", "");
hideLoading()
this.inputFocus("ueightCode");
});
} catch (err) {
console.log(err);
generateColorPackageNumber(param).then(res => {
hideLoading()
if (res.data.code !== 0) {
this.$message.error(res.data.msg);
hideLoading()
this.focusUeightCodeInput();
this.inputFocus("ueightCode");
return;
}
}
me.formObj.singleVolumeLength = '';
me.formObj.volumeQty = '';
me.formObj.length = '';
me.formObj.weight = '';
this.inputFocus("ueightCode");
this.$message.success("托盘码[" + res.data.data.packageNumber + "]生成成功");
}).catch(e => {
me.$set(me, "ueightCode", "");
hideLoading()
this.inputFocus("ueightCode");
});
},
inputFocus(fieldName) {
this.$nextTick(() => {
this.$refs[fieldName].focus();
@ -455,42 +403,7 @@ export default {
let me = this;
me.formObj = Object.assign({}, me.initData);
this.inputFocus("ueightCode");
},
openU8CodeDialog() {
this.show.ueightCode = true;
this.fetchU8CodeList().then(res => {
if (res.code === 0) {
this.u8CodeList = res.data;
} else {
this.$message.error(res.msg);
}
}).catch(e => {
});
},
selectU8Code(row) {
this.formObj.ueightCode = row.ueightCode;
this.formObj.ueightDesc = row.ueightDesc;
this.formObj.sapItem = row.sapItem;
this.formObj.sapItemDesc = row.sapItemDesc;
this.show.ueightCode = false;
},
inputCallBack(row, id, callBackTarget, callBackFun) {
if (!callBackTarget) {
callBackTarget = this;
}
if (callBackFun instanceof Array) {
for (let key of callBackFun) {
this.$set(callBackTarget, key, row[key]);
}
} else if (callBackFun instanceof Object) {
for (let key of Object.keys(callBackFun)) {
this.$set(callBackTarget, callBackFun[key], row[key]);
}
} else {
this.$set(callBackTarget, Object.keys(row)[0], row[Object.keys(row)[0]]);
}
this.nextFun(id, callBackTarget, row);
},
}
}
};
</script>