南骏 池
2025-03-20 14b1756e21ba4401ce5916f035576804f4be5878
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
var vm = new Vue({
    el: '#app',
    data: function () {
        return {
            isLoading: false,
            userInfo: {
                "loginGuid": '',
                "loginAccount": '',
            },
            formData: {
                id: "",
                releaseNo: "",
                createBy: "",
                createDate: "",
                lotNo: "",
                itemNo: "",
                billNo: "",
                fcovertQty: "",
                detailMem: "",
                taskNo: "",
                fcheckResu: "",
                boardModel: "",
                planQty: "",
                mocode: "",
                boardStyle: ""
            },
            isShowTable: false,
            tableData: [],//返回的检验项目
            jymxData: [],//展示的检验项目
 
            okNum:'',//合格数
            ngNum: '',//不合格数
            ttrre: false,
            show: false,
            tableMxData: [],
            tabActive: 0,
            inputValue: '',//特征值输入
            resultValue: '',//检验结果录入
            showButton: false,//右上角菜单触发
            okValue: '',//OK-数量
            ngValue: ''//NG-数量
        }
    },
    mounted() {
        var that = this;
        this.userInfo = {
            loginGuid: this.GetLoginInfor().loginGuid,
            loginAccount: this.GetLoginInfor().loginAccount,
        };
        this.formData.id = this.Request("id"),
        this.formData.releaseNo = this.Request("releaseNo");
        this.formData.lotNo = this.Request("lotNo");
        this.init();
    },
    methods: {
        // 输入过滤
        handleNumberInput1(value) {
            // 去除非数字并确保首位不为0(除非是单独的0)
            this.okValue = value.replace(/[^\d]/g, '') // 去除非数字字符
                .replace(/^0+(?!$)/, ''); // 去除开头的0,除非整个字符串是0
        },
        handleNumberInput2(value) {
            // 去除非数字并确保首位不为0(除非是单独的0)
            this.ngValue = value.replace(/[^\d]/g, '') // 去除非数字字符
                .replace(/^0+(?!$)/, ''); // 去除开头的0,除非整个字符串是0
        },
        handleNumberInput3(value) {
            this.inputValue = value.replace(/[^\d.]/g, '')  // 1. 去除非数字和小数点
                .replace(/(\..*)\./g, '$1')               // 2. 禁止多个小数点
                .replace(/^\./g, '');    
        },
 
        togglePopup(index) {
            // 切换指定索引的 popup 状态
            var that = this;
            this.show = true;
            console.log(index);
            console.log(that.tableData[index].guid);
            var mxguid = that.tableData[index].guid;
            that.jymxData = that.tableData[index];
            that.tabActive = index;
            that.AxiosHttp("post", 'MesQaItemsDetect01Manager/GetModel12', {
                parentGuid : "",
                guid : mxguid ,
            }, 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);
                }
            }).catch(function (error) {
                that.$toast.fail("网络错误,请重试!");
                console.log(error);
            });
 
 
        },
 
        getInputOK() {
            var that = this;
            var jys = that.tableData[that.tabActive].checkQyt;//检验项目的检验数
            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 (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
 
            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);
                }
            }).catch(function (error) {
                that.$toast.fail("网络错误,请重试!");
                console.log(error);
            });
        },
 
        getInputTZZ() {
            // 切换指定索引的 popup 状态
            var that = this;
            var mxguid = that.tableData[that.tabActive].guid;//检验项目的guid
            var input = that.inputValue;
            that.AxiosHttp("post", 'MesQaItemsDetect01Manager/EditYangLi', {
                dt05Guid: mxguid,
                fSeq : "pda",
                fVal : input,
            }, true, 1).then(function (res1) {
                if (res1.rtnData.outSum == 1) {
                    that.$notify({
                        type: 'success', message: res1.rtnMsg
                    });
                    that.okValue = null;
                    that.refreshJYItem();//刷新检验项目
                    //that.handleTabClick();//刷新检验明细面板
                    //that.$refs.inputValue.focus();
                    that.inputValue = null;
                } else {
                    that.$toast.fail(res1.rtnMsg);
                    that.inputValue = null;
                }
            }).catch(function (error) {
                that.$toast.fail("网络错误,请重试!");
                that.inputValue = null;
            });
        },
 
        handleTabClick() {
            console.log(this.tabActive)
            this.togglePopup(this.tabActive);
        },
        //检验明细刷新
        refreshJYItem() {
            const that = this;
            return that.AxiosHttp("post", 'LLJ/getJYItem', {
                releaseNo: that.formData.releaseNo
            }, false).then(res1 => {
                const tableData = res1.data.tbBillList || [];
                that.tableData = tableData;
                that.handleTabClick();//刷新检验明细面板
            }).catch(error => {
                that.$toast.fail("网络错误,请重试!");
                console.error('Refresh error:', error);
            });
        },
 
        //主页面加载
        init() {
            
            //alert(this.Request("id"));
            var that = this;
            that.showButton = false;
            that.AxiosHttp("post", 'LLJ/getPage', {
                id: that.Request("id"),
                pageIndex: 1,
                limit: 1,
            }, false)
                .then(function (res) {
                    let data = res.data.tbBillList[0];
                    if (data) {
                        that.formData = data;
 
                        that.AxiosHttp("post", 'LLJ/getJYItem', {
                            //id: that.formData.guid,
                            releaseNo: that.formData.releaseNo
                        }, false).then(function (res1) {
                            let tableData = res1.data.tbBillList
                            //当已检验个数都不为空时按照检测结构排序
                            tableData.sort((a, b) => {
                                if (a.result === '未完成' && b.result === '合格') {
                                    return -1;
                                } else if (a.result === '合格' && b.result === '未完成') {
                                    return 1;
                                } else {
                                    return 0;
                                }
                            });
                            that.tableData = tableData;
                            //if (that.tableData.length === 0) {
                            //    that.isShowTable = true;
                            //}
                        }).catch(function (error) {
                            that.$toast.fail("网络错误,请重试!");
                            console.log(error);
                        });
                    }
                })
                .catch(function (error) {
                    that.$toast.fail("网络错误,请重试!");
                    console.log(error);
                });
        },
        submit() {
            var that = this;
 
            //if (that.formdata.remarks == undefined && that.formdata.fcheckresu == "不合格") {
            //    that.$toast.fail("检验结果为不合格时,需要填写不合格描述!");
            //    return;
            //}
 
 
 
            that.ttrre = true;
 
            //that.AxiosHttp("post", 'LLJ/IqcQaSubmit', {
            //    userNo: this.userInfo.loginAccount,
            //    releaseNo: this.formData.releaseNo
            //}, false).then(function (res1) {
            //    if (res1.status == 1) {
            //        that.$toast.fail(res1.message);
            //    } else {
            //        that.$notify({ type: 'success', message: '提交成功' });
            //        that.init();
            //    }
            //    that.ttrre = false
            //}).catch(function (error) {
            //    that.$toast.fail("网络错误,请重试!");
            //    that.ttrre = false
            //    console.log(error);
            //});
            that.AxiosHttp("post", 'MesQaItemsDetect01Manager/EditModelSubmit', {
                guid: that.formData.guid
            }, true, 1).then(function (res1) {
                if (res1.rtnCode == 1) {
                    that.$notify({ type: 'success', message: '提交成功' });
                    that.init();
                } else {
                    that.$toast.fail(res1.rtnMsg);
                }
                that.ttrre = false
            }).catch(function (error) {
                that.$toast.fail("网络错误,请重试!");
                that.ttrre = false
                console.log(error);
            });
        },
        removeXJ() {
            const that = this;
 
            // 添加确认弹窗
            that.$dialog.confirm({
                title: '操作确认',
                message: '确认要重新加载检验项目吗?',
                confirmButtonText: '确认',
                cancelButtonText: '取消'
            }).then(() => {  // 确认回调
                that.AxiosHttp("post", 'MesQaItemsDetect01Manager/ReloadModel5', {
                    guid: that.formData.guid
                }, true, 1).then(res1 => {
                    if (res1.rtnCode == 1) {
                        that.$notify({ type: 'success', message: '重新加载成功' });
                        that.init();
                    } else {
                        that.$toast.fail(res1.rtnMsg);
                    }
                }).catch(error => {
                    that.$toast.fail("网络错误,请重试!");
                    console.error('Reload error:', error);
                });
 
            }).catch(() => {  // 取消回调
                that.$toast('已取消操作');
            });
        },
        GetBack1() {
            window.history.back();
        },
        onClickRight() {
            
        },
    }
})