南骏 池
2025-05-29 c35b25fc7b3f039bb525b73b4f72e9e2abf8b5d9
H5/Js/IPQC_SJ/Add.js
@@ -2,6 +2,36 @@
    el: '#app',
    data: function () {
        return {
            tableData: [],      // 生成的表格数据
            formData: {         // 表单数据
            temperatureData: {} // 存储温度数据
            },
            headers: [],
            showZr: false,
            waterOptions: [
                { value: '常温水', text: '常温水' },
                { value: '0℃', text: '0℃' },
                { value: '5℃', text: '5℃' },
                { value: '15℃', text: '15℃' },
                { value: '35℃', text: '35℃' },
                { value: '55℃', text: '55℃' },
                { value: '75℃', text: '75℃' },
                { value: '100℃', text: '100℃' }
            ],
            flowOptions: [
                { value: '100ml', text: '100ml' },
                { value: '200ml', text: '200ml' },
                { value: '300ml', text: '300ml' },
                { value: '400ml', text: '400ml' },
                { value: '500ml', text: '500ml' },
                { value: '600ml', text: '600ml' },
                { value: '700ml', text: '700ml' },
                { value: '800ml', text: '800ml' },
                { value: '900ml', text: '900ml' },
                { value: '1000ml', text: '1000ml' }
            ],
            selectedWater: [],// 已选水温值
            selectedFlow: [],   // 已选流量值
            isLoading: false,
            userInfo: {
                "loginGuid": '',
@@ -40,6 +70,8 @@
            okValue: '',//OK-数量
            ngValue: '',//NG-数量
            showDialog: false,//不良表述输入框
            showDialogRzxx: false,//认证信息输入框
            rzxxValue: '',//认证信息输入值
            //图片上传框
            fileList: [
                //{
@@ -83,6 +115,18 @@
                .replace(/(\..*)\./g, '$1')               // 2. 禁止多个小数点
                .replace(/^\./g, '');    
        },
        openZrPopup() {
            this.showZr = true;
        },
        closeZrPopup() {
            this.showZr = false;
            this.selectedWater = [];  // 关闭时清空选择
            this.selectedFlow = [];   // 关闭时清空选择
        },
        //针对没有上下限值的数据,只需选择合格或不合格.按钮触发
        handleQualified(isQualified) {
            var input = "";
@@ -170,7 +214,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 || [];
@@ -196,8 +240,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) {
@@ -231,7 +275,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) {
@@ -284,6 +328,10 @@
        updateRemarks(guid) {
            this.showDialog= true
        },
        updateRzxx() {
            this.showDialogRzxx = true
        },
        deleteDetail13(guid12) {
            const that = this;
            var guid1 = that.formData.guid;//主表id
@@ -316,6 +364,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;
            });
        },
@@ -431,17 +505,60 @@
                }, 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.tableData = [];
            this.formData.temperatureData = {};
            // 校验选择
            if (this.selectedWater.length === 0 || this.selectedFlow.length === 0) {
                this.$toast.fail('请先选择水温和流量');
                return;
            }
            // 生成表头
            const headers = ['设定温度','实际温度', ...this.selectedFlow.sort().map(f => f )];
            this.headers = headers;
            // 生成行数据
            this.tableData = this.selectedWater.sort((a,b) => a - b).map(water => {
                const row = {
                    temperature: water === '常温水' ? water : water,
                    values: this.selectedFlow.map(flow => ({
                        flow: flow,
                        value: '' // 初始空值
                    }))
                };
                // 初始化表单数据
                this.formData.temperatureData[water] = {};
                this.selectedFlow.forEach(flow => {
                    this.formData.temperatureData[water][flow] = '';
                });
                return row;
            });
            // 自动滚动到表格区域
            setTimeout(() => {
                const tableEl = document.getElementById('temperature-table');
                if (tableEl) tableEl.scrollIntoView({ behavior: 'smooth' });
            }, 100);
        },
    }
})
})