南骏 池
2025-06-02 1aa48962bf1ae1ea53d7bca7eccdf3bc074fdda4
H5/Js/IPQC_SJ/Add.js
@@ -98,6 +98,17 @@
                //    message: '上传失败',
                //},
            ],
            //时间选择参数
            showScDatePicker: false,
            minDate: new Date(new Date().getFullYear() - 1, 0, 1),  // 过去一年
            maxDate: new Date(new Date().getFullYear() + 1, 11, 31), // 未来一年
            currentDate: new Date(),
            scDate: '',  // 存储格式化后的日期
            //认证信息选择
            showRzxx: false,
            actions: [],
        }
    },
    mounted() {
@@ -342,9 +353,10 @@
            this.showDialog= true
        },
        updateRzxx() {
            this.showDialogRzxx = true
        },
        // updateRzxx() {
        //     this.showDialogRzxx = true
        // },
        //删除检验明细记录
        deleteDetail13(guid12) {
            const that = this;
            var guid1 = that.formData.guid;//主表id
@@ -380,6 +392,7 @@
                that.isLoading = false;
            });
        },
        //更新认证信息
        rzxxConfirm() {
            var that = this;
            var guid1 = that.formData.guid;//主表id
@@ -393,7 +406,7 @@
                var json = res;
                if (json.status == 0) {
                    that.$notify({ type: 'success', message: '输入成功' });
                    that.refreshJYItem();//刷新检验项目
                    //that.refreshJYItem();//刷新检验项目
                }
                else {
                    that.$toast.fail(json.message);
@@ -406,6 +419,7 @@
                that.isLoading = false;
            });
        },
        //更新不合格表述
        remarksConfirm() {
            const that = this;
            that.isLoading = true;
@@ -666,5 +680,125 @@
            }, 100);
            console.log(that.formTbData.temperatureData);
        },
        //保存生产日期
        confirmScDate(value) {
            const date = new Date(value);
            this.scDate = `${date.getFullYear()}-${(date.getMonth() + 1).toString().padStart(2, '0')}-${date.getDate().toString().padStart(2, '0')}`;
            //this.rzxxValue = this.scDate; // 同时更新认证信息字段
            console.log(this.scDate);
            var that = this;
            var guid1 = that.formData.guid;//主表id
            var mxguid = that.tableData[that.tabActive].guid;//检验项目的guid
            that.isLoading = true;
            that.AxiosHttp("post", 'Ipqc/updateScDate', {
                gid: guid1,
                mxguid: mxguid,
                scDateValue: that.scDate,//输入的认证信息
            }, true, 0).then(function (res) {
                var json = res;
                if (json.status == 0) {
                    that.$notify({ type: 'success', message: '输入成功' });
                    that.refreshJYItem();//刷新检验项目
                }
                else {
                    that.$toast.fail(json.message);
                }
                //that.$notify({ type: 'success', message: json.message });
                that.isLoading = false;
            }).catch(function (error) {
                that.$toast.fail("网络错误,请重试!");
                that.inRzxxValue = null;
                that.isLoading = false;
            });
            this.showScDatePicker = false;
        },
        selectRzxx() {
            this.showRzxx = true;
            this.getRzxxList();
        },
        //获取认证信息相关列表
        getRzxxList() {
            var that = this;
            that.isLoading = true;
            var mxguid = that.tableData[that.tabActive].guid;//检验项目的guid
            that.AxiosHttp("post", 'Ipqc/GetRzxxList', {
                // 根据实际接口需要传递参数
                mxguid: mxguid,
            }, false)
            .then(function (res) {
                if (res.status == 0) {
                    that.actions = res.data.tbBillList.map(item => {
                        return { name: item.defect_name } // 根据实际数据结构调整
                    });
                } else {
                    that.$toast.fail(res.message);
                }
                that.isLoading = false;
            })
            .catch(function (error) {
                that.isLoading = false;
                that.$toast.fail("获取认证信息失败");
            });
        },
        //选择认证信息
        onRzxxSelect(item) {
            this.showRzxx = false;
            this.rzxxValue = item.name;
            this.rzxxConfirm();
            //this.refreshJYItem();//刷新检验项目
            // 如果需要获取详细信息可在此处调用其他方法
        },
        //更新认证信息使用数量
        updateRzxxNum(value, index) {
            // 添加防抖判断
            if (this.isLoading) {
                return;
            }
            const that = this;
            that.isLoading = true;
            that.AxiosHttp("post", 'Ipqc/saveIpqcrzxxNum', {
                guid: that.tableData[that.tabActive].guid,
                ipqcrzxxNum: value
            }, true, 0).then(res => {
                if (res.status == 0) {
                    //that.$notify({ type: 'success', message: '数量更新成功' });
                    //that.refreshJYItem();//刷新检验项目
                } else {
                    that.$toast.fail(res.rtnMsg);
                }
                that.isLoading = false;
            }).catch(error => {
                that.isLoading = false;
                that.$toast.fail("网络错误,请重试!");
            });
        },
        //更新是否有无异味
        updateCpscs(value) {
            // 添加防抖判断
            if (this.isLoading) {
                return;
            }
            const that = this;
            that.isLoading = true;
            if (!value) return;
            that.AxiosHttp("post", 'Ipqc/saveIpqCpscs', {
                guid: that.tableData[that.tabActive].guid,
                ipqCpscs: value
            }, true, 0).then(res => {
                if (res.status == 0) {
                    //that.refreshJYItem();
                } else {
                    that.$toast.fail(res.rtnMsg);
                }
                that.isLoading = false;
            }).catch(error => {
                that.isLoading = false;
                that.$toast.fail("网络错误,请重试!");
            });
        },
    }
})