Browse Source

518合并代码

XMLWAN 2 years ago
parent
commit
07537412c1

+ 7 - 5
src/xt_pages/stock/drugs/drugStockOutOrder.vue View File

235
             {{getHouseName(scope.row.storehouse_id)}}
235
             {{getHouseName(scope.row.storehouse_id)}}
236
           </template>
236
           </template>
237
         </el-table-column>
237
         </el-table-column>
238
-
238
+         <!-- <el-table-column label="剩余库存" align="center" v-if="is_sys == 0">
239
+            <template slot-scope="scope">
240
+              {{scope.row.stock_count}}
241
+            </template>
242
+          </el-table-column> -->
239
           <el-table-column label="出库数量" align="center">
243
           <el-table-column label="出库数量" align="center">
240
             <template slot-scope="scope">
244
             <template slot-scope="scope">
241
               <span> {{getTotalCountOne(scope.row.drug_id,scope.row.min_number,scope.row.max_unit,scope.row.min_unit)}}</span>
245
               <span> {{getTotalCountOne(scope.row.drug_id,scope.row.min_number,scope.row.max_unit,scope.row.min_unit)}}</span>
252
               <span v-if="scope.row.price == 0"> {{scope.row.retail_price}}</span>
256
               <span v-if="scope.row.price == 0"> {{scope.row.retail_price}}</span>
253
             </template>
257
             </template>
254
           </el-table-column>
258
           </el-table-column>
255
-          <!-- <el-table-column label="拆零零售价" align="center">
259
+          <!-- <el-table-column label="进货价" align="center" v-if="is_sys == 0">
256
             <template slot-scope="scope">
260
             <template slot-scope="scope">
257
-              {{scope.row.retail_price}}
261
+              {{scope.row.last_price}}
258
             </template>
262
             </template>
259
           </el-table-column> -->
263
           </el-table-column> -->
260
           <el-table-column label="总价" align="center">
264
           <el-table-column label="总价" align="center">
1010
          }
1014
          }
1011
          if(is_sys == 0 || is_sys == 12){
1015
          if(is_sys == 0 || is_sys == 12){
1012
             var flowlist = response.data.data.flowlist
1016
             var flowlist = response.data.data.flowlist
1013
-            console.log("flowlist233232232323233223",flowlist)
1014
             this.drugFlowList = []
1017
             this.drugFlowList = []
1015
             for(let i=0;i<flowlist.length;i++){
1018
             for(let i=0;i<flowlist.length;i++){
1016
               if(flowlist[i].count_unit == flowlist[i].max_unit){
1019
               if(flowlist[i].count_unit == flowlist[i].max_unit){
1022
               }
1025
               }
1023
             }
1026
             }
1024
             this.drugFlowList = flowlist
1027
             this.drugFlowList = flowlist
1025
-            console.log("this.drugFlowList32323232322323323232322323我的",flowlist)
1026
 
1028
 
1027
          }
1029
          }
1028
 
1030
 

+ 169 - 6
src/xt_pages/stock/drugs/drugStockOutOrderAdd.vue View File

117
               </el-form-item>
117
               </el-form-item>
118
             </template>
118
             </template>
119
           </el-table-column>
119
           </el-table-column>
120
+
121
+
122
+          <!-- <el-table-column width="150" align="center">
123
+            <template slot="header" slot-scope="scope">
124
+              <span>剩余库存</span>
125
+            </template>
126
+            <template slot-scope="scope">
127
+              <el-form-item
128
+                :rules="tableRules.stock_count"
129
+                style="padding-top: 20px"
130
+              >
131
+                <div>
132
+                  <el-input
133
+                    :disabled="true"
134
+                    style="width:120px"
135
+                    placeholder="剩余库存"
136
+                    v-model="scope.row.stock_count"
137
+                  ></el-input>
138
+                </div>
139
+              </el-form-item>
140
+            </template>
141
+          </el-table-column> -->
120
           
142
           
121
           <el-table-column width="200" align="center">
143
           <el-table-column width="200" align="center">
122
             <template slot="header" slot-scope="scope">
144
             <template slot="header" slot-scope="scope">
130
               >
152
               >
131
                 <div style="display:flex;">
153
                 <div style="display:flex;">
132
                   <el-input
154
                   <el-input
155
+                    @input="getSupplyCount(scope.row.count,scope.row.max_unit,scope.row.min_number,scope.$index,scope.row.total_count,scope.row.max_unit_fisrt,scope.row.min_unit_fisrt)"
133
                     oninput="value=value.replace(/\D|^0/g,'')"
156
                     oninput="value=value.replace(/\D|^0/g,'')"
134
                     style="width:80px"
157
                     style="width:80px"
135
                     placeholder="请输入出库数量"
158
                     placeholder="请输入出库数量"
136
                     type="number"
159
                     type="number"
137
                     v-model="scope.row.count"
160
                     v-model="scope.row.count"
138
                   ></el-input>
161
                   ></el-input>
139
-                  <el-select v-model="scope.row.max_unit" filterable placeholder="请选择单位" style="width:80px" @change="changeUnit(scope.row)">
162
+                  <el-select v-model="scope.row.max_unit" filterable placeholder="请选择单位" style="width:80px" @change="changeUnit(scope.row,scope.$index)">
140
                     <el-option
163
                     <el-option
141
                       v-for="(option, index) in unitList"
164
                       v-for="(option, index) in unitList"
142
                       :key="index"
165
                       :key="index"
164
             </template>
187
             </template>
165
           </el-table-column>
188
           </el-table-column>
166
 
189
 
190
+           <!-- <el-table-column width="120" align="center">
191
+            <template slot="header" slot-scope="scope">
192
+              <span>进货价</span>
193
+            </template>
194
+            <template slot-scope="scope">
195
+            
196
+              <el-form-item
197
+                :rules="tableRules.last_price"
198
+                style="padding-top: 20px"
199
+              >
200
+                <el-input
201
+                 :disabled="true"
202
+                  placeholder="进货价"
203
+                  type="number"
204
+                  v-model="scope.row.last_price"
205
+                ></el-input>
206
+              </el-form-item>
207
+            </template>
208
+          </el-table-column> -->
209
+
167
           <el-table-column width="120" align="center">
210
           <el-table-column width="120" align="center">
168
             <template slot="header" slot-scope="scope">
211
             <template slot="header" slot-scope="scope">
169
               <span>出货价<span style="color: red">*</span></span>
212
               <span>出货价<span style="color: red">*</span></span>
454
       tempObj["dealer"] = ""
497
       tempObj["dealer"] = ""
455
       tempObj['manufacturer'] = ''
498
       tempObj['manufacturer'] = ''
456
       tempObj["admin_user_id"] =  this.$store.getters.xt_user.user.user_name
499
       tempObj["admin_user_id"] =  this.$store.getters.xt_user.user.user_name
500
+      tempObj["last_price"] = ""
501
+      tempObj["stock_count"] = ""
502
+      tempObj["total_count"] = 0
503
+      tempObj["max_unit_fisrt"] = 0
504
+      tempObj["min_unit_fisrt"] = 0
457
       this.recordInfo.recordData.push(tempObj);
505
       this.recordInfo.recordData.push(tempObj);
458
     },
506
     },
459
     handleDelete: function(index, row) {
507
     handleDelete: function(index, row) {
590
 
638
 
591
             }
639
             }
592
 
640
 
641
+            this.recordInfo.recordData[i].last_price = this.recordInfo.recordData[i].last_price.toString()
642
+            this.recordInfo.recordData[i].stock_count = this.recordInfo.recordData[i].stock_count.toString()
643
+
593
           }
644
           }
594
           const params = {
645
           const params = {
595
             stockOut: this.recordInfo.recordData
646
             stockOut: this.recordInfo.recordData
596
           };
647
           };
597
        
648
        
598
-          console.log("parasm2233223233232233232",params)
599
-        
600
           const loading = this.$loading({
649
           const loading = this.$loading({
601
             lock: true,
650
             lock: true,
602
             text: 'Loading',
651
             text: 'Loading',
696
         this.currentIndex = val
745
         this.currentIndex = val
697
       },
746
       },
698
       handleSelect(val){
747
       handleSelect(val){
748
+       
699
         var arr = []
749
         var arr = []
750
+
700
          for(let i=0;i<this.recordInfo.recordData.length;i++){
751
          for(let i=0;i<this.recordInfo.recordData.length;i++){
701
             arr.push(this.recordInfo.recordData[i].drug_id)
752
             arr.push(this.recordInfo.recordData[i].drug_id)
702
          }
753
          }
707
             return
758
             return
708
          }
759
          }
709
          this.getDrugBatchNumber(val.id)
760
          this.getDrugBatchNumber(val.id)
761
+        
762
+        var str_count = ""
763
+        var total_count = 0
764
+        for(let i=0;i<val.drug_warehouse_info.length;i++){
765
+           if(val.max_unit == val.drug_warehouse_info[i].max_unit){
766
+             val.drug_warehouse_info[i].stock_max_number = val.drug_warehouse_info[i].stock_max_number * val.min_number
767
+           }
768
+        }
769
+       
770
+       str_count =  this.getWarehoseInfo(val.drug_warehouse_info,val.max_unit,val.min_unit,val.min_number)
771
+       total_count = this.getWarehoseInfoTwo(val.drug_warehouse_info)
772
+     
710
         for(let i=0;i<this.recordInfo.recordData.length;i++){
773
         for(let i=0;i<this.recordInfo.recordData.length;i++){
711
           if(this.currentIndex == i){
774
           if(this.currentIndex == i){
712
             this.recordInfo.recordData[i].drug_id = val.id
775
             this.recordInfo.recordData[i].drug_id = val.id
721
             this.recordInfo.recordData[i].number = val.number
784
             this.recordInfo.recordData[i].number = val.number
722
             this.recordInfo.recordData[i].unit = val.max_unit
785
             this.recordInfo.recordData[i].unit = val.max_unit
723
             this.recordInfo.recordData[i].retail_price = val.retail_price
786
             this.recordInfo.recordData[i].retail_price = val.retail_price
787
+            this.recordInfo.recordData[i].last_price = val.last_price
788
+            this.recordInfo.recordData[i].stock_count = str_count
789
+            this.recordInfo.recordData[i].total_count = total_count
790
+            this.recordInfo.recordData[i].max_unit_fisrt = val.max_unit
791
+            this.recordInfo.recordData[i].min_unit_fisrt = val.min_unit
724
             if(val.retail_price == 0){
792
             if(val.retail_price == 0){
725
               this.recordInfo.recordData[i].price = ""
793
               this.recordInfo.recordData[i].price = ""
726
             }else{
794
             }else{
754
            }
822
            }
755
         })
823
         })
756
       },
824
       },
757
-      changeUnit(val){
758
-       
825
+      changeUnit(val,index){
826
+        console.log("vla33232233232323232",val)
827
+
759
         this.getDrugBatchNumber(val.drug_id)
828
         this.getDrugBatchNumber(val.drug_id)
760
         for(let i=0;i<this.recordInfo.recordData.length;i++){
829
         for(let i=0;i<this.recordInfo.recordData.length;i++){
761
           if(this.recordInfo.recordData[i].drug_id == val.drug_id){
830
           if(this.recordInfo.recordData[i].drug_id == val.drug_id){
773
             }
842
             }
774
           }
843
           }
775
         }
844
         }
776
-        console.log('23323223333233232',this.recordInfo.recordData)
845
+
846
+        var count_total = 0
847
+        if(val.max_unit == val.max_unit_fisrt){
848
+          count_total = val.count * val.min_number
849
+        }
850
+
851
+        if(val.max_unit == val.min_unit_fisrt){
852
+          count_total = val.count 
853
+        }
854
+        if(count_total > val.total_count){
855
+          this.$message.error("出库数量不能大于剩余库存")
856
+          for(let i=0;i<this.recordInfo.recordData.length;i++){
857
+            if(index == i){
858
+                this.recordInfo.recordData[i].count = ""
859
+            }
860
+          }
861
+        }else{
862
+          for(let i=0;i<this.recordInfo.recordData.length;i++){
863
+            if(index == i){
864
+                this.recordInfo.recordData[i].count = val.count
865
+            }
866
+          } 
867
+        }
868
+     
869
+
870
+       
777
       },
871
       },
778
       changeBatchNumber(val){
872
       changeBatchNumber(val){
779
        
873
        
788
               }
882
               }
789
             }
883
             }
790
         }
884
         }
885
+      },
886
+
887
+     getWarehoseInfo(arr, max_unit, min_unit, min_number) {
888
+      var total = 0;
889
+      var max_str = "";
890
+      var min_str = "";
891
+      if (arr.length > 0) {
892
+        for (let i = 0; i < arr.length; i++) {
893
+
894
+          total += parseInt(arr[i].stock_max_number+ arr[i].stock_min_number);
895
+        }
896
+      }
897
+      if (total < min_number) {
898
+        min_str = total + min_unit;
899
+      }
900
+      if (total == 0) {
901
+        min_str = "";
902
+        max_str = "";
903
+      }
904
+      if (total >= min_number) {
905
+        if (parseInt(total / min_number) != 0) {
906
+          max_str = parseInt(total / min_number) + max_unit;
907
+        }
908
+        if (total % min_number != 0) {
909
+          min_str = (total % min_number) + min_unit;
910
+        }
911
+      }
912
+      return max_str + min_str;
913
+    },
914
+    getWarehoseInfoTwo(arr){
915
+      var total = 0;
916
+      if (arr.length > 0) {
917
+        for (let i = 0; i < arr.length; i++) {
918
+          total += parseInt(arr[i].stock_max_number+ arr[i].stock_min_number);
919
+        }
920
+      }
921
+      return total
922
+    },
923
+    getSupplyCount(count,max_unit,min_number,index,total_count,max_unit_fisrt,min_unit_fisrt){
924
+     
925
+      var count_total = 0
926
+      if(max_unit == max_unit_fisrt){
927
+        count_total = count * min_number
928
+      }
929
+
930
+      if(max_unit == min_unit_fisrt){
931
+        count_total = count 
932
+      }
933
+
934
+      if(count_total > total_count){
935
+        this.$message.error("出库数量不能大于剩余库存")
936
+        for(let i=0;i<this.recordInfo.recordData.length;i++){
937
+           if(index == i){
938
+              this.recordInfo.recordData[i].count = ""
939
+           }
940
+        }
941
+      }else{
942
+        for(let i=0;i<this.recordInfo.recordData.length;i++){
943
+           if(index == i){
944
+              this.recordInfo.recordData[i].count = count
945
+           }
946
+        } 
791
       }
947
       }
948
+     console.log("count_toal23233232",count_total)
949
+    }
792
   },
950
   },
793
   created() {
951
   created() {
794
     this.drugTypeList = getDictionaryDataConfig('system','drug_type') 
952
     this.drugTypeList = getDictionaryDataConfig('system','drug_type') 
821
     tempObj["count"] = ""
979
     tempObj["count"] = ""
822
     tempObj["admin_user_id"] =  this.$store.getters.xt_user.user.user_name
980
     tempObj["admin_user_id"] =  this.$store.getters.xt_user.user.user_name
823
     tempObj["retail_price"] = 0;
981
     tempObj["retail_price"] = 0;
982
+    tempObj["last_price"] = ""
983
+    tempObj["stock_count"] = ""
984
+    tempObj["total_count"] = 0
985
+    tempObj["max_unit_fisrt"] = 0
986
+    tempObj["min_unit_fisrt"] = 0
824
     this.recordInfo.recordData.push(tempObj);
987
     this.recordInfo.recordData.push(tempObj);
825
     this.GetConfigInfo();
988
     this.GetConfigInfo();
826
     this.propForm.goodUnit = this.$store.getters.good_unit;
989
     this.propForm.goodUnit = this.$store.getters.good_unit;

+ 138 - 2
src/xt_pages/stock/drugs/drugStockOutOrderEdit.vue View File

126
                   </el-form-item>
126
                   </el-form-item>
127
               </template>
127
               </template>
128
           </el-table-column> -->
128
           </el-table-column> -->
129
+<!--          
130
+         <el-table-column width="150" align="center">
131
+            <template slot="header" slot-scope="scope">
132
+              <span>剩余库存</span>
133
+            </template>
134
+            <template slot-scope="scope">
135
+              <el-form-item
136
+                :rules="tableRules.stock_count"
137
+                style="padding-top: 20px"
138
+              >
139
+                <div>
140
+                  <el-input
141
+                    :disabled="true"
142
+                    style="width:120px"
143
+                    placeholder="剩余库存"
144
+                    v-model="scope.row.stock_count"
145
+                  ></el-input>
146
+                </div>
147
+              </el-form-item>
148
+            </template>
149
+          </el-table-column> -->
129
            <el-table-column width="200" align="center">
150
            <el-table-column width="200" align="center">
130
             <template slot="header" slot-scope="scope">
151
             <template slot="header" slot-scope="scope">
131
               <span>出库数量<span style="color: red">*</span></span>
152
               <span>出库数量<span style="color: red">*</span></span>
138
               >
159
               >
139
                 <div style="display:flex;">
160
                 <div style="display:flex;">
140
                   <el-input
161
                   <el-input
162
+                   @input="getSupplyCount(scope.row.count,scope.row.max_unit,scope.row.min_number,scope.$index,scope.row.total_count,scope.row.max_unit_fisrt,scope.row.min_unit_fisrt)"
141
                    oninput="value=value.replace(/\D|^0/g,'')"
163
                    oninput="value=value.replace(/\D|^0/g,'')"
142
                    style="width:100px"
164
                    style="width:100px"
143
                    :disabled="drug_show"
165
                    :disabled="drug_show"
144
                     placeholder="请输入出库数量"
166
                     placeholder="请输入出库数量"
145
                     type="number"
167
                     type="number"
146
                     v-model="scope.row.count"
168
                     v-model="scope.row.count"
169
+
147
                   ></el-input>
170
                   ></el-input>
148
                   <el-select v-model="scope.row.count_unit" filterable placeholder="请选择单位" style="width:80px" :disabled="unitShow">
171
                   <el-select v-model="scope.row.count_unit" filterable placeholder="请选择单位" style="width:80px" :disabled="unitShow">
149
                     <el-option
172
                     <el-option
170
                </el-select>
193
                </el-select>
171
             </template>
194
             </template>
172
           </el-table-column>
195
           </el-table-column>
196
+        
197
+          <!-- <el-table-column width="120" align="center">
198
+            <template slot="header" slot-scope="scope">
199
+              <span>进货价</span>
200
+            </template>
201
+            <template slot-scope="scope">
202
+            
203
+              <el-form-item
204
+                :rules="tableRules.last_price"
205
+                style="padding-top: 20px"
206
+              >
207
+                <el-input
208
+                 :disabled="true"
209
+                  placeholder="进货价"
210
+                  type="number"
211
+                  v-model="scope.row.last_price"
212
+                ></el-input>
213
+              </el-form-item>
214
+            </template>
215
+          </el-table-column> -->
173
          <el-table-column width="120" align="center">
216
          <el-table-column width="120" align="center">
174
             <template slot="header" slot-scope="scope">
217
             <template slot="header" slot-scope="scope">
175
               <span>出货价<span style="color: red">*</span></span>
218
               <span>出货价<span style="color: red">*</span></span>
486
         tempObj['drug_id'] = 0
529
         tempObj['drug_id'] = 0
487
         tempObj['retail_price'] = ''
530
         tempObj['retail_price'] = ''
488
         tempObj['count'] = ''
531
         tempObj['count'] = ''
532
+        tempObj['max_unit'] = ''
533
+        tempObj['min_unit'] = ''
489
         tempObj['price'] = ''
534
         tempObj['price'] = ''
490
         tempObj['remark'] = ''
535
         tempObj['remark'] = ''
491
         tempObj['batch_number'] = ''
536
         tempObj['batch_number'] = ''
492
         tempObj['number'] = ''
537
         tempObj['number'] = ''
493
-        tempObj['count_unit'] = ""
538
+        tempObj['count_unit'] = ''
494
         tempObj['dealer'] = ""
539
         tempObj['dealer'] = ""
495
         tempObj['manufacturer'] = ""
540
         tempObj['manufacturer'] = ""
496
         tempObj['warehouse_info_id'] = 0
541
         tempObj['warehouse_info_id'] = 0
497
         tempObj["admin_user_id"] =  this.$store.getters.xt_user.user.user_name
542
         tempObj["admin_user_id"] =  this.$store.getters.xt_user.user.user_name
543
+        tempObj["last_price"] = ""
544
+        tempObj["stock_count"] = ""
545
+        tempObj["total_count"] = 0
546
+        tempObj["max_unit_fisrt"] = 0
547
+        tempObj["min_unit_fisrt"] = 0
498
         this.recordInfo.recordData.push(tempObj)
548
         this.recordInfo.recordData.push(tempObj)
499
       }, handleDelete: function(index, row) {
549
       }, handleDelete: function(index, row) {
500
         if(parseInt(this.$route.query.is_sys) == 12){
550
         if(parseInt(this.$route.query.is_sys) == 12){
645
                   }
695
                   }
646
 
696
 
647
                }
697
                }
698
+               this.recordInfo.recordData[i].last_price = this.recordInfo.recordData[i].last_price.toString()
699
+               this.recordInfo.recordData[i].stock_count = this.recordInfo.recordData[i].stock_count.toString()
648
             }
700
             }
649
             const loading = this.$loading({
701
             const loading = this.$loading({
650
               lock: true,
702
               lock: true,
720
               response.data.data.list[i].price = response.data.data.list[i].price.toString()
772
               response.data.data.list[i].price = response.data.data.list[i].price.toString()
721
               response.data.data.list[i].retail_price = response.data.data.list[i].price.toString()
773
               response.data.data.list[i].retail_price = response.data.data.list[i].price.toString()
722
               response.data.data.list[i].count = response.data.data.list[i].count.toString()
774
               response.data.data.list[i].count = response.data.data.list[i].count.toString()
775
+
776
+            
723
               if(response.data.data.list[i].dealer == "0" || response.data.data.list[i].dealer == 0){
777
               if(response.data.data.list[i].dealer == "0" || response.data.data.list[i].dealer == 0){
724
                   response.data.data.list[i].dealer = ""
778
                   response.data.data.list[i].dealer = ""
725
               }else{
779
               }else{
728
 
782
 
729
               response.data.data.list[i].product_date = this.getTime(response.data.data.list[i].product_date,"{y}-{h}-{d}")
783
               response.data.data.list[i].product_date = this.getTime(response.data.data.list[i].product_date,"{y}-{h}-{d}")
730
               response.data.data.list[i].expiry_date = this.getTime(response.data.data.list[i].expiry_date,"{y}-{h}-{d}")
784
               response.data.data.list[i].expiry_date = this.getTime(response.data.data.list[i].expiry_date,"{y}-{h}-{d}")
785
+
786
+              response.data.data.list[i].stock_count = response.data.data.list[i].stock_count
787
+              response.data.data.list[i].last_price = response.data.data.list[i].last_price
731
               this.recordInfo.recordData.push(response.data.data.list[i])
788
               this.recordInfo.recordData.push(response.data.data.list[i])
732
             }
789
             }
733
              for(let j=0;j<this.recordInfo.recordData.length;j++){
790
              for(let j=0;j<this.recordInfo.recordData.length;j++){
819
             return
876
             return
820
          }
877
          }
821
          this.getDrugBatchNumber(val.id)
878
          this.getDrugBatchNumber(val.id)
879
+          var str_count = ""
880
+          var total_count = 0
881
+          for(let i=0;i<val.drug_warehouse_info.length;i++){
882
+            if(val.max_unit == val.drug_warehouse_info[i].max_unit){
883
+              val.drug_warehouse_info[i].stock_max_number = val.drug_warehouse_info[i].stock_max_number * val.min_number
884
+            }
885
+          }
886
+        
887
+        str_count =  this.getWarehoseInfo(val.drug_warehouse_info,val.max_unit,val.min_unit,val.min_number)
888
+        total_count = this.getWarehoseInfoTwo(val.drug_warehouse_info)
822
          for(let i=0;i<this.recordInfo.recordData.length;i++){
889
          for(let i=0;i<this.recordInfo.recordData.length;i++){
823
            if(i == this.currentIndex){
890
            if(i == this.currentIndex){
824
              this.recordInfo.recordData[i].drug_id  = val.id
891
              this.recordInfo.recordData[i].drug_id  = val.id
830
              this.recordInfo.recordData[i].number = val.number
897
              this.recordInfo.recordData[i].number = val.number
831
              this.recordInfo.recordData[i].max_unit = val.max_unit
898
              this.recordInfo.recordData[i].max_unit = val.max_unit
832
              this.recordInfo.recordData[i].min_unit = val.min_unit
899
              this.recordInfo.recordData[i].min_unit = val.min_unit
900
+             this.recordInfo.recordData[i].last_price = val.last_price
901
+             this.recordInfo.recordData[i].stock_count = str_count
902
+             this.recordInfo.recordData[i].total_count = total_count
903
+             this.recordInfo.recordData[i].max_unit_fisrt = val.max_unit
904
+             this.recordInfo.recordData[i].min_unit_fisrt = val.min_unit
905
+             this.recordInfo.recordData[i].count_unit = val.max_unit
833
              if(val.dealer == 0){
906
              if(val.dealer == 0){
834
                this.recordInfo.recordData[i].dealer = ""
907
                this.recordInfo.recordData[i].dealer = ""
835
              }else{
908
              }else{
849
           var params = {
922
           var params = {
850
             id:id
923
             id:id
851
           }
924
           }
852
-        getDrugBatchNumber(params).then(response=>{
925
+     getDrugBatchNumber(params).then(response=>{
853
            if(response.data.state == 1){
926
            if(response.data.state == 1){
854
              var list = response.data.data.list
927
              var list = response.data.data.list
855
 
928
 
856
              this.numberList = list
929
              this.numberList = list
857
            }
930
            }
858
         })
931
         })
932
+      },
933
+    getWarehoseInfo(arr, max_unit, min_unit, min_number) {
934
+      var total = 0;
935
+      var max_str = "";
936
+      var min_str = "";
937
+      if (arr.length > 0) {
938
+        for (let i = 0; i < arr.length; i++) {
939
+
940
+          total += parseInt(arr[i].stock_max_number+ arr[i].stock_min_number);
941
+        }
859
       }
942
       }
943
+      if (total < min_number) {
944
+        min_str = total + min_unit;
945
+      }
946
+      if (total == 0) {
947
+        min_str = "";
948
+        max_str = "";
949
+      }
950
+      if (total >= min_number) {
951
+        if (parseInt(total / min_number) != 0) {
952
+          max_str = parseInt(total / min_number) + max_unit;
953
+        }
954
+        if (total % min_number != 0) {
955
+          min_str = (total % min_number) + min_unit;
956
+        }
957
+      }
958
+      return max_str + min_str;
959
+    },
960
+    getWarehoseInfoTwo(arr){
961
+      var total = 0;
962
+      if (arr.length > 0) {
963
+        for (let i = 0; i < arr.length; i++) {
964
+          total += parseInt(arr[i].stock_max_number+ arr[i].stock_min_number);
965
+        }
966
+      }
967
+      return total
968
+    },
969
+    getSupplyCount(count,max_unit,min_number,index,total_count,max_unit_fisrt,min_unit_fisrt){
970
+     
971
+      var count_total = 0
972
+      if(max_unit == max_unit_fisrt){
973
+        count_total = count * min_number
974
+      }
975
+
976
+      if(max_unit == min_unit_fisrt){
977
+        count_total = count 
978
+      }
979
+
980
+      if(count_total > total_count){
981
+        this.$message.error("出库数量不能大于剩余库存")
982
+        for(let i=0;i<this.recordInfo.recordData.length;i++){
983
+           if(index == i){
984
+              this.recordInfo.recordData[i].count = ""
985
+           }
986
+        }
987
+      }else{
988
+        for(let i=0;i<this.recordInfo.recordData.length;i++){
989
+           if(index == i){
990
+              this.recordInfo.recordData[i].count = count
991
+           }
992
+        } 
993
+      }
994
+     console.log("count_toal23233232",count_total)
995
+    }
860
     },
996
     },
861
     created() {
997
     created() {
862
       this.drugTypeList = getDictionaryDataConfig('system','drug_type')
998
       this.drugTypeList = getDictionaryDataConfig('system','drug_type')

+ 0 - 3
src/xt_pages/stock/stockModifyPrice.vue View File

666
          var params= {
666
          var params= {
667
            tableData:this.tableData,
667
            tableData:this.tableData,
668
          }
668
          }
669
-      
670
-      console.log("parasm222",params)
671
       saveAdjustPrice(params).then(response=>{
669
       saveAdjustPrice(params).then(response=>{
672
         if(response.data.state == 1){
670
         if(response.data.state == 1){
673
           var msg =  response.data.data.msg
671
           var msg =  response.data.data.msg
674
-          console.log("msg",msg)
675
           this.$message.success("保存成功!")
672
           this.$message.success("保存成功!")
676
           this.dialogVisible = false
673
           this.dialogVisible = false
677
           this.tableData = []
674
           this.tableData = []

+ 27 - 21
src/xt_pages/stock/stockOutOrder.vue View File

229
               {{getHouseName(scope.row.storehouse_id)}}
229
               {{getHouseName(scope.row.storehouse_id)}}
230
             </template>
230
             </template>
231
           </el-table-column>
231
           </el-table-column>
232
+          <!-- <el-table-column label="剩余库存" align="center" v-if="is_sys== 0">
233
+            <template slot-scope="scope">
234
+              <span>{{scope.row.stock_count}}</span>
235
+            </template>
236
+          </el-table-column> -->
232
          
237
          
233
           <el-table-column label="出库数量" align="center">
238
           <el-table-column label="出库数量" align="center">
234
             <template slot-scope="scope">
239
             <template slot-scope="scope">
241
              {{getXuserName(scope.row.admin_user_id)}}
246
              {{getXuserName(scope.row.admin_user_id)}}
242
             </template>
247
             </template>
243
           </el-table-column>
248
           </el-table-column>
249
+          <!-- <el-table-column label="进货价" align="center" v-if="is_sys== 0">
250
+            <template slot-scope="scope">
251
+              <span>{{scope.row.buy_price}}</span>
252
+            </template>
253
+          </el-table-column> -->
244
           <el-table-column label="出货价" align="center">
254
           <el-table-column label="出货价" align="center">
245
             <template slot-scope="scope">
255
             <template slot-scope="scope">
246
               <span v-if="scope.row.price >0">{{ scope.row.price}}</span> 
256
               <span v-if="scope.row.price >0">{{ scope.row.price}}</span> 
926
     },
936
     },
927
     fetchAllAdminUsers() {
937
     fetchAllAdminUsers() {
928
       fetchAllAdminUsers().then(response => {
938
       fetchAllAdminUsers().then(response => {
929
-        console.log(response);
939
+       
930
         if (response.data.state == 1) {
940
         if (response.data.state == 1) {
931
           this.adminUserOptions = response.data.data.users;
941
           this.adminUserOptions = response.data.data.users;
932
           var alen = this.adminUserOptions.length;
942
           var alen = this.adminUserOptions.length;
1073
       for(let i=0;i<selection.length;i++){
1083
       for(let i=0;i<selection.length;i++){
1074
         ids.push(selection[i].id)
1084
         ids.push(selection[i].id)
1075
       }
1085
       }
1076
-      console.log("ids",ids)
1086
+
1077
       this.exportList = []
1087
       this.exportList = []
1078
       this.order_id = ids.join(",")
1088
       this.order_id = ids.join(",")
1079
       this.warehouse_out_time = selection[0].warehouse_out_time
1089
       this.warehouse_out_time = selection[0].warehouse_out_time
1082
 
1092
 
1083
     },
1093
     },
1084
     batchDelete() {
1094
     batchDelete() {
1085
-      console.log("this.selectedTableData",this.selectedTableData)
1095
+     
1086
       
1096
       
1087
       if (this.selectedTableData.length <= 0) {
1097
       if (this.selectedTableData.length <= 0) {
1088
         this.$message.error("请选择要删除的记录");
1098
         this.$message.error("请选择要删除的记录");
1160
             if(response.data.state == 1){
1170
             if(response.data.state == 1){
1161
               this.tableShow = true
1171
               this.tableShow = true
1162
               var list = response.data.data.list          
1172
               var list = response.data.data.list          
1163
-              console.log("info2232323",list)
1173
+             
1164
               this.tableList = []
1174
               this.tableList = []
1165
               for(let i=0;i<list.length;i++){
1175
               for(let i=0;i<list.length;i++){
1166
                 // if(list[i].dealer == 0){
1176
                 // if(list[i].dealer == 0){
1245
               is_total: 1,
1255
               is_total: 1,
1246
               total: total,
1256
               total: total,
1247
             })
1257
             })
1248
-            // this.type_name = this.userList[0].type.type_name
1249
-            // this.specification_name = this.userList[0].info.specification_name
1250
-            console.log("详情数据区",this.userList)
1258
+        
1251
             this.editdialogVisibleThree = true
1259
             this.editdialogVisibleThree = true
1252
           }
1260
           }
1253
         })
1261
         })
1294
         GetOutStockTotalCount(params).then(response=>{
1302
         GetOutStockTotalCount(params).then(response=>{
1295
            if(response.data.state == 1){
1303
            if(response.data.state == 1){
1296
               var stockCount = response.data.data.stockCount
1304
               var stockCount = response.data.data.stockCount
1297
-              console.log("出库数量2323",stockCount)
1305
+             
1298
               this.stockCount = stockCount
1306
               this.stockCount = stockCount
1299
-              // this.dialogVisible = true
1307
+            
1300
            }
1308
            }
1301
         })
1309
         })
1302
       },
1310
       },
1328
         const params = {
1336
         const params = {
1329
           'id': order_id
1337
           'id': order_id
1330
         }
1338
         }
1331
-        console.log("触发了222222",order_id)
1339
+
1332
         getWarehouseOutInfo(params).then(response => {
1340
         getWarehouseOutInfo(params).then(response => {
1333
          if (response.data.state == 0) {
1341
          if (response.data.state == 0) {
1334
             this.$message.error(response.data.msg)
1342
             this.$message.error(response.data.msg)
1535
         this.$refs['tableForm'].validate((valid) => {
1543
         this.$refs['tableForm'].validate((valid) => {
1536
           if (valid) {
1544
           if (valid) {
1537
             const array = this.recordInfo.recordData
1545
             const array = this.recordInfo.recordData
1538
-            console.log("$arr3333333333",array)
1546
+
1539
             for (let i = 0; i < array.length; i++) {
1547
             for (let i = 0; i < array.length; i++) {
1540
               if (array[i].good_type_id == 0) {
1548
               if (array[i].good_type_id == 0) {
1541
                 this.$message.error('商品类型不能为空')
1549
                 this.$message.error('商品类型不能为空')
1583
               var arrList =  this.unique(list)
1591
               var arrList =  this.unique(list)
1584
               var info = response.data.data.info
1592
               var info = response.data.data.info
1585
               this.infoList = info
1593
               this.infoList = info
1586
-              console.log("info列表22222222",info)
1594
+             
1587
               var stockflowlist = response.data.data.stockFlowList
1595
               var stockflowlist = response.data.data.stockFlowList
1588
-              console.log("stockflowlist",stockflowlist)
1596
+ 
1589
               this.stockFlowList = stockflowlist
1597
               this.stockFlowList = stockflowlist
1590
              
1598
              
1591
 
1599
 
1599
                 is_total: 1,
1607
                 is_total: 1,
1600
                 total: total,
1608
                 total: total,
1601
               })
1609
               })
1602
-
1603
-              console.log("详情数据区",this.userList)
1604
               if(val.is_sys == 1){
1610
               if(val.is_sys == 1){
1605
                 this.editdialogVisibleThree = true
1611
                 this.editdialogVisibleThree = true
1606
               }
1612
               }
1619
             arr.push(...this.userList[i].warehouseOutInfo)
1625
             arr.push(...this.userList[i].warehouseOutInfo)
1620
           }
1626
           }
1621
         }
1627
         }
1622
-        console.log("arr",arr)
1628
+      
1623
         if(arr.length > 0){
1629
         if(arr.length > 0){
1624
           for(let i=0;i<arr.length;i++){
1630
           for(let i=0;i<arr.length;i++){
1625
               ids.push(arr[i].number)
1631
               ids.push(arr[i].number)
1641
            "start_time":this.start_time,
1647
            "start_time":this.start_time,
1642
            "end_time":this.end_time,
1648
            "end_time":this.end_time,
1643
          }
1649
          }
1644
-        console.log('parasm22',params)
1650
+       
1645
        getOutExportList(params).then(response=>{
1651
        getOutExportList(params).then(response=>{
1646
           if(response.data.state == 1){
1652
           if(response.data.state == 1){
1647
             var list = response.data.data.list
1653
             var list = response.data.data.list
1648
             var outCount = response.data.data.outCount
1654
             var outCount = response.data.data.outCount
1649
-            console.log("outCount",outCount)
1655
+        
1650
             for(let i=0;i<list.length;i++){
1656
             for(let i=0;i<list.length;i++){
1651
                list[i].unit = list[i].specification_name +"/" + list[i].packing_unit
1657
                list[i].unit = list[i].specification_name +"/" + list[i].packing_unit
1652
                list[i].total_price = (list[i].total_count * list[i].price).toFixed(2)
1658
                list[i].total_price = (list[i].total_count * list[i].price).toFixed(2)
1668
                  }
1674
                  }
1669
               } 
1675
               } 
1670
             }
1676
             }
1671
-            console.log("导出list222222",list)
1677
+           
1672
             this.exportList = list
1678
             this.exportList = list
1673
           }
1679
           }
1674
         })
1680
         })
1679
          return
1685
          return
1680
         }
1686
         }
1681
         import('@/vendor/Export2Excel').then(excel => {
1687
         import('@/vendor/Export2Excel').then(excel => {
1682
-          console.log("23232323",this.exportList)
1688
+         
1683
         for(let i=0;i<this.exportList.length;i++){
1689
         for(let i=0;i<this.exportList.length;i++){
1684
           this.exportList[i].total_price = this.exportList[i].count * this.exportList[i].price
1690
           this.exportList[i].total_price = this.exportList[i].count * this.exportList[i].price
1685
           for(let j=0;j<this.goodType.length;j++){
1691
           for(let j=0;j<this.goodType.length;j++){
1700
        
1706
        
1701
         const tHeader = ['耗材名称', '耗材类型', '规格&单位','出库数量','出货价','总价','生产厂商','经销商','生产日期','有效期','备注']
1707
         const tHeader = ['耗材名称', '耗材类型', '规格&单位','出库数量','出货价','总价','生产厂商','经销商','生产日期','有效期','备注']
1702
         const filterVal = ['good_name', 'good_type_id', 'unit','count','price','total_price','manufacturer','dealer','product_date','expiry_date','remark']
1708
         const filterVal = ['good_name', 'good_type_id', 'unit','count','price','total_price','manufacturer','dealer','product_date','expiry_date','remark']
1703
-        console.log("table",this.exportList)
1709
+    
1704
        
1710
        
1705
         const data = this.formatJson(filterVal, this.exportList)
1711
         const data = this.formatJson(filterVal, this.exportList)
1706
         excel.export_json_to_excel({
1712
         excel.export_json_to_excel({

+ 82 - 5
src/xt_pages/stock/stockOutOrderAdd.vue View File

122
             </template>
122
             </template>
123
             <template slot-scope="scope">
123
             <template slot-scope="scope">
124
               <el-form-item style="padding-top: 20px">
124
               <el-form-item style="padding-top: 20px">
125
-                <el-input v-model="scope.row.name"></el-input>
125
+                <el-input v-model="scope.row.name" placeholder="规格&单位"></el-input>
126
               </el-form-item>
126
               </el-form-item>
127
             </template>
127
             </template>
128
           </el-table-column>
128
           </el-table-column>
129
           
129
           
130
-      
130
+          <!-- <el-table-column  width="150" align="center">
131
+            <template slot="header" slot-scope="scope">
132
+              <span>剩余库存</span>
133
+            </template>
134
+            <template slot-scope="scope">
135
+              <el-form-item
136
+                :rules="tableRules.count"
137
+                style="padding-top: 17px"
138
+              >
139
+                <el-input
140
+                  :disabled="true"
141
+                  placeholder="剩余库存"
142
+                  type="number"
143
+                  v-model="scope.row.stock_count"
144
+                ></el-input>
145
+              </el-form-item>
146
+            </template>
147
+          </el-table-column>
148
+       -->
131
 
149
 
132
          <el-table-column  width="150" align="center">
150
          <el-table-column  width="150" align="center">
133
             <template slot="header" slot-scope="scope">
151
             <template slot="header" slot-scope="scope">
140
                 style="padding-top: 17px"
158
                 style="padding-top: 17px"
141
               >
159
               >
142
                 <el-input
160
                 <el-input
161
+                  @input="getSupplyCount(scope.row.count,scope.row.stock_count,scope.$index)"
143
                  oninput="value=value.replace(/\D|^0/g,'')"
162
                  oninput="value=value.replace(/\D|^0/g,'')"
144
                   placeholder="请输入出库数量"
163
                   placeholder="请输入出库数量"
145
                   type="number"
164
                   type="number"
161
                </el-select>
180
                </el-select>
162
             </template>   
181
             </template>   
163
           </el-table-column>
182
           </el-table-column>
183
+<!-- 
184
+          <el-table-column  width="150" align="center">
185
+            <template slot="header" slot-scope="scope">
186
+              <span>进货价</span>
187
+            </template>
188
+            <template slot-scope="scope">
189
+              <el-form-item
190
+                :prop="'recordData.' + scope.$index + '.buy_price'"
191
+                :rules="tableRules.buy_price"
192
+                style="padding-top: 20px"
193
+              >
194
+                <el-input
195
+                  :disabled="true"
196
+                  placeholder="进货价"
197
+                  type="number"
198
+                  v-model="scope.row.buy_price"
199
+                ></el-input>
200
+              </el-form-item>
201
+            </template>
202
+          </el-table-column> -->
164
 
203
 
165
           <el-table-column  width="150" align="center">
204
           <el-table-column  width="150" align="center">
166
             <template slot="header" slot-scope="scope">
205
             <template slot="header" slot-scope="scope">
474
       tempObj["license_number"] = ""
513
       tempObj["license_number"] = ""
475
       tempObj["warehouse_info_id"] = 0
514
       tempObj["warehouse_info_id"] = 0
476
       tempObj["admin_user_id"] = this.$store.getters.xt_user.user.user_name
515
       tempObj["admin_user_id"] = this.$store.getters.xt_user.user.user_name
516
+      tempObj["buy_price"]= ""
517
+      tempObj["stock_count"] = ""
477
       this.recordInfo.recordData.push(tempObj);
518
       this.recordInfo.recordData.push(tempObj);
478
     },
519
     },
479
     handleDelete: function(index, row) {
520
     handleDelete: function(index, row) {
600
             }
641
             }
601
            
642
            
602
              this.recordInfo.recordData[i].price = this.recordInfo.recordData[i].price.toString()
643
              this.recordInfo.recordData[i].price = this.recordInfo.recordData[i].price.toString()
644
+
645
+             this.recordInfo.recordData[i].stock_count = this.recordInfo.recordData[i].stock_count.toString()
646
+
647
+             this.recordInfo.recordData[i].buy_price = this.recordInfo.recordData[i].buy_price.toString()
603
           }
648
           }
604
        
649
        
605
           for(let i=0;i<this.recordInfo.recordData.length;i++){
650
           for(let i=0;i<this.recordInfo.recordData.length;i++){
631
           const params = {
676
           const params = {
632
             stockOut: this.recordInfo.recordData
677
             stockOut: this.recordInfo.recordData
633
           };
678
           };
634
-        
679
+         
680
+         
635
           const loading = this.$loading({
681
           const loading = this.$loading({
636
             lock: true,
682
             lock: true,
637
             text: 'Loading',
683
             text: 'Loading',
721
       this.currentIndex = val
767
       this.currentIndex = val
722
     },
768
     },
723
     handleSelect(val){
769
     handleSelect(val){
724
-       console.log("val232323",val)
770
+       
725
         var arr = []
771
         var arr = []
772
+       
773
+       
726
         for(let i=0;i<this.recordInfo.recordData.length;i++){
774
         for(let i=0;i<this.recordInfo.recordData.length;i++){
727
            arr.push(this.recordInfo.recordData[i].good_id)
775
            arr.push(this.recordInfo.recordData[i].good_id)
728
         }
776
         }
735
         }
783
         }
736
         //获取当前耗材的批号
784
         //获取当前耗材的批号
737
         this.getStockBatchNumber(val.id)
785
         this.getStockBatchNumber(val.id)
786
+        var total_count = 0
787
+        for(let i=0;i<val.xt_warehouse_info.length;i++){
788
+           total_count += val.xt_warehouse_info[i].stock_count
789
+        }
790
+
738
         for(let i=0;i<this.recordInfo.recordData.length;i++){
791
         for(let i=0;i<this.recordInfo.recordData.length;i++){
739
           if(this.currentIndex == i){
792
           if(this.currentIndex == i){
793
+           
740
             this.recordInfo.recordData[i].good_type_id = val.id
794
             this.recordInfo.recordData[i].good_type_id = val.id
741
             this.recordInfo.recordData[i].good_name = val.good_name
795
             this.recordInfo.recordData[i].good_name = val.good_name
742
             this.recordInfo.recordData[i].good_type_id = val.good_type_id
796
             this.recordInfo.recordData[i].good_type_id = val.good_type_id
743
             this.recordInfo.recordData[i].name = val.specification_name +"/"+val.packing_unit
797
             this.recordInfo.recordData[i].name = val.specification_name +"/"+val.packing_unit
744
             this.recordInfo.recordData[i].manufacturer = val.manufacturer
798
             this.recordInfo.recordData[i].manufacturer = val.manufacturer
745
             this.recordInfo.recordData[i].remark = val.remark
799
             this.recordInfo.recordData[i].remark = val.remark
746
-          
800
+            this.recordInfo.recordData[i].buy_price = val.buy_price
801
+            this.recordInfo.recordData[i].stock_count = total_count
747
             if(val.packing_price == 0){
802
             if(val.packing_price == 0){
748
               this.recordInfo.recordData[i].price =""
803
               this.recordInfo.recordData[i].price =""
749
             }else{
804
             }else{
786
        }  
841
        }  
787
     
842
     
788
     },
843
     },
844
+    getSupplyCount(count,sum_count,index){
845
+    
846
+      if(sum_count < count){
847
+        this.$message.error("出库数量不能大于剩余库存")
848
+        for(let i=0;i<this.recordInfo.recordData.length;i++){
849
+          if(index == i){
850
+            this.recordInfo.recordData[i].count = ""
851
+          }
852
+          return
853
+        }
854
+      }else{
855
+       for(let i=0;i<this.recordInfo.recordData.length;i++){
856
+          if(index == i){
857
+            this.recordInfo.recordData[i].count = count
858
+          }
859
+          return
860
+        }
861
+      }
862
+ 
863
+    }
789
     
864
     
790
   },
865
   },
791
   created() {
866
   created() {
813
     tempObj["license_number"] = ""
888
     tempObj["license_number"] = ""
814
     tempObj["warehouse_info_id"] = 0
889
     tempObj["warehouse_info_id"] = 0
815
     tempObj["admin_user_id"] = this.$store.getters.xt_user.user.user_name
890
     tempObj["admin_user_id"] = this.$store.getters.xt_user.user.user_name
891
+    tempObj["buy_price"]= ""
892
+    tempObj["stock_count"] = ""
816
     this.recordInfo.recordData.push(tempObj);
893
     this.recordInfo.recordData.push(tempObj);
817
     this.GetConfigInfo();
894
     this.GetConfigInfo();
818
   
895
   

+ 72 - 2
src/xt_pages/stock/stockOutOrderEdit.vue View File

126
             </template>
126
             </template>
127
           </el-table-column> -->
127
           </el-table-column> -->
128
 
128
 
129
+          <!-- <el-table-column  width="150" align="center">
130
+            <template slot="header" slot-scope="scope">
131
+              <span>进货价</span>
132
+            </template>
133
+            <template slot-scope="scope">
134
+              <el-form-item
135
+                :prop="'recordData.' + scope.$index + '.buy_price'"
136
+                :rules="tableRules.buy_price"
137
+                style="padding-top: 20px"
138
+              >
139
+                <el-input
140
+                  :disabled="true"
141
+                  placeholder="进货价"
142
+                  type="number"
143
+                  v-model="scope.row.buy_price"
144
+                ></el-input>
145
+              </el-form-item>
146
+            </template>
147
+          </el-table-column> -->
148
+
129
           <el-table-column width="150" align="center">
149
           <el-table-column width="150" align="center">
130
             <template slot="header" slot-scope="scope">
150
             <template slot="header" slot-scope="scope">
131
               <span>单价<span style="color: red">*</span></span>
151
               <span>单价<span style="color: red">*</span></span>
141
             </template>
161
             </template>
142
           </el-table-column>
162
           </el-table-column>
143
 
163
 
164
+          <!-- <el-table-column  width="150" align="center">
165
+            <template slot="header" slot-scope="scope">
166
+              <span>剩余库存</span>
167
+            </template>
168
+            <template slot-scope="scope">
169
+              <el-form-item
170
+                :rules="tableRules.count"
171
+                style="padding-top: 17px"
172
+              >
173
+                <el-input
174
+                  :disabled="true"
175
+                  placeholder="剩余库存"
176
+                  type="number"
177
+                  v-model="scope.row.stock_count"
178
+                ></el-input>
179
+              </el-form-item>
180
+            </template>
181
+          </el-table-column> -->
182
+
144
           <el-table-column width="150" align="center">
183
           <el-table-column width="150" align="center">
145
             <template slot="header" slot-scope="scope">
184
             <template slot="header" slot-scope="scope">
146
               <span>出库数量<span style="color: red">*</span></span>
185
               <span>出库数量<span style="color: red">*</span></span>
148
             <template slot-scope="scope">
187
             <template slot-scope="scope">
149
               <el-form-item :prop="'recordData.' + scope.$index + '.count'" :rules='tableRules.count'
188
               <el-form-item :prop="'recordData.' + scope.$index + '.count'" :rules='tableRules.count'
150
                             style="padding-top: 17px">
189
                             style="padding-top: 17px">
151
-                <el-input type="number" v-model="scope.row.count"  :disabled="stockShow"   oninput="value=value.replace(/\D|^0/g,'')"></el-input>
190
+                <el-input type="number" v-model="scope.row.count"  :disabled="stockShow"   oninput="value=value.replace(/\D|^0/g,'')"  @input="getSupplyCount(scope.row.count,scope.row.stock_count,scope.$index)"></el-input>
152
               </el-form-item>
191
               </el-form-item>
153
             </template>
192
             </template>
154
           </el-table-column>
193
           </el-table-column>
451
         tempObj['dealer'] = ""
490
         tempObj['dealer'] = ""
452
         tempObj['manufacturer'] = ""
491
         tempObj['manufacturer'] = ""
453
         tempObj["admin_user_id"] = this.$store.getters.xt_user.user.user_name
492
         tempObj["admin_user_id"] = this.$store.getters.xt_user.user.user_name
493
+        tempObj["buy_price"]= ""
494
+        tempObj["stock_count"] = ""
454
         this.recordInfo.recordData.push(tempObj)
495
         this.recordInfo.recordData.push(tempObj)
455
       },
496
       },
456
       handleDelete: function(index, row) {
497
       handleDelete: function(index, row) {
591
                 this.recordInfo.recordData[i].product_date = ""
632
                 this.recordInfo.recordData[i].product_date = ""
592
               }
633
               }
593
                this.recordInfo.recordData[i].price = this.recordInfo.recordData[i].price.toString()
634
                this.recordInfo.recordData[i].price = this.recordInfo.recordData[i].price.toString()
635
+              
636
+              this.recordInfo.recordData[i].buy_price = this.recordInfo.recordData[i].buy_price.toString()
637
+              this.recordInfo.recordData[i].stock_count = this.recordInfo.recordData[i].stock_count.toString()
594
 
638
 
595
               for(let j=0;j<this.manufacturerList.length;j++){
639
               for(let j=0;j<this.manufacturerList.length;j++){
596
                 if(this.recordInfo.recordData[i].manufacturer == this.manufacturerList[j].manufacturer_name){
640
                 if(this.recordInfo.recordData[i].manufacturer == this.manufacturerList[j].manufacturer_name){
726
           return
770
           return
727
         }
771
         }
728
         this.getStockBatchNumber(val.id)
772
         this.getStockBatchNumber(val.id)
773
+        var total_count = 0
774
+        for(let i=0;i<val.xt_warehouse_info.length;i++){
775
+           total_count += val.xt_warehouse_info[i].stock_count
776
+        }
729
         for(let i=0;i<this.recordInfo.recordData.length;i++){
777
         for(let i=0;i<this.recordInfo.recordData.length;i++){
730
           if(this.currentIndex == i){
778
           if(this.currentIndex == i){
731
             this.recordInfo.recordData[i].good_type_id = val.id
779
             this.recordInfo.recordData[i].good_type_id = val.id
736
             this.recordInfo.recordData[i].remark = val.remark
784
             this.recordInfo.recordData[i].remark = val.remark
737
             this.recordInfo.recordData[i].license_number = ""
785
             this.recordInfo.recordData[i].license_number = ""
738
             this.recordInfo.recordData[i].warehouse_info_id = 0
786
             this.recordInfo.recordData[i].warehouse_info_id = 0
787
+            this.recordInfo.recordData[i].buy_price = val.buy_price
788
+            this.recordInfo.recordData[i].stock_count = total_count
739
             if(val.packing_price == 0){
789
             if(val.packing_price == 0){
740
                this.recordInfo.recordData[i].price = ""
790
                this.recordInfo.recordData[i].price = ""
741
             }else{
791
             }else{
774
           this.manufacturerList = manufacturerList
824
           this.manufacturerList = manufacturerList
775
           this.goodType = response.data.data.goodType
825
           this.goodType = response.data.data.goodType
776
           this.doctorList = response.data.data.doctorlist
826
           this.doctorList = response.data.data.doctorlist
827
+         
777
           for (let i = 0; i < response.data.data.list.length; i++) {
828
           for (let i = 0; i < response.data.data.list.length; i++) {
778
 
829
 
779
             response.data.data.list[i].price = response.data.data.list[i].price.toString()
830
             response.data.data.list[i].price = response.data.data.list[i].price.toString()
784
             response.data.data.list[i].expiry_date = this.getTime(response.data.data.list[i].expiry_date,"{y}-{m}-{d}")
835
             response.data.data.list[i].expiry_date = this.getTime(response.data.data.list[i].expiry_date,"{y}-{m}-{d}")
785
             response.data.data.list[i].product_date = this.getTime(response.data.data.list[i].product_date,"{y}-{m}-{d}")
836
             response.data.data.list[i].product_date = this.getTime(response.data.data.list[i].product_date,"{y}-{m}-{d}")
786
             response.data.data.list[i].remark = response.data.data.list[i].remark
837
             response.data.data.list[i].remark = response.data.data.list[i].remark
787
-
838
+            response.data.data.list[i].buy_price = response.data.data.list[i].buy_price.toString()
839
+            response.data.data.list[i].stock_count = response.data.data.list[i].stock_count.toString()
788
             if(response.data.data.list[i].dealer == 0){
840
             if(response.data.data.list[i].dealer == 0){
789
                response.data.data.list[i].dealer = ""
841
                response.data.data.list[i].dealer = ""
790
             }
842
             }
822
          }
874
          }
823
        }
875
        }
824
 
876
 
877
+     },
878
+     getSupplyCount(count,sum_count,index){
879
+      if(sum_count < count){
880
+        this.$message.error("出库数量不能大于剩余库存")
881
+        for(let i=0;i<this.recordInfo.recordData.length;i++){
882
+          if(index == i){
883
+            this.recordInfo.recordData[i].count = ""
884
+          }
885
+          return
886
+        }
887
+      }else{
888
+       for(let i=0;i<this.recordInfo.recordData.length;i++){
889
+          if(index == i){
890
+            this.recordInfo.recordData[i].count = count
891
+          }
892
+          return
893
+        }
894
+      }
825
      }
895
      }
826
     },
896
     },
827
     created() {
897
     created() {

+ 2 - 2
src/xt_pages/user/patients.vue View File

1341
         this.getList()
1341
         this.getList()
1342
       },
1342
       },
1343
       getList() {
1343
       getList() {
1344
-        console.log("parasm2222",this.listQuery)
1344
+       
1345
         fetchList(this.listQuery).then(response => {
1345
         fetchList(this.listQuery).then(response => {
1346
           if (response.data.state === 0) {
1346
           if (response.data.state === 0) {
1347
             this.$message.error(response.data.msg)
1347
             this.$message.error(response.data.msg)
1348
             return false
1348
             return false
1349
           } else {
1349
           } else {
1350
             this.tableData = response.data.data.patients
1350
             this.tableData = response.data.data.patients
1351
-            console.log('病人是', this.tableData)
1351
+           
1352
             this.pageTotal = this.tableData.length
1352
             this.pageTotal = this.tableData.length
1353
             this.total = response.data.data.total
1353
             this.total = response.data.data.total
1354
            
1354