小小儁爺
2025-05-12 8081e115c0d8ffd0dd572e02a4dfa28818ad2d5a
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
<template>
    <view>
        <page-nav title="完工检验"></page-nav>
 
 
        <view class="mainContent">
            <view>
                <u-gap height="10" bgColor="#eff0f1"></u-gap>
                <view class="head">
                    <view class="head_block">
                        <view class="head_left">
                            <view class="head_bar"></view>
                            <view class="head_title" style="font-weight: bolder;">
                                物料信息
                            </view>
                        </view>
                    </view>
 
                    <view class="marginLeft20 marginRight20">
                        <view class="marginBottom20" style="display: flex;">
                            <view class="flex_column titleFont">
                                <view>单据编号:</view>
                                <view>物料编码:</view>
                                <view>物料名称:</view>
                                <view>物料规格:</view>
                                <view>工序编码:</view>
                                <view>工序名称:</view>
                                <view>质检方案:</view>
                                <view>抽样方式:</view>
                                <view>质量状态:</view>
                                <view>物料数量:</view>
                            </view>
                            <view class="flex_column contentFont">
                                <view>{{processObj.wocode}}</view>
                                <view>{{processObj.partcode}}</view>
                                <view>{{processObj.partname}}</view>
                                <view>{{processObj.partspec?processObj.partspec:'/'}}</view>
                                <view>{{processObj.stepcode}}</view>
                                <view>{{processObj.stepname}}</view>
                                <view class="ellipsis" style="width: 460rpx;">{{processObj.checkstandname}}</view>
                                <view>{{processObj.sampmethod==='FIXED'?'固时抽检':'比例抽检'}}</view>
                                <view style="display: flex;align-items: center;">
                                    <u-icon :name="isPlain?'checkmark-circle-fill':'close-circle-fill'"
                                        :color="isPlain?'#55ff00':'#FF0000'" size="20"></u-icon>
                                    <view style="margin-left: 10rpx;">
                                        {{isPlain?'合格':'不合格'}}
                                    </view>
                                </view>
                                <view>{{processObj.good_qty}}</view>
                            </view>
                        </view>
                    </view>
 
 
                </view>
 
                <u-gap height="10" bgColor="#eff0f1"></u-gap>
                <view class="head">
                    <view class="head_block">
                        <view class="head_left">
                            <view class="head_bar"></view>
                            <view class="head_title" style="font-weight: bolder;">
                                检验结果
                            </view>
                        </view>
                    </view>
 
                    <view class="marginLeft20 marginRight20 marginBottom20">
                        <view class="" style="display: flex;">
                            <view class="flex_column titleFont">
                                <view>样本数量:</view>
                                <view>合格数量:</view>
                                <view>不合格数量:</view>
                            </view>
                            <view class="flex_column contentFont">
                                <view>{{processObj.sampleqty}} 个</view>
                                <view>{{processObj.goodqty}} 个</view>
                                <view>{{processObj.sampleqty-processObj.goodqty}} 个</view>
                            </view>
                        </view>
 
 
                        <view style="display: flex;margin-top: 30rpx;justify-content: flex-start;">
                            <u-button type="primary" @click="isPlain=true" style="width: 160rpx;height: 60rpx; "
                                :plain="!isPlain" text="合格"></u-button>
                            <u-button type="warning" @click="isPlain=false" style="width: 160rpx;height: 60rpx;"
                                :plain="isPlain" text="不合格"></u-button>
                        </view>
                    </view>
 
 
                </view>
 
 
            </view>
        </view>
 
 
        <view class="footer">
            <u-button type="primary" size='large' :hairline="true" :loading="isDisabledSubmitButton" @click="submit"
                loadingText="正在提交,请稍等..." text="确认提交"></u-button>
        </view>
 
 
    </view>
</template>
 
 
<script>
    import {
        SaveMesOrderStepCheckItem
 
    } from '../../config/api.js';
 
    export default {
        onLoad(option) {
 
 
            console.log(option, 2)
 
            // let t1=JSON.parse(option.processObj)
            // let t2=JSON.parse(option.processObj)
 
 
 
            let processObj = JSON.parse(option.processObj)
            // console.log(this.processObj)
 
            this.processObj.wocode = processObj.wo_code
            this.processObj.partcode = processObj.partcode
            this.processObj.partname = processObj.partname
            this.processObj.partspec = processObj.partspec
            this.processObj.stepcode = processObj.stepcode
            this.processObj.stepname = processObj.stepname
            this.processObj.sampmethod = processObj.sampmethod
            this.processObj.good_qty = processObj.good_qty
            this.processObj.checkstandcode = processObj.checkstandcode
            this.processObj.checkstandname = processObj.checkstandname
            this.processObj.sampleqty = processObj.sampscare
 
            this.processObj.goodqty = option.goodqty
 
            this.isPlain = parseFloat(this.processObj.goodqty) === parseFloat(this.processObj.sampleqty)
 
 
            this.processArr = JSON.parse(option.processArr)
 
 
        },
 
        onPullDownRefresh() {
            setTimeout(() => {
                this.init(() => {
                    uni.stopPullDownRefresh();
                })
            }, 1000);
        },
 
        data() {
            return {
                topRightMessageCount: '',
                isDisabledSubmitButton: false,
 
                processObj: {
                    wocode: '',
                    partcode: '',
                    partname: '',
                    partspec: '',
                    stepcode: '',
                    stepname: '',
                    checkstandcode: '',
                    checkstandname: '',
                    check_type: 'EndCheck',
                    sampmethod: '', // FIXED(固时抽检)  SCARE(比例抽检)
                    sampscare: '',
                    qualitystatus: '/',
                    good_qty: '', // 指的报工数量
                    sampleqty: '',
                    goodqty: '', // 合格数量
                    ngqty: '', // 不良数量
                },
                processArr: [],
                isPlain: true
            }
        },
        created() {
 
        },
        mounted() {
            this.init()
 
        },
        methods: {
            init() {
                uni.stopPullDownRefresh();
            },
 
 
            // 提交接口
            async submit() {
 
                let checkitemcont = []
 
                this.processArr.forEach((i, index) => {
                    checkitemcont.push({
                        checknum: i.checkNumber + '/' + this.processArr.length / this
                            .processArr.filter(j => j.checkNumber === 1).length,
                        checkiem_seq: i.stepcheckitem_seq,
                        checkitem_code: i.code,
                        checkitem_name: i.name,
                        check_value: i.real_value ? i.real_value : '',
                        check_result: i.check_result ? 'OK' : 'NG',
                        checkitem_descr: ''
                    })
                })
 
                console.log(checkitemcont, 7)
 
 
                let formData = {
                    stu_torgcode: uni.getStorageSync('stu_torgcode'),
                    wocode: this.processObj.wocode,
                    partcode: this.processObj.partcode,
                    stepcode: this.processObj.stepcode,
                    checkstandcode: this.processObj.checkstandcode,
                    check_type: this.processObj.check_type,
                    sampmethod: this.processObj.sampmethod,
                    qualitystatus: this.isPlain ? 'OK' : 'NG',
                    good_qty: this.processObj.good_qty,
                    sampleqty: this.processObj.sampleqty,
                    goodqty: this.processObj.goodqty,
 
                    ngqty: this.processObj.sampleqty - this.processObj.goodqty,
 
                    admin: uni.getStorageSync('usercode'),
                    checkitemcont: JSON.stringify(checkitemcont)
                }
 
 
                console.log(formData, 888)
 
                this.isDisabledSubmitButton = true
 
                const res = await SaveMesOrderStepCheckItem(formData)
 
                if (res.code === '200') {
                    uni.$u.toast('提交成功!')
 
 
                    setTimeout(() => {
                        let prevPage = getCurrentPages()[getCurrentPages().length - 2]; // 上一页面实例
                        prevPage.$vm.fromSubmitData() // 调用上一页 定义的方法
                        uni.navigateBack({
                            delta: 1, //返回层数,1则上页   
                        })
                    }, 1000)
 
                    this.isDisabledSubmitButton = false
                } else {
                    uni.$u.toast(result.Message)
                    this.isDisabledSubmitButton = false
                }
 
                // uni.uploadFile({
                //     url: this.$baseUrl + '/AppQualityManagement/SaveStepCheckItem',
                //     files: [{
                //         "uri": "/"
                //     }],
                //     header: header,
                //     formData: formData,
                //     success: (res) => {
                //         console.log(res, 999)
                //         let result = JSON.parse(res.data)
                //         if (res.statusCode == 200 && result.code == '200') {
                //             uni.$u.toast('提交成功!')
 
                //             let prevPage = getCurrentPages()[getCurrentPages().length - 2]; // 上一页面实例
                //             prevPage.$vm.fromSubmitData() // 调用上一页 定义的方法
                //             uni.navigateBack({
                //                 delta: 1, //返回层数,1则上页   
                //             })
 
                //         } else {
                //             uni.$u.toast(result.Message)
                //         }
                //         this.isDisabledSubmitButton = false
                //     },
                //     fail(res) {
                //         console.log(res, 1000)
                //         uni.$u.toast('提交失败!')
                //         this.isDisabledSubmitButton = false
                //     },
                // })
 
            },
 
        }
    }
</script>
 
<style lang="scss" scoped>
    @import url('@/style/global.css');
 
    ::v-deep .uicon-arrow-left>span {
        display: block;
    }
</style>