llj
2025-10-31 a3e399e2c7ee937e4937cfd7d4ddd0212b3dab9b
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
<template>
    <view>
        <view class="inspect-value-content">
            <view class="form-item">
                <view class="left">项目序号</view>
                <view class="right disabled">
                    <input type="text" v-model="checkData.num" disabled />
                </view>
            </view>
            <view class="form-item">
                <view class="left">检验项目</view>
                <view class="right disabled">
                    <input type="text" v-model="checkData.HQCCheckItemName" disabled />
                </view>
            </view>
            <view class="form-item">
                <view class="left">样本量</view>
                <view class="right disabled">
                    <input type="text" v-model="checkData.HSampleQty" disabled />
                </view>
            </view>
            <view class="form-item">
                <view class="left">检验结果</view>
                <view class="right disabled">
                    <input type="text" v-model="checkData.HResult2" disabled />
                </view>
            </view>
            <view class="form-item">
                <view class="left">不合格数</view>
                <view class="right">
                    <input type="number" v-model="checkData.HSampleUnRightQty" />
                </view>
            </view>
            <view class="form-item">
                <view class="left">保留小数位</view>
                <view class="right">
                    <input type="number" v-model="checkData.HResDec" />
                </view>
            </view>
            <view style="width: 100%;border-bottom: 1px solid #e3e3e3;"></view>
            <view class="form-item" style="width: 100%;">
                <view class="left">状态</view>
                <view class="right none-border">
                    <view style="width: 4em; ">
                        {{ checkData.HStatus?"合格":"不合格" }}
                    </view>
                    <view>
                        <switch style="width: 2em; transform:scale(0.7);" :checked="checkData.HStatus?'checked':''"
                            @change="HStatusChange" />
                    </view>
                </view>
            </view>
            <view class="form-item">
                <view class="left">比较符</view>
                <view class="right disabled">
                    <input type="text" v-model="checkData.HResult2" disabled />
                </view>
            </view>
            <view class="form-item">
                <view class="left">单位</view>
                <view class="right disabled">
                    <input type="text" v-model="checkData.HTargetVal" disabled />
                </view>
            </view>
            <view class="form-item">
                <view class="left">检验值</view>
                <view class="right disabled">
                    <input type="text" v-model="checkData.HInspectVal" disabled />
                </view>
            </view>
            <view class="form-item">
                <view class="left">目标值</view>
                <view class="right disabled">
                    <input type="text" v-model="checkData.HTargetVal" disabled />
                </view>
            </view>
            <view class="form-item">
                <view class="left">上限值</view>
                <view class="right disabled">
                    <input type="text" v-model="checkData.HUpLimit" disabled />
                </view>
            </view>
            <view class="form-item">
                <view class="left">下限值</view>
                <view class="right disabled">
                    <input type="text" v-model="checkData.HDownLimit" disabled />
                </view>
            </view>
            <view class="form-item">
                <view class="left">上偏差</view>
                <view class="right disabled">
                    <input type="text" v-model="checkData.HUpOffset" disabled />
                </view>
            </view>
            <view class="form-item">
                <view class="left">下偏差</view>
                <view class="right disabled">
                    <input type="text" v-model="checkData.HDownOffset" disabled />
                </view>
            </view>
            <view style="width: 100%;border-bottom: 1px solid #e3e3e3;"></view>
            <view class="inspect-value-list">
                <view style="width: 100%;text-align: right;">
                    <button type="default" size="mini" class="btn-a" @click="storeInspectValue">缓存检验值</button>
                </view>
                <view class="item" style="border-top: 2px solid #e3e3e3 ;">
                    <view class="th1">序号</view>
                    <view class="th2" style="display: flex; flex-direction: row; align-items: center;">
                        检验结果
                    </view>
                    <view class="th3">
                        检验值({{getAnalysisMethodTitle(checkData.HAnalysisMethod)}})
                    </view>
                </view>
                <view class="item" v-for="(item, index) in inspectValues">
                    <view class="th1">{{item.HSEQ}}</view>
                    <view class="th2" style="display: flex; flex-direction: row; align-items: center;">
                        <view style="width: 3em; ">
                            {{ item.HInspectResult?"合格":"不合格" }}
                        </view>
                        <view>
                            <switch style="width: 3em; transform:scale(0.7);" :checked="item.HInspectResult?'checked':''"
                                @change="HInspectResultChange(index, $event)" />
                        </view>
                    </view>
                    <view class="th3">
                        <input type="number" v-model="item.HInspectValue" />
                    </view>
                </view>
            </view>
        </view>
    </view>
</template>
 
<script>
    // 检验值模板
    export default {
        name: "InspectValueTemplate",
        data() {
            return {
                checkData: {
                    HResDec: 2,
                    HResult2: '',
                    HStatus: true,
                },
                inspectValues: []
            };
        },
        props: {
            bindKey: {
                type: [String, Number],
                required: true
            },
            bindData: {
                type: Object,
                required: true
            }
        },
        mounted() {
            console.log('bingData: ', this.bindData);
            let {data, list} = this.bindData
            this.checkData = Object.assign(data, JSON.parse(JSON.stringify(this.bindData)))
            // 判断是否有缓存数据或者缓存数据是否与样本数一致
            if(!list || list.length != this.checkData.HSampleQty ){
                for (let index = 0; index < this.checkData.HSampleQty; index++) {
                    this.inspectValues.push({
                        HSEQ: index + 1,
                        HInspectResult: true,
                        HInspectValue: 0,
                    })
                }
            }else {
                this.inspectValues = list
            }
           
            this.$forceUpdate()
        },
        methods: {
            storeInspectValue(){
                this.$emit("update", {
                    data: this.checkData,
                    list: this.inspectValues
                })
            },
            getAnalysisMethodTitle(type){
                if(type == 1) {
                    return '定性分析'
                }else if(type == 2){
                    return '定量分析'
                }
                return '其他分析'
            },
            HStatusChange(e) {
                this.checkData.HStatus = e.detail.value
            },
            HInspectResultChange(index, e) {
                console.log('e: ',e.detail.value);
                this.inspectValues[index].HInspectResult = e.detail.value
            },
 
        }
    }
</script>
 
<style lang="scss">
    input {
        height: inherit;
        width: inherit;
        font-size: 26rpx;
    }
 
    .inspect-value-content {
        box-sizing: border-box;
        padding: 20rpx 10rpx;
        display: flex;
        flex-direction: row;
        flex-wrap: wrap;
        gap: 20rpx 0;
 
        .form-item {
            width: 50%;
            display: flex;
            align-items: center;
            font-size: 26rpx;
            box-sizing: border-box;
            padding-left: 20rpx;
 
            .left {
                width: 5em;
 
                text {
                    color: red;
                    font-weight: bold;
                }
            }
 
            .right {
                // width: 450rpx;
                padding: 8rpx 20rpx;
                font-size: 26rpx;
                flex: 1;
                border-radius: 22rpx;
                border: 1px solid #acacac;
                display: flex;
                flex-direction: row;
                align-items: center;
            }
 
            .disabled {
                border: 1px solid #e4e4e4;
                background-color: #e4e4e4;
            }
 
            .none-border {
                border: none;
            }
        }
    }
 
    .inspect-value-list {
        box-sizing: border-box;
        display: flex;
        flex-direction: column;
        width: 100%;
 
        .item {
            display: flex;
            flex-direction: row;
            align-items: center;
            font-size: 30rpx;
        }
 
        .th1 {
            height: 100%;
            width: 4em;
            border: #e4e4e4 2px solid;
            border-top: 0;
            display: flex;
            align-items: center;
            box-sizing: border-box;
            padding: 8rpx 16rpx;
        }
 
        .th2 {
            height: 100%;
            width: 50%;
            border: #e4e4e4 2px solid;
            border-left: 0;
            border-top: 0;
            box-sizing: border-box;
            padding: 8rpx 16rpx;
        }
 
        .th3 {
            height: 100%;
            flex: 1;
            border: #e4e4e4 2px solid;
            border-left: 0;
            border-top: 0;
            box-sizing: border-box;
            padding: 8rpx 16rpx;
        }
    }
 
    .btn-a {
        background-color: #3A78FF;
        color: #fff;
    }
</style>