|
@@ -7,11 +7,15 @@
|
7
|
7
|
<template slot-scope="scope"><span :title="scope.row.drug_name">{{ scope.row.drug_name }}</span></template>
|
8
|
8
|
</el-table-column>
|
9
|
9
|
|
10
|
|
- <el-table-column align="center" prop="single_dose" width="90" label="单次用量">
|
|
10
|
+ <el-table-column align="center" prop="single_dose" width="120" label="单次用量">
|
11
|
11
|
<template slot-scope="scope">
|
12
|
12
|
<div style="display:flex;align-items:center;">
|
13
|
|
- <el-input v-model="scope.row.single_dose" @input="getSingleDose(scope)" style="width:65%;"></el-input>
|
14
|
|
- <div>{{scope.row.single_dose_unit}}</div>
|
|
13
|
+ <el-input v-model="scope.row.single_dose" @input="getAllChange(scope)" style="width:50%;"></el-input>
|
|
14
|
+ <!-- <div>{{scope.row.single_dose_unit}}</div> -->
|
|
15
|
+ <el-select v-model="scope.row.single_dose_unit" placeholder="请选择" style="width:50%;" @change="getAllChange(scope)">
|
|
16
|
+ <el-option :label="scope.row.drug.min_unit" :value="scope.row.drug.min_unit"></el-option>
|
|
17
|
+ <el-option :label="scope.row.drug.dose_unit" :value="scope.row.drug.dose_unit"></el-option>
|
|
18
|
+ </el-select>
|
15
|
19
|
</div>
|
16
|
20
|
</template>
|
17
|
21
|
</el-table-column>
|
|
@@ -29,7 +33,7 @@
|
29
|
33
|
</el-table-column>
|
30
|
34
|
<el-table-column align="center" prop="execution_frequency" width="100" label="频率">
|
31
|
35
|
<template slot-scope="scope">
|
32
|
|
- <el-select v-model="scope.row.execution_frequency" placehold er="请选择">
|
|
36
|
+ <el-select v-model="scope.row.execution_frequency" placeholder="请选择" @change="getAllChange(scope)">
|
33
|
37
|
<el-option
|
34
|
38
|
v-for="item,index in efs"
|
35
|
39
|
:key="index"
|
|
@@ -44,16 +48,20 @@
|
44
|
48
|
<el-table-column align="center" prop="day" width="70" label="天数">
|
45
|
49
|
<template slot-scope="scope">
|
46
|
50
|
<div style="display:flex;align-items:center;">
|
47
|
|
- <el-input v-model="scope.row.day" @input="getDay(scope)" placeholder=""></el-input>{{'天'}}
|
|
51
|
+ <el-input v-model="scope.row.day" @input="getAllChange(scope)" placeholder=""></el-input>{{'天'}}
|
48
|
52
|
</div>
|
49
|
53
|
</template>
|
50
|
54
|
</el-table-column>
|
51
|
55
|
|
52
|
|
- <el-table-column align="center" prop="prescribing_number" width="80" label="总量">
|
|
56
|
+ <el-table-column align="center" prop="prescribing_number" width="120" label="总量">
|
53
|
57
|
<template slot-scope="scope">
|
54
|
58
|
<div style="display:flex;align-items:center;">
|
55
|
|
- <el-input v-model="scope.row.prescribing_number" style="width:60%" placeholder=""></el-input>
|
56
|
|
- <div> {{scope.row.prescribing_number_unit}}</div>
|
|
59
|
+ <el-input v-model="scope.row.prescribing_number" @input="changePrescribingNumber(scope)" style="width:50%" placeholder=""></el-input>
|
|
60
|
+ <!-- <div> {{scope.row.prescribing_number_unit}}</div> -->
|
|
61
|
+ <el-select v-model="scope.row.prescribing_number_unit" placeholder="请选择" style="width:50%;" @change="getAllChange(scope)">
|
|
62
|
+ <el-option :label="scope.row.drug.min_unit" :value="scope.row.drug.min_unit"></el-option>
|
|
63
|
+ <el-option :label="scope.row.drug.max_unit" :value="scope.row.drug.max_unit"></el-option>
|
|
64
|
+ </el-select>
|
57
|
65
|
</div>
|
58
|
66
|
</template>
|
59
|
67
|
</el-table-column>
|
|
@@ -381,11 +389,50 @@
|
381
|
389
|
.catch(() => {});
|
382
|
390
|
|
383
|
391
|
},
|
384
|
|
- getSingleDose(scope){
|
385
|
|
- this.prescription.advices[scope.$index].prescribing_number = scope.row.single_dose * scope.row.day
|
|
392
|
+ getAllChange(scope){
|
|
393
|
+ if(scope.row.drug.min_unit == scope.row.single_dose_unit){
|
|
394
|
+ if(scope.row.prescribing_number_unit == scope.row.drug.min_unit){
|
|
395
|
+ console.log(1)
|
|
396
|
+ scope.row.prescribing_number = scope.row.single_dose * this.getNum(scope.row.execution_frequency) * scope.row.day
|
|
397
|
+ }else{
|
|
398
|
+ console.log(12)
|
|
399
|
+ scope.row.prescribing_number = Math.ceil((scope.row.single_dose * this.getNum(scope.row.execution_frequency)) * scope.row.day / scope.row.drug.min_number)
|
|
400
|
+ }
|
|
401
|
+ }else{
|
|
402
|
+ if(scope.row.prescribing_number_unit == scope.row.drug.min_unit){
|
|
403
|
+ console.log(123)
|
|
404
|
+ scope.row.prescribing_number = Math.ceil((scope.row.single_dose * this.getNum(scope.row.execution_frequency) * scope.row.day) / scope.row.drug.dose)
|
|
405
|
+ }else{
|
|
406
|
+ console.log(1234)
|
|
407
|
+ scope.row.prescribing_number = Math.ceil((scope.row.single_dose * this.getNum(scope.row.execution_frequency) * scope.row.day) / scope.row.drug.dose / scope.row.drug.min_number)
|
|
408
|
+ }
|
|
409
|
+ }
|
|
410
|
+ if(scope.row.prescribing_number == 0){
|
|
411
|
+ scope.row.prescribing_number = 1
|
|
412
|
+ }
|
|
413
|
+ if(scope.row.prescribing_number_unit == scope.row.drug.min_unit){
|
|
414
|
+ scope.row.retail_price = scope.row.drug.min_price * scope.row.prescribing_number
|
|
415
|
+ if(scope.row.prescribing_number > scope.row.drug.total){
|
|
416
|
+ this.$message.error(scope.row.drug_name + '库存不足')
|
|
417
|
+ }
|
|
418
|
+ }else{
|
|
419
|
+ if((parseInt(scope.row.prescribing_number) * scope.row.drug.min_number) > scope.row.drug.total){
|
|
420
|
+ this.$message.error(scope.row.drug_name + '库存不足')
|
|
421
|
+ }
|
|
422
|
+ scope.row.retail_price = scope.row.drug.retail_price * scope.row.prescribing_number
|
|
423
|
+ }
|
|
424
|
+
|
386
|
425
|
},
|
387
|
|
- getDay(scope){
|
388
|
|
- this.prescription.advices[scope.$index].prescribing_number = scope.row.single_dose * scope.row.day
|
|
426
|
+ changePrescribingNumber(scope){
|
|
427
|
+ if(scope.row.prescribing_number_unit == scope.row.drug.min_unit){
|
|
428
|
+ if(parseInt(scope.row.prescribing_number) > scope.row.drug.total){
|
|
429
|
+ this.$message.error(scope.row.drug_name + '库存不足')
|
|
430
|
+ }
|
|
431
|
+ }else{
|
|
432
|
+ if((parseInt(scope.row.prescribing_number) * scope.row.drug.min_number) > scope.row.drug.total){
|
|
433
|
+ this.$message.error(scope.row.drug_name + '库存不足')
|
|
434
|
+ }
|
|
435
|
+ }
|
389
|
436
|
},
|
390
|
437
|
getProjectSingleDose(scope){
|
391
|
438
|
this.prescription.project[scope.$index].total = scope.row.single_dose * scope.row.number_days
|
|
@@ -398,25 +445,55 @@
|
398
|
445
|
if(this.prescription.project[scope.$index].total == 0){
|
399
|
446
|
this.prescription.project[scope.$index].total = 1
|
400
|
447
|
}
|
|
448
|
+
|
|
449
|
+ },
|
|
450
|
+ getNum(execution_frequency){
|
|
451
|
+ let arr = [
|
|
452
|
+ {name:'立即执行',count:1},
|
|
453
|
+ {name:'透析时',count:1},
|
|
454
|
+ {name:'透析1h一次',count:1},
|
|
455
|
+ {name:'透析2h一次',count:1},
|
|
456
|
+ {name:'透析3h一次',count:1},
|
|
457
|
+ {name:'每日一次',count:1},
|
|
458
|
+ {name:'每日两次',count:2},
|
|
459
|
+ {name:'每日三次',count:1},
|
|
460
|
+ {name:'每晚一次',count:1},
|
|
461
|
+ {name:'每晚',count:1},
|
|
462
|
+ {name:'上机前',count:1},
|
|
463
|
+ {name:'下机前',count:1},
|
|
464
|
+ {name:'透析后立即',count:1},
|
|
465
|
+ {name:'持续使用',count:1},
|
|
466
|
+ {name:'临时开药',count:1},
|
|
467
|
+ {name:'临睡前',count:1},
|
|
468
|
+ {name:'隔日一次',count:1},
|
|
469
|
+ {name:'隔三日一次',count:1},
|
|
470
|
+ {name:'每二小时一次',count:12},
|
|
471
|
+ {name:'每四小时一次',count:6},
|
|
472
|
+ {name:'每六小时一次',count:4},
|
|
473
|
+ {name:'每八小时一次',count:3},
|
|
474
|
+ ]
|
|
475
|
+ let num = ''
|
|
476
|
+ arr.map(item => {
|
|
477
|
+ if(item.name == execution_frequency){
|
|
478
|
+ num = item.count
|
|
479
|
+ }
|
|
480
|
+ })
|
|
481
|
+ if(num == ''){
|
|
482
|
+ num = 1
|
|
483
|
+ }
|
|
484
|
+ return num
|
401
|
485
|
}
|
402
|
486
|
},mounted(){
|
403
|
487
|
this.getInitData()
|
404
|
488
|
|
405
|
489
|
},
|
406
|
490
|
watch:{
|
407
|
|
- // "prescription.advices":{
|
408
|
|
- // handler(newVal,oldVal){
|
409
|
|
- // newVal.map(item => {
|
410
|
|
- // item.prescribing_number = item.single_dose * item.day
|
411
|
|
- // if(item.single_dose != oldVal[index].single_dose || item.number_days != oldVal[index].number_days){
|
412
|
|
- // item.total = item.single_dose * item.number_days
|
413
|
|
- // }
|
414
|
|
-
|
415
|
|
-
|
416
|
|
- // })
|
417
|
|
- // },
|
418
|
|
- // deep:true
|
419
|
|
- // },
|
|
491
|
+ "prescription.advices":{
|
|
492
|
+ handler(newVal,oldVal){
|
|
493
|
+
|
|
494
|
+ },
|
|
495
|
+ deep:true
|
|
496
|
+ },
|
420
|
497
|
// "prescription.project":{
|
421
|
498
|
// handler(newVal,oldVal){
|
422
|
499
|
// newVal.map((item,index) => {
|