var vm = new Vue({
|
el: '#app',
|
data: function () {
|
return {
|
isLoading: false,
|
userInfo: {
|
"loginGuid": '',
|
"loginAccount": '',
|
},
|
modeInfo: { daa001: "", planNo: "" },
|
scanInfo: { barcodeNum: "", splitNum: "", barcode: "" },
|
ItemDetail: [],
|
ip: "",
|
port: "",
|
oldBarInfo: [],
|
cfBarInfo: [],
|
selectKey: "",//查询关键字
|
actions: [],//列表的值
|
show: false,//列表展示
|
// 当前选中行的索引
|
currentIndex: -1,
|
// 存储选中行数据对象
|
selItem: {},
|
ItemBarKw: [],//当天行相关条码库位信息
|
DaaInfo: {},
|
}
|
},
|
mounted() {
|
var that = this;
|
this.userInfo = {
|
loginGuid: this.GetLoginInfor().loginGuid,
|
loginAccount: this.GetLoginInfor().loginAccount,
|
};
|
},
|
methods: {
|
/**
|
* 处理行点击事件(单选逻辑)
|
* @param {Object} item 当前行数据
|
* @param {Number} index 当前行索引
|
*/
|
handleRowClick(item, index) {
|
if (this.isLoading) {
|
return;
|
}
|
|
// 重置所有行的选中状态
|
this.currentIndex = -1;
|
|
// 设置当前选中行
|
this.currentIndex = index;
|
this.selItem = {
|
itemid: item.itemId,//驼峰命名法
|
index: index
|
};
|
|
console.log('当前选中项:', this.selItem); // 调试用
|
|
this.GetBarKwByItem();
|
},
|
//获取库位信息
|
GetBarKwByItem() {
|
//Womdaa
|
//WwGd
|
var that = this;
|
that.isLoading = true;
|
that.AxiosHttp("post", 'Womdaa/GetBarKwByItem', {
|
itemId: that.selItem.itemid,
|
userName: that.userInfo.loginAccount
|
}, false)
|
.then(function (res) {
|
var json = res;
|
if (json.status == 0) {
|
that.ItemBarKw = json.data.tbBillList;
|
}
|
else {
|
that.$toast.fail(json.message);
|
that.$playSound('error');
|
that.ItemBarKw = [];
|
}
|
that.isLoading = false;
|
})
|
.catch(function (error) {
|
that.isLoading = false;
|
that.$toast.fail("网络错误,请重试!");
|
that.$playSound('error');
|
console.log(error);
|
that.ItemBarKw = [];
|
});
|
},
|
|
getModel() {
|
var that = this;
|
that.isLoading = true;
|
that.AxiosHttp("post", 'WwGd/GetItemsByDaa001', {
|
daa001: that.modeInfo.daa001,
|
userName: that.userInfo.loginAccount
|
}, false)
|
.then(function (res) {
|
var json = res;
|
if (json.status == 0) {
|
that.ItemDetail = json.data.tbBillList;
|
that.DaaInfo = json.data.tbBillList.daaInfo;
|
that.modeInfo.planNo = json.data.tbBillList.planNo;
|
that.modeInfo.startTime = json.data.tbBillList.startTime;
|
that.$refs.barcode.focus();
|
}
|
else {
|
that.$toast.fail(json.message);
|
that.$playSound('error');
|
that.$refs.daa001.focus();
|
that.modeInfo.daa001 = "";
|
that.modeInfo.planNo = "";
|
that.modeInfo.startTime = "";
|
that.ItemDetail = [];
|
}
|
that.isLoading = false;
|
})
|
.catch(function (error) {
|
that.isLoading = false;
|
that.$toast.fail("网络错误,请重试!");
|
console.log(error);
|
that.$refs.daa001.focus();
|
that.modeInfo.daa001 = "";
|
});
|
},
|
//扫码
|
getScan() {
|
var that = this;
|
if (that.modeInfo.daa001.length <= 0) {
|
that.$toast.fail("委外工单不能为空!");
|
return;
|
}
|
that.isLoading = true;
|
that.AxiosHttp("post", 'WwGd/ScanCode', {
|
daa001: that.modeInfo.daa001,
|
userName: that.userInfo.loginAccount,
|
barcode: that.scanInfo.barcode,
|
}, false)
|
.then(function (res) {
|
var json = res;
|
if (json.status == 0) {
|
// that.scanInfo = json.data.tbBillList;
|
that.$notify({ type: 'success', message: json.message });
|
that.getModel();
|
that.$refs.barcode.focus();
|
that.scanInfo.barcode = null;
|
}
|
else if (json.status == 2) {
|
that.$refs.splitNum.focus();
|
that.scanInfo.splitNum = json.data.tbBillList.splitNum;
|
that.scanInfo.barcodeNum = json.data.tbBillList.barcodeNum;
|
}
|
else {
|
that.$toast.fail(json.message);
|
that.$refs.barcode.focus();
|
}
|
//that.$notify({ type: 'success', message: json.message });
|
that.isLoading = false;
|
})
|
.catch(function (error) {
|
that.isLoading = false;
|
that.$toast.fail("网络错误,请重试!");
|
console.log(error);
|
that.$refs.barcode.focus();
|
});
|
},
|
//拆分
|
getChaiFen() {
|
var that = this;
|
if (that.modeInfo.daa001.length <= 0) {
|
that.$toast.fail("委外工单号不能为空!");
|
return;
|
}
|
if (that.scanInfo.splitNum * 1 <= 0) {
|
that.$toast.fail("拆分数量不能为空!");
|
return;
|
}
|
if (that.scanInfo.barcode.length * 1 <= 0) {
|
that.$toast.fail("物料条码不能为空!");
|
return;
|
}
|
that.isLoading = true;
|
that.AxiosHttp("post", 'WwGd/ScanCodeCF', {
|
daa001: that.modeInfo.daa001,
|
userName: that.userInfo.loginAccount,
|
barcode: that.scanInfo.barcode,
|
Num: that.scanInfo.splitNum,
|
}, false)
|
.then(function (res) {
|
var json = res;
|
if (json.status == 0) {
|
// that.modeInfo = json.data.tbBillList;
|
that.$notify({ type: 'success', message: json.message });
|
that.getModel();
|
that.$refs.barcode.focus();
|
that.scanInfo.barcode = null;
|
that.scanInfo.barcodeNum = "";
|
that.scanInfo.splitNum = "";
|
}
|
else {
|
that.$toast.fail(json.message);
|
that.$refs.splitNum.focus();
|
}
|
that.isLoading = false;
|
})
|
.catch(function (error) {
|
that.isLoading = false;
|
that.$toast.fail("网络错误,请重试!");
|
console.log(error);
|
that.$refs.splitNum.focus();
|
});
|
},
|
//获取工单信息
|
getInfo() {
|
this.show = true;
|
var that = this;
|
that.actions = [];
|
that.isLoading = true;
|
that.AxiosHttp("post", 'WwGd/GetXcslDaa', {
|
selectKey: that.selectKey,
|
}, false)
|
.then(function (res) {
|
var json = res;
|
if (json.status == 0) {
|
|
if (json.data.tbBillList.length <= 0) {
|
that.$toast.fail("没有可用的数据");
|
that.$playSound('error');
|
} else {
|
that.itemInfo = json.data.tbBillList;
|
that.actions = json.data.tbBillList.map(item => {
|
return {
|
name: item.daaInfo, // 拼接字段
|
subname: item.startTime
|
};
|
});
|
}
|
}
|
else {
|
that.$toast.fail(json.message);
|
that.$playSound('error');
|
}
|
that.isLoading = false;
|
})
|
.catch(function (error) {
|
that.isLoading = false;
|
that.$toast.fail("网络错误,请重试!");
|
that.$playSound('error');
|
console.log(error);
|
});
|
},
|
onSelect(item) {
|
// 默认情况下点击选项时不会自动收起
|
// 可以通过 close-on-click-action 属性开启自动收起
|
this.show = false;
|
console.log(item);
|
// 正则匹配第一个方括号内容
|
const regex = /\[([^\]]+)\]/;
|
const matchResult = item.name.match(regex);
|
|
if (matchResult && matchResult[1]) {
|
this.modeInfo.daa001 = matchResult[1]; // PPBOM00000088-1
|
console.log('提取的DAA001:', this.modeInfo.daa001);
|
} else {
|
this.$toast.fail('工单号格式异常');
|
this.modeInfo.daa001 = '';
|
}
|
this.getModel();
|
//this.$toast(item.name);
|
},
|
}
|
})
|