H5/Js/IPQC_XJ/Add.js
@@ -24,6 +24,7 @@
                mocode: "",
                boardStyle: ""
            },
            jyGw:"",//检验工位
            isShowTable: false,
            tableData: [],//返回的检验项目
            jymxData: [],//展示的检验项目
@@ -40,6 +41,10 @@
            okValue: '',//OK-数量
            ngValue: '',//NG-数量
            showDialog: false,//不良表述输入框
            selectKey: "",//查询关键字
            actions: [],//列表的值
            daashow: false,//工单列表展示
            lineId:[],
            //图片上传框
            fileList: [
@@ -47,7 +52,24 @@
        }
    },
    mounted() {
        var that = this;
        let that = this;
        //读取扫码beg 2025-7-25
        window.msgFromUniapp = function (arg) {
            //alert(arg.txtName);
            //alert("扫码的结果:" + arg.msg);
            //alert("工位码:" + that.jyGw);
            if (arg.txtName === "GW") {
                that.jyGw = arg.msg;
                that.selIpqcItemsByGw();
            }
            else if (arg.txtName === "DAA") {
                that.formData.lotNo = arg.msg;
                that.createByWomdaa();
            }
        }
        //读取扫码end
        this.userInfo = {
            loginGuid: this.GetLoginInfor().loginGuid,
            loginAccount: this.GetLoginInfor().loginAccount,
@@ -55,7 +77,16 @@
        this.formData.id = this.Request("id"),
        this.formData.releaseNo = this.Request("releaseNo");
        this.formData.lotNo = this.Request("lotNo");
        ////读取扫码beg 2025-7-25
        //let that = this;
        //window.msgFromUniapp = function (arg) {
        //    alert("扫码的结果:" + arg.msg);
        //}
        ////读取扫码end
        this.init();
    },
    methods: {
        // 输入过滤
@@ -111,6 +142,70 @@
                console.log(error);
            });
        },
        getInfo() {
            this.daashow = true;
            var that = this;
            that.actions = [];
            that.isLoading = true;
            console.log(that.lineId);
            that.AxiosHttp("post", 'Ipqc/GetIpqcXjDaa', {
                selectKey: that.selectKey,
                xt: that.lineId,
            }, 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  // 拼接字段
                                };
                            });
                        }
                    }
                    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.daashow = false;
            console.log(item);
            // 正则匹配第一个方括号内容
            const regex = /\[([^\]]+)\]/;
            const matchResult = item.name.match(regex);
            if (matchResult && matchResult[1]) {
                this.formData.lotNo = matchResult[1]; // PPBOM00000088-1
                console.log('提取的DAA001:', this.formData.lotNo);
            } else {
                this.$toast.fail('工单号格式异常');
                this.formData.lotNo = '';
            }
            this.createByWomdaa();
            //this.$toast(item.name);
        },
        getInputJYZ() {
            // 切换指定索引的 popup 状态
            var that = this;
@@ -125,6 +220,7 @@
        },
        addJyzIpqc(input) {
            var that = this;
            var guid1 = that.formData.guid;//主表id
            var mxguid = that.tableData[that.tabActive].guid;//检验项目的guid
@@ -135,8 +231,12 @@
                inP1: input,//或者0k-19,或者ng-19,或实际检验值
            }, true, 1).then(function (res1) {
                if (res1.rtnCode > 0) {
                    that.$notify({
                        type: 'success', message: res1.rtnMsg
                    //that.$notify({
                    //    type: 'success', message: res1.rtnMsg
                    //});
                    that.$toast.success({
                        duration: 1000, // 持续展示 toast
                        message: '操作成功',
                    });
                    that.refreshJYItem();//刷新检验项目
                    //that.handleTabClick();//刷新检验明细面板
@@ -158,10 +258,38 @@
            console.log(this.tabActive)
            this.togglePopup(this.tabActive);
        },
        //生成检验单
        createByWomdaa() {
            const that = this;
            var guid1 = that.formData.guid;//主表id
            return that.AxiosHttp("post", 'Ipqc/createByWomdaa', {
                inOrderGuid1: guid1,
                userAccount: that.userInfo.loginAccount,
                DAA001: that.formData.lotNo
            }, false).then(res => {
                var json = res;
                if (json.status == 0) {
                }
                else {
                    that.$toast.fail(json.message);
                    that.$playSound('error');
                    that.formData.lotNo = "";
                }
                that.isLoading = false;
                that.init();
            }).catch(error => {
                that.$toast.fail("网络错误,请重试!");
                console.error('Refresh error:', error);
            });
        },
        //检验明细刷新
        refreshJYItem() {
            const that = this;
            return that.AxiosHttp("post", 'LLJ/getJYItem', {
            return that.AxiosHttp("post", 'Ipqc/getJYItem', {
                releaseNo: that.formData.releaseNo
            }, false).then(res1 => {
                const tableData = res1.data.tbBillList || [];
@@ -187,8 +315,9 @@
                    let data = res.data.tbBillList[0];
                    if (data) {
                        that.formData = data;
                        that.remarks = that.formData.remarks;
                        that.AxiosHttp("post", 'LLJ/getJYItem', {
                        that.remarks = that.formData.fnGDesc;
                        that.lineId = data.lineId;
                        that.AxiosHttp("post", 'Ipqc/getJYItem', {
                            //id: that.formData.guid,
                            releaseNo: that.formData.releaseNo
                        }, false).then(function (res1) {
@@ -222,7 +351,7 @@
        submit() {
            var that = this;
            that.ttrre = true;
            that.AxiosHttp("post", 'MesQaItemsDetect01Manager/EditModelSubmit', {
            that.AxiosHttp("post", 'FqcManager/EditModelSubmit', {
                guid: that.formData.guid
            }, true, 1).then(function (res1) {
                if (res1.rtnData.outSum == 1) {
@@ -422,16 +551,76 @@
                }, true, 0).then(res1 => {
                    if (res1.status === 0) {
                        that.$notify({ type: 'success', message: '删除成功' });
                        that.init();//刷新检验项目
                    } else {
                        that.$toast.fail(res1.rtnMsg);
                    }
                    that.init();//刷新检验项目
                }).catch(error => {
                    that.$toast.fail("网络错误,请重试!");
                });
            }).catch(() => {
                // 取消操作
                that.init();//刷新检验项目
            })
        },
        //检验项目扫描工位可做检验
        selIpqcItemsByGw() {
            //alert("开始工位");
            const that = this;
            var guid1 = that.formData.guid;//主表id
            return that.AxiosHttp("post", 'Ipqc/selIpqcItemsByGw', {
                inOrderGuid1: guid1,
                userAccount: that.userInfo.loginAccount,
                gw: that.jyGw
            }, false).then(res => {
                var json = res;
                if (json.status == 0) {
                    that.init();//刷新
                }
                else {
                    that.$toast.fail(json.message);
                    that.$playSound('error');
                    that.jyGw = "";
                }
                that.isLoading = false;
            }).catch(error => {
                that.$toast.fail("网络错误,请重试!");
                console.error('Refresh error:', error);
            });
        },
        //扫描工位
        scanOnH5GW() {
            let sendData = {
                Type: 'Scan',
                txtName: 'GW',
                Barcode: '',
                Detail: '',
                Ip: '',
                Port: '',
            }
            uni.webView.postMessage({
                data: JSON.stringify(sendData)
            })
        },
        //扫描工单
        scanOnH5DAA() {
            let sendData = {
                Type: 'Scan',
                txtName: 'DAA',
                Barcode: '',
                Detail: '',
                Ip: '',
                Port: '',
            }
            uni.webView.postMessage({
                data: JSON.stringify(sendData)
            })
        },
    }