Ver código fonte

药房科室切换

seimin 3 anos atrás
pai
commit
7a0d3b9cdb

+ 92 - 56
pages/pharmacy/pharmacy.vue

@@ -1,6 +1,12 @@
1 1
 <template>
2 2
   <view class="pharmacy">
3 3
     <view class="pharmacy_header">
4
+      <view class="page_tab_bar pharmacy_changeDept active">
5
+        <view class="tab_dept">{{ currenDept.dept
6
+          }}<button type="default" size="mini" class="changeDept" @click="changeDept">
7
+            切换科室
8
+          </button></view>
9
+      </view>
4 10
       <view
5 11
         class="scanning_btn"
6 12
         hover-class="seimin-btn-hover"
@@ -9,9 +15,6 @@
9 15
         <text class="icon_transport transport-saoma"></text>
10 16
       </view>
11 17
       <view class="scanFont">扫一扫</view>
12
-      <picker v-if="depts[index]" @change="bindPickerChange" :value="index" range-key="dept" :range="depts" class="pharmacy_changeDept">
13
-          <view class="pharmacy_input">{{depts[index].dept}}</view>
14
-      </picker>
15 18
     </view>
16 19
     <view class="pharmacy-heng">
17 20
       <view
@@ -126,9 +129,9 @@ export default {
126 129
           label: "核对中",
127 130
         },
128 131
       ],
129
-      depts: [],//下拉框选项
130
-      index: 0,//下拉框索引
131 132
       hosId: uni.getStorageSync("userData").user.currentHospital.id,//当前院区
133
+      loginUser: uni.getStorageSync("userData").user,
134
+      currenDept: {},//当前登录人所属科室
132 135
     };
133 136
   },
134 137
   methods: {
@@ -156,7 +159,7 @@ export default {
156 159
         sum: 20,
157 160
         drugsBag: {
158 161
           searchType: type,
159
-          launch:{id:this.depts[this.index].id}
162
+          launch:{id:this.currenDept.id}
160 163
         },
161 164
       };
162 165
       uni.showLoading({
@@ -235,45 +238,36 @@ export default {
235 238
     stop(e) {
236 239
       e.preventDefault();
237 240
     },
238
-    //选择药房科室
239
-    bindPickerChange: function(e) {
240
-        console.log('picker发送选择改变,携带值为', e.target.value)
241
-        this.index = e.target.value;
242
-        // 待配药
243
-        this.getPharmacyListData(4, 0);
241
+    // 切换科室
242
+    changeDept() {
243
+      uni.navigateTo({
244
+        url: `../search/search?type=pharmacy`,
245
+      });
244 246
     },
245
-    // 获取药房类型的科室
246
-    getDeptByPharmacy(){
247
-      let postData = {
248
-          "idx": 0,
249
-          "sum": 10,
250
-          "department": {
251
-              "hospital": {
252
-                  "id": this.hosId
253
-              },
254
-              "type": {
255
-                  "id": "386"
256
-              },
257
-          }
247
+    // 更新用户所在科室
248
+    updateUser(dept){
249
+      let dataObj = {
250
+        user: {
251
+          dept: {
252
+            id: dept.id,
253
+          },
254
+          id: this.loginUser.id,
255
+        },
258 256
       };
259
-      uni.showLoading({
260
-        title: "加载中",
261
-        mask: true,
262
-      });
263
-      post("/data/fetchDataList/department", postData).then((res) => {
264
-        uni.hideLoading();
257
+      post("/data/updData/user", dataObj).then((res) => {
265 258
         if (res.status == 200) {
266
-          this.depts = res.list.map(v=>({id:v.id,dept:v.dept}));
267
-          if(this.depts.length){
268
-            this.getPharmacyListData(this.selectedLabelSlots, 0);
269
-          }
270
-        } else {
271
-          uni.showToast({
272
-            icon: "none",
273
-            title: "请求失败!",
274
-          });
259
+          this.getCurrentUserNow();
275 260
         }
276
-      });
261
+      })
262
+    },
263
+    // 重新获取用户信息
264
+    getCurrentUserNow(){
265
+      get("/user/data/getCurrentUser").then((res) => {
266
+        if (res.status == 200) {
267
+          this.loginUser.dept = this.currenDept;
268
+          uni.setStorageSync('userData', this.loginUser);
269
+        }
270
+      })
277 271
     }
278 272
   },
279 273
   onLoad(options) {
@@ -286,8 +280,19 @@ export default {
286 280
       });
287 281
     }
288 282
     //#endif
289
-    // 获取药房类型的科室
290
-    this.getDeptByPharmacy();
283
+    if (options.id && options.dept) {
284
+      let {
285
+        id,
286
+        dept
287
+      } = options;
288
+      this.currenDept.id = id;
289
+      this.currenDept.dept = dept;
290
+      this.updateUser(this.currenDept)
291
+    } else {
292
+      this.currenDept = uni.getStorageSync("userData").user.dept;
293
+    }
294
+    // 请求列表
295
+    this.getPharmacyListData(this.selectedLabelSlots, 0);
291 296
     // #ifdef APP-PLUS
292 297
     webHandle("no", "app");
293 298
     // #endif
@@ -321,27 +326,58 @@ export default {
321 326
 
322 327
 .pharmacy {
323 328
   background-color: rgb(249, 250, 251);
324
-  padding-top: 36rpx;
329
+  // padding-top: 36rpx;
325 330
   .pharmacy_header{
326 331
     position: relative;
327 332
     .pharmacy_changeDept{
328
-      position: absolute;
329
-      top: 50%;
330
-      right: 52rpx;
331
-      transform: translateY(-50%);
332
-      .pharmacy_input{
333
-        background-image: linear-gradient(to right, #72c172, #3bb197);
334
-        border-radius: 8rpx;
335
-        color: #fff;
333
+      padding: 16rpx 0;
334
+      &.page_tab_bar {
335
+        flex: 1;
336 336
         font-size: 36rpx;
337
-        font-weight: 700;
338
-        padding: 8rpx 16rpx;
337
+        background: #fff;
338
+        display: flex;
339
+        justify-content: center;
340
+        align-items: center;
341
+        position: relative;
342
+
343
+        &:after {
344
+          content: "";
345
+          position: absolute;
346
+          left: 0;
347
+          bottom: 0;
348
+          height: 2rpx;
349
+          width: 100%;
350
+          background-color: transparent;
351
+        }
352
+
353
+        .tab_dept {
354
+          position: relative;
355
+
356
+          .changeDept {
357
+            white-space: nowrap;
358
+            margin: 0;
359
+            position: absolute;
360
+            right: 0;
361
+            top: 50%;
362
+            transform: translate(105%, -50%);
363
+            padding: 0 0.5em;
364
+            line-height: 2;
365
+          }
366
+        }
367
+
368
+        &.active {
369
+          color: #49b856;
370
+
371
+          &:after {
372
+            background-color: #49b856;
373
+          }
374
+        }
339 375
       }
340 376
     }
341 377
   }
342 378
 
343 379
   .scanning_btn {
344
-    margin: 0 auto;
380
+    margin: 16rpx auto;
345 381
     width: 138rpx;
346 382
     height: 138rpx;
347 383
     background: #72c172;
@@ -580,7 +616,7 @@ export default {
580 616
     font-size: 36rpx;
581 617
     font-weight: 700;
582 618
     margin-top: 16rpx;
583
-    margin-bottom: 32rpx;
619
+    margin-bottom: 16rpx;
584 620
     text-align: center;
585 621
   }
586 622
 }

+ 41 - 31
pages/pharmacyDetails/pharmacyDetails.vue

@@ -82,38 +82,50 @@ export default {
82 82
         post("/drugsBag/changeToIng", {
83 83
           id: this.infoDATA.id,
84 84
         }).then((result) => {
85
+          this.isLoading = false;
85 86
           if (result.state == 200) {
86
-            let data = {
87
-              launchId: this.infoDATA.launch.id,
88
-              drugsBagId: this.infoDATA.id,
89
-            };
90
-            post("/drugsBag/autoDrugsBags", data).then((result1) => {
91
-              this.isLoading = false;
92
-              if (result1.status == 200) {
93
-                uni.showToast({
94
-                  title: "操作成功!",
95
-                  success() {
96
-                    // setTimeout(() => {
97
-                    uni.navigateTo({
98
-                      url: "../pharmacy/pharmacy",
99
-                    });
100
-                    // }, 3000)
101
-                  },
102
-                });
103
-              }else if(result1.status == 501){
104
-                uni.showToast({
105
-                  icon: "none",
106
-                  title: result1.error,
107
-                });
108
-              }else {
109
-                uni.showToast({
110
-                  icon: "none",
111
-                  title: "请求失败!",
87
+            uni.showToast({
88
+              title: "开始配药成功!",
89
+              success() {
90
+                uni.navigateTo({
91
+                  url: "../pharmacy/pharmacy",
112 92
                 });
113
-              }
93
+              },
94
+            });
95
+            // let data = {
96
+            //   launchId: this.infoDATA.launch.id,
97
+            //   drugsBagId: this.infoDATA.id,
98
+            // };
99
+            // post("/drugsBag/autoDrugsBags", data).then((result1) => {
100
+            //   this.isLoading = false;
101
+            //   if (result1.status == 200) {
102
+            //     uni.showToast({
103
+            //       title: "操作成功!",
104
+            //       success() {
105
+            //         uni.navigateTo({
106
+            //           url: "../pharmacy/pharmacy",
107
+            //         });
108
+            //       },
109
+            //     });
110
+            //   }else if(result1.status == 501){
111
+            //     uni.showToast({
112
+            //       icon: "none",
113
+            //       title: result1.error,
114
+            //     });
115
+            //   }else {
116
+            //     uni.showToast({
117
+            //       icon: "none",
118
+            //       title: "请求失败!",
119
+            //     });
120
+            //   }
121
+            // });
122
+          } else if(result.state == 501){
123
+            uni.showToast({
124
+              icon: "none",
125
+              title: result.error,
114 126
             });
115 127
           } else {
116
-            this.isLoading = false;
128
+            // this.isLoading = false;
117 129
             uni.showToast({
118 130
               icon: "none",
119 131
               title: "请求失败!",
@@ -127,13 +139,11 @@ export default {
127 139
           this.isLoading = false;
128 140
           if (result.state == 200) {
129 141
             uni.showToast({
130
-              title: "操作成功!",
142
+              title: "完成配药成功!",
131 143
               success() {
132
-                // setTimeout(() => {
133 144
                 uni.navigateTo({
134 145
                   url: "../pharmacy/pharmacy",
135 146
                 });
136
-                // }, 3000)
137 147
               },
138 148
             });
139 149
           } else {

+ 8 - 1
pages/search/search.vue

@@ -113,6 +113,8 @@
113 113
         this.queryDeptId = options.queryDeptId;
114 114
         this.qrCode = options.qrCode;
115 115
         this.sysDeptType = -1;
116
+      }  else if (this.type == "pharmacy") { //药房切换科室
117
+        this.sysDeptType = 386;
116 118
       } else {
117 119
         this.getSysDeptType();
118 120
       }
@@ -274,7 +276,7 @@
274 276
         let arr = this.deptList.filter((item) => item.dept === keyword);
275 277
         if (arr.length) {
276 278
           let msg = "";
277
-          if (this.type == "patientInformationList" || this.type == "inspectList") {
279
+          if (this.type == "patientInformationList" || this.type == "inspectList" || this.type == "pharmacy") {
278 280
             msg = "切换科室成功";
279 281
             uni.showToast({
280 282
               title: msg,
@@ -301,6 +303,11 @@
301 303
             uni.navigateTo({
302 304
               url: `../inspectList/inspectList?id=${arr[0].id}&dept=${arr[0].dept}`,
303 305
             });
306
+          } else if (this.type == "pharmacy") {
307
+            //药房进入
308
+            uni.navigateTo({
309
+              url: `../pharmacy/pharmacy?id=${arr[0].id}&dept=${arr[0].dept}`,
310
+            });
304 311
           } else if (this.type == "setDept") {
305 312
             //上班添加科室进入
306 313
             let obj = uni.getStorageSync("setDepts");