|
@@ -27,14 +27,7 @@
|
27
|
27
|
</div>
|
28
|
28
|
</div>
|
29
|
29
|
<div class="app-container" v-loading="loading">
|
30
|
|
- <drugs-stock-dialog
|
31
|
|
- ref="dialog"
|
32
|
|
- :propForm="propForm"
|
33
|
|
- :visibility="isVisibility"
|
34
|
|
- v-on:dialog-comfirm="comfirm"
|
35
|
|
- v-on:dialog-cancle="cancle"
|
36
|
|
- ></drugs-stock-dialog>
|
37
|
|
-
|
|
30
|
+
|
38
|
31
|
<div class="cell clearfix">
|
39
|
32
|
<label class="title"
|
40
|
33
|
><span class="name"><span style="color: red">*</span>患者</span>
|
|
@@ -358,7 +351,7 @@
|
358
|
351
|
import BreadCrumb from "../../components/bread-crumb";
|
359
|
352
|
import { getDataConfig, getDictionaryDataConfig } from "@/utils/data";
|
360
|
353
|
import { getAllDrugList, postSearchDrugList } from "@/api/data";
|
361
|
|
- import { getallPatientList,postSearchSelfDrugList,postSelfDrugOutInfoWarehouse,getSelfDrugBatchNumber} from "@/api/drug/drug"
|
|
354
|
+ import { getallPatientList,postSearchSelfDrugList,postSelfDrugWarehouseOut,getSelfDrugBatchNumber} from "@/api/drug/drug"
|
362
|
355
|
export default {
|
363
|
356
|
components: { BreadCrumb },
|
364
|
357
|
name: "stockIn",
|
|
@@ -766,126 +759,140 @@
|
766
|
759
|
this.$router.go(-1);
|
767
|
760
|
},
|
768
|
761
|
submit() {
|
769
|
|
- this.$refs["tableForm"].validate((valid) => {
|
770
|
|
- if (valid) {
|
771
|
|
- this.loading = true;
|
772
|
|
- const array = this.recordInfo.recordData;
|
773
|
|
- if (this.patient_id == 0) {
|
774
|
|
- this.$message.error("患者不能为空!");
|
775
|
|
- this.loading = false;
|
776
|
|
- return false;
|
|
762
|
+ this.$refs["tableForm"].validate((valid) => {
|
|
763
|
+ if (valid) {
|
|
764
|
+ const array = this.recordInfo.recordData;
|
|
765
|
+ let total = 0;
|
|
766
|
+ for (let i = 0; i < array.length; i++) {
|
|
767
|
+ if (array[i].drug_id == 0) {
|
|
768
|
+ this.$message.error("药品名称或者药品规格名称不能为空");
|
|
769
|
+ return;
|
777
|
770
|
}
|
|
771
|
+ total = total + array[i].price * array[i].return_count;
|
|
772
|
+ }
|
|
773
|
+ if (this.patient_id == 0) {
|
|
774
|
+ this.$message.error("患者不能为空!");
|
|
775
|
+ return false;
|
|
776
|
+ }
|
|
777
|
+ if (this.recordInfo.recordData.length <= 0) {
|
|
778
|
+ this.$message.success("请添加出库商品");
|
|
779
|
+ return;
|
|
780
|
+ }
|
|
781
|
+ for (let i = 0; i < this.recordInfo.recordData.length; i++) {
|
|
782
|
+ this.recordInfo.recordData[i].total_price = 0
|
|
783
|
+ this.recordInfo.recordData[i].price = 0
|
778
|
784
|
|
779
|
|
- for (let i = 0; i < array.length; i++) {
|
780
|
|
- if (array[i].drug_id == 0) {
|
781
|
|
- this.$message.error("药品名称或者药品规格名称不能为空");
|
782
|
|
- this.loading = false;
|
783
|
|
- return;
|
|
785
|
+ for (let j = 0; j < this.manufacturerList.length; j++) {
|
|
786
|
+ if (this.recordInfo.recordData[i].manufacturer == this.manufacturerList[j].manufacturer_name) {
|
|
787
|
+ this.recordInfo.recordData[i].manufacturer = this.manufacturerList[j].id;
|
784
|
788
|
}
|
785
|
789
|
}
|
786
|
|
-
|
787
|
|
- if (this.recordInfo.recordData.length <= 0) {
|
788
|
|
- this.$message.success("请添加入库商品");
|
789
|
|
- this.loading = false;
|
790
|
|
- return;
|
791
|
|
- }
|
792
|
|
-
|
793
|
|
- for (let i = 0; i < this.recordInfo.recordData.length; i++) {
|
794
|
|
- if (this.recordInfo.recordData[i].dealer == "") {
|
|
790
|
+ if (this.recordInfo.recordData[i].dealer == "") {
|
795
|
791
|
this.recordInfo.recordData[i].dealer = 0;
|
|
792
|
+ }
|
|
793
|
+ for (let z = 0; z < this.dealerList.length; z++) {
|
|
794
|
+ if (this.recordInfo.recordData[i].dealer ==this.dealerList[z].dealer_name) {
|
|
795
|
+ this.recordInfo.recordData[i].dealer = this.dealerList[z].id;
|
796
|
796
|
}
|
797
|
|
- this.recordInfo.recordData[i].last_price =
|
798
|
|
- this.recordInfo.recordData[i].last_price.toString();
|
799
|
|
- this.recordInfo.recordData[i].retail_price =
|
800
|
|
- this.recordInfo.recordData[i].retail_price.toString();
|
801
|
|
- if (this.recordInfo.recordData[i].dealer == "") {
|
802
|
|
- this.recordInfo.recordData[i].dealer = 0;
|
|
797
|
+ }
|
|
798
|
+
|
|
799
|
+ for (let y = 0; y < this.numberList.length; y++) {
|
|
800
|
+ if (this.recordInfo.recordData[i].batch_number ==this.numberList[y].id) {
|
|
801
|
+ this.recordInfo.recordData[i].batch_number = this.numberList[y].batch_number;
|
|
802
|
+ this.recordInfo.recordData[i].warehouse_info_id = this.numberList[y].id;
|
803
|
803
|
}
|
804
|
|
- for (let j = 0; j < this.manufacturerList.length; j++) {
|
805
|
|
- if (
|
806
|
|
- this.recordInfo.recordData[i].manufacturer ==
|
807
|
|
- this.manufacturerList[j].manufacturer_name
|
808
|
|
- ) {
|
809
|
|
- this.recordInfo.recordData[i].manufacturer =
|
810
|
|
- this.manufacturerList[j].id;
|
|
804
|
+ }
|
|
805
|
+ // for (let s = 0; s < this.doctorList.length; s++) {
|
|
806
|
+ // if (this.recordInfo.recordData[i].admin_user_id == this.doctorList[s].user_name) {
|
|
807
|
+ // this.recordInfo.recordData[i].admin_user_id = this.doctorList[s].admin_user_id;
|
|
808
|
+ // }
|
|
809
|
+ // }
|
|
810
|
+
|
|
811
|
+ this.recordInfo.recordData[i].last_price = 0
|
|
812
|
+ this.recordInfo.recordData[i].stock_count = this.recordInfo.recordData[i].stock_count.toString();
|
|
813
|
+ }
|
|
814
|
+ const params = {
|
|
815
|
+ stockOut: this.recordInfo.recordData,
|
|
816
|
+ };
|
|
817
|
+ console.log("param22222222",params)
|
|
818
|
+ const loading = this.$loading({
|
|
819
|
+ lock: true,
|
|
820
|
+ text: "Loading",
|
|
821
|
+ spinner: "el-icon-loading",
|
|
822
|
+ background: "rgba(0, 0, 0, 0.7)",
|
|
823
|
+ });
|
|
824
|
+ postSelfDrugWarehouseOut(
|
|
825
|
+ params,
|
|
826
|
+ this.warehouse_out_time,
|
|
827
|
+ this.form.dealer,
|
|
828
|
+ this.form.manufacturer,
|
|
829
|
+ this.type,
|
|
830
|
+ this.patient_id,
|
|
831
|
+ this.warehouse_out_id,
|
|
832
|
+ ).then((response) => {
|
|
833
|
+ if (response.data.state == 0) {
|
|
834
|
+ this.$message.error("库存不足");
|
|
835
|
+ loading.close();
|
|
836
|
+ return false;
|
|
837
|
+ } else {
|
|
838
|
+ this.loading = false;
|
|
839
|
+ loading.close();
|
|
840
|
+ var msg = response.data.data.msg;
|
|
841
|
+ var drug_name = response.data.data.drug_name;
|
|
842
|
+ var dose = response.data.data.dose;
|
|
843
|
+ var dose_unit = response.data.data.dose_unit;
|
|
844
|
+ var min_number = response.data.data.min_number;
|
|
845
|
+ var min_unit = response.data.data.min_unit;
|
|
846
|
+ var max_unit = response.data.data.max_unit;
|
|
847
|
+ var str = drug_name +" " +dose +dose_unit +"*" + min_number + min_unit +"/" + max_unit;
|
|
848
|
+ var warehousingOutInfo = response.data.data.warehousingOutInfo
|
|
849
|
+ var warehouseOut = response.data.data.warehouseOut
|
|
850
|
+ this.warehouse_out_id = warehouseOut.id
|
|
851
|
+ var dealerList = response.data.data.dealerList
|
|
852
|
+ var manufacturerList = response.data.data.manufacturerList
|
|
853
|
+ var drugTypeList = response.data.data.drugTypeList
|
|
854
|
+ for(let i=0;i<warehousingOutInfo.length;i++){
|
|
855
|
+ for(let j=0;j<dealerList.length;j++){
|
|
856
|
+ if(warehousingOutInfo[i].dealer == dealerList[j].id){
|
|
857
|
+ warehousingOutInfo[i].dealer = dealerList[j].dealer_name
|
|
858
|
+ }
|
811
|
859
|
}
|
812
|
|
- }
|
813
|
|
-
|
814
|
|
- for (let z = 0; z < this.dealerList.length; z++) {
|
815
|
|
- if (
|
816
|
|
- this.recordInfo.recordData[i].dealer ==
|
817
|
|
- this.dealerList[z].dealer_name
|
818
|
|
- ) {
|
819
|
|
- this.recordInfo.recordData[i].dealer = this.dealerList[z].id;
|
|
860
|
+
|
|
861
|
+ for(let z=0;z<manufacturerList.length;z++){
|
|
862
|
+ if(warehousingOutInfo[i].manufacturer == manufacturerList[z].id){
|
|
863
|
+ warehousingOutInfo[i].manufacturer = manufacturerList[z].manufacturer_name
|
|
864
|
+ }
|
|
865
|
+ }
|
|
866
|
+ warehousingOutInfo[i].drug_name = warehousingOutInfo[i].drug.drug_name
|
|
867
|
+ warehousingOutInfo[i].name = warehousingOutInfo[i].drug.dose + warehousingOutInfo[i].drug.dose_unit +"*"+warehousingOutInfo[i].drug.min_number +warehousingOutInfo[i].drug.min_unit+"/"+warehousingOutInfo[i].drug.max_unit
|
|
868
|
+ warehousingOutInfo[i].product_date = this.getTimeOne(warehousingOutInfo[i].product_date)
|
|
869
|
+ warehousingOutInfo[i].expiry_date = this.getTimeOne(warehousingOutInfo[i].expiry_date)
|
|
870
|
+ warehousingOutInfo[i].last_price = warehousingOutInfo[i].price
|
|
871
|
+ warehousingOutInfo[i].max_unit = warehousingOutInfo[i].count_unit
|
|
872
|
+ warehousingOutInfo[i].count = warehousingOutInfo[i].count.toString()
|
|
873
|
+ warehousingOutInfo[i].patient_id = warehousingOutInfo[i].patient_id
|
|
874
|
+ for(let z=0;z<drugTypeList.length;z++){
|
|
875
|
+ if(warehousingOutInfo[i].drug.drug_type == drugTypeList[z].value){
|
|
876
|
+ warehousingOutInfo[i].drug_type = drugTypeList[z].name
|
|
877
|
+ }
|
820
|
878
|
}
|
821
|
879
|
}
|
822
|
|
- }
|
823
|
|
- const params = {
|
824
|
|
- stockIn: this.recordInfo.recordData,
|
825
|
|
- };
|
826
|
|
-
|
827
|
|
- postSelfDrugOutInfoWarehouse(
|
828
|
|
- params,
|
829
|
|
- this.warehousing_time,
|
830
|
|
- this.patient_id,
|
831
|
|
- this.warehouse_out_id,
|
832
|
|
- ).then((response) => {
|
833
|
|
- if (response.data.state == 0) {
|
834
|
|
- this.loading = false;
|
835
|
|
- this.$message.error(response.data.msg);
|
836
|
|
- return false;
|
|
880
|
+ if (msg == 1) {
|
|
881
|
+ this.$message.error(str + "库存不足");
|
837
|
882
|
} else {
|
838
|
|
- this.loading = false;
|
|
883
|
+ loading.close();
|
839
|
884
|
this.$message.success("保存成功");
|
840
|
|
- this.listLoading = false;
|
841
|
|
- var info = response.data.data.info
|
842
|
|
- this.warehousing_id = info.id
|
843
|
|
- var list = response.data.data.list
|
844
|
|
- var manufacturerList = response.data.data.manufacturerList
|
845
|
|
- var dealerList = response.data.data.dealerList
|
846
|
|
- var drugTypeList = response.data.data.drugTypeList
|
847
|
|
- for(let i=0;i<list.length;i++){
|
848
|
|
- for(let j=0;j<manufacturerList.length;j++){
|
849
|
|
- if(list[i].manufacturer_id == manufacturerList[j].id){
|
850
|
|
- list[i].manufacturer_id = manufacturerList[j].manufacturer_name
|
851
|
|
- }
|
852
|
|
- }
|
853
|
|
- for(let s=0;s<dealerList.length;s++){
|
854
|
|
- if(list[i].dealer_id == dealerList[s].id){
|
855
|
|
- list[i].dealer_id = dealerList[s].manufacturer_name
|
856
|
|
- }
|
857
|
|
- }
|
858
|
|
-
|
859
|
|
- list[i].expiry_date = this.getTimeOne(list[i].expiry_date)
|
860
|
|
- list[i].product_date = this.getTimeOne(list[i].product_date)
|
861
|
|
- list[i].drug_name = list[i].drug.drug_name
|
862
|
|
- list[i].name = list[i].drug.dose + list[i].drug.dose_unit +"*"+list[i].drug.min_number +list[i].drug.min_unit+"/"+list[i].drug.max_unit
|
863
|
|
- for(let z=0;z<drugTypeList.length;z++){
|
864
|
|
- if(list[i].drug.drug_type == drugTypeList[z].value){
|
865
|
|
- list[i].drug_type = drugTypeList[z].name
|
866
|
|
- }
|
867
|
|
- }
|
868
|
|
- list[i].last_price = list[i].price
|
869
|
|
- list[i].warehousing_count = list[i].warehousing_count.toString()
|
870
|
|
- list[i].unitList = []
|
871
|
|
- var obj = {id:1,name:""}
|
872
|
|
- obj.name = list[i].drug.max_unit
|
873
|
|
- var objOne = {id:2,name:""}
|
874
|
|
- objOne.name = list[i].drug.min_unit
|
875
|
|
- list[i].unitList.push(obj)
|
876
|
|
- list[i].unitList.push(objOne)
|
877
|
|
- }
|
878
|
|
- this.recordInfo.recordData = []
|
879
|
|
- this.recordInfo.recordData = list
|
|
885
|
+ this.recordInfo.recordData = [];
|
|
886
|
+ this.recordInfo.recordData = warehousingOutInfo
|
880
|
887
|
this.showCheck = true
|
881
|
|
- this.showReturnCheck = false
|
882
|
|
- // this.$router.back(-1);
|
|
888
|
+
|
883
|
889
|
}
|
884
|
|
- });
|
885
|
|
- } else {
|
886
|
|
- return false;
|
887
|
|
- }
|
888
|
|
- });
|
|
890
|
+ }
|
|
891
|
+ });
|
|
892
|
+ } else {
|
|
893
|
+ return false;
|
|
894
|
+ }
|
|
895
|
+ });
|
889
|
896
|
},
|
890
|
897
|
changeManufacturer(val) {},
|
891
|
898
|
changeDealer(val) {
|
|
@@ -1113,7 +1120,41 @@
|
1113
|
1120
|
}
|
1114
|
1121
|
});
|
1115
|
1122
|
},
|
1116
|
|
-
|
|
1123
|
+ getWarehoseInfo(arr, max_unit, min_unit, min_number) {
|
|
1124
|
+ var total = 0;
|
|
1125
|
+ var max_str = "";
|
|
1126
|
+ var min_str = "";
|
|
1127
|
+ if (arr.length > 0) {
|
|
1128
|
+ for (let i = 0; i < arr.length; i++) {
|
|
1129
|
+ total += parseInt(arr[i].stock_max_number + arr[i].stock_min_number);
|
|
1130
|
+ }
|
|
1131
|
+ }
|
|
1132
|
+ if (total < min_number) {
|
|
1133
|
+ min_str = total + min_unit;
|
|
1134
|
+ }
|
|
1135
|
+ if (total == 0) {
|
|
1136
|
+ min_str = "";
|
|
1137
|
+ max_str = "";
|
|
1138
|
+ }
|
|
1139
|
+ if (total >= min_number) {
|
|
1140
|
+ if (parseInt(total / min_number) != 0) {
|
|
1141
|
+ max_str = parseInt(total / min_number) + max_unit;
|
|
1142
|
+ }
|
|
1143
|
+ if (total % min_number != 0) {
|
|
1144
|
+ min_str = (total % min_number) + min_unit;
|
|
1145
|
+ }
|
|
1146
|
+ }
|
|
1147
|
+ return max_str + min_str;
|
|
1148
|
+ },
|
|
1149
|
+ getWarehoseInfoTwo(arr) {
|
|
1150
|
+ var total = 0;
|
|
1151
|
+ if (arr.length > 0) {
|
|
1152
|
+ for (let i = 0; i < arr.length; i++) {
|
|
1153
|
+ total += parseInt(arr[i].stock_max_number + arr[i].stock_min_number);
|
|
1154
|
+ }
|
|
1155
|
+ }
|
|
1156
|
+ return total;
|
|
1157
|
+ },
|
1117
|
1158
|
|
1118
|
1159
|
|
1119
|
1160
|
},
|