xiaojiao
2026-01-24 c5f01e9a882b16f534166d033312c5c8ba8d94dd
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
<template>
    <view>
        <view>
            <u-table font-size="25">
                <u-tr>
                    <u-td>
                        <xfl-select :list="UserArray" :initValue="this.$UserTool.UserInfo.userName" :clearable="false"
                            :disabled="true">
                        </xfl-select>
                    </u-td>
                    <u-td width="25%">现在时间:</u-td>
                    <u-td width="25%">{{date}}</u-td>
                </u-tr>
            </u-table>
        </view>
        <view style="padding: 0rpx 0rpx">
            <u-table>
                <u-tr>
                    <u-td width="30%">轴承编号</u-td>
                    <u-td>
                        <u-input v-model="materielNumber" :focus="qrcodeFocus" :border="true" placeholder="请扫描轴承编号!"
                            @input="barcodeChange" />
                    </u-td>
                </u-tr>
 
                <u-tr>
                    <u-td width="30%">轴承型号</u-td>
                    <u-td>
                        <u-input v-model="recordInfo.containerdtl_type" :border="false" :disabled="true"
                            placeholder="" />
                    </u-td>
                </u-tr>
                <u-tr>
                    <u-td width="30%">重量(克)</u-td>
                    <u-td>
                        <u-input v-model="recordInfo.containerdtl_goodsWeight" :border="false" :disabled="true"
                            placeholder="" />
                    </u-td>
                </u-tr>
                <u-tr>
                    <u-td width="30%">托盘号</u-td>
                    <u-td>
                        <u-input v-model="recordInfo.containerhead_barcode" :border="false" :disabled="true"
                            placeholder="" />
                    </u-td>
                    <u-td width="30%">选配标准</u-td>
                    <u-td>
                        <u-input v-model="recordInfo.containerdtl_standard" :border="false" :disabled="true"
                            placeholder="" />
                    </u-td>
                </u-tr>
                <u-tr>
                    <u-td width="30%">车型</u-td>
                    <u-td>
                        <u-input v-model="recordInfo.materiel_id" :border="false" :disabled="true" placeholder="" />
                    </u-td>
                    <u-td width="30%">厂家</u-td>
                    <u-td>
                        <u-input v-model="recordInfo.containerdtl_madeUnit" :border="false" :disabled="true"
                            placeholder="" />
                    </u-td>
                </u-tr>
                <u-tr>
                    <u-td width="30%" height="50px;">轴承内径平均值</u-td>
                    <u-td>
                        <u-input v-model="recordInfo.csize_in_value" :border="false" :disabled="true" placeholder="" />
                    </u-td>
                    <u-td width="30%">油档平均值</u-td>
                    <u-td>
                        <u-input v-model="recordInfo.csize_three_3" :border="false" :disabled="true" placeholder="" />
                    </u-td>
                </u-tr>
                <u-tr>
                    <u-td width="30%">外径平均值</u-td>
                    <u-td>
                        <u-input v-model="recordInfo.csize_out_value" :border="false" :disabled="true" placeholder="" />
                    </u-td>
                    <u-td width="30%">后档平均值</u-td>
                    <u-td>
                        <u-input v-model="recordInfo.csize_four_3" :border="false" :disabled="true" placeholder="" />
                    </u-td>
                </u-tr>
                <u-tr>
                    <u-td width="30%">抽检结果:</u-td>
                    <u-td>
                        <xfl-select :list="checkResultList" :initValue="'请选择'" :clearable="false"
                            @change="checkResultChange">
                        </xfl-select>
                    </u-td>
                </u-tr>
            </u-table>
        </view>
 
        <view style="padding: 0rpx 0rpx;">
            <u-table>
                <u-tr>
                    <u-td>
                        <u-button style="width:100px" type="primary" @click="SaveInfomation">确认</u-button>
                    </u-td>
                </u-tr>
            </u-table>
        </view>
    </view>
</template>
 
<script>
    var _this;
    var _user;
    export default {
        data() {
            return {
                date: '',
                CurrentUser: '', //当前用户
                recordInfo: {
                    containerdtl_id: '',
                    containerdtl_type: '',
                    materiel_id: '',
                    containerdtl_goodsWeight: '',
                    containerhead_barcode: '',
                    containerdtl_standard: '',
                    containerdtl_madeUnit: '',
                    csize_in_value: '',
                    csize_out_value: '',
                    csize_three_3: '',
                    csize_four_3: '',
                },
                checkResultList: [{
                    label: '合格',
                    value: '合格'
                }, {
                    label: '不合格',
                    value: '不合格'
                }, ],
                checkResult: '',
                materielNumber: '',
                qrcodeFocus: false,
            }
        },
        methods: {
            UserChange(value) {
 
            },
            setTimer() {
                if (this.timer == null) {
                    this.timer = setInterval(() => {
                        this.date = this.$DateTool.getDate();
                    }, 1000)
                }
 
            },
            checkResultChange(value) {
                this.checkResult = value.orignItem.label;
            },
            barcodeChange() {
                if(this.materielNumber.length > 20){
                    const rawStr = _this.materielNumber;
                    // 2. 修复格式(单引号→双引号 + 删尾逗号)
                    const fixedStr = rawStr.replace(/'/g, '"').replace(/,\s*}/, '}');
                    console.log(fixedStr)
                    // 3. 解析为字典(对象)
                    const temp_dict = JSON.parse(fixedStr);
                    console.log(temp_dict)
                    // 4. 正确获取值
                    console.log(temp_dict['轴承条码']); // 输出:1(不再是undefined)
                    
                    _this.materielNumber = temp_dict['轴承条码']; 
                }
                
                if (_this.materielNumber == '' || _this.materielNumber == null) {
                    _this.initAVG();
                    return;
                }
                
                
                let where =
                    "[" +
                    "{'name':'containerdtl_number','value':'" + _this.materielNumber + "'}]";
                let data = {
                    page: 1,
                    rows: 1,
                    sort: 'containerhead_createtime',
                    order: 'sort',
                    wheres: where
                }
                //console.log(data);
                _this.$AjaxRequest.Params('post', 'VV_ContainerInfo/getPageData',
                    data, _user.token);
                _this.$AjaxRequest.Request().then(function(result) {
                    //debugger
                    if (result.data.status == 0) {
                        _this.recordInfo = result.data.rows[0];
                    } else {
                        uni.showToast({
                            icon: 'none',
                            title: "请求错误:" + result.data.message,
                            duration: 2000
                        });
                        _this.initAVG();
                    }
                }).catch(function(err) {
                    uni.showToast({
                        icon: 'none',
                        title: "请求后台异常,错误信息." + err.errMsg,
                        duration: 2000
                    });
                    _this.initAVG();
                });
            },
            initAVG() {
                Object.keys(_this.recordInfo).map(key => _this.recordInfo[key] = '');
            },
            SaveInfomation() {
                if (_this.materielNumber == '' || _this.recordInfo.containerdtl_id == '') {
                    uni.showToast({
                        icon: 'none',
                        title: "请扫描轴承编号获取信息.",
                        duration: 2000
                    });
                    return;
                }
                if (_this.checkResult == '') {
                    uni.showToast({
                        icon: 'none',
                        title: "请选择抽检结果.",
                        duration: 2000
                    });
                    return;
                }
 
                uni.showModal({
                    title: '提示',
                    content: '确认复核?',
                    success: function(res) {
                        if (res.confirm) {
                            let data = {
                                MainData: {
                                    containerdtl_id: _this.recordInfo.containerdtl_id,
                                    checkResult: _this.checkResult
                                },
                            };
                            _this.$AjaxRequest.Params('post', 'ToAPP/MeasureCheckAction',
                                data, _user.token);
                            _this.$AjaxRequest.Request().then(function(result) {
                                if (result.data.status) {
                                    uni.showToast({
                                        title: "测量复核确认成功!",
                                        duration: 2000
                                    });
                                    _this.initAVG();
                                    _this.qrcodeFocus = true;
                                } else {
                                    uni.showToast({
                                        icon: 'none',
                                        title: "请求错误:" + result.data.message,
                                        duration: 2000
                                    });
                                }
                            }).catch(function(err) {
                                uni.showToast({
                                    icon: 'none',
                                    title: "请求后台异常,错误信息." + err.errMsg,
                                    duration: 2000
                                });
                            });
                        } else if (res.cancel) {}
                    }
                });
            },
        },
        created: function() {
            // 每次进入界面时,先清除之前的所有定时器,然后启动新的定时器
            clearInterval(this.timer)
            this.timer = null;
            this.setTimer();
            _user = this.$UserTool.UserInfo;
            this.CurrentUser = _user.userName;
            this.UserArray = [this.$UserTool.AllUserInfo];
        },
        destroyed: function() {
            // 每次离开当前界面时,清除定时器
            clearInterval(this.timer);
            this.timer = null;
        },
        mounted() {
            _this = this;
            _this.qrcodeFocus = true;
            //_this.queryOrder();
        },
 
 
    }
</script>
 
<style scoped lang="scss">
 
</style>