H5/Js/Wwll.js
@@ -9,6 +9,20 @@
            },
            modeInfo: { daa001: "", planNo: "" },
            scanInfo: { barcodeNum: "", splitNum: "", barcode: "" },
            ItemDetail: [],
            ip: "",
            port: "",
            oldBarInfo: [],
            cfBarInfo: [],
            selectKey: "",//查询关键字
            actions: [],//列表的值
            show: false,//列表展示
            // 当前选中行的索引
            currentIndex: -1,
            // 存储选中行数据对象
            selItem: {},
            ItemBarKw: [],//当天行相关条码库位信息
            DaaInfo: {},
        }
    },
    mounted() {
@@ -19,6 +33,61 @@
        };
    },
    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;
@@ -29,13 +98,20 @@
                .then(function (res) {
                    var json = res;
                    if (json.status == 0) {
                        that.modeInfo = json.data.tbBillList;
                        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;
                })
@@ -47,6 +123,7 @@
                    that.modeInfo.daa001 = "";
                });
        },
        //扫码
        getScan() {
            var that = this;
            if (that.modeInfo.daa001.length <= 0) {
@@ -87,6 +164,7 @@
                    that.$refs.barcode.focus();
                });
        },
        //拆分
        getChaiFen() {
            var that = this;
            if (that.modeInfo.daa001.length <= 0) {
@@ -132,5 +210,63 @@
                    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);
        },
    }
})