var vm = new Vue({
|
el: '#app', // 指定Vue实例挂载到ID为'app'的DOM元素上
|
data: function () {
|
return {
|
isLoading: false, // 加载状态标志
|
userInfo: { // 用户信息对象
|
"loginGuid": '', // 用户登录GUID
|
"loginAccount": '', // 用户登录账号
|
},
|
formData: { // 表单数据对象
|
barcode: "", // 物料条码
|
itemNo: "", // 物料编码
|
sumQuantity: 0, // 条码数量
|
|
DepotId: "",// 仓库ID
|
DepotCode: "", // 仓库编码
|
depotName: "", // 仓库名称
|
depotSectionsCode: "" //库位
|
|
// 注意:这里只显示了部分字段,实际代码中可能还有更多字段
|
},
|
itemInsFormData: {}, // 物料实例表单数据
|
tableData: [], // 表格数据
|
itemTableData: [], // 物料表格数据
|
barMessage: "", // 条码消息
|
|
Message: "", // 通用消息
|
messageCenter: {}, // 消息中心
|
messageId: 0, // 消息ID
|
|
showClearIcon: false, // 是否显示清除图标
|
focus1: true, // 焦点控制1
|
focus2: false, // 焦点控制2
|
isActive: 0, // 活动状态
|
index: 0, // 索引
|
currentTab: 0, // 当前标签页
|
contentScrollW: 0, // 导航区宽度
|
scrollLeft: 0, // 横向滚动条位置
|
fullHeight: "", // 全屏高度
|
kwInfo: {},
|
}
|
},
|
mounted() { // Vue实例挂载完成后执行
|
var that = this;
|
// 初始化用户信息
|
this.userInfo = {
|
loginGuid: this.GetLoginInfor().loginGuid, // 从GetLoginInfor方法获取登录GUID
|
loginAccount: this.GetLoginInfor().loginAccount, // 从GetLoginInfor方法获取登录账号
|
};
|
},
|
methods: { // 方法定义
|
// 已注释的getModel方法
|
//getModel() {
|
// var that = this;
|
// that.isLoading = true;
|
// that.AxiosHttp("post", 'MesDepotSections/GetSectionName', {
|
// sectionCode: that.formData.sectionCode
|
// }, false)
|
// .then(function (res) {
|
// var json = res;
|
// if (json.status == 0) {
|
// that.formData.sectionName = json.data.tbBillList;
|
// }
|
// else {
|
// that.$toast.fail(json.message);
|
// that.formData.sectionName = "";
|
// }
|
// that.isLoading = false;
|
// })
|
// .catch(function (error) {
|
// that.isLoading = false;
|
// that.$toast.fail("网络错误,请重试!");
|
// console.log(error);
|
// that.$refs.daa001.focus();
|
// });
|
//},
|
|
// 获取条码扫描信息的方法
|
getScan() {
|
var that = this;
|
|
that.isLoading = true; // 设置加载状态为true
|
// 发送POST请求获取条码信息
|
that.AxiosHttp("post", 'Kwbg/GetBarInfo', {
|
barcode: that.formData.barcode, // 传递条码参数
|
}, false)
|
.then(function (res) { // 请求成功处理
|
var json = res;
|
if (json.status == 0) { // 如果返回状态为0表示成功
|
// 更新表单数据
|
console.log(json.data.tbBillList);
|
console.log(json.data.tbBillList[0]);
|
that.kwInfo = json.data.tbBillList[0];
|
// 已注释的代码:设置其他数据
|
//that.itemInsFormData = json.data.tbBillList.itemIns;
|
//that.itemTableData = json.data.tbBillList.itemInDetails;
|
//that.tableData = json.data.tbBillList.invItemInCDetails;
|
//that.barMessage = json.data.tbBillList.message;
|
//that.$refs.barcode.focus();
|
//that.formData.barcode = null;
|
|
that.$refs.kwbg.focus(); // 将焦点移动到拆分数量输入框
|
}
|
else { // 如果返回状态不为0表示失败
|
that.$toast.fail(json.message); // 显示错误提示
|
that.$refs.barcode.focus(); // 将焦点移回条码输入框
|
that.formData.barcode = null; // 清空条码输入
|
}
|
//that.$notify({ type: 'success', message: json.message }); // 已注释的成功通知
|
that.isLoading = false; // 设置加载状态为false
|
})
|
.catch(function (error) { // 请求失败处理
|
that.isLoading = false; // 设置加载状态为false
|
that.$toast.fail("网络错误,请重试!"); // 显示网络错误提示
|
console.log(error); // 输出错误到控制台
|
that.$refs.barcode.focus(); // 将焦点移回条码输入框
|
});
|
},
|
|
|
|
// 执行库位变更的方法
|
getBianGeng() {
|
if (this.isLoading) { // 如果正在加载中,直接返回
|
return;
|
}
|
|
var that = this;
|
|
// 验证库位变更条件
|
if (!that.formData.kwbg || that.formData.kwbg.trim() === "") {
|
that.$toast.fail("变更库位不能为空!");
|
return;
|
}
|
if (that.formData.kwbg === that.formData.depotSectionsCode) {
|
that.$toast.fail("当前库位不能等于变更库位!");
|
return;
|
}
|
if (!that.formData.barcode || that.formData.barcode.trim() === "") {
|
that.$toast.fail("条码不能为空!");
|
return;
|
}
|
|
that.isLoading = true; // 设置加载状态为true
|
// 发送POST请求执行库位变更操作
|
that.AxiosHttp("post", 'Kwbg/ChangeDepotSection', {
|
userName: that.userInfo.loginAccount, // 用户名
|
barcode: that.formData.barcode, // 条码
|
OldDepotSectionCode: that.kwInfo.depoT_SECTIONS_CODE, // 原库位编码
|
NewDepotSectionCode: that.formData.kwbg // 新库位编码
|
}, false)
|
.then(function (res) { // 请求成功处理
|
var json = res;
|
if (json.status == 0) { // 如果返回状态为0表示成功
|
// 已注释的代码:设置模式信息
|
// that.modeInfo = json.data.tbBillList;
|
|
// 调用打印方法
|
//that.sendPrintMessage(json.data.tbBillList);
|
|
that.$refs.barcode.focus(); // 将焦点移回条码输入框
|
that.formData.barcode = null; // 清空条码输入
|
that.formData.kwbg = null; // 清空‘库位变更’
|
that.$notify({ type: 'success', message: json.message }); // 显示成功通知
|
}
|
else { // 如果返回状态不为0表示失败
|
that.$toast.fail(json.message); // 显示错误提示
|
that.$refs.kwbg.focus(); // 将焦点移回‘库位变更’输入框
|
}
|
that.isLoading = false; // 设置加载状态为false
|
})
|
.catch(function (error) { // 请求失败处理
|
that.isLoading = false; // 设置加载状态为false
|
that.$toast.fail("网络错误,请重试!"); // 显示网络错误提示
|
console.log(error); // 输出错误到控制台
|
});
|
},
|
|
// 已注释的清除代码方法
|
//cleraCode() {
|
// this.formData.sectionCode = null;
|
//},
|
|
// 处理数字输入的方法,限制只能输入数字和小数点
|
//handleNumberInput3(value) {
|
// this.formData.kwbg = value.replace(/[^\d.]/g, '') // 1. 去除非数字和小数点
|
// .replace(/(\..*)\./g, '$1') // 2. 禁止多个小数点
|
// .replace(/^\./g, ''); // 3. 禁止小数点开头
|
//},
|
}
|
})
|