Browse Source

工单详情开关

seimin 1 year ago
parent
commit
ca83af8141
2 changed files with 370 additions and 30 deletions
  1. 370 3
      pages/receipt_infopage/receipt_infopage.vue
  2. 0 27
      pages/receiptpage/receiptpage.vue

+ 370 - 3
pages/receipt_infopage/receipt_infopage.vue

@@ -337,12 +337,17 @@
337 337
           infoDATA.taskType.associationType.value != 'drugsBag' &&
338 338
           infoDATA.taskType.associationType.value != 'specimen' &&
339 339
           infoDATA.taskType.associationType.value != 'specimenPlan' &&
340
-          infoDATA.taskType.associationType.value != 'ordinary'
340
+          infoDATA.taskType.associationType.value != 'ordinary' &&
341
+          !(infoDATA.taskType.associationType.value == 'other' && infoDATA.gdState.value == 5 && infoDATA.taskType.carryingCourses[1].actionsSwitch)
341 342
         " hover-class="seimin-btn-hover">
342 343
           <smallScreen :sData="infoDATA" :sType="1">扫码</smallScreen>
343 344
         </view>
345
+        <!-- 其他临床服务-完成工单-待送达 -->
346
+        <view v-if="infoDATA.taskType.associationType.value == 'other' && infoDATA.gdState.value == 5 && infoDATA.taskType.carryingCourses[1].actionsSwitch" class="btn2 page_item_btn" @click="otherCompleteOrder(infoDATA)" hover-class="seimin-btn-hover">完成工单</view>
347
+        <!-- 其他临床服务-拍照 -->
348
+        <view v-if="infoDATA.taskType.associationType.value == 'other' && infoDATA.gdState.value == 4 && infoDATA.taskType.carryingCourses[0].photoSwitch" class="btn2 page_item_btn" @click="photographToOther(infoDATA, 'start')" hover-class="seimin-btn-hover">拍照</view>
349
+        
344 350
         <view :class="[infoDATA.taskType.specialCloseButton == 1 ? 'btn3' : 'btn2']" @click="photograph(infoDATA)" v-if="
345
-          infoDATA.gdState.value != 2 &&
346 351
           infoDATA.taskType.associationType.value != 'jPBag' &&
347 352
           infoDATA.taskType.associationType.value != 'drugsBag' &&
348 353
           infoDATA.taskType.associationType.value != 'specimen' &&
@@ -400,9 +405,14 @@
400 405
     <inspectRemoveModel :title="models1.title" :icon="models1.icon" :disjunctor="models1.disjunctor"
401 406
       :content="models1.content" @know="know1" :operate="models1.operate" @ok="ok1" @cancel="cancel1" :remove="true">
402 407
     </inspectRemoveModel>
408
+    <!-- 填写交接人账号弹窗 -->
409
+    <selectAccount v-if="hosModels.disjunctor" :title="hosModels.title" :disjunctor="hosModels.disjunctor" @ok="hosOk"
410
+      @cancel="hosCancel">
411
+    </selectAccount>
403 412
   </view>
404 413
 </template>
405 414
 <script>
415
+  import selectAccount from "../../components/selectAccount/selectAccount.vue";
406 416
   import smallScreen from "../../components/smallScreen/smallScreen.vue";
407 417
   import {
408 418
     get,
@@ -411,11 +421,21 @@
411 421
     webHandle
412 422
   } from "../../http/http.js";
413 423
   import {
424
+    pathUrl,
414 425
     photographTool
415 426
   } from "../../tools/photograph.js";
416 427
   export default {
428
+    components: {
429
+      selectAccount,
430
+    },
417 431
     data() {
418 432
       return {
433
+        // 填写交接人账号弹窗model
434
+        hosModels: {
435
+          disjunctor: false,
436
+        },
437
+        currentCode: '', //当前拍照使用的科室二维码
438
+        currentData: {}, //当前小扫描的工单对象
419 439
         multiplayerMode: 0,
420 440
         hosId: uni.getStorageSync('userData').user.currentHospital.id,
421 441
         SMFlag:true,
@@ -468,6 +488,354 @@
468 488
       },
469 489
     },
470 490
     methods: {
491
+      // 前往其他临床服务完成工单确认页面
492
+      otherCompleteOrder(data){
493
+        console.log(data);
494
+        uni.navigateTo({
495
+          url: `../otherCompleteOrder/otherCompleteOrder?orderId=${data.id}&taskType=${data.taskType ? encodeURIComponent(JSON.stringify(data.taskType)) : ''}&order=${data ? encodeURIComponent(JSON.stringify(data)) : ''}`,
496
+        });
497
+      },
498
+      // 如果不是静配,药配,标本配送,标本轮巡
499
+      // 科室签到(小扫描)-拍照
500
+      nextDeptOrder_ss(data, accountObj) {
501
+        console.log(this.currentCode);
502
+        let isKs = 0;
503
+        let ids = [];
504
+        let id = data.id;
505
+        ids.push(id);
506
+        let list = {
507
+          code: "",
508
+          ids: ids,
509
+        };
510
+        let code = "";
511
+        let type = "";
512
+        if (this.currentCode) {
513
+          let gdStateValue = data.gdState.value; //工单状态value
514
+          let associationTypeValue = data.taskType.associationType.value; //关联类型value
515
+          
516
+          // 其他临床服务,并且工单状态是待到达||工单状态待送达
517
+          if (
518
+            (associationTypeValue == "other" &&
519
+              gdStateValue == "4") ||
520
+            gdStateValue == "5"
521
+          ) {
522
+            code = this.currentCode;
523
+            type = "orderSign/" + code;
524
+            list = {
525
+              ids
526
+            };
527
+            if (accountObj) {
528
+              list.handover = [accountObj.accountId];
529
+            }
530
+            isKs = 1;
531
+          }
532
+          uni.showLoading({
533
+            title: "加载中",
534
+            mask: true,
535
+          });
536
+          post("/workerOrder/" + type, list).then((res) => {
537
+            uni.hideLoading();
538
+            if (res) {
539
+              if (res.status == 200) {
540
+                if (
541
+                  gdStateValue == "4" &&
542
+                  associationTypeValue == "other"
543
+                ) {
544
+                  uni.navigateTo({
545
+                    url: `../../pages/scanning_code/scanning_code?type=${associationTypeValue}&type1=${res.type}&id=${data.id}&deptCode=${code}&dept=${res.dept}&accountObj=${encodeURIComponent(JSON.stringify(accountObj))}`,
546
+                  });
547
+                }
548
+                if (gdStateValue == "5") {
549
+                  uni.navigateTo({
550
+                    url: `../../pages/scanning_code/scanning_code?type=${associationTypeValue}&type1=${res.type}&id=${data.id}&deptCode=${code}&dept=${res.dept}&accountObj=${encodeURIComponent(JSON.stringify(accountObj))}`,
551
+                  });
552
+                }
553
+              } else {
554
+                uni.navigateTo({
555
+                  url: `../../pages/scanning_Result/scanning_Result?type=${
556
+                  associationTypeValue
557
+                }&type1=${res.type}&id=${data.id}&status=600&msg=${
558
+                  res.msg
559
+                }&isKs=${isKs}&model=${encodeURIComponent(
560
+                  JSON.stringify(res)
561
+                )}&qrcode=${this.currentCode}`,
562
+                });
563
+              }
564
+            } else {
565
+              uni.navigateTo({
566
+                url: `../../pages/scanning_Result/scanning_Result?id=${data.id}&status=600&msg=扫码失败!请扫描正确的二维码!&isKs=${isKs}&qrcode=${this.currentCode}`,
567
+              });
568
+            }
569
+          });
570
+        }
571
+      },
572
+      // 填写交接人账号-确认
573
+      hosOk(data) {
574
+        console.log(data);
575
+        const {
576
+          accountName,
577
+          account,
578
+          accountId
579
+        } = data;
580
+        if (!accountName && !account) {
581
+          //没有填写交接人
582
+          uni.showModal({
583
+            title: '提示',
584
+            content: "请填写交接人账号!",
585
+            showCancel: false,
586
+            success: function(res) {
587
+              if (res.confirm) {
588
+                console.log('用户点击确定');
589
+              } else if (res.cancel) {
590
+                console.log('用户点击取消');
591
+              }
592
+            }
593
+          });
594
+          return;
595
+        } else if (!accountName && account || accountName && !account) {
596
+          //没有填写交接人
597
+          uni.showModal({
598
+            title: '提示',
599
+            content: "请填写正确的交接人账号!",
600
+            showCancel: false,
601
+            success: function(res) {
602
+              if (res.confirm) {
603
+                console.log('用户点击确定');
604
+              } else if (res.cancel) {
605
+                console.log('用户点击取消');
606
+              }
607
+            }
608
+          });
609
+          return;
610
+        }
611
+        this.hosModels.disjunctor = false;
612
+        let associationTypeValue = this.currentData.taskType.associationType.value;
613
+        console.log(associationTypeValue)
614
+        this.uploadToOther(this.currentData, data, 'start');
615
+      },
616
+      // 填写交接人账号-取消
617
+      hosCancel() {
618
+        this.hosModels.disjunctor = false;
619
+      },
620
+      // 填写交接人账号弹窗
621
+      showSelectAccount() {
622
+        this.hosModels = {
623
+          title: '填写交接人账号',
624
+          disjunctor: true,
625
+        }
626
+      },
627
+      // 拍照-上传
628
+      uploadToOther(data, accountObj, type){
629
+        // 其他临床服务拍照签到
630
+        console.log(data, 1111);
631
+        let id_seimin;
632
+        let asTypeValue_seimin;
633
+        let gdStateValue_seimin;
634
+        if (data.status != 200 && data.status !== undefined) {
635
+          id_seimin = data.id;
636
+          asTypeValue_seimin = data.type;
637
+          gdStateValue_seimin = JSON.parse(data.model).gdstate2; //type改成gdstate
638
+        } else {
639
+          id_seimin = data.id;
640
+          asTypeValue_seimin = data.taskType.associationType.value;
641
+          gdStateValue_seimin = data.gdState.value;
642
+        }
643
+        //#ifdef H5
644
+        uni.chooseImage({
645
+          count: 1,
646
+          sourceType: ['camera'],
647
+          success: (chooseImageRes) => {
648
+            console.log(chooseImageRes, pathUrl)
649
+            const tempFilePaths = chooseImageRes.tempFilePaths;
650
+            const tempFiles = chooseImageRes.tempFiles;
651
+            let tp = tempFilePaths[0];
652
+            uni.showLoading({
653
+              mask: true,
654
+              title: '加载中'
655
+            });
656
+            post('/workerOrder/findRecordInfoByOrderId', {
657
+              orderId: id_seimin,
658
+              gdOperate: 21,
659
+            }).then(result => {
660
+              console.log(result)
661
+              if (result.state == 200) {
662
+                uni.getImageInfo({
663
+                  src: tp,
664
+                  success: (res) => {
665
+                    console.log('压缩前', res)
666
+                    let canvasWidth = res.width //图片原始长宽
667
+                    let canvasHeight = res.height
668
+                    let img = new Image()
669
+                    img.src = res.path
670
+                    let canvas = document.createElement('canvas');
671
+                    let ctx = canvas.getContext('2d')
672
+                    canvas.width = canvasWidth
673
+                    canvas.height = canvasHeight
674
+                    ctx.drawImage(img, 0, 0, canvasWidth, canvasHeight)
675
+                    canvas.toBlob((fileSrc) => {
676
+                      tp = window.URL.createObjectURL(fileSrc)
677
+                      console.log('压缩后', tp);
678
+                      uni.uploadFile({
679
+                        url: pathUrl + '/common/common/uploadAttachment/'+(type == 'start' ? 'orderStartPhoto' : 'orderEndPhoto')+'/' + id_seimin + '/' + result.recordId,
680
+                        filePath: tp,
681
+                        name: 'file',
682
+                        formData: {
683
+                          'filename': tempFiles[0].name ? tempFiles[0].name.split('.')[0] + '.jpg' : tempFiles[
684
+                            0].path.split(
685
+                              /[\\/]/).reverse()[0].split('.')[0] + '.jpg'
686
+                        },
687
+                        success: (uploadFileRes) => {
688
+                          console.log(uploadFileRes, 10086, asTypeValue_seimin);
689
+                          this.nextDeptOrder_ss(data, accountObj, type);
690
+                        },
691
+                        fail: err => {
692
+                          console.error(err);
693
+                          uni.hideLoading();
694
+                          uni.showToast({
695
+                            icon: 'none',
696
+                            title: '上传失败',
697
+                            duration: 2000
698
+                          });
699
+                        }
700
+                      });
701
+                    }, 'image/jpeg', 0.3)
702
+                  },
703
+                  fail: function () {
704
+                    uni.hideLoading();
705
+                    uni.showToast({
706
+                      icon: 'none',
707
+                      title: '上传失败',
708
+                      duration: 2000
709
+                    });
710
+                  }
711
+                })
712
+              } else {
713
+                uni.hideLoading();
714
+                uni.showToast({
715
+                  icon: "none",
716
+                  title: "请求失败!",
717
+                });
718
+              }
719
+            })
720
+          }
721
+        });
722
+        //#endif
723
+        //#ifdef APP-PLUS
724
+        uni.chooseImage({
725
+          count: 1,
726
+          sourceType: ['camera'],
727
+          sizeType: ['compressed'],
728
+          success: (chooseImageRes) => {
729
+            console.log(chooseImageRes, pathUrl)
730
+            const tempFilePaths = chooseImageRes.tempFilePaths;
731
+            const tempFiles = chooseImageRes.tempFiles;
732
+            let tp = tempFilePaths[0];
733
+            uni.showLoading({
734
+              mask: true,
735
+              title: '加载中'
736
+            });
737
+            post('/workerOrder/findRecordInfoByOrderId', {
738
+              orderId: id_seimin,
739
+              gdOperate: 21,
740
+            }).then(result => {
741
+              console.log(result)
742
+              if (result.state == 200) {
743
+                uni.compressImage({
744
+                  src: tp,
745
+                  quality: 30,
746
+                  success: (res) => {
747
+                    console.log('压缩前', res)
748
+                    tp = res.tempFilePath;
749
+                    console.log('压缩后', tp);
750
+                    uni.uploadFile({
751
+                      url: pathUrl + '/common/common/uploadAttachment/'+(type == 'start' ? 'orderStartPhoto' : 'orderEndPhoto')+'/' + id_seimin + '/' + result.recordId,
752
+                      filePath: tp,
753
+                      name: 'file',
754
+                      formData: {
755
+                        'filename': tempFiles[0].name ? tempFiles[0].name.split('.')[0] + '.jpg' : tempFiles[
756
+                          0].path.split(
757
+                            /[\\/]/).reverse()[0].split('.')[0] + '.jpg'
758
+                      },
759
+                      success: (uploadFileRes) => {
760
+                        console.log(uploadFileRes, 10086, asTypeValue_seimin);
761
+                        this.nextDeptOrder_ss(data, accountObj, type);
762
+                      },
763
+                      fail: err => {
764
+                        console.error(err);
765
+                        uni.hideLoading();
766
+                        uni.showToast({
767
+                          icon: 'none',
768
+                          title: '上传失败',
769
+                          duration: 2000
770
+                        });
771
+                      }
772
+                    });
773
+                  },
774
+                  fail: function () {
775
+                    uni.hideLoading();
776
+                    uni.showToast({
777
+                      icon: 'none',
778
+                      title: '上传失败',
779
+                      duration: 2000
780
+                    });
781
+                  }
782
+                })
783
+              } else {
784
+                uni.hideLoading();
785
+                uni.showToast({
786
+                  icon: "none",
787
+                  title: "请求失败!",
788
+                });
789
+              }
790
+            })
791
+          }
792
+        });
793
+        //#endif
794
+      },
795
+      // 拍照-其他
796
+      async photographToOther(data, type) {
797
+        this.currentData = data;
798
+        uni.showLoading({
799
+          title: "加载中",
800
+          mask: true,
801
+        });
802
+        // 其他临床服务
803
+        let result = await post("/dept/scanning", {
804
+          content: type === 'start' ? data.startDept.qrcode : data.endDepts[0].qrcode,
805
+          taskTypeId: data.taskType.id,
806
+          gdState: data.gdState.id,
807
+        });
808
+        uni.hideLoading();
809
+        this.currentCode = result.code;
810
+        if (result.state == 200 || result.state == 201) {
811
+          uni.showModal({
812
+          	title: '提示',
813
+          	content: '请尽量拍摄角度覆盖清洁区域?',
814
+          	success: (res) => {
815
+          		if (res.confirm) {
816
+          			if (result.account) {
817
+          			  this.uploadToOther(data, {
818
+          			    account: result.account,
819
+          			    accountName: result.name,
820
+          			    accountId: result.id,
821
+          			  }, type);
822
+          			} else {
823
+          			  this.uploadToOther(data, undefined, type);
824
+          			}
825
+          		} else if (res.cancel) {
826
+          			console.log('用户点击取消');
827
+          		}
828
+          	}
829
+          });
830
+        } else if (result.state == '0000') {
831
+          this.showSelectAccount();
832
+        } else {
833
+          uni.showToast({
834
+            icon: "none",
835
+            title: "请求失败!",
836
+          });
837
+        }
838
+      },
471 839
       goBack() {
472 840
         uni.navigateTo({
473 841
           url: "../receiptpage/receiptpage",
@@ -628,7 +996,6 @@
628 996
           return;
629 997
         }
630 998
         this.SMFlag = false;
631
-        // this.currentData = data;
632 999
         console.log(data, 'data');
633 1000
         SM().then((ress1) => {
634 1001
           uni.showLoading({

+ 0 - 27
pages/receiptpage/receiptpage.vue

@@ -995,33 +995,6 @@
995 995
             title: "请求失败!",
996 996
           });
997 997
         }
998
-        //检验二维码的有效性
999
-        // post("/dept/scanning", {
1000
-        //   content: type === 'start' ? data.startDept.qrcode : data.endDepts[0].qrcode,
1001
-        //   taskTypeId: data.taskType.id,
1002
-        //   gdState: data.gdState.id,
1003
-        // }).then((result) => {
1004
-        //   uni.hideLoading();
1005
-        //   this.currentCode = result.code;
1006
-        //   if (result.state == 200 || result.state == 201) {
1007
-        //     if (result.account) {
1008
-        //       this.uploadToOther(data, {
1009
-        //         account: result.account,
1010
-        //         accountName: result.name,
1011
-        //         accountId: result.id,
1012
-        //       }, type);
1013
-        //     } else {
1014
-        //       this.uploadToOther(data, undefined, type);
1015
-        //     }
1016
-        //   } else if (result.state == '0000') {
1017
-        //     this.showSelectAccount();
1018
-        //   } else {
1019
-        //     uni.showToast({
1020
-        //       icon: "none",
1021
-        //       title: "请求失败!",
1022
-        //     });
1023
-        //   }
1024
-        // });
1025 998
       },
1026 999
       // 悬浮按钮点击事件
1027 1000
       trigger(e) {