cdk
2025-03-24 06e6cf5719a7de9d7919cee2f6fcc3cfc6f9eb9d
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
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
<template>
  <view>
    <view class="form-container">
      <form :modelValue="formData">
        <view class="form-group">
          <label class="form-label">项目名称:</label>
          <input class="form-input" disabled="true" type="text" v-model="formData.projName"/>
        </view>
        <view class="form-group">
          <label class="form-label">质量要求:</label>
          <input class="form-input" disabled="true" type="text" v-model="formData.itemMod"/>
        </view>
        <view class="form-group">
          <label class="form-label">检验方法:</label>
          <input class="form-input" disabled="true" type="text" v-model="formData.inspectionMethod"/>
        </view>
        <view class="form-group">
          <label class="form-label">使用仪表:</label>
          <input class="form-input" disabled="true" type="text" v-model="formData.usingInstruments"/>
        </view>
        <view class="form-group">
          <label class="form-label">检验数:</label>
          <input class="form-input" disabled="true" type="text" v-model="formData.levelNum"/>
        </view>
        <view class="form-group">
          <label class="form-label">检验标准编码:</label>
          <input class="form-input" disabled="true" type="text" v-model="formData.qsCode"/>
        </view>
        <view class="form-group">
          <label class="form-label">检验标准名称:</label>
          <input class="form-input" disabled="true" type="text" v-model="formData.qsName"/>
        </view>
        <view class="form-group">
          <label class="form-label">检验水平:</label>
          <input class="form-input" disabled="true" type="text" v-model="formData.fcheckLevel"/>
        </view>
        <view class="form-group">
          <label class="form-label">接收水平:</label>
          <input class="form-input" disabled="true" type="text" v-model="formData.facLevel"/>
        </view>
        <view class="form-group">
          <label class="form-label">下限:</label>
          <input class="form-input" disabled="true" type="text" v-model="formData.minValue"/>
        </view>
        <view class="form-group">
          <label class="form-label">标准值:</label>
          <input class="form-input" disabled="true" type="text" v-model="formData.standardValue"/>
        </view>
        <view class="form-group">
          <label class="form-label">上限:</label>
          <input class="form-input" disabled="true" type="text" v-model="formData.maxValue"/>
        </view>
        <view class="form-group">
          <label class="form-label">AC数:</label>
          <input class="form-input" disabled="true" type="text" v-model="formData.freQty - 1"/>
        </view>
        <view class="form-group">
          <label class="form-label">RE数:</label>
          <input class="form-input" disabled="true" type="text" v-model="formData.freQty"/>
        </view>
        <view class="form-group">
          <label class="form-label">不合格数:</label>
          <input class="form-input" disabled="true" type="text" v-model="formData.unqualified"/>
        </view>
        <view class="form-group">
          <label class="form-label">预览结果:</label>
          <input class="form-input" disabled="true" type="text" v-model="formData.result"/>
        </view>
        <view class="form-group">
          <label class="form-label">不合格描述:</label>
          <input class="form-input" disabled="true" type="text" v-model="formData.remarks"/>
        </view>
        <view class="form-group edit">
          <input class="form-input" style="color: red" disabled="true" type="text"
                 value="没有最大值和最小值时填写0(未通过检验)或1(通过检验)"/>
        </view>
        <view class="form-group edit">
          <label class="form-label">检测结果:</label>
          <input class="form-input" type="number" v-model="formData.fcheckResu"/>
        </view>
        <button type="primary" v-if="tableData.length < formData.levelNum" @click="submit">保存</button>
      </form>
    </view>
    <view>
      <img v-if="isShowImg" :src="base64Image" style="width:100%" @click="previewImage"/>
    </view>
    <view class="list-container">
      <uni-table ref="table" border emptyText="暂无更多数据">
        <uni-tr>
          <uni-th align="center" style="color: #FFFFFF;background-color: lightskyblue;">编号</uni-th>
          <uni-th align="center" style="color: #FFFFFF;background-color: lightskyblue;">判定标识</uni-th>
          <uni-th align="center" style="color: #FFFFFF;background-color: lightskyblue;">检验结果</uni-th>
          <uni-th width="150" align="center"
                  style="color: #FFFFFF;background-color: lightskyblue;">修改
          </uni-th>
        </uni-tr>
        <uni-tr v-for="(item, index) in tableData" :key="index">
          <uni-td align="center">
            {{ index + 1 }}
          </uni-td>
          <uni-td align="center">
            <input class="form-input" disabled="true" type="text" v-model="item.fstand"/>
          </uni-td>
          <uni-td align="center">
            <input class="form-input" disabled="true" type="text" v-model="item.fcheckResu"/>
          </uni-td>
          <uni-td>
            <view class="uni-group">
              <button type="warn" v-if="isNumber" @click="toDetail(item)">修改</button>
              <button type="warn" v-if="!isNumber" @click="numberEdit(item)">{{ editResult(item.fcheckResu) }}</button>
            </view>
          </uni-td>
        </uni-tr>
      </uni-table>
    </view>
 
    <view class="plus-button">
      <button type="warn" @click="saveRemarks">添加不合格描述</button>
    </view>
 
    <view v-if="showPopup" class="overlay">
      <view class="popup">
        <h3>修改检验结果</h3>
        <form :modelValue="editData">
          <view class="form-group">
            <label class="form-label">检验结果:</label>
            <input class="form-input" type="text" v-model="editData.fcheckResu"/>
          </view>
          <button type="warn" @click="eidt">修改</button>
          <button @click="showPopup = !showPopup">取消</button>
        </form>
      </view>
    </view>
 
    <view v-if="remarksPopup" class="overlay">
      <view class="popup">
        <h3>修改不合格描述</h3>
        <form>
          <view class="form-group">
            <label class="form-label">不合格描述:</label>
            <input class="form-input" type="text" v-model="remarks"/>
          </view>
          <button type="warn" @click="editRemarks">修改</button>
          <button @click="remarksPopup = !remarksPopup">取消</button>
        </form>
      </view>
    </view>
  </view>
</template>
 
<script>
 
export default {
  data() {
    return {
      formData: {},
      isNumber: false,
      checkItem: "",
      id: 0,
      gid: 0,
      itemInId: 0,
      billNo: "",
      showPopup: false,
      editData: {},
      tableData: [],
      isShowImg: false,
      base64Image: "",
      remarks: "",
      remarksPopup: false,
      fcheckResu: null
    }
  },
  methods: {
 
    previewImage() {
      uni.previewImage({
        urls: [this.base64Image],
      });
    },
 
    editResult(fcheckResu) {
      if (fcheckResu == '1') {
        return "改为不合格";
      } else {
        return "改为合格";
      }
    },
    submit() {
 
      let count = this.formData.levelNum;
      let fstand = "√";
 
      //有最大值和最小值就根据是否符合标准值更新判定结果,没有最大值和最小值就根据是否通过检验判定结果
      if (this.formData.maxValue && this.formData.minValue) {
 
        if (!this.formData.fcheckResu) {
          this.$showMessage("请输入检验值");
          return;
        }
 
        if (this.formData.fcheckResu >= this.formData.minValue && this.formData.fcheckResu <= this.formData
            .maxValue) {
          fstand = "√"
        } else {
          fstand = "×";
        }
        count = 1;
      } else {
 
        if (!this.formData.fcheckResu) {
          this.formData.fcheckResu = 1
        }
 
        if (this.formData.fcheckResu == 0 || this.formData.fcheckResu == 1) {
          this.formData.isPass = this.formData.fcheckResu
        } else {
          this.$showMessage("无标准值时,检验结果只能为0或1!");
          return;
        }
        count = count - this.tableData.length;
      }
 
      this.formData.updater = this.$loginInfo.account;
 
      this.$post({
        url: "/RKJ/SetQSItemDetail",
        data: {
          pid: this.id,
          gid: this.gid,
          fstand: fstand,
          fcheckResu: this.formData.fcheckResu,
          updateBy: this.formData.updater,
          count: count
        }
      }).then(res => {
        this.formData.fcheckResu = null;
        this.$showMessage("保存成功");
        this.refreshResult();
      })
 
    },
    refreshResult() {
      this.$post({
        url: "/RKJ/getXjDetail02ById",
        data: {
          id: this.id
        }
      }).then(res => {
        this.formData = res.data.tbBillList.itemXj01;
 
        this.tableData = res.data.tbBillList.itemXj02s;
 
        if (this.formData.imageData) {
          this.isShowImg = true;
          this.base64Image = 'data:image/jpeg;base64,' + this.formData.imageData;
        }
 
        //maxValue  minValue  standardValue
        if (this.formData.maxValue && this.formData.minValue && this.formData.standardValue) {
          this.isNumber = true;
        }
 
      })
    },
    toDetail(item) {
      this.showPopup = !this.showPopup;
      this.editData = item;
      this.fcheckResu = this.editData.fcheckResu;
    },
    eidt() {
 
      if (!this.editData.fcheckResu) {
        this.$showMessage("请输入检验结果");
      }
 
      if (this.formData.fcheckResu == this.editData.fcheckResu) {
        this.$showMessage("修改成功");
        return;
      }
 
      let fstand = "√";
       
      if (this.formData.maxValue && this.formData.minValue) {
 
        if (!this.editData.fcheckResu) {
          this.$showMessage("请输入检验值");
          return;
        }
 
        if (this.editData.fcheckResu >= this.formData.minValue && this.editData.fcheckResu <= this.formData
            .maxValue) {
          this.editData.isPass = 1
        } else {
          this.editData.isPass = 0
          fstand = "×";
        }
      } else {
 
        if (!this.editData.fcheckResu) {
          this.editData.fcheckResu = 1
        }
 
        if (this.editData.fcheckResu == 0 || this.editData.fcheckResu == 1) {
          if (this.editData.fcheckResu == 0) {
            fstand = "×";
          }
        } else {
          this.$showMessage("无标准值时,检验结果只能为0或1!");
          return;
        }
      }
 
      this.editData.updater = this.$loginInfo.account;
 
      this.$post({
        url: "/RKJ/UpdateQSItemDetail",
        data: {
          id: this.editData.id,
          pid: this.id,
          gid: this.gid,
          itemInId: this.itemInId,
          fstand: fstand,
          fcheckResu: this.editData.fcheckResu,
          updateBy: this.editData.updater,
        }
      }).then(res => {
        this.showPopup = !this.showPopup;
        if(res.status == 0){
            this.$showMessage("修改成功");
            this.refreshResult(); //刷新页面
        }else{
            this.$showMessage(res.message);
            this.editData.fcheckResu = this.fcheckResu;
        }
      })
    },
 
    numberEdit(item) {
 
      let fstand = "√";
      let fcheckResu = 1;
 
      if (item.fcheckResu == '1') {
        fstand = "×";
        fcheckResu = 0;
      }
 
      this.$post({
        url: "/RKJ/UpdateQSItemDetail",
        data: {
          id: item.id,
          pid: item.pid,
          gid: item.gid,
          itemInId: this.itemInId,
          fstand: fstand,
          fcheckResu: fcheckResu,
          updateBy: this.$loginInfo.account,
        }
      }).then(res => {
        if(res.status == 0){
            this.$showMessage("修改成功");
            this.refreshResult(); //刷新页面
        }else{
            this.$showMessage(res.message);
        }
      })
    },
    saveRemarks() {
      this.remarksPopup = !this.remarksPopup;
      this.remarks = this.formData.remarks;
    },
    editRemarks() {
      if (this.remarks) {
        //saveRemarksGid
        this.$post({
          url: "/RKJ/saveRemarksPid",
          data: {
            pid: this.formData.id,
            remarks: this.remarks
          }
        }).then(res => {
          if (res.data.tbBillList > 0) {
            this.formData.remarks = this.remarks;
            this.remarksPopup = !this.remarksPopup;
            this.$showMessage("保存成功");
          }
        })
      }
    }
  },
  onLoad(options) {
    //options中包含了url附带的参数
    let params = options;
 
    this.id = params["id"];
    this.billNo = params["billNo"];
    this.gid = params["gid"];
    this.itemInId = params["itemInId"];
 
    this.refreshResult();
  }
}
</script>
 
<style>
.form-group {
  display: flex;
  align-items: center;
  border: 1px solid #c9c9c9;
  background-color: #d4d4d4;
}
 
.form-label {
  margin-bottom: 0;
  padding: 5px;
}
 
.form-input {
  flex: 1;
  margin-bottom: 0;
  padding: 5px;
}
 
/* 默认样式 */
.list-container {
  height: calc(100vh - 750px);
  /* 设置列表容器的高度为剩余空间,并减去表单容器的高度 */
  overflow-y: auto;
  /* 允许列表容器垂直滚动 */
  padding: 10px;
  /* 可选:添加一些内边距,使列表内容更美观 */
}
 
/* 在小屏幕设备上,重置高度为适应屏幕 */
@media (max-width: 768px) {
  .list-container {
    height: calc(100vh - 485px);
    /* 适当调整高度 */
  }
}
 
.form-container {
  /* 设置表单容器的高度,使其可以滚动 */
  overflow-y: auto;
  /* 允许表单容器垂直滚动 */
  padding: 10px;
  /* 可选:添加一些内边距,使表单内容更美观 */
}
 
.overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  display: flex;
  justify-content: center;
  align-items: center;
}
 
.popup {
  background-color: #fff;
  padding: 20px;
  border: 1px solid #ccc;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
  width: 68vw;
  /* 设置宽度为视口宽度的80% */
  height: 25vh;
  /* 设置高度为视口高度的80% */
}
 
.edit {
  background-color: white;
}
</style>