licp
2024-12-20 1a09e4c1f2eef787ed9e5826f16a587185e364b1
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
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
<template>
  <div class="contract-review">
    <el-row class="title">
      <el-col :span="12" style="padding-left: 20px;text-align: left;">检验委托单</el-col>
    </el-row>
    <div class="search">
      <div class="search_thing">
        <div class="search_label">试样名称:</div>
        <div class="search_input"><el-input size="small" placeholder="请输入" clearable v-model="componentData.entity.sample"
            @keyup.enter.native="refreshTable()"></el-input></div>
      </div>
      <div class="search_thing">
        <div class="search_label">委托单位:</div>
        <div class="search_input">
          <el-input size="small" placeholder="请输入" clearable v-model="componentData.entity.company"
            @keyup.enter.native="refreshTable()"></el-input>
        </div>
      </div>
      <div class="search_thing">
        <div class="search_label">生产单位:</div>
        <div class="search_input">
          <el-input size="small" placeholder="请输入" clearable v-model="componentData.entity.production"
            @keyup.enter.native="refreshTable()"></el-input>
        </div>
      </div>
      <div class="search_thing">
        <div class="search_label">委托人:</div>
        <div class="search_input">
          <el-input size="small" placeholder="请输入" clearable v-model="componentData.entity.prepareUser"
            @keyup.enter.native="refreshTable()"></el-input>
        </div>
      </div>
      <div class="search_thing" style="padding-left: 30px;">
        <el-button size="small" @click="refresh()">重 置</el-button>
        <el-button size="small" type="primary" @click="refreshTable()">查 询</el-button>
      </div>
    </div>
    <div class="table">
      <ValueTable ref="ValueTable" :url="$api.processOrder.pageProcessOrder"
        :componentData="componentData" :delUrl="$api.processOrder.delProcessOrder" :key="upIndex"/>
    </div>
    <el-dialog
      title="补充信息"
      :visible.sync="addDialogVisible"
      width="400px">
      <el-row>
        <el-col :span="24" style="margin-bottom: 16px;">
          <div class="search_thing">
            <div class="search_label">判定规则:</div>
            <div class="search_input" style="display: flex;align-items: center;">
              <!-- <el-input size="small" placeholder="请输入" clearable v-model="addInfo.rule"></el-input> -->
              <el-radio-group v-model="addInfo.rule" size="small" style="width: 60%;">
                <el-radio label="不考虑不确定度">不考虑不确定度</el-radio>
                <el-radio label="考虑不确定度">考虑不确定度</el-radio>
              </el-radio-group>
              <el-input v-model="addInfo.num" placeholder="请输入" v-if="addInfo.rule=='考虑不确定度'" size="small" style="width: 80px;margin-right: 10px;"></el-input>
              <span v-if="addInfo.rule=='考虑不确定度'"> %</span>
            </div>
          </div>
        </el-col>
        <el-col :span="24" style="margin-bottom: 16px;">
          <div class="search_thing">
            <div class="search_label">综合室签名人:</div>
            <div class="search_input">
              <el-select v-model="addInfo.comprehensiveUser" placeholder="请选择" size="small" style="width: 100%;">
                <el-option
                  v-for="item in personList"
                  :key="item.value"
                  :label="item.label"
                  :value="item.value">
                </el-option>
              </el-select>
            </div>
          </div>
        </el-col>
        <el-col :span="24" style="margin-bottom: 16px;">
          <div class="search_thing">
            <div class="search_label">接收日期:</div>
            <div class="search_input">
              <el-date-picker
                v-model="addInfo.comprehensiveTime"
                type="date"
                size="small"
                placeholder="选择日期"
                format="yyyy-MM-dd"
                value-format="yyyy-MM-dd" style="width: 100%;">
              </el-date-picker>
            </div>
          </div>
        </el-col>
        <el-col :span="24" style="margin-bottom: 16px;">
          <div class="search_thing">
            <div class="search_label">领样员:</div>
            <div class="search_input">
              <el-select v-model="addInfo.issueUser" placeholder="请选择" size="small" style="width: 100%;">
                <el-option
                  v-for="item in personList"
                  :key="item.value"
                  :label="item.label"
                  :value="item.value">
                </el-option>
              </el-select>
            </div>
          </div>
        </el-col>
        <el-col :span="24" style="margin-bottom: 16px;">
          <div class="search_thing">
            <div class="search_label">领样日期:</div>
            <div class="search_input">
              <el-date-picker
                v-model="addInfo.issueTime"
                type="date"
                size="small"
                placeholder="选择日期"
                format="yyyy-MM-dd"
                value-format="yyyy-MM-dd" style="width: 100%;">
              </el-date-picker>
            </div>
          </div>
        </el-col>
      </el-row>
      <span slot="footer" class="dialog-footer">
        <el-button @click="addDialogVisible = false">取 消</el-button>
        <el-button type="primary" @click="handleAdd" :loading="addLoading">确 定</el-button>
      </span>
    </el-dialog>
    <el-dialog
      :title="title"
      :visible.sync="detailDialogVisible" width="900px" top="20px" :class="{downPdf:title=='下载'}" :modal="title!='下载'">
      <div style="max-height: 75vh;overflow-y: auto;">
        <div id="dialogBody">
          <table border="1" class="tables heads" cellpadding="10" style="border: 1px dashed black;">
            <tr>
              <td rowspan="2">
                <img src="../../../static/img/logo2.png" alt="" style="width: 80%;">
              </td>
              <td>
                <p>记录名称:检验委托单</p>
                <p class="en">Record name: Commission List of Testing</p>
              </td>
              <td>
                <p>保存期限:6年</p>
                <p class="en">Record retention:6 years</p>
              </td>
            </tr>
            <tr>
              <td>
                <p>记录编号: ZTT/QR-16-04-a</p>
                <p class="en">Record number: ZTT/QR-16-04-a</p>
              </td>
              <td>
                <p>归档部门:综合室</p>
                <p class="en">Archive department: general office</p>
              </td>
            </tr>
          </table>
          <h4 style="display: flex;align-items: center;flex-direction: column;justify-content: center;">
            <span style="font-size: 28px;">检 验 委 托 单</span>
            <span>Commission List of Testing</span>
          </h4>
          <p style="margin-top: 16px;margin-left: 600px;">委托编号:{{ currentInfo.entrustCode }}</p>
          <p style="margin-left: 600px;" class="en">Report No:{{ currentInfo.entrustCode }}</p>
          <table border="1" class="tables" cellpadding="10">
            <tr>
              <td colspan="2">
                <p>试样名称</p>
                <p class="en">Sample name</p>
              </td>
              <td>{{ currentInfo.sample }}</td>
              <td>
                <p>委托时间</p>
                <p class="en">Commission date</p>
              </td>
              <td>{{ currentInfo.createTime }}</td>
            </tr>
            <tr>
              <td colspan="2">
                <p>型 号</p>
                <p class="en">Model NO.</p>
              </td>
              <td>{{ currentInfo.sampleType }}</td>
              <td>
                <p>委托单位</p>
                <p class="en">Commission unit</p>
              </td>
              <td>{{ currentInfo.company }}</td>
            </tr>
            <tr>
              <td colspan="2">
                <p>生产单位</p>
                <p class="en">Production unit</p>
              </td>
              <td>{{ currentInfo.production }}</td>
              <td>
                <p>委托人</p>
                <p class="en">Commission by</p>
              </td>
              <td>{{ currentInfo.prepareUser }}</td>
            </tr>
            <tr>
              <td colspan="2">
                <p>样品数量</p>
                <p class="en">Quantity</p>
              </td>
              <td>{{ currentInfo.sampleNum }}</td>
              <td>
                <p>样品状态</p>
                <p class="en">Sample status</p>
              </td>
              <td>{{ insStateList.find(m=>m.value==currentInfo.insState)?insStateList.find(m=>m.value==currentInfo.insState).label:'/' }}</td>
            </tr>
            <tr>
              <td colspan="2">
                <p>是否留样</p>
                <p class="en">Reserve sample or not</p>
              </td>
              <td>
                <span v-if="currentInfo.isLeave==1">是 <span class="en" >Yes</span></span>
                <span v-else>否 <span class="en">No</span></span>
              </td>
              <td>
                <p>样品处理方式</p>
                <p class="en">Sample treatment</p>
              </td>
              <td>
                <span v-if="currentInfo.processing==0">委托单位取回 <span class="en">Taken away by commission unit</span></span>
                <span v-else>实验室处理 <span class="en">Laboratory treatment</span></span>
              </td>
            </tr>
            <tr>
              <td colspan="2">
                <p>约定完成时间(报告日期)</p>
                <p class="en">Agreed completion time</p>
              </td>
              <td>{{ currentInfo.appointed }}</td>
              <td>
                <p>报告发送方式</p>
                <p class="en">Way of report sending</p>
              </td>
              <td>
                <span v-if="currentInfo.send==1">自取 <span class="en">Taken by themselves</span></span>
                <span v-else>其他 <span class="en">Other:</span></span>
              </td>
            </tr>
            <tr>
              <td>
                <p>序号</p>
                <p class="en">NO.</p>
              </td>
              <td>
                <p>样品编号</p>
                <p class="en">Sample number</p>
              </td>
              <td>
                <p>试验项目</p>
                <p class="en">Test item</p>
              </td>
              <td>
                <p>检验依据</p>
                <p class="en">Test standard</p>
              </td>
              <td>
                <p>备注</p>
                <p class="en">Note</p>
              </td>
            </tr>
            <tr v-for="(item,index) in currentInfo.sampleItems
    " :key="index" >
              <td>{{ index+1 }}</td>
              <td>
                <p>{{ item.code }}</p>
                <p>{{ item.model }}</p>
              </td>
              <td>{{ item.product }}</td>
              <td>{{ item.standardMethodList }}</td>
              <td>{{ item.remark }}</td>
            </tr>
            <tr>
              <td colspan="2">
                <p>判定规则</p>
                <p class="en">Criterion rule</p>
              </td>
              <td colspan="3">
                <span v-if="currentInfo.rule&&!currentInfo.rule.includes('-')">不考虑不确定度 <span class="en">Not considering uncertainty</span></span>
                <span v-else-if="currentInfo.rule&&currentInfo.rule.includes('-')">考虑不确定度 <span class="en">Consider uncertainty ( {{currentInfo.rule.split('-')[1]}}%)</span></span>
                <span v-else>/</span>
              </td>
            </tr>
            <tr>
              <td colspan="2">
                <p>委托人签名</p>
                <p class="en">Signature of consignor</p>
              </td>
              <td>
                <img style="height: 100%;" :src="javaApi+'/img/'+currentInfo.prepareUserUrl" :alt="currentInfo.prepareUser" />
              </td>
              <td>
                <p>委托日期</p>
                <p class="en">Date of consignation</p>
              </td>
              <td>{{ currentInfo.createTime }}</td>
            </tr>
            <tr>
              <td colspan="2">
                <p>委托人联系电话</p>
                <p class="en">Contact number</p>
              </td>
              <td colspan="3">{{ currentInfo.phone }}</td>
            </tr>
            <tr>
              <td colspan="2">
                <p>综合室签名</p>
                <p class="en">Signature of general office</p>
              </td>
              <td><img style="height: 100%;" :src="javaApi+'/img/'+currentInfo.comprehensiveUserUrl" :alt="currentInfo.comprehensiveUser" /></td>
              <td>
                <p>接收日期</p>
                <p class="en">Receipt date</p>
              </td>
              <td>{{ currentInfo.comprehensiveTime }}</td>
            </tr>
            <tr>
              <td colspan="2">
                <p>领样员签名</p>
                <p class="en">Signature of sample taker</p>
              </td>
              <td><img :src="javaApi+'/img/'+currentInfo.issueUserUrl" :alt="currentInfo.issueUser" style="height: 100%;" /></td>
              <td>
                <p>领样日期</p>
                <p class="en">Sample date</p>
              </td>
              <td>{{ currentInfo.issueTime }}</td>
            </tr>
            <tr>
              <td rowspan="3" colspan="2">
                <p>检测机构信息</p>
                <p class="en">Information about Test center</p>
              </td>
              <td colspan="3">
                <p>江苏中天科技股份有限公司检测中心</p>
                <p class="en">Test cnter of Jiangsu ZhongtianTechnology CO.,Ltd</p>
              </td>
            </tr>
            <tr>
              <td colspan="3">
                <p>地址:江苏省如东县河口镇中天路1号</p>
                <p class="en">Address:No.1,Zhongtian Village,Hekou Town,Rudong County,Nantong City,JiangsuProvince</p>
              </td>
            </tr>
            <tr>
              <td colspan="3">
                <p>电话:0513-84885175</p>
                <p class="en">Telephone:0513-84885175</p>
              </td>
            </tr>
          </table>
          <p style="margin-top: 10px;margin-left: 20px;">注:本检验委托单一式二份,一份综合室归档,一份委托单位留存。</p>
          <p class="en" style="margin-left: 20px;">Note:The commission list of testing is done in duplicate, general office and client shall retain their respective one.</p>
        </div>
      </div>
    </el-dialog>
  </div>
</template>
 
<script>
import ValueTable from '../tool/value-table.vue'
export default {
  components: {
    ValueTable
  },
  data() {
    return {
      title:'检验委托单',
      detailDialogVisible:false,
      addLoading:false,
      addDialogVisible:false,
      outLoading:false,
      componentData: {
        entity: {
          sample: null,
          company: null,
          production:null,
          prepareUser:null,
          orderBy: {
            field: 'createTime',
            order: 'desc'
          }
        },
        isIndex: true,
        showSelect: false,
        select: false,
        do: [{
          id: 'handleLook',
          font: '查看',
          type: 'text',
          method: 'handleLook'
        }, {
          id: 'handleDown',
          font: '下载',
          type: 'text',
          method: 'handleDown'
        }, {
          id: 'delete',
          font: '删除',
          type: 'text',
          method: 'doDiy'
        }, {
          id: 'handleWork',
          font: '补充信息',
          type: 'text',
          method: 'handleWork'
        }],
        tagField: {
          insState:{
            select: [
            {
              label: '待审核',
              value: 0
            }, {
              label: '待检验',
              value: 1
            },
            {
              label: '已检验',
              value: 4
            },
            {
              label: '退回',
              value: 2
            },
            {
              label: '撤销',
              value: 3
            },
            ]
          },
          isLeave:{
            select: [
              {
                value:0,
                label:'不留样'
              },
              {
                value:1,
                label:'留样'
              },
            ]
          },
          processing:{
            select: [
            {
                value:0,
                label:'委托单位取回'
              },
              {
                value:1,
                label:'实验室处理'
              },
            ]
          },
        },
        selectField: {
          sendUser:{
            select: []
          },
          signatory:{
            select: []
          },
        },
        requiredAdd: [],
        requiredUp: [],
        needSort: [],
        inputType: ''
      },
      entityCopy: {},
      upIndex: 0,
      currentInfo:{},
      personList:[],
      addInfo:{},
      insStateList:[
      {
        label: '待审核',
        value: 0
      }, {
        label: '待检验',
        value: 1
      },
      {
        label: '已检验',
        value: 4
      },
      {
        label: '退回',
        value: 2
      },
      {
        label: '撤销',
        value: 3
      },
      ]
    };
  },
  mounted() {
    this.entityCopy = this.HaveJson(this.componentData.entity);
    this.getPower()
    this.getAuthorizedPerson()
  },
  methods: {
    getPower(){
      let power = JSON.parse(sessionStorage.getItem('power'))
      let del = false
      for (var i = 0; i < power.length; i++) {
        if (power[i].menuMethod == 'delProcessOrder') {
          del = true
        }
      }
      if (!del) {
        this.componentData.do.splice(2, 1)
      }
    },
    refreshTable() {
      this.$refs['ValueTable'].selectList()
    },
    refresh() {
      this.componentData.entity = this.HaveJson(this.entityCopy)
      this.upIndex++
      this.refreshTable()
    },
    // 导出
    handleDown(row) {
      // this.$axios.post(this.$api.processOrder.getProcessOrder,{id:row.id}).then(res => {
      //   if(res.code==200){
      //     this.currentInfo = res.data
      //     this.title = '下载';
      //     this.detailDialogVisible = true
      //     setTimeout(() => {
      //     this.$nextTick(() => {
      //       const element = document.getElementById("dialogBody");
      //       exportHtmlToPDF(element,row.sample+'-'+row.sampleType+'-'+'检验委托单').then(res=>{
      //         this.detailDialogVisible = false
      //       })
      //     })
      //   }, 500);
      //   }
      // }).catch(err => {
      // })
      this.$axios.post(this.$api.processOrder.exportInspectionOrder,{id:row.id},{responseType: 'blob'}).then(res => {
        this.$message.success('导出成功')
        const blob = new Blob([res], {
          type: 'application/force-download'
        })
        const filename = decodeURI(row.sample+'-'+row.sampleType+'-'+'检验委托单.docx')
        // 创建一个超链接,将文件流赋进去,然后实现这个超链接的单击事件
        const elink = document.createElement('a')
        elink.download = filename
        elink.style.display = 'none'
        elink.href = URL.createObjectURL(blob)
        document.body.appendChild(elink)
        elink.click();
        URL.revokeObjectURL(elink.href) // 释放URL 对象
        document.body.removeChild(elink)
      }).catch(err => {
      })
    },
    // 补充
    handleWork(row){
      this.addInfo = {...row}
      this.currentInfo = row;
      this.addDialogVisible = true;
    },
    // 人员列表
    getAuthorizedPerson() {
      this.$axios.get(this.$api.user.getUserMenu).then(res => {
        let data = []
        res.data.forEach(a => {
          data.push({
            label: a.name,
            value: a.id
          })
        })
        this.personList = data
      })
    },
    // 补充保存
    handleAdd(){
      if(this.addInfo.rule=='考虑不确定度'&&!this.addInfo.num){
        return this.$message({
          type: 'error',
          message: '请输入考虑不确定度'
        });
      }else if(this.addInfo.rule=='考虑不确定度'&&this.addInfo.num){
        this.addInfo.rule = '考虑不确定度-'+this.addInfo.num
      }
      this.addLoading = true;
      this.$axios.post(this.$api.processOrder.doProcessOrder, {id:this.currentInfo.id,...this.addInfo},{headers: { 'Content-Type': 'application/json' },noQs:true}).then(res => {
        this.addLoading = false;
        if(res.code==201){
          return
        }
        this.$message({
          type: 'success',
          message: '补充成功'
        });
        this.refreshTable()
        this.addDialogVisible = false;
      }).catch(err => {
      })
    },
    // 查看
    handleLook(row){
      this.$axios.post(this.$api.processOrder.getProcessOrder,{id:row.id}).then(res => {
        if(res.code==200){
          this.currentInfo = res.data
          this.title = '检验委托单';
          this.detailDialogVisible = true
        }
      }).catch(err => {
      })
    },
  },
}
</script>
 
<style scoped>
.title {
    height: 60px;
    line-height: 60px;
  }
  .search {
    background-color: #fff;
    height: 80px;
    display: flex;
    align-items: center;
  }
 
  .search_thing {
    width: 350px;
    display: flex;
    align-items: center;
  }
 
  .search_label {
    width: 110px;
    font-size: 14px;
    text-align: right;
  }
 
  .search_input {
    width: calc(100% - 110px);
  }
 
  .table {
    margin-top: 10px;
    background-color: #fff;
    width: calc(100% - 40px);
    height: calc(100% - 60px - 80px - 10px - 40px);
    padding: 20px;
  }
  .tables {
    table-layout: fixed;
    width: 100%;
    margin-top: 10px;
  }
 
  .tables td {
    height: 40px;
    width: 100px;
    text-align: center;
    font-size: 14px;
    word-wrap: break-word;
    white-space: normal;
  }
  .en{
    font-size: 12px;
    word-break: break-word; /* 自动断行 */
    overflow-wrap: break-word; /* 防止溢出 */
    white-space: normal; /* 默认换行 */
  }
 
  .heads td {
    border: 1px dashed black; /* 单元格的虚线 */
    padding: 8px;
    text-align: left;
  }
  .downPdf{
    opacity: 0 !important;
  }
</style>