See999 4 years ago
parent
commit
5e765e0a28
2 changed files with 676 additions and 382 deletions
  1. 582 354
      src/xt_pages/medicalScheduling/index.vue
  2. 94 28
      src/xt_pages/medicalScheduling/medical_print.vue

File diff suppressed because it is too large
+ 582 - 354
src/xt_pages/medicalScheduling/index.vue


+ 94 - 28
src/xt_pages/medicalScheduling/medical_print.vue View File

@@ -14,6 +14,9 @@
14 14
                     <div class="order_title_panl">
15 15
                         <span class="main_title">{{ $store.getters.xt_user.org.org_name }}医护排班表</span>
16 16
                     </div>
17
+                    <div style="text-align:right;margin-bottom:20px;font-size: 18px;">
18
+                      打印时间:{{ getNowFormatDate() }}
19
+                    </div>
17 20
                     <div class="table_panel">
18 21
                         <table class="table">
19 22
                             <thead>
@@ -29,15 +32,15 @@
29 32
                                 </tr>
30 33
                             </thead>
31 34
                             <tbody>
32
-                                <tr v-for='item in 6'>
33
-                                    <td>张三</td>
34
-                                    <td>张三</td>
35
-                                    <td>张三</td>
36
-                                    <td>张三</td>
37
-                                    <td>张三</td>
38
-                                    <td>张三</td>
39
-                                    <td>张三</td>
40
-                                    <td>张三</td>
35
+                                <tr v-for='(item,index) in tableData' :key="index">
36
+                                    <td>{{ item.user_name }}</td>
37
+                                    <td>{{ getClass(item.user_name,1) }}</td>
38
+                                    <td>{{ getClass(item.user_name,2) }}</td>
39
+                                    <td>{{ getClass(item.user_name,3) }}</td>
40
+                                    <td>{{ getClass(item.user_name,4) }}</td>
41
+                                    <td>{{ getClass(item.user_name,5) }}</td>
42
+                                    <td>{{ getClass(item.user_name,6) }}</td>
43
+                                    <td>{{ getClass(item.user_name,7) }}</td>
41 44
                                 </tr>
42 45
                             </tbody>
43 46
                         </table>
@@ -64,29 +67,33 @@ export default {
64 67
           ],
65 68
           start_time:"",
66 69
           end_time:"",
70
+
71
+          doctorlist:[],
72
+          tableData:[]
67 73
         }
68 74
     },
69 75
     methods:{
70
-        printAction: function() {
71
-            const style = '@media print { .print_main_content { background-color: white; width:960px;  margin:0 auto; padding: 0 0 20px 0; } .order_title_panl { text-align: center; } .main_title { font-size: 18px; line-height: 40px; font-weight: 500; } .table_panel { } .table { width: 100%; border: 1px solid; border-collapse: collapse; padding: 2px; } thead tr td { border: 1px solid; text-align: center; font-size: 20px; padding: 15px 5px; } tbody tr td { border: 1px solid; text-align: center; font-size: 18px; padding: 10px 5px; } .proj { padding: 5px 0; text-align: left; } .proj_title { font-size: 16px; font-weight: 500; line-height: 25px; } .proj_item { font-size: 15px; line-height: 20px; } .zone_name { font-weight: 500; } }'
76
+      printAction: function() {
77
+          const style = '@media print { .print_main_content { background-color: white; width:960px;  margin:0 auto; padding: 0 0 20px 0; } .order_title_panl { text-align: center; } .main_title { font-size: 18px; line-height: 40px; font-weight: 500; } .table_panel { } .table { width: 100%; border: 1px solid; border-collapse: collapse; padding: 2px; } thead tr td { border: 1px solid; text-align: center; font-size: 20px; padding: 15px 5px; } tbody tr td { border: 1px solid; text-align: center; font-size: 18px; padding: 10px 5px; } .proj { padding: 5px 0; text-align: left; } .proj_title { font-size: 16px; font-weight: 500; line-height: 25px; } .proj_item { font-size: 15px; line-height: 20px; } .zone_name { font-weight: 500; } }'
72 78
 
73
-            printJS({
74
-            printable: 'print_content',
75
-            type: 'html',
76
-            documentTitle: '  ',
77
-            style: style,
78
-            scanStyles: false
79
-            })
80
-        },
81
-        getDoctorList(){
82
-          getDoctorList().then(response=>{
83
-             var list =  response.data.data.list
84
-             console.log("医护列表",list)
85
-              this.getStaffScheduleList()
79
+          printJS({
80
+          printable: 'print_content',
81
+          type: 'html',
82
+          documentTitle: '  ',
83
+          style: style,
84
+          scanStyles: false
86 85
           })
87
-        },
88
-        //获取本周的所有排班列表
89
-       getStaffScheduleList(){
86
+      },
87
+      getDoctorList(){
88
+        getDoctorList().then(response=>{
89
+          var list =  response.data.data.list
90
+          console.log("医护列表",list)
91
+          this.doctorlist = list
92
+          this.getStaffScheduleList()
93
+        })
94
+      },
95
+      //获取本周的所有排班列表
96
+      getStaffScheduleList(){
90 97
           const params = {
91 98
             start_time:this.start_time,
92 99
             end_time:this.end_time,
@@ -95,9 +102,68 @@ export default {
95 102
             if(response.data.state == 1){
96 103
               var staffList = response.data.data.staffList
97 104
               console.log("staffList",staffList)
105
+
106
+              let tempArr = [], newArr = []
107
+              for (let i = 0; i < staffList.length; i++) {
108
+                if(tempArr.indexOf(staffList[i].user_name) === -1) {
109
+                  newArr.push({
110
+                    user_name: staffList[i].user_name,
111
+                    admin_user_id:staffList[i].admin_user_id,
112
+                    list: [{class_name:staffList[i].class_name,schedule_week:staffList[i].schedule_week}]
113
+                  })
114
+                  tempArr.push(staffList[i].user_name);
115
+                } else {
116
+                  for (let j = 0; j < newArr.length; j++) {
117
+                    if (newArr[j].user_name == staffList[i].user_name) {
118
+                      newArr[j].list.push({class_name:staffList[i].class_name,admin_user_id:staffList[i].admin_user_id,schedule_week:staffList[i].schedule_week})
119
+                    }
120
+                  }
121
+                }
122
+              }
123
+              let arr = [...newArr]
124
+              this.doctorlist.map((item,index) => {
125
+                if(!(arr[index] && item.admin_user_id == arr[index].admin_user_id)){
126
+                  arr.splice(index,0,{user_name:item.user_name,admin_user_id: item.admin_user_id,list: []})
127
+                }
128
+              })
129
+              console.log(arr)
130
+              this.tableData = arr
131
+              
98 132
             }
99 133
          })
100
-       }
134
+      },
135
+      getClass(name,index){
136
+        if(name != undefined){
137
+          let newClass = '';
138
+          this.tableData.map(item => {
139
+            if(item.user_name == name){
140
+              if(item.list){
141
+                item.list.map(it => {
142
+                  if(it.schedule_week == index){
143
+                    newClass = it.class_name
144
+                  }
145
+                })
146
+              } 
147
+            }
148
+          })
149
+          return newClass
150
+        }
151
+      },
152
+      getNowFormatDate() {
153
+        var date = new Date();
154
+        var seperator1 = "-";
155
+        var year = date.getFullYear();
156
+        var month = date.getMonth() + 1;
157
+        var strDate = date.getDate();
158
+        if (month >= 1 && month <= 9) {
159
+            month = "0" + month;
160
+        }
161
+        if (strDate >= 0 && strDate <= 9) {
162
+            strDate = "0" + strDate;
163
+        }
164
+        var currentdate = year + seperator1 + month + seperator1 + strDate;
165
+        return currentdate;
166
+      }
101 167
     },
102 168
     created(){
103 169
       var starttime =  this.$route.query.starttime