Parcourir la source

Merge branch 'master' of http://git.shengws.com/csx/Vue_New

csx il y a 4 ans
Parent
révision
2dddcc8c5d

+ 7 - 0
src/api/patient.js Voir le fichier

@@ -356,6 +356,13 @@ export function postExportPatients(params) {
356 356
 
357 357
 
358 358
 
359
+export function getMaxDialysisNo() {
360
+  return request({
361
+    url: '/api/patients/dialysis_no',
362
+    method: 'Get',
363
+  })
364
+}
365
+
359 366
 
360 367
 
361 368
 

+ 423 - 231
src/xt_pages/user/patients.vue Voir le fichier

@@ -14,6 +14,45 @@
14 14
     </el-dialog>
15 15
 
16 16
 
17
+    <el-dialog
18
+      title="提示"
19
+      :visible.sync="dialysisVisible"
20
+      width="40%"
21
+    >
22
+      <span>您提交的文档中存在不同病人存在相同的透析号,请检查修改后在提交 </span>
23
+      <span slot="footer" class="dialog-footer">
24
+    <el-button @click="dialysisVisible = false">取 消</el-button>
25
+    <el-button type="primary" @click="dialysisVisible = false">确 定</el-button>
26
+  </span>
27
+    </el-dialog>
28
+
29
+
30
+    <el-dialog
31
+      title="提示"
32
+      :visible.sync="phoneVisible"
33
+      width="40%"
34
+    >
35
+      <span>您提交的文档中存在不同病人存在相同的手机号,请检查修改后在提交 </span>
36
+      <span slot="footer" class="dialog-footer">
37
+    <el-button @click="phoneVisible = false">取 消</el-button>
38
+    <el-button type="primary" @click="phoneVisible = false">确 定</el-button>
39
+  </span>
40
+    </el-dialog>
41
+
42
+
43
+    <el-dialog
44
+      title="提示"
45
+      :visible.sync="idCardNoVisible"
46
+      width="40%"
47
+    >
48
+      <span>您提交的文档中存在不同病人存在相同的身份证,请检查修改后在提交 </span>
49
+      <span slot="footer" class="dialog-footer">
50
+    <el-button @click="idCardNoVisible = false">取 消</el-button>
51
+    <el-button type="primary" @click="idCardNoVisible = false">确 定</el-button>
52
+  </span>
53
+    </el-dialog>
54
+
55
+
17 56
     <el-dialog
18 57
       title="提示"
19 58
       :visible.sync="exportLogVisible"
@@ -25,7 +64,7 @@
25 64
         <br/>
26 65
         <br/>
27 66
         <span>{{getContent(item)}}</span>
28
-        <span style="color:blue"  @click="generateTxt(item)">点击</span>
67
+        <span style="color:blue" @click="generateTxt(item)">点击</span>
29 68
         <span>查看详情</span>
30 69
         <br/>
31 70
         <br/>
@@ -499,7 +538,7 @@
499 538
 </template>
500 539
 
501 540
 <script>
502
-  import { code, EditLapseto, fetchList, OpenView, postExportPatients } from '@/api/patient'
541
+  import { code, EditLapseto, fetchList, getMaxDialysisNo, OpenView, postExportPatients } from '@/api/patient'
503 542
   import { generateLog } from '@/api/config'
504 543
 
505 544
   import QRCode from 'qrcodejs2'
@@ -535,6 +574,8 @@
535 574
         isIndeterminate: true,
536 575
         dialogVisible: false,
537 576
         exportLogVisible: false,
577
+        phoneVisible:false,
578
+        idCardNoVisible:false,
538 579
         wechatbindimg: '',
539 580
         active: true,
540 581
         schedulType: 0,
@@ -601,7 +642,9 @@
601 642
         // value2: '',
602 643
         total: 0,
603 644
         pageTotal: 0,
645
+        dialysisVisible:false,
604 646
         pageSelect: 0,
647
+        max_dialysis_no: '',
605 648
         listQuery: {
606 649
           page: 1,
607 650
           limit: 10,
@@ -648,25 +691,25 @@
648 691
     },
649 692
 
650 693
     methods: {
651
-      generateTxt:function(log) {
694
+      generateTxt: function(log) {
652 695
         var content = ''
653
-       var errlog =  log.err_logs
654
-        for (let i = 0; i< errlog.length; i++){
696
+        var errlog = log.err_logs
697
+        content = this.getContent(log)
698
+        for (let i = 0; i < errlog.length; i++) {
655 699
           if (content.length == 0) {
656 700
             content = errlog[i].err_msg
657
-          }else{
658
-            content = content +"\n"+errlog[i].err_msg
701
+          } else {
702
+            content = content + '\n' + errlog[i].err_msg
659 703
           }
660 704
         }
661 705
 
662
-
663 706
         var url = new Blob(['\ufeff' + content], { type: 'text/txt,charset=UTF-8' })
664 707
         if (typeof url === 'object' && url instanceof Blob) {
665 708
           url = URL.createObjectURL(url) // 创建blob地址
666 709
         }
667 710
         const aLink = document.createElement('a')
668 711
         aLink.href = url
669
-        aLink.download = this.timestampToTime(log.export_time)+'错误日志'+".txt"
712
+        aLink.download = this.timestampToTime(log.export_time) + '错误日志' + '.txt'
670 713
         aLink.click()
671 714
 
672 715
       },
@@ -680,7 +723,7 @@
680 723
         var D = (date.getDate() < 10 ? '0' + (date.getDate()) : date.getDate()) + '日 '
681 724
         var h = (date.getHours() < 10 ? '0' + (date.getHours()) : date.getHours()) + '时'
682 725
         var m = (date.getMinutes() < 10 ? '0' + (date.getMinutes()) : date.getMinutes()) + '分'
683
-        var s = (date.getSeconds() < 10 ? '0' + (date.getSeconds()) : date.getSeconds())+'秒'
726
+        var s = (date.getSeconds() < 10 ? '0' + (date.getSeconds()) : date.getSeconds()) + '秒'
684 727
         return Y + M + D + h + m + s
685 728
       },
686 729
       generateLog() {
@@ -700,7 +743,8 @@
700 743
 
701 744
       },
702 745
       handleSuccess({ results, header }) {
703
-
746
+        console.log(results)
747
+        console.log(header)
704 748
 
705 749
         if (header != undefined && header.length > 0) {
706 750
           var isHasName = header.includes('*姓名')
@@ -712,177 +756,325 @@
712 756
           var isHasLapseto = header.includes('*治疗状态')
713 757
           var isHasInfectious = header.includes('*传染病')
714 758
           var isHasDiagnose = header.includes('诊断')
715
-          if (!(isHasName && isHasGender && isHasPhone && isHasIdCard && isHasDate && isHasSource && isHasLapseto && isHasInfectious && isHasDiagnose)) {
759
+          var isHasDialysisNo = header.includes('透析号')
760
+
761
+          var isHasDryWeight = header.includes('干体重(kg)')
762
+          var isHasHeight = header.includes('身高(cm)')
763
+          var isHasHomeAddress = header.includes('家庭住址')
764
+
765
+          if (!(isHasName && isHasGender && isHasPhone && isHasIdCard && isHasDate && isHasSource && isHasLapseto && isHasInfectious && isHasDiagnose && isHasDialysisNo && isHasDryWeight && isHasHeight && isHasHomeAddress)) {
716 766
             this.dialogVisible = true
717 767
             return
718 768
           }
719
-        }else{
769
+        } else {
720 770
           this.dialogVisible = true
721 771
           return
722 772
         }
723
-        this.export_date = []
724
-        for (let i = 1; i < results.length; i++) {
725
-          let obj = {}
726
-          for (var key in results[i]) {
727
-            if (results[i]['*姓名'] === undefined) {
728
-              obj['name'] = ''
729
-            } else {
730
-              if (key == '*姓名') {
731
-                obj['name'] = results[i][key]
773
+        getMaxDialysisNo().then(
774
+          response => {
775
+            if (response.data.state === 1) {
776
+              this.max_dialysis_no = response.data.data.dialysis_no
777
+              if (this.max_dialysis_no == 0) {
778
+                this.max_dialysis_no = 1
779
+              } else {
780
+                this.max_dialysis_no++
732 781
               }
733
-            }
734 782
 
735
-            if (results[i]['*性别'] === undefined) {
736
-              obj['gender'] = '0'
737
-            } else {
738
-              if (key == '*性别') {
739
-                if (results[i][key] == '男') {
740
-                  obj['gender'] = '1'
741
-                } else if (results[i][key] == '女') {
742
-                  obj['gender'] = '2'
743
-                } else {
744
-                  obj['gender'] = '0'
783
+
784
+              this.export_date = []
785
+              for (let i = 1; i < results.length; i++) {
786
+                let obj = {}
787
+                for (var key in results[i]) {
788
+                  if (results[i]['*姓名'] === undefined) {
789
+                    obj['name'] = ''
790
+                  } else {
791
+                    if (key == '*姓名') {
792
+                      obj['name'] = results[i][key].replace(/\s/g,"")
793
+
794
+                    }
795
+                  }
796
+
797
+                  if (results[i]['*性别'] === undefined) {
798
+                    obj['gender'] = '0'
799
+                  } else {
800
+                    if (key == '*性别') {
801
+                      if (results[i][key] == '男') {
802
+                        obj['gender'] = '1'
803
+                      } else if (results[i][key] == '女') {
804
+                        obj['gender'] = '2'
805
+                      } else {
806
+                        obj['gender'] = '0'
807
+                      }
808
+                    }
809
+                  }
810
+
811
+                  if (results[i]['*手机号'] === undefined) {
812
+                    obj['phone'] = ''
813
+                  } else {
814
+                    if (key == '*手机号') {
815
+                      obj['phone'] = results[i][key].replace(/\s/g,"")
816
+                    }
817
+                  }
818
+
819
+                  if (results[i]['*身份证号'] === undefined) {
820
+                    obj['id_card_no'] = ''
821
+
822
+                  } else {
823
+                    if (key == '*身份证号') {
824
+                      obj['id_card_no'] = results[i][key].replace(/\s/g,"")
825
+                    }
826
+                  }
827
+
828
+                  if (results[i]['*首次肾脏治疗时间'] === undefined) {
829
+                    obj['first_treatment_date'] = ''
830
+
831
+                  } else {
832
+                    if (key == '*首次肾脏治疗时间') {
833
+                      var month = parseInt(results[i][key].replace(/\s/g,"").split('/')[0])
834
+                      var day = parseInt(results[i][key].replace(/\s/g,"").split('/')[1])
835
+                      var year = parseInt(results[i][key].replace(/\s/g,"").split('/')[2])
836
+
837
+                      if (day < 10) {
838
+                        day = '0' + day
839
+                      }
840
+                      if (month < 10) {
841
+                        month = '0' + month
842
+                      }
843
+                      obj['first_treatment_date'] = '20' + year + '/' + month + '/' + day
844
+                    }
845
+                  }
846
+
847
+                  if (results[i]['*患者来源'] === undefined) {
848
+                    obj['source'] = '0'
849
+
850
+                  } else {
851
+                    if (key == '*患者来源') {
852
+                      if (results[i][key] == '门诊') {
853
+                        obj['source'] = '1'
854
+                      } else if (results[i][key] == '住院') {
855
+                        obj['source'] = '2'
856
+                      } else {
857
+                        obj['source'] = '0'
858
+                      }
859
+                    }
860
+                  }
861
+
862
+                  if (results[i]['*治疗状态'] === undefined) {
863
+                    obj['lapseto'] = '0'
864
+
865
+                  } else {
866
+                    if (key == '*治疗状态') {
867
+                      if (results[i][key] == '留治') {
868
+                        obj['lapseto'] = '1'
869
+                      } else if (results[i][key] == '转归') {
870
+                        obj['lapseto'] = '2'
871
+                      } else {
872
+                        obj['lapseto'] = '0'
873
+                      }
874
+                    }
875
+                  }
876
+
877
+                  if (results[i]['*传染病'] === undefined) {
878
+                    let contagions = []
879
+                    obj['is_infectious'] = '0'
880
+                    obj['contagions'] = contagions
881
+
882
+                  } else {
883
+                    if (key == '*传染病') {
884
+                      if (results[i][key] == '无') {
885
+                        let contagions = []
886
+                        obj['is_infectious'] = '1'
887
+                        obj['contagions'] = contagions
888
+
889
+                      } else if (results[i][key] == '乙肝') {
890
+                        let contagions = []
891
+                        contagions.push(2)
892
+                        obj['is_infectious'] = '2'
893
+                        obj['contagions'] = contagions
894
+                      } else if (results[i][key] == '丙肝') {
895
+                        let contagions = []
896
+                        contagions.push(3)
897
+                        obj['is_infectious'] = '2'
898
+                        obj['contagions'] = contagions
899
+
900
+                      } else if (results[i][key] == '艾滋病') {
901
+                        let contagions = []
902
+                        contagions.push(4)
903
+                        obj['is_infectious'] = '2'
904
+                        obj['contagions'] = contagions
905
+
906
+                      } else if (results[i][key] == '肺结核') {
907
+                        let contagions = []
908
+                        contagions.push(5)
909
+                        obj['is_infectious'] = '2'
910
+                        obj['contagions'] = contagions
911
+
912
+                      } else if (results[i][key] == '梅毒') {
913
+                        let contagions = []
914
+                        contagions.push(6)
915
+                        obj['is_infectious'] = '2'
916
+                        obj['contagions'] = contagions
917
+                      } else {
918
+                        let contagions = []
919
+                        obj['is_infectious'] = '0'
920
+                        obj['contagions'] = contagions
921
+                      }
922
+                    }
923
+                  }
924
+
925
+                  if (results[i]['诊断'] === undefined) {
926
+                    obj['diagnose'] = ''
927
+                  } else {
928
+                    if (key == '诊断') {
929
+                      obj['diagnose'] = results[i][key]
930
+                    }
931
+                  }
932
+                  console.log(obj)
933
+
934
+                  if (results[i]['透析号'] === undefined) {
935
+                    obj['dialysis_no'] = ''
936
+                  } else {
937
+                    if (key == '透析号') {
938
+                      obj['dialysis_no'] = results[i][key].replace(/\s/g,"")
939
+                    }
940
+                  }
941
+
942
+                  console.log(obj)
943
+
944
+                  if (results[i]['干体重(kg)'] === undefined) {
945
+                    obj['dry_weight'] = ''
946
+                  } else {
947
+                    if (key == '干体重(kg)') {
948
+                      obj['dry_weight'] = results[i][key].replace(/\s/g,"")
949
+                    }
950
+                  }
951
+
952
+                  console.log(obj)
953
+
954
+                  if (results[i]['身高(cm)'] === undefined) {
955
+                    obj['height'] = ''
956
+                  } else {
957
+                    if (key == '身高(cm)') {
958
+                      obj['height'] = results[i][key].replace(/\s/g,"")
959
+                    }
960
+                  }
961
+
962
+                  console.log(obj)
963
+
964
+                  if (results[i]['家庭住址'] === undefined) {
965
+                    obj['home_address'] = ''
966
+                  } else {
967
+                    if (key == '家庭住址') {
968
+                      obj['home_address'] = results[i][key]
969
+                    }
970
+                  }
745 971
                 }
972
+
973
+                this.export_date.push(obj)
746 974
               }
747
-            }
748 975
 
749
-            if (results[i]['*手机号'] === undefined) {
750
-              obj['phone'] = ''
751
-            } else {
752
-              if (key == '*手机号') {
753
-                obj['phone'] = results[i][key].trim()
976
+              let index = 0
977
+
978
+              for (let i = 0; i < this.export_date.length; i++) {
979
+                if (this.export_date[i].dialysis_no == '') {
980
+                  let new_dialysis_no = this.max_dialysis_no + index
981
+                  console.log(new_dialysis_no)
982
+                  index++
983
+                  let no = new_dialysis_no.toString()
984
+                  console.log(no)
985
+                  let rep = 3 - no.length
986
+                  console.log(rep)
987
+                  let tempNo = ""
988
+                  if (rep == 1){
989
+                    tempNo = "0"
990
+                  }
991
+
992
+                  if (rep == 2){
993
+                    tempNo = "00"
994
+                  }
995
+
996
+
997
+                  console.log(tempNo)
998
+                  if (rep > 0) {
999
+                    no = tempNo + no
1000
+                  }
1001
+                  this.export_date[i].dialysis_no = no
1002
+                }
754 1003
               }
755
-            }
756 1004
 
757
-            if (results[i]['*身份证号'] === undefined) {
758
-              obj['id_card_no'] = ''
759 1005
 
760
-            } else {
761
-              if (key == '*身份证号') {
762
-                obj['id_card_no'] = results[i][key].trim()
763
-              }
764
-            }
1006
+              console.log(this.export_date)
765 1007
 
766
-            if (results[i]['*首次肾脏治疗时间'] === undefined) {
767
-              obj['first_treatment_date'] = ''
1008
+              var tempExportDate = this.export_date
1009
+              var tempExportDateOne = this.export_date
1010
+              var tempExportDateTwo = this.export_date
768 1011
 
769
-            } else {
770
-              if (key == '*首次肾脏治疗时间') {
771
-                var month = parseInt(results[i][key].trim().split('/')[0])
772
-                var day = parseInt(results[i][key].trim().split('/')[1])
773
-                var year = parseInt(results[i][key].trim().split('/')[2])
774 1012
 
775
-                if (day < 10) {
776
-                  day = '0' + day
777
-                }
778
-                if (month < 10) {
779
-                  month = '0' + month
780
-                }
781
-                obj['first_treatment_date'] = '20' + year + '/' + month + '/' + day
782
-              }
783
-            }
784 1013
 
785
-            if (results[i]['*患者来源'] === undefined) {
786
-              obj['source'] = '0'
1014
+              const obj2 = {}
1015
+              tempExportDate = tempExportDate.reduce((cur, next) => {
1016
+                obj2[next.dialysis_no] ? '' : obj2[next.dialysis_no] = true && cur.push(next)
1017
+                return cur
1018
+              }, []) // 设置cur默认类型为数组,并且初始值为空的数组
787 1019
 
788
-            } else {
789
-              if (key == '*患者来源') {
790
-                if (results[i][key] == '门诊') {
791
-                  obj['source'] = '1'
792
-                } else if (results[i][key] == '住院') {
793
-                  obj['source'] = '2'
794
-                } else {
795
-                  obj['source'] = '0'
796
-                }
797
-              }
798
-            }
799 1020
 
800
-            if (results[i]['*治疗状态'] === undefined) {
801
-              obj['lapseto'] = '0'
802 1021
 
803
-            } else {
804
-              if (key == '*治疗状态') {
805
-                if (results[i][key] == '留治') {
806
-                  obj['lapseto'] = '1'
807
-                } else if (results[i][key] == '转归') {
808
-                  obj['lapseto'] = '2'
809
-                } else {
810
-                  obj['lapseto'] = '0'
811
-                }
1022
+              if (tempExportDate.length < this.export_date.length){
1023
+                this.dialysisVisible = true
1024
+                return
812 1025
               }
813
-            }
814 1026
 
815
-            if (results[i]['*传染病'] === undefined) {
816
-              let contagions = []
817
-              obj['is_infectious'] = '0'
818
-              obj['contagions'] = contagions
819 1027
 
820
-            } else {
821
-              if (key == '*传染病') {
822
-                if (results[i][key] == '无') {
823
-                  let contagions = []
824
-                  obj['is_infectious'] = '1'
825
-                  obj['contagions'] = contagions
826
-
827
-                } else if (results[i][key] == '乙肝') {
828
-                  let contagions = []
829
-                  contagions.push(2)
830
-                  obj['is_infectious'] = '2'
831
-                  obj['contagions'] = contagions
832
-                } else if (results[i][key] == '丙肝') {
833
-                  let contagions = []
834
-                  contagions.push(3)
835
-                  obj['is_infectious'] = '2'
836
-                  obj['contagions'] = contagions
837
-
838
-                } else if (results[i][key] == '艾滋病') {
839
-                  let contagions = []
840
-                  contagions.push(4)
841
-                  obj['is_infectious'] = '2'
842
-                  obj['contagions'] = contagions
843
-
844
-                } else if (results[i][key] == '肺结核') {
845
-                  let contagions = []
846
-                  contagions.push(5)
847
-                  obj['is_infectious'] = '2'
848
-                  obj['contagions'] = contagions
849
-
850
-                } else if (results[i][key] == '梅毒') {
851
-                  let contagions = []
852
-                  contagions.push(6)
853
-                  obj['is_infectious'] = '2'
854
-                  obj['contagions'] = contagions
855
-                } else {
856
-                  let contagions = []
857
-                  obj['is_infectious'] = '0'
858
-                  obj['contagions'] = contagions
859
-                }
1028
+
1029
+              const obj3 = {}
1030
+              tempExportDateOne = tempExportDateOne.reduce((cur, next) => {
1031
+                obj3[next.phone] ? '' : obj3[next.phone] = true && cur.push(next)
1032
+                return cur
1033
+              }, []) // 设置cur默认类型为数组,并且初始值为空的数组
1034
+
1035
+
1036
+
1037
+              if (tempExportDateOne.length < this.export_date.length){
1038
+                this.phoneVisible = true
1039
+                return
860 1040
               }
861
-            }
862 1041
 
863
-            if (results[i]['诊断'] === undefined) {
864
-              obj['diagnose'] = ''
865
-            } else {
866
-              if (key == '诊断') {
867
-                obj['diagnose'] = results[i][key]
1042
+
1043
+
1044
+
1045
+              const obj4 = {}
1046
+              tempExportDateTwo = tempExportDateTwo.reduce((cur, next) => {
1047
+                obj4[next.id_card_no] ? '' : obj4[next.id_card_no] = true && cur.push(next)
1048
+                return cur
1049
+              }, []) // 设置cur默认类型为数组,并且初始值为空的数组
1050
+
1051
+
1052
+
1053
+              if (tempExportDateTwo.length < this.export_date.length){
1054
+                this.idCardNoVisible = true
1055
+                return
868 1056
               }
869
-            }
870
-          }
871
-          this.export_date.push(obj)
872
-        }
873 1057
 
874
-        let params = {
875
-          'patients': this.export_date
876
-        }
877
-        postExportPatients(params).then(
878
-          response => {
879
-            if (response.data.state === 1) {
880
-              this.getList()
881
-            } else {
882
-              this.$message.error(response.data.msg)
1058
+
1059
+
1060
+
1061
+              // let params = {
1062
+              //   'patients': this.export_date
1063
+              // }
1064
+              // postExportPatients(params).then(
1065
+              //   response => {
1066
+              //     if (response.data.state === 1) {
1067
+              //       this.getList()
1068
+              //     } else {
1069
+              //       this.$message.error(response.data.msg)
1070
+              //     }
1071
+              //   }
1072
+              // )
1073
+
883 1074
             }
884 1075
           }
885 1076
         )
1077
+
886 1078
       },
887 1079
       getCount(row) {
888 1080
         console.log(row)
@@ -946,88 +1138,88 @@
946 1138
         this.pageSelect = this.multipleSelection.length
947 1139
       },
948 1140
 
949
-    handleCheckedCitiesChange(value) {
950
-      const checkedCount = value.length;
951
-      this.checkAll = checkedCount === this.cities.length;
952
-      this.isIndeterminate =
953
-        checkedCount > 0 && checkedCount < this.cities.length;
954
-    },
955
-    handleSizeChange(val) {
956
-      this.listQuery.limit = val;
957
-      this.getList();
958
-    },
959
-    handleCurrentChange(val) {
960
-      this.listQuery.page = val;
961
-      this.getList();
962
-    },
963
-    changeCategoryId(categoryId) {
964
-      this.categoryId = categoryId;
965
-    },
966
-    selectSchedulType(scheduleType) {
967
-      // alert(scheduleType);/
968
-      this.schedulType = scheduleType;
969
-      this.listQuery.schedul_type = scheduleType;
970
-      this.getList();
971
-    },
972
-    selectSystemType(systemType) {
973
-      this.systemType = systemType;
974
-      this.listQuery.binding_state = systemType;
975
-      this.getList();
976
-    },
977
-    selectLapseTo(lapseto) {
978
-      this.lapsetoType = lapseto;
979
-      this.listQuery.lapseto = lapseto;
980
-      this.getList();
981
-    },
982
-    selectSource(source) {
983
-      this.sourceType = source;
984
-      this.listQuery.source = source;
985
-      this.getList();
986
-    },
987
-    changeTimeOne(val) {
988
-      var time = this.getTimestamp(val) - this.end_time;
989
-      if (time > 0) {
990
-        this.$message.error("结束时间不能小于开始时间");
991
-        this.listQuery.start_time = "";
992
-      } else {
993
-        this.getList();
994
-        this.startTime = this.getTimestamp(val);
995
-      }
996
-    },
997
-    changeTime(val) {
998
-      var time = this.getTimestamp(val) - this.startTime;
999
-      if (time < 0) {
1000
-        this.$message.error("结束时间不能小于开始时间");
1001
-        this.listQuery.end_time = "";
1002
-      } else {
1003
-        this.getList();
1004
-        this.end_time = this.getTimestamp(val);
1005
-      }
1006
-    },
1007
-    getTimestamp(time) {
1008
-      // 把时间日期转成时间戳
1009
-      return new Date(time).getTime() / 1000;
1010
-    },
1011
-    search() {
1012
-      this.listQuery.keywords = this.searchKey;
1013
-      this.getList();
1014
-    },
1015
-    changeOtherSearch() {
1016
-      this.getList();
1017
-    },
1018
-    getList() {
1019
-      fetchList(this.listQuery).then(response => {
1020
-        if (response.data.state === 0) {
1021
-          this.$message.error(response.data.msg);
1022
-          return false;
1141
+      handleCheckedCitiesChange(value) {
1142
+        const checkedCount = value.length
1143
+        this.checkAll = checkedCount === this.cities.length
1144
+        this.isIndeterminate =
1145
+          checkedCount > 0 && checkedCount < this.cities.length
1146
+      },
1147
+      handleSizeChange(val) {
1148
+        this.listQuery.limit = val
1149
+        this.getList()
1150
+      },
1151
+      handleCurrentChange(val) {
1152
+        this.listQuery.page = val
1153
+        this.getList()
1154
+      },
1155
+      changeCategoryId(categoryId) {
1156
+        this.categoryId = categoryId
1157
+      },
1158
+      selectSchedulType(scheduleType) {
1159
+        // alert(scheduleType);/
1160
+        this.schedulType = scheduleType
1161
+        this.listQuery.schedul_type = scheduleType
1162
+        this.getList()
1163
+      },
1164
+      selectSystemType(systemType) {
1165
+        this.systemType = systemType
1166
+        this.listQuery.binding_state = systemType
1167
+        this.getList()
1168
+      },
1169
+      selectLapseTo(lapseto) {
1170
+        this.lapsetoType = lapseto
1171
+        this.listQuery.lapseto = lapseto
1172
+        this.getList()
1173
+      },
1174
+      selectSource(source) {
1175
+        this.sourceType = source
1176
+        this.listQuery.source = source
1177
+        this.getList()
1178
+      },
1179
+      changeTimeOne(val) {
1180
+        var time = this.getTimestamp(val) - this.end_time
1181
+        if (time > 0) {
1182
+          this.$message.error('结束时间不能小于开始时间')
1183
+          this.listQuery.start_time = ''
1023 1184
         } else {
1024
-          this.tableData = response.data.data.patients;
1025
-          // console.log('病人是', this.tableData)
1026
-          this.pageTotal = this.tableData.length;
1027
-          this.total = response.data.data.total;
1185
+          this.getList()
1186
+          this.startTime = this.getTimestamp(val)
1028 1187
         }
1029
-      });
1030
-    },
1188
+      },
1189
+      changeTime(val) {
1190
+        var time = this.getTimestamp(val) - this.startTime
1191
+        if (time < 0) {
1192
+          this.$message.error('结束时间不能小于开始时间')
1193
+          this.listQuery.end_time = ''
1194
+        } else {
1195
+          this.getList()
1196
+          this.end_time = this.getTimestamp(val)
1197
+        }
1198
+      },
1199
+      getTimestamp(time) {
1200
+        // 把时间日期转成时间戳
1201
+        return new Date(time).getTime() / 1000
1202
+      },
1203
+      search() {
1204
+        this.listQuery.keywords = this.searchKey
1205
+        this.getList()
1206
+      },
1207
+      changeOtherSearch() {
1208
+        this.getList()
1209
+      },
1210
+      getList() {
1211
+        fetchList(this.listQuery).then(response => {
1212
+          if (response.data.state === 0) {
1213
+            this.$message.error(response.data.msg)
1214
+            return false
1215
+          } else {
1216
+            this.tableData = response.data.data.patients
1217
+            // console.log('病人是', this.tableData)
1218
+            this.pageTotal = this.tableData.length
1219
+            this.total = response.data.data.total
1220
+          }
1221
+        })
1222
+      },
1031 1223
 
1032 1224
       OpenView(name, number, id) {
1033 1225
         this.name = name

+ 42 - 103
src/xt_pages/workforce/appointment.vue Voir le fichier

@@ -11,7 +11,7 @@
11 11
         <br/>
12 12
         <br/>
13 13
         <span>{{getContent(item)}}</span>
14
-        <span style="color:blue"  @click="generateTxt(item)">点击</span>
14
+        <span style="color:blue" @click="generateTxt(item)">点击</span>
15 15
         <span>查看详情</span>
16 16
         <br/>
17 17
         <br/>
@@ -54,23 +54,23 @@
54 54
         <div>
55 55
           <schedule-upload-excel style="float:left;margin-right: -500px" :on-success='handleSuccess'
56 56
                                  :before-upload="beforeUpload"></schedule-upload-excel>
57
-        <el-button v-if="isShow()" type="primary" size="small" @click="export_file()"
58
-                   :loading="downloadLoading"
59
-        >
60
-          导出模版
61
-        </el-button>
62
-
63
-        <el-button
64
-          @click="generateLog()"
65
-          class="filter-item"
66
-          type="primary"
67
-          size="small"
68
-        >下载错误日志
69
-        </el-button>
70
-
71
-        <el-button type="primary" size="small" icon="el-icon-printer" @click="printScheduleAction">打印</el-button>
72
-        <el-button type="primary" size="small" icon="el-icon-setting" @click="setScheduleTemplateAction">排班模板
73
-        </el-button>
57
+          <el-button v-if="isShow()" type="primary" size="small" @click="export_file()"
58
+                     :loading="downloadLoading"
59
+          >
60
+            导出模版
61
+          </el-button>
62
+
63
+          <el-button
64
+            @click="generateLog()"
65
+            class="filter-item"
66
+            type="primary"
67
+            size="small"
68
+          >下载错误日志
69
+          </el-button>
70
+
71
+          <el-button type="primary" size="small" icon="el-icon-printer" @click="printScheduleAction">打印</el-button>
72
+          <el-button type="primary" size="small" icon="el-icon-setting" @click="setScheduleTemplateAction">排班模板
73
+          </el-button>
74 74
         </div>
75 75
       </el-col>
76 76
     </div>
@@ -103,7 +103,7 @@
103 103
 <script>
104 104
   import { parseTime } from '@/utils'
105 105
   import tableData from './components/tableData'
106
-  import { exportSchedule, getWeekPanels,initDate } from '@/api/schedule'
106
+  import { exportSchedule, getWeekPanels, initDate } from '@/api/schedule'
107 107
   import BreadCrumb from '@/xt_pages/components/bread-crumb'
108 108
   import UploadExcel from '@/xt_pages/components/UploadExcel'
109 109
   import ScheduleUploadExcel from './components/scheduleUploadExcel/index'
@@ -121,14 +121,14 @@
121 121
         tabPosition: 'top',
122 122
         partitions: {},
123 123
         scheduleZone: [],
124
-        days:[],
125
-        logs:[],
124
+        days: [],
125
+        logs: [],
126 126
         scheduleZoneRow: [],
127 127
         downloadLoading: false,
128 128
         msgTipVisible: false,
129 129
         dialogVisible: false,
130 130
         isExistRepeatVisible: false,
131
-        exportLogVisible:false,
131
+        exportLogVisible: false,
132 132
         theWeek: {
133 133
           lastWeek: 0,
134 134
           thisWeek: 0,
@@ -144,25 +144,26 @@
144 144
       UploadExcel
145 145
     },
146 146
     methods: {
147
-      generateTxt:function(log) {
147
+      generateTxt: function(log) {
148 148
         var content = ''
149
-        var errlog =  log.err_logs
150
-        for (let i = 0; i< errlog.length; i++){
149
+        var errlog = log.err_logs
150
+        content = this.getContent(log)
151
+
152
+        for (let i = 0; i < errlog.length; i++) {
151 153
           if (content.length == 0) {
152 154
             content = errlog[i].err_msg
153
-          }else{
154
-            content = content +"\n"+errlog[i].err_msg
155
+          } else {
156
+            content = content + '\n' + errlog[i].err_msg
155 157
           }
156 158
         }
157 159
 
158
-
159 160
         var url = new Blob(['\ufeff' + content], { type: 'text/txt,charset=UTF-8' })
160 161
         if (typeof url === 'object' && url instanceof Blob) {
161 162
           url = URL.createObjectURL(url) // 创建blob地址
162 163
         }
163 164
         const aLink = document.createElement('a')
164 165
         aLink.href = url
165
-        aLink.download = this.timestampToTime(log.export_time)+'错误日志.txt'
166
+        aLink.download = this.timestampToTime(log.export_time) + '错误日志.txt'
166 167
         aLink.click()
167 168
 
168 169
       },
@@ -173,7 +174,7 @@
173 174
         var D = (date.getDate() < 10 ? '0' + (date.getDate()) : date.getDate()) + '日 '
174 175
         var h = (date.getHours() < 10 ? '0' + (date.getHours()) : date.getHours()) + '时'
175 176
         var m = (date.getMinutes() < 10 ? '0' + (date.getMinutes()) : date.getMinutes()) + '分'
176
-        var s = (date.getSeconds() < 10 ? '0' + (date.getSeconds()) : date.getSeconds())+'秒'
177
+        var s = (date.getSeconds() < 10 ? '0' + (date.getSeconds()) : date.getSeconds()) + '秒'
177 178
         return Y + M + D + h + m + s
178 179
       },
179 180
       getContent(log) {
@@ -420,13 +421,13 @@
420 421
           }
421 422
           console.log(list)
422 423
           const data = this.formatJson(filterVal, list)
423
-          const filename = "排班模版"
424
+          const filename = '排班模版'
424 425
           excel.export_json_to_excel({
425 426
             multiHeader,
426 427
             header,
427 428
             merges,
428 429
             data,
429
-            filename,
430
+            filename
430 431
           })
431 432
           this.downloadLoading = false
432 433
         })
@@ -477,9 +478,7 @@
477 478
         return isShow
478 479
       }, handleSuccess({ results, header }) {
479 480
 
480
-
481
-
482
-        if(results.length > 0) {
481
+        if (results.length > 0) {
483 482
           let headers = []
484 483
           for (let key in results[0]) {
485 484
             headers.push(key)
@@ -612,13 +611,11 @@
612 611
             this.dialogVisible = true
613 612
             return
614 613
           }
615
-        }else{
614
+        } else {
616 615
           this.dialogVisible = true
617 616
           return
618 617
         }
619 618
 
620
-
621
-
622 619
         let is_system_zone = true
623 620
         let is_device_number = true
624 621
         let zones = []
@@ -678,14 +675,7 @@
678 675
         }
679 676
 
680 677
 
681
-        console.log("111111111")
682
-        console.log(is_system_zone)
683
-        console.log(is_device_number)
684
-        console.log("22222222222")
685
-
686
-
687 678
 
688
-        //
689 679
 
690 680
         let tempObj = null
691 681
         if (results.length > 0) {
@@ -699,7 +689,7 @@
699 689
 
700 690
             if (key != '区号' && key != '机号') {
701 691
               let obj = {}
702
-              obj['name'] = results[i + 1][key].trim()
692
+              obj['name'] = results[i + 1][key].replace(/\s/g, '')
703 693
               if (tempObj[key] == '上午') {
704 694
                 obj['schedule_type'] = 1
705 695
               } else if (tempObj[key] == '下午') {
@@ -731,7 +721,7 @@
731 721
 
732 722
               var current_date_two = new Date(m_year + '-' + m_month + '-' + m_date)
733 723
 
734
-              if(new Date(tempObjTwo['schedule_date']).getTime() >=  new Date(current_date_two).getTime()) {
724
+              if (new Date(tempObjTwo['schedule_date']).getTime() >= new Date(current_date_two).getTime()) {
735 725
                 datas.push(tempObjTwo)
736 726
               }
737 727
             }
@@ -739,9 +729,6 @@
739 729
 
740 730
         }
741 731
 
742
-        console.log("333333333")
743
-        console.log(datas)
744
-        console.log("44444444444")
745 732
 
746 733
         let date_arr = []
747 734
         //校验文档是否规范
@@ -777,10 +764,7 @@
777 764
           }
778 765
         }
779 766
 
780
-        console.log("333333333")
781
-        console.log(is_system_zone)
782
-        console.log(is_device_number)
783
-        console.log("44444444444")
767
+
784 768
 
785 769
         //校验文档中同一天同个人是否存在多个排班
786 770
         let is_exist_repeat = false
@@ -820,11 +804,10 @@
820 804
           }
821 805
         }
822 806
 
823
-        console.log(header.length )
824
-        console.log(is_system_zone )
807
+        console.log(header.length)
808
+        console.log(is_system_zone)
825 809
         console.log(is_device_number)
826 810
 
827
-
828 811
         if (header.length > 65 || !is_system_zone || !is_device_number) {
829 812
           this.dialogVisible = true
830 813
           return
@@ -844,30 +827,24 @@
844 827
             var day = day2.getDate() < 10 ? '0' + (day2.getDate()).toString() : (day2.getMonth() + 1).toString()
845 828
 
846 829
             var date = day2.getFullYear() + '-' + month + '-' + day
847
-            exportSchedule(params,date).then(response => {
830
+            exportSchedule(params, date).then(response => {
848 831
               if (response.data.state == 0) {
849 832
                 return false
850 833
               }
851 834
               this.getWeekPanels()
852 835
 
853
-
854
-
855 836
             })
856 837
           }
857 838
 
858 839
         }
859 840
 
860 841
       },
861
-      getInitDate(){
842
+      getInitDate() {
862 843
         initDate().then(response => {
863 844
           if (response.data.state == 0) {
864 845
             return false
865 846
           }
866
-
867 847
           this.days = response.data.data.days
868
-
869
-
870
-
871 848
         })
872 849
       },
873 850
       getWeekByResultsStr(key) {
@@ -1413,23 +1390,18 @@
1413 1390
           case '周一_1': //下周一
1414 1391
             return this.days[7]
1415 1392
 
1416
-
1417
-
1418
-
1419 1393
             break
1420 1394
 
1421 1395
           case '_14': //下周一
1422 1396
 
1423 1397
             return this.days[7]
1424 1398
 
1425
-
1426 1399
             break
1427 1400
 
1428 1401
           case   '_15': //下周一
1429 1402
 
1430 1403
             return this.days[7]
1431 1404
 
1432
-
1433 1405
             break
1434 1406
 
1435 1407
           case '周一_2' : //下下周一
@@ -1442,14 +1414,12 @@
1442 1414
 
1443 1415
             return this.days[14]
1444 1416
 
1445
-
1446 1417
             break
1447 1418
 
1448 1419
           case '_29': //下下周一
1449 1420
 
1450 1421
             return this.days[14]
1451 1422
 
1452
-
1453 1423
             break
1454 1424
 
1455 1425
           case '周二' : //本周二
@@ -1475,19 +1445,16 @@
1475 1445
           case  '_16' ://下周二
1476 1446
             return this.days[8]
1477 1447
 
1478
-
1479 1448
             break
1480 1449
 
1481 1450
           case  '_17'://下周二
1482 1451
             return this.days[8]
1483 1452
 
1484
-
1485 1453
             break
1486 1454
 
1487 1455
           case '周二_2' ://下下周二
1488 1456
             return this.days[15]
1489 1457
 
1490
-
1491 1458
             break
1492 1459
 
1493 1460
           case '_30' ://下下周二
@@ -1508,43 +1475,36 @@
1508 1475
           case  '_4': //本周三
1509 1476
             return this.days[2]
1510 1477
 
1511
-
1512 1478
             break
1513 1479
 
1514 1480
           case '_5': //本周三
1515 1481
             return this.days[2]
1516 1482
 
1517
-
1518 1483
             break
1519 1484
 
1520 1485
           case '周三_1': //下周三
1521 1486
             return this.days[9]
1522 1487
 
1523
-
1524 1488
             break
1525 1489
 
1526 1490
           case  '_18' : //下周三
1527 1491
             return this.days[9]
1528 1492
 
1529
-
1530 1493
             break
1531 1494
 
1532 1495
           case '_19': //下周三
1533 1496
             return this.days[9]
1534 1497
 
1535
-
1536 1498
             break
1537 1499
 
1538 1500
           case '周三_2' : //下下周三
1539 1501
             return this.days[16]
1540 1502
 
1541
-
1542 1503
             break
1543 1504
 
1544 1505
           case '_32' : //下下周三
1545 1506
             return this.days[16]
1546 1507
 
1547
-
1548 1508
             break
1549 1509
 
1550 1510
           case  '_33': //下下周三
@@ -1560,20 +1520,17 @@
1560 1520
           case '_6' :
1561 1521
             return this.days[4]
1562 1522
 
1563
-
1564 1523
             break
1565 1524
 
1566 1525
           case  '_7':
1567 1526
             return this.days[4]
1568 1527
 
1569
-
1570 1528
             break
1571 1529
 
1572 1530
           case '周四_1':
1573 1531
 
1574 1532
             return this.days[10]
1575 1533
 
1576
-
1577 1534
             break
1578 1535
 
1579 1536
           case '_20' :
@@ -1592,7 +1549,6 @@
1592 1549
 
1593 1550
             return this.days[17]
1594 1551
 
1595
-
1596 1552
             break
1597 1553
 
1598 1554
           case '_34':
@@ -1609,24 +1565,20 @@
1609 1565
           case '周五':
1610 1566
             return this.days[4]
1611 1567
 
1612
-
1613 1568
             break
1614 1569
 
1615 1570
           case  '_8':
1616 1571
             return this.days[4]
1617 1572
 
1618
-
1619 1573
             break
1620 1574
 
1621 1575
           case  '_9':
1622 1576
             return this.days[4]
1623 1577
 
1624
-
1625 1578
             break
1626 1579
           case '周五_1' :
1627 1580
             return this.days[11]
1628 1581
 
1629
-
1630 1582
             break
1631 1583
 
1632 1584
           case '_22' :
@@ -1637,18 +1589,15 @@
1637 1589
           case  '_23':
1638 1590
             return this.days[11]
1639 1591
 
1640
-
1641 1592
             break
1642 1593
           case '周五_2' :
1643 1594
             return this.days[18]
1644 1595
 
1645
-
1646 1596
             break
1647 1597
 
1648 1598
           case '_36':
1649 1599
             return this.days[18]
1650 1600
 
1651
-
1652 1601
             break
1653 1602
 
1654 1603
           case  '_37':
@@ -1659,7 +1608,6 @@
1659 1608
           case '周六' :
1660 1609
             return this.days[5]
1661 1610
 
1662
-
1663 1611
             break
1664 1612
 
1665 1613
           case  '_10' :
@@ -1670,18 +1618,15 @@
1670 1618
           case '_11':
1671 1619
             return this.days[5]
1672 1620
 
1673
-
1674 1621
             break
1675 1622
           case '周六_1' :
1676 1623
             return this.days[12]
1677 1624
 
1678
-
1679 1625
             break
1680 1626
 
1681 1627
           case  '_24' :
1682 1628
             return this.days[12]
1683 1629
 
1684
-
1685 1630
             break
1686 1631
 
1687 1632
           case  '_25':
@@ -1692,24 +1637,20 @@
1692 1637
           case '周六_2' :
1693 1638
             return this.days[19]
1694 1639
 
1695
-
1696 1640
             break
1697 1641
 
1698 1642
           case '_38' :
1699 1643
             return this.days[19]
1700 1644
 
1701
-
1702 1645
             break
1703 1646
 
1704 1647
           case '_39':
1705 1648
             return this.days[19]
1706 1649
 
1707
-
1708 1650
             break
1709 1651
           case '周日' :
1710 1652
             return this.days[6]
1711 1653
 
1712
-
1713 1654
             break
1714 1655
 
1715 1656
           case  '_12' :
@@ -1723,13 +1664,11 @@
1723 1664
           case '周日_1' :
1724 1665
             return this.days[13]
1725 1666
 
1726
-
1727 1667
             break
1728 1668
 
1729 1669
           case  '_26' :
1730 1670
             return this.days[13]
1731 1671
 
1732
-
1733 1672
             break
1734 1673
 
1735 1674
           case  '_27':

+ 14 - 1
src/xt_pages/workforce/template.vue Voir le fichier

@@ -71,6 +71,18 @@
71 71
       </el-button>
72 72
 
73 73
 
74
+      <el-button
75
+        @click="generateLog()"
76
+        class="filter-item"
77
+        type="primary"
78
+        size="small"
79
+      >下载错误日志
80
+      </el-button>
81
+
82
+      <!--<upload-excel style="float:right;" :on-success='handleSuccess' :before-upload="beforeUpload"></upload-excel>-->
83
+      <schedule-template-upload-excel style="float:right;" :on-success='handleSuccess'
84
+                                      :before-upload="beforeUpload"></schedule-template-upload-excel>
85
+
74 86
 
75 87
       <el-button size="small" icon="el-icon-setting" type="primary" @click="setScheduleTemplateAction">设置模板</el-button>
76 88
       <!-- </el-col> -->
@@ -209,6 +221,7 @@
209 221
       generateTxt:function(log) {
210 222
         var content = ''
211 223
         var errlog =  log.err_logs
224
+        content = this.getContent(log)
212 225
         for (let i = 0; i< errlog.length; i++){
213 226
           if (content.length == 0) {
214 227
             content = errlog[i].err_msg
@@ -552,7 +565,7 @@
552 565
 
553 566
             if (key != '区号' && key != '机号') {
554 567
               let obj = {}
555
-              obj['name'] = results[i + 1][key].trim()
568
+              obj['name'] = results[i + 1][key].replace(/\s/g,"")
556 569
               if (tempObj[key] == '上午') {
557 570
                 obj['schedule_type'] = 1
558 571
               } else if (tempObj[key] == '下午') {

+ 13 - 13
src/xt_permission.js Voir le fichier

@@ -12,19 +12,19 @@ const permissionWhiteList = loginWhiteList.concat(["/"]); // 权限验证白名
12 12
 
13 13
 router.beforeEach((to, from, next) => {
14 14
   // 线上注释
15
-  // if (!store.getters.configlist || store.getters.configlist === undefined || store.getters.configlist.length <= 0) {
16
-  //  store.dispatch('VerifyConfigList', []).then(() => {
17
-  //    next()
18
-  // })
19
-  // }
20
-  // if (store.getters.permission_routers === undefined) {
21
-  //  store.dispatch('xt_GenerateRoutes', []).then(() => {
22
-  //    next()
23
-  //  })
24
-  // } else {
25
-  //   next()
26
-  // }
27
-  // return
15
+  //   if (!store.getters.configlist || store.getters.configlist === undefined || store.getters.configlist.length <= 0) {
16
+  //    store.dispatch('VerifyConfigList', []).then(() => {
17
+  //      next()
18
+  //   })
19
+  //   }
20
+  //   if (store.getters.permission_routers === undefined) {
21
+  //    store.dispatch('xt_GenerateRoutes', []).then(() => {
22
+  //      next()
23
+  //    })
24
+  //   } else {
25
+  //     next()
26
+  //   }
27
+  //   return
28 28
   // 线上注释
29 29
 
30 30
   NProgress.start();