Browse Source

提交代码

陈少旭 1 year ago
parent
commit
5931cffbe3
1 changed files with 197 additions and 1 deletions
  1. 197 1
      src/xt_pages/outpatientTool/labelPrint.vue

+ 197 - 1
src/xt_pages/outpatientTool/labelPrint.vue View File

@@ -47,11 +47,16 @@
47 47
 
48 48
                   <el-checkbox v-model="is_combination_print">是否组合打印</el-checkbox>
49 49
 
50
+<!--                  <el-checkbox v-model="is_combination_print">是否组合打印</el-checkbox>-->
51
+                  <el-button v-if="!is_combination_print" @click="printTwo()">组合打印</el-button>
52
+
50 53
                 </div>
51 54
             </div>
52 55
             <el-table :data="isShow?tableData:tableDataTwo" border :row-style="{ color: '#303133' }" ref="table"
53 56
                       :header-cell-style="{backgroundColor: 'rgb(245, 247, 250)',color: '#606266'}"
57
+                      @selection-change="handleSelectionChange"
54 58
                       highlight-current-row>
59
+              <el-table-column align="center" type="selection" width="55"></el-table-column>
55 60
 
56 61
                 <el-table-column align="center" prop="name" label="患者名字">
57 62
                     <template slot-scope="scope">{{ scope.row.patient_name }}</template>
@@ -216,7 +221,7 @@
216 221
         current_number: '',
217 222
         current_project_name: '',
218 223
         current_name: '',
219
-
224
+        selecting_schs:[],
220 225
         labelVisible: false,
221 226
         crumbs: [
222 227
           { path: false, name: 'HIS工具' },
@@ -244,6 +249,182 @@
244 249
       }
245 250
     },
246 251
     methods: {
252
+      printTwo(){
253
+        let patient_ids = []
254
+        for(let i = 0; i < this.selecting_schs.length; i++){
255
+          patient_ids.push(this.selecting_schs[i].patient_id)
256
+        }
257
+        patient_ids =  this.uniqueTwo(patient_ids)
258
+        if(patient_ids.length != 0 && patient_ids.length > 1){
259
+          this.$message.error("请选择同一患者打印")
260
+          return
261
+        }else{
262
+          let ids = []
263
+          var name = ""
264
+          var patient_name = ""
265
+          var team_ids = ""
266
+          var project_ids = ""
267
+
268
+
269
+          for(let i = 0; i < this.selecting_schs.length; i++){
270
+            ids.push(this.selecting_schs[i].id)
271
+            patient_name = this.selecting_schs[0].patient_name
272
+            if(name.length == 0){
273
+              name = this.selecting_schs[i].project_name
274
+            }else{
275
+              name = name + "," + this.selecting_schs[i].project_name
276
+
277
+            }
278
+
279
+            if(team_ids.length == 0){
280
+              if(this.selecting_schs[i].team_id > 0) {
281
+                team_ids = this.selecting_schs[i].team_id
282
+              }
283
+            }else{
284
+              if(this.selecting_schs[i].team_id > 0) {
285
+                team_ids = team_ids + "," + this.selecting_schs[i].team_id
286
+              }
287
+            }
288
+
289
+            if(project_ids.length == 0){
290
+              if(this.selecting_schs[i].team_id > 0) {
291
+                project_ids = this.selecting_schs[i].project_ids
292
+              }
293
+            }else{
294
+              if(this.selecting_schs[i].team_id > 0) {
295
+                project_ids = project_ids + "," + this.selecting_schs[i].project_ids
296
+              }
297
+            }
298
+          }
299
+          let params = {
300
+            patient_id: patient_ids[0],
301
+            ids: ids,
302
+            record_date:this.chargeDate,
303
+          }
304
+          getPrintLable(params).then(response => {
305
+            if (response.data.state == 0) {
306
+              this.$message.error(response.data.msg)
307
+              return false
308
+            } else {
309
+              this.labelVisible = true
310
+              if(response.data.data.labels.id > 0){
311
+                this.current_ctime = response.data.data.labels.ctime
312
+                this.current_number = ""
313
+                this.current_project_name =name
314
+                this.current_name = patient_name
315
+                this.$nextTick(() => {
316
+                  JsBarcode('#barcode',response.data.data.labels.id, {
317
+                    format: 'CODE39',
318
+                    lineColor: '#000',
319
+                    background: '#EBEEF5',
320
+                    width: 3,
321
+                    height: 200,
322
+                    displayValue: false,
323
+                    fontOptions:"bold italic",//使文字加粗体或变斜体
324
+                    font:"fantasy",//设置文本的字体
325
+                    textAlign:"left",//设置文本的水平对齐方式
326
+                    textPosition:"top",//设置文本的垂直位置
327
+                    textMargin:5,//设置条形码和文本之间的间距
328
+                    fontSize:15,//设置文本的大小
329
+                    margin:15//设置条形码周围的空白边距
330
+                  })
331
+                });
332
+
333
+              }else{
334
+                let params = {
335
+                  is_combination_print:this.is_combination_print,
336
+                  patient_id: patient_ids[0],
337
+                  ids:ids,
338
+                  team_ids:team_ids,
339
+                  project_ids:project_ids,
340
+                  doctor_id:0,
341
+                  is_team:0,
342
+                  record_date:this.chargeDate,
343
+                }
344
+                this.current_params = params
345
+                console.log(this.current_params)
346
+                if(!this.current_params.is_combination_print){
347
+                  if(this.current_params.project_ids.toString().length > 0 && this.current_params.team_ids.toString().length == 0){
348
+                    this.current_params.is_team = 0
349
+                  }else if(this.current_params.project_ids.toString().length == 0 && this.current_params.team_ids.toString().length > 0){
350
+                    this.current_params.is_team= 1
351
+                  }
352
+                }else{
353
+                  this.current_params.is_team = 0
354
+
355
+                }
356
+
357
+
358
+                if(!this.isShow){
359
+                  createPrintLable(this.current_params).then(response => {
360
+                    if (response.data.state == 0) {
361
+                      this.$message.error(response.data.msg)
362
+                      return false
363
+                    } else {
364
+                      this.current_ctime = row.ctime
365
+                      this.current_number = row.number
366
+                      this.current_project_name = row.project_name
367
+                      this.current_name = row.patient_name
368
+                      this.$nextTick(() => {
369
+                        JsBarcode('#barcode',response.data.data.hlpsi.id, {
370
+                          format: 'CODE39',
371
+                          lineColor: '#000',
372
+                          background: '#EBEEF5',
373
+                          width: 3,
374
+                          height: 200,
375
+                          displayValue: false,
376
+                          fontOptions:"bold italic",//使文字加粗体或变斜体
377
+                          font:"fantasy",//设置文本的字体
378
+                          textAlign:"left",//设置文本的水平对齐方式
379
+                          textPosition:"top",//设置文本的垂直位置
380
+                          textMargin:5,//设置条形码和文本之间的间距
381
+                          fontSize:15,//设置文本的大小
382
+                          margin:15//设置条形码周围的空白边距
383
+                        })
384
+
385
+                      });
386
+                    }
387
+                  })
388
+
389
+                }else{
390
+                  createPrintLable(this.current_params).then(response => {
391
+                    if (response.data.state == 0) {
392
+                      this.$message.error(response.data.msg)
393
+                      return false
394
+                    } else {
395
+                      this.current_ctime = row.ctime
396
+                      this.current_number = row.number
397
+                      this.current_project_name = row.project_name
398
+                      this.current_name = row.patient_name
399
+                      this.$nextTick(() => {
400
+                        JsBarcode('#barcode',response.data.data.hlpsi.id, {
401
+                          format: 'CODE39',
402
+                          lineColor: '#000',
403
+                          background: '#EBEEF5',
404
+                          width: 5,
405
+                          height: 300,
406
+                          displayValue: false,
407
+                          fontOptions:"bold italic",//使文字加粗体或变斜体
408
+                          font:"fantasy",//设置文本的字体
409
+                          textAlign:"left",//设置文本的水平对齐方式
410
+                          textPosition:"top",//设置文本的垂直位置
411
+                          textMargin:5,//设置条形码和文本之间的间距
412
+                          fontSize:15,//设置文本的大小
413
+                          margin:15//设置条形码周围的空白边距
414
+                        })
415
+                      });
416
+                    }
417
+                  })
418
+                }
419
+              }
420
+            }
421
+          })
422
+        }
423
+      },
424
+      handleSelectionChange(val) {
425
+        this.selecting_schs = val
426
+        console.log(this.selecting_schs)
427
+      },
247 428
       getDictionaryDataConfig(module, filed_name) {
248 429
         return getDictionaryDataConfig(module, filed_name)
249 430
 
@@ -504,6 +685,21 @@
504 685
           }
505 686
         }
506 687
         return res
688
+      },uniqueTwo(array) {
689
+        // res用来存储结果
690
+        var res = []
691
+        for (var i = 0, arrayLen = array.length; i < arrayLen; i++) {
692
+          for (var j = 0, resLen = res.length; j < resLen; j++) {
693
+            if (array[i] === res[j]) {
694
+              break
695
+            }
696
+          }
697
+          // 如果array[i]是唯一的,那么执行完循环,j等于resLen
698
+          if (j === resLen) {
699
+            res.push(array[i])
700
+          }
701
+        }
702
+        return res
507 703
       },
508 704
       getListTwo() {
509 705
         let params = {