南骏 池
2025-05-30 790d5f4ed220eb76f28682b057799a57c62c9c94
H5/Js/IPQC_SJ/Add.js
@@ -2,6 +2,48 @@
    el: '#app',
    data: function () {
        return {
            tableTbData: [],      // "制热性能"生成的表格数据
            formTbData: {         // 表单数据
            temperatureData: {} // 存储的实际温度、实际流量数据
            },
            headers: [],
            showZr: false,
            waterOptions: [
                { value: '100℃', text: '100℃' },
                { value: '99℃', text: '99℃' },
                { value: '90℃', text: '90℃' },
                { value: '85℃', text: '85℃' },
                { value: '80℃', text: '80℃' },
                { value: '75℃', text: '75℃' },
                { value: '65℃', text: '65℃' },
                { value: '60℃', text: '60℃' },
                { value: '55℃', text: '55℃' },
                { value: '45℃', text: '45℃' },
                { value: '42℃', text: '42℃' },
                { value: '常温水', text: '常温水' },
                { value: '冰水', text: '冰水' },
                { value: '70℃', text: '70℃' },
                { value: '50℃', text: '50℃' },
                { value: '微冷', text: '微冷' }
            ],//水温选项
            flowOptions: [
                { value: '50ml', text: '50ml' },
                { value: '120ml', text: '120ml' },
                { value: '150ml', text: '150ml' },
                { value: '160ml', text: '160ml' },
                { value: '250ml', text: '250ml' },
                { value: '260ml', text: '260ml' },
                { value: '350ml', text: '350ml' },
                { value: '360ml', text: '360ml' },
                { value: '450ml', text: '450ml' },
                { value: '550ml', text: '550ml' },
                { value: '750ml', text: '750ml' },
                { value: '999ml', text: '999ml' },
                { value: '1min', text: '一分钟流量' },
                { value: '3min', text: '三分钟流量' }
            ],//流量选项
            selectedWater: [],// 已选水温值
            selectedFlow: [],   // 已选流量值
            isLoading: false,
            userInfo: {
                "loginGuid": '',
@@ -40,6 +82,8 @@
            okValue: '',//OK-数量
            ngValue: '',//NG-数量
            showDialog: false,//不良表述输入框
            showDialogRzxx: false,//认证信息输入框
            rzxxValue: '',//认证信息输入值
            //图片上传框
            fileList: [
                //{
@@ -83,17 +127,31 @@
                .replace(/(\..*)\./g, '$1')               // 2. 禁止多个小数点
                .replace(/^\./g, '');    
        },
        //针对没有上下限值的数据,只需选择合格或不合格.按钮触发
        handleQualified(isQualified) {
            if (isQualified) {
                console.log('合格操作');
                // 执行合格相关逻辑
            } else {
                console.log('不合格操作');
                // 执行不合格相关逻辑
            }
        openZrPopup() {
            this.showZr = true;
        },
        closeZrPopup() {
            this.showZr = false;
            this.selectedWater = [];  // 关闭时清空选择
            this.selectedFlow = [];   // 关闭时清空选择
        },
        //针对没有上下限值的数据,只需选择合格或不合格.按钮触发
        handleQualified(isQualified) {
            var input = "";
            if (isQualified) {
                // 执行合格相关逻辑
                 input = "OK-1";
                this.addJyzIpqc(input);
            } else {
                // 执行不合格相关逻辑
                 input = "NG-1";
                this.addJyzIpqc(input);
            }
        },
        togglePopup(index) {
            // 切换指定索引的 popup 状态
            var that = this;
@@ -109,14 +167,6 @@
            }, true, 1).then(function (res1) {
                if (res1.rtnCode == 1) {
                    that.tableMxData = res1.rtnData;
                    // 统计合格数和不合格数
                    const list = res1.rtnData?.list || []; // 确保 list 是数组,避免 undefined 错误
                    const okNum = list.filter(item => item.fstand === '√').length;
                    const ngNum = list.length - okNum;
                    // 将结果保存到指定变量(如 that 的成员属性)
                    that.okNum = okNum;
                    that.ngNum = ngNum;
                } else {
                    that.$toast.fail(res1.rtnMsg);
@@ -125,105 +175,34 @@
                that.$toast.fail("网络错误,请重试!");
                console.log(error);
            });
        },
        getInputOK() {
            var that = this;
            var jys = that.tableData[that.tabActive].checkQyt;//检验项目的检验数
            if (!that.okValue) {
                this.$toast.fail("OK数不能为空");
                that.isLoading = false;
                return;
            }
            if (jys < that.okValue) {
                that.$toast.fail("录入数量不能大于检验数!");
                that.okValue = null;
                //that.$refs.okValue.focus();
                return;
            }
            // 切换指定索引的 popup 状态
            var resultValue = "OK-" + this.okValue;
            this.getInput(resultValue);
            that.okValue = null;
        },
        getInputNG() {
            var that = this;
            var jys = that.tableData[that.tabActive].checkQyt;//检验项目的检验数
            if (!that.ngValue) {
                this.$toast.fail("NG数不能为空");
                that.isLoading = false;
                return;
            }
            if (jys < that.ngValue) {
                that.$toast.fail("录入数量不能大于检验数!");
                that.ngValue = null;
                //that.$refs.ngValue.focus();
                return;
            }
            // 切换指定索引的 popup 状态
            var resultValue = "NG-" + this.ngValue;
            this.getInput(resultValue);
            that.ngValue = null;
        },
        getInput(resultValue) {
            // 切换指定索引的 popup 状态
            var that = this;
            var guid1 = that.formData.guid;//主表id
            var mxguid = that.tableData[that.tabActive].guid;//检验项目的guid
            that.isLoading = true;
            console.log(that.formData);
            var input = resultValue;//拼接检验值
            that.AxiosHttp("post", 'MesQaItemsDetect01Manager/EdtModel12', {
                inOrderGuid1: guid1,
                inOrderGuid5: mxguid,
                inP1: input,//或者0k-19,或者ng-19
            }, true, 1).then(function (res1) {
                if (res1.rtnCode == 1) {
                    that.$notify({
                        type: 'success', message: res1.rtnMsg
                    });
                    that.refreshJYItem();//刷新检验项目
                    //that.tableData = null;
                    //that.$refs.inputValue.focus();
                } else {
                    that.$toast.fail(res1.rtnMsg);
                }
                that.isLoading = false;
            }).catch(function (error) {
                that.$toast.fail("网络错误,请重试!");
                that.isLoading = false;
            });
        },
        getInputTZZ() {
        getInputJYZ() {
            // 切换指定索引的 popup 状态
            var that = this;
            if (!that.inputValue) {
                this.$toast.fail("特征值不能为空");
                this.$toast.fail("检验值不能为空");
                that.isLoading = false;
                return;
            }
            that.addJyzIpqc(that.inputValue);
        },
        addJyzIpqc(input) {
            var that = this;
            var guid1 = that.formData.guid;//主表id
            var mxguid = that.tableData[that.tabActive].guid;//检验项目的guid
            var input = that.inputValue;
            that.isLoading = true;
            that.AxiosHttp("post", 'MesQaItemsDetect01Manager/EditYangLi', {
                dt05Guid: mxguid,
                fSeq : "pda",
                fVal : input,
            that.AxiosHttp("post", 'PqcManager/AddIpqcJyz', {
                inOrderGuid1: guid1,
                inOrderGuid5: mxguid,
                inP1: input,//或者0k-19,或者ng-19,或实际检验值
            }, true, 1).then(function (res1) {
                if (res1.rtnData.outSum == 1) {
                if (res1.rtnCode > 0) {
                    that.$notify({
                        type: 'success', message: res1.rtnMsg
                    });
                    that.okValue = null;
                    that.refreshJYItem();//刷新检验项目
                    //that.handleTabClick();//刷新检验明细面板
                    //that.$refs.inputValue.focus();
@@ -247,7 +226,7 @@
        //检验明细刷新
        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 || [];
@@ -264,7 +243,7 @@
            //alert(this.Request("id"));
            var that = this;
            that.showButton = false;
            that.AxiosHttp("post", 'LLJ/getPage', {
            that.AxiosHttp("post", 'Ipqc/getPageSj', {
                id: that.Request("id"),
                pageIndex: 1,
                limit: 1,
@@ -273,8 +252,8 @@
                    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.AxiosHttp("post", 'Ipqc/getJYItem', {
                            //id: that.formData.guid,
                            releaseNo: that.formData.releaseNo
                        }, false).then(function (res1) {
@@ -308,7 +287,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) {
@@ -361,21 +340,30 @@
        updateRemarks(guid) {
            this.showDialog= true
        },
        deleteDetail13(guid13) {
        updateRzxx() {
            this.showDialogRzxx = true
        },
        deleteDetail13(guid12) {
            const that = this;
            var guid1 = that.formData.guid;//主表id
            var mxguid = that.tableData[that.tabActive].guid;//检验项目的guid
            // 添加确认弹窗
            that.$dialog.confirm({
                message: '确认要删除该样本值记录吗?',
                message: '确认要删除该检验值记录吗?',
                confirmButtonText: '确认',
                cancelButtonText: '取消'
            }).then(() => {  // 确认回调
                that.isLoading = true;
                that.AxiosHttp("post", 'Llj/deleteDetail13', {
                    id13: guid13
                }, true, 0).then(res1 => {
                    if (res1.status == 0) {
                        that.$notify({ type: 'success', message: '删除成功' });
                that.AxiosHttp("post", 'PqcManager/DeleteIpqcJyz', {
                    inOrderGuid1: guid1,
                    inOrderGuid5: mxguid,
                    inOrderGuid12: guid12
                }, true, 1).then(res1 => {
                    if (res1.rtnCode > 0) {
                        that.$notify({
                            type: 'success', message: res1.rtnMsg
                        });
                        that.refreshJYItem();//刷新检验项目
                    } else {
                        that.$toast.fail(res1.rtnMsg);
@@ -388,6 +376,32 @@
            }).catch(() => {  // 取消回调
                that.$toast('已取消操作');
                that.isLoading = false;
            });
        },
        rzxxConfirm() {
            var that = this;
            var guid1 = that.formData.guid;//主表id
            var mxguid = that.tableData[that.tabActive].guid;//检验项目的guid
            that.isLoading = true;
            that.AxiosHttp("post", 'Ipqc/updateIpqcRzxx', {
                gid: guid1,
                pid: mxguid,
                inRzxxValue: that.rzxxValue,//输入的认证信息
            }, 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;
            });
        },
@@ -503,17 +517,68 @@
                }, 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();//刷新检验项目
            })
        },
        createTb() {
            // 清空旧数据
            this.tableTbData = [];
            this.formTbData.temperatureData = {};
            // 校验选择
            if (this.selectedWater.length === 0 || this.selectedFlow.length === 0) {
                this.$toast.fail('请先选择水温和流量');
                return;
            }
            // 生成表头
            // 修改headers生成逻辑 ↓
            const headers = [
                '设定温度',
                '实际温度',
                ...this.selectedFlow.sort().map(f => `流量${f}`)
            ];
            this.headers = headers;
            console.log(this.headers);
            // 生成行数据
            this.tableTbData = this.selectedWater.sort((a,b) => a - b).map(water => {
                const row = {
                    temperature: water === '常温水' ? water : water,
                    values: Object.fromEntries([
                        ['temp', ''],  // 固定温度字段
                        ...this.selectedFlow.map(flow => [flow, ''])
                    ])
                };
                // 初始化表单数据结构
                this.$set(this.formTbData.temperatureData, water, {});
                // 添加固定字段”实际温度“初始化
                this.$set(this.formTbData.temperatureData[water], 'temp', '');
                this.selectedFlow.forEach(flow => {
                    this.$set(this.formTbData.temperatureData[water], flow, '');
                });
                return row;
            });
            // 自动滚动到表格区域
            setTimeout(() => {
                const tableEl = document.getElementById('temperature-table');
                if (tableEl) tableEl.scrollIntoView({ behavior: 'smooth' });
            }, 100);
            console.log(this.formTbData);
        },
    }
})
})