see999 3 years ago
parent
commit
aeb9c95391
1 changed files with 177 additions and 87 deletions
  1. 177 87
      src/xt_pages/outpatientDoctorStation/components/deskPrescription.vue

+ 177 - 87
src/xt_pages/outpatientDoctorStation/components/deskPrescription.vue View File

@@ -1924,111 +1924,189 @@
1924 1924
           this.order_status = '已退费'
1925 1925
         }
1926 1926
 
1927
+        if (info.id > 0) {
1928
+          this.doctorValue = info.doctor_id
1929
+          this.departmentValue = info.departments
1930
+        } else {
1931
+          if(admin_info.id > 0 && admin_info.user_type == 2){
1932
+            this.doctorValue = admin_info.admin_user_id
1933
+            this.departmentValue = this.department[0].id
1927 1934
 
1935
+          }else{
1928 1936
 
1929
-        getInitData().then(response => {
1930
-          if (response.data.state == 0) {
1931
-            this.$message.error(response.data.msg)
1932
-            return false
1933
-          } else {
1934
-            this.drugs = response.data.data.drugs
1935
-            this.allDrugs = response.data.data.drugs
1936
-            this.advices_template = response.data.data.advices_template
1937
-            this.doctors = response.data.data.doctors
1938
-            for (let i = 0; i < this.doctors.length; i++) {
1939
-              if (this.doctors[i].user_type == 1) {
1940
-                this.doctors.splice(i, 1)
1941
-              }
1942
-            }
1943
-            this.department = response.data.data.department
1944
-            this.sick = response.data.data.sick
1945
-            this.diagnoses = response.data.data.diagnose
1946
-            this.additions = response.data.data.additions
1937
+            this.doctorValue = this.doctors[0].admin_user_id
1938
+            this.departmentValue = this.department[0].id
1947 1939
 
1940
+          }
1948 1941
 
1949 1942
 
1943
+        }
1950 1944
 
1945
+        if (info.register_type == 0) {
1946
+          for (let i = 0; i < this.register.length; i++) {
1947
+            this.register_type = this.register[0].value
1948
+          }
1949
+        } else {
1950
+          this.register_type = info.register_type
1951
+        }
1952
+        this.diagnose = []
1951 1953
 
1952
-            if (info.id > 0) {
1953
-              this.doctorValue = info.doctor_id
1954
-              this.departmentValue = info.departments
1955
-            } else {
1956
-              if(admin_info.id > 0 && admin_info.user_type == 2){
1957
-                this.doctorValue = admin_info.admin_user_id
1958
-                this.departmentValue = this.department[0].id
1954
+        if(info.id == 0){
1955
+          if(last_info.diagnosis.length == 0){
1956
+            this.diagnose = []
1957
+          }else{
1958
+            for(let i = 0; i < last_info.diagnosis.split(",").length;i++){
1959
+              this.diagnose.push(parseInt(last_info.diagnosis.split(",")[i]))
1959 1960
 
1960
-              }else{
1961
+            }
1962
+          }
1961 1963
 
1962
-                this.doctorValue = this.doctors[0].admin_user_id
1963
-                this.departmentValue = this.department[0].id
1964
+          if(last_info.sick_history == 0){
1965
+            this.state2 = ''
1966
+          }else{
1967
+            this.state2 = last_info.sick_history
1968
+          }
1964 1969
 
1965
-              }
1966 1970
 
1971
+        }else{
1972
+          this.state2 = info.sick_history
1973
+          if (this.state2 == 0) {
1974
+            this.state2 = ''
1975
+          }
1976
+          if(info.diagnosis.length == 0){
1977
+            this.diagnose = []
1978
+          }else{
1979
+            for(let i = 0; i < info.diagnosis.split(",").length;i++){
1980
+              this.diagnose.push(parseInt(info.diagnosis.split(",")[i]))
1967 1981
 
1968 1982
             }
1969 1983
 
1970
-            if (info.register_type == 0) {
1971
-              for (let i = 0; i < this.register.length; i++) {
1972
-                this.register_type = this.register[0].value
1973
-              }
1974
-            } else {
1975
-              this.register_type = info.register_type
1976
-            }
1977
-            this.diagnose = []
1984
+          }
1978 1985
 
1979
-            if(info.id == 0){
1980
-              if(last_info.diagnosis.length == 0){
1981
-                this.diagnose = []
1982
-              }else{
1983
-                for(let i = 0; i < last_info.diagnosis.split(",").length;i++){
1984
-                  this.diagnose.push(parseInt(last_info.diagnosis.split(",")[i]))
1986
+        }
1985 1987
 
1986
-                }
1987
-              }
1988 1988
 
1989
-              if(last_info.sick_history == 0){
1990
-                this.state2 = ''
1991
-              }else{
1992
-                this.state2 = last_info.sick_history
1993
-              }
1994 1989
 
1990
+        this.state1 = info.sick_type
1991
+        if (this.state1 == 0 || this.state1 == "") {
1992
+          this.state1 = ''
1993
+          for (let i = 0; i < this.sick.length; i++) {
1994
+            this.state1 = this.sick[0].id
1995
+          }
1996
+        }
1995 1997
 
1996
-            }else{
1997
-              this.state2 = info.sick_history
1998
-              if (this.state2 == 0) {
1999
-                this.state2 = ''
2000
-              }
2001
-              if(info.diagnosis.length == 0){
2002
-                this.diagnose = []
2003
-              }else{
2004
-                for(let i = 0; i < info.diagnosis.split(",").length;i++){
2005
-                  this.diagnose.push(parseInt(info.diagnosis.split(",")[i]))
1998
+        if(this.departmentValue == "" || this.departmentValue == 0){
1999
+          if(this.department.length > 0){
2000
+            this.departmentValue = this.department[0].id
2006 2001
 
2007
-                }
2002
+          }
2003
+        }
2008 2004
 
2009
-              }
2005
+        
2006
+          // getInitData().then(response => {
2007
+          //   if (response.data.state == 0) {
2008
+          //     this.$message.error(response.data.msg)
2009
+          //     return false
2010
+          //   } else {
2011
+          //     this.onceTime = false
2012
+          //     this.drugs = response.data.data.drugs
2013
+          //     this.allDrugs = response.data.data.drugs
2014
+          //     this.advices_template = response.data.data.advices_template
2015
+          //     this.doctors = response.data.data.doctors
2016
+          //     for (let i = 0; i < this.doctors.length; i++) {
2017
+          //       if (this.doctors[i].user_type == 1) {
2018
+          //         this.doctors.splice(i, 1)
2019
+          //       }
2020
+          //     }
2021
+          //     this.department = response.data.data.department
2022
+          //     this.sick = response.data.data.sick
2023
+          //     this.diagnoses = response.data.data.diagnose
2024
+          //     this.additions = response.data.data.additions
2010 2025
 
2011
-            }
2012 2026
 
2013 2027
 
2014 2028
 
2015
-            this.state1 = info.sick_type
2016
-            if (this.state1 == 0 || this.state1 == "") {
2017
-              this.state1 = ''
2018
-              for (let i = 0; i < this.sick.length; i++) {
2019
-                this.state1 = this.sick[0].id
2020
-              }
2021
-            }
2022 2029
 
2023
-            if(this.departmentValue == "" || this.departmentValue == 0){
2024
-              if(this.department.length > 0){
2025
-                this.departmentValue = this.department[0].id
2030
+          //     if (info.id > 0) {
2031
+          //       this.doctorValue = info.doctor_id
2032
+          //       this.departmentValue = info.departments
2033
+          //     } else {
2034
+          //       if(admin_info.id > 0 && admin_info.user_type == 2){
2035
+          //         this.doctorValue = admin_info.admin_user_id
2036
+          //         this.departmentValue = this.department[0].id
2026 2037
 
2027
-              }
2028
-            }
2038
+          //       }else{
2029 2039
 
2030
-          }
2031
-        })
2040
+          //         this.doctorValue = this.doctors[0].admin_user_id
2041
+          //         this.departmentValue = this.department[0].id
2042
+
2043
+          //       }
2044
+
2045
+
2046
+          //     }
2047
+
2048
+          //     if (info.register_type == 0) {
2049
+          //       for (let i = 0; i < this.register.length; i++) {
2050
+          //         this.register_type = this.register[0].value
2051
+          //       }
2052
+          //     } else {
2053
+          //       this.register_type = info.register_type
2054
+          //     }
2055
+          //     this.diagnose = []
2056
+
2057
+          //     if(info.id == 0){
2058
+          //       if(last_info.diagnosis.length == 0){
2059
+          //         this.diagnose = []
2060
+          //       }else{
2061
+          //         for(let i = 0; i < last_info.diagnosis.split(",").length;i++){
2062
+          //           this.diagnose.push(parseInt(last_info.diagnosis.split(",")[i]))
2063
+
2064
+          //         }
2065
+          //       }
2066
+
2067
+          //       if(last_info.sick_history == 0){
2068
+          //         this.state2 = ''
2069
+          //       }else{
2070
+          //         this.state2 = last_info.sick_history
2071
+          //       }
2072
+
2073
+
2074
+          //     }else{
2075
+          //       this.state2 = info.sick_history
2076
+          //       if (this.state2 == 0) {
2077
+          //         this.state2 = ''
2078
+          //       }
2079
+          //       if(info.diagnosis.length == 0){
2080
+          //         this.diagnose = []
2081
+          //       }else{
2082
+          //         for(let i = 0; i < info.diagnosis.split(",").length;i++){
2083
+          //           this.diagnose.push(parseInt(info.diagnosis.split(",")[i]))
2084
+
2085
+          //         }
2086
+
2087
+          //       }
2088
+
2089
+          //     }
2090
+
2091
+
2092
+
2093
+          //     this.state1 = info.sick_type
2094
+          //     if (this.state1 == 0 || this.state1 == "") {
2095
+          //       this.state1 = ''
2096
+          //       for (let i = 0; i < this.sick.length; i++) {
2097
+          //         this.state1 = this.sick[0].id
2098
+          //       }
2099
+          //     }
2100
+
2101
+          //     if(this.departmentValue == "" || this.departmentValue == 0){
2102
+          //       if(this.department.length > 0){
2103
+          //         this.departmentValue = this.department[0].id
2104
+
2105
+          //       }
2106
+          //     }
2107
+
2108
+          //   }
2109
+          // })
2032 2110
 
2033 2111
       },
2034 2112
       moreState(tab, event) {
@@ -2774,18 +2852,21 @@
2774 2852
         this.teamList = row
2775 2853
       },
2776 2854
       selectChange(selection, row) {
2855
+        console.log('row',row)
2777 2856
         if(row.total <= 0){
2778
-          if (selection) {
2779
-            selection.forEach(row => {
2780
-              if(row.total <= 0){
2781
-                this.$refs.tables.toggleRowSelection(row);
2782
-              }
2783
-            });
2784
-          } else {
2785
-            this.$refs.tables.clearSelection();
2857
+          if(row.type == 3){
2858
+            if (selection) {
2859
+              selection.forEach(row => {
2860
+                if(row.total <= 0){
2861
+                  this.$refs.tables.toggleRowSelection(row);
2862
+                }
2863
+              });
2864
+            } else {
2865
+              this.$refs.tables.clearSelection();
2866
+            }
2867
+            this.$message.error(row.project_name + '库存不足')
2868
+            return
2786 2869
           }
2787
-          this.$message.error(row.project_name + '库存不足')
2788
-          return
2789 2870
         }
2790 2871
         this.teamList.push(row)
2791 2872
       },
@@ -2908,6 +2989,7 @@
2908 2989
           if (response.data.state == 1) {
2909 2990
             this.teamList = []
2910 2991
             var project = response.data.data.project
2992
+            let num = 0
2911 2993
             for (let i = 0; i < project.length; i++) {
2912 2994
               if (project[i].type == 2 && project[i].status == 1) {
2913 2995
 
@@ -2932,6 +3014,14 @@
2932 3014
 
2933 3015
                 this.teamList.push(obj)
2934 3016
               } else if (project[i].type == 3 && project[i].status == 1) {
3017
+                if(project[i].good_info.total <= 0){
3018
+                  num++
3019
+                  this.$refs.tabProjectTeam.toggleRowSelection(row);
3020
+                  this.$message.error(project[i].good_info.good_name + '库存不足')
3021
+                }
3022
+                if(num > 0){
3023
+                  this.$refs.tabProjectTeam.clearSelection();
3024
+                }
2935 3025
                 let obj = {
2936 3026
                   id: project[i].project_id,
2937 3027
                   project_name: project[i].good_info.good_name,