Browse Source

库存显示展示

XMLWAN 2 years ago
parent
commit
ae1aed0aa7
2 changed files with 67 additions and 0 deletions
  1. 46 0
      src/xt_pages/stock/drugs/drugStockFlow.vue
  2. 21 0
      src/xt_pages/stock/stockFlow.vue

+ 46 - 0
src/xt_pages/stock/drugs/drugStockFlow.vue View File

@@ -131,6 +131,21 @@
131 131
               {{getTime(scope.row.expire_date,"{y}-{h}-{d}")}}
132 132
             
133 133
            </template>
134
+        </el-table-column>
135
+         <el-table-column prop="drug_name" label="剩余库存" align="center">
136
+           <template slot-scope="scope">
137
+             {{scope.row.over_count}}
138
+           </template>
139
+        </el-table-column>
140
+        <el-table-column prop="drug_name" label="使用人" align="center">
141
+           <template slot-scope="scope">
142
+             <span > {{getPatientName(scope.row.patient_id)}}</span>
143
+           </template>
144
+        </el-table-column>
145
+        <el-table-column prop="drug_name" label="剩余库存" align="center">
146
+           <template slot-scope="scope">
147
+             <span > {{getDrugCount(scope.row.over_count,scope.row.BaseDrugLib.max_unit,scope.row.BaseDrugLib.min_unit,scope.row.BaseDrugLib.min_number)}}</span>
148
+           </template>
134 149
         </el-table-column>
135 150
         <!-- <el-table-column prop="drug_name" label="批号" align="center">
136 151
            <template slot-scope="scope">
@@ -257,6 +272,7 @@
257 272
         total:0,
258 273
         drug:{},
259 274
         houseList:[],
275
+        patientList:[],
260 276
       }
261 277
     },
262 278
     methods:{
@@ -509,6 +525,7 @@
509 525
             var drug = response.data.data.drug
510 526
            
511 527
             this.drug = drug
528
+            this.patientList = response.data.data.patientList
512 529
 
513 530
             this.houseList = response.data.data.houseList
514 531
           }
@@ -552,6 +569,35 @@
552 569
       }
553 570
       return storehouse_name
554 571
      },
572
+     getPatientName(id){
573
+       var name = ""
574
+       for(let i=0;i<this.patientList.length;i++){
575
+          if(id == this.patientList[i].id){
576
+              name = this.patientList[i].name
577
+          }
578
+       }
579
+       return name
580
+     },
581
+     getDrugCount(total,max_unit,min_unit,min_number){
582
+        var max_str = "";
583
+        var min_str = "";
584
+        if (total < min_number) {
585
+        min_str = total + min_unit;
586
+      }
587
+      if (total == 0) {
588
+        min_str = "";
589
+        max_str = "";
590
+      }
591
+      if (total >= min_number) {
592
+        if (parseInt(total / min_number) != 0) {
593
+          max_str = parseInt(total / min_number) + max_unit;
594
+        }
595
+        if (total % min_number != 0) {
596
+          min_str = (total % min_number) + min_unit;
597
+        }
598
+      }
599
+      return max_str + min_str;
600
+     }
555 601
     }
556 602
   }
557 603
 </script>

+ 21 - 0
src/xt_pages/stock/stockFlow.vue View File

@@ -131,6 +131,16 @@
131 131
              <span > {{getManufacturer(scope.row.manufacturer)}}</span>
132 132
            </template>
133 133
         </el-table-column>
134
+        <el-table-column prop="drug_name" label="使用人" align="center">
135
+           <template slot-scope="scope">
136
+             <span > {{getPatientName(scope.row.patient_id)}}</span>
137
+           </template>
138
+        </el-table-column>
139
+        <el-table-column prop="drug_name" label="剩余库存" align="center">
140
+           <template slot-scope="scope">
141
+             <span > {{scope.row.over_count}}</span>
142
+           </template>
143
+        </el-table-column>
134 144
        </el-table>
135 145
        
136 146
       <el-pagination
@@ -236,6 +246,7 @@
236 246
         cancelCountList:[],
237 247
         good:{},
238 248
         houseList:[],
249
+        patientList:[]
239 250
       }
240 251
     },
241 252
     methods:{
@@ -443,6 +454,7 @@
443 454
            var manufacturerList = response.data.data.manufacturerList
444 455
            this.manufacturerList = manufacturerList
445 456
            this.houseList = response.data.data.houseList
457
+           this.patientList = response.data.data.patients
446 458
           }
447 459
        })
448 460
      },
@@ -469,6 +481,15 @@
469 481
          specification_name = this.good.specification_name
470 482
        }
471 483
        return specification_name
484
+     },
485
+     getPatientName(id){
486
+       var name = ""
487
+       for(let i=0;i<this.patientList.length;i++){
488
+          if(id == this.patientList[i].id){
489
+              name = this.patientList[i].name
490
+          }
491
+       }
492
+       return name
472 493
      }
473 494
     }
474 495
   }