csx 4 лет назад
Родитель
Сommit
7f2f900a2b

+ 11 - 30
package-lock.json Просмотреть файл

@@ -4740,8 +4740,7 @@
4740 4740
         "ansi-regex": {
4741 4741
           "version": "2.1.1",
4742 4742
           "bundled": true,
4743
-          "dev": true,
4744
-          "optional": true
4743
+          "dev": true
4745 4744
         },
4746 4745
         "aproba": {
4747 4746
           "version": "1.2.0",
@@ -4764,15 +4763,13 @@
4764 4763
         "balanced-match": {
4765 4764
           "version": "1.0.0",
4766 4765
           "bundled": true,
4767
-          "dev": true,
4768
-          "optional": true
4766
+          "dev": true
4769 4767
         },
4770 4768
         "brace-expansion": {
4771 4769
           "version": "1.1.11",
4772 4770
           "resolved": false,
4773 4771
           "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==",
4774 4772
           "dev": true,
4775
-          "optional": true,
4776 4773
           "requires": {
4777 4774
             "balanced-match": "^1.0.0",
4778 4775
             "concat-map": "0.0.1"
@@ -4788,22 +4785,19 @@
4788 4785
         "code-point-at": {
4789 4786
           "version": "1.1.0",
4790 4787
           "bundled": true,
4791
-          "dev": true,
4792
-          "optional": true
4788
+          "dev": true
4793 4789
         },
4794 4790
         "concat-map": {
4795 4791
           "version": "0.0.1",
4796 4792
           "resolved": false,
4797 4793
           "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=",
4798
-          "dev": true,
4799
-          "optional": true
4794
+          "dev": true
4800 4795
         },
4801 4796
         "console-control-strings": {
4802 4797
           "version": "1.1.0",
4803 4798
           "resolved": false,
4804 4799
           "integrity": "sha1-PXz0Rk22RG6mRL9LOVB/mFEAjo4=",
4805
-          "dev": true,
4806
-          "optional": true
4800
+          "dev": true
4807 4801
         },
4808 4802
         "core-util-is": {
4809 4803
           "version": "1.0.2",
@@ -4933,8 +4927,7 @@
4933 4927
         "inherits": {
4934 4928
           "version": "2.0.3",
4935 4929
           "bundled": true,
4936
-          "dev": true,
4937
-          "optional": true
4930
+          "dev": true
4938 4931
         },
4939 4932
         "ini": {
4940 4933
           "version": "1.3.5",
@@ -4948,7 +4941,6 @@
4948 4941
           "resolved": false,
4949 4942
           "integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=",
4950 4943
           "dev": true,
4951
-          "optional": true,
4952 4944
           "requires": {
4953 4945
             "number-is-nan": "^1.0.0"
4954 4946
           }
@@ -4965,7 +4957,6 @@
4965 4957
           "resolved": false,
4966 4958
           "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==",
4967 4959
           "dev": true,
4968
-          "optional": true,
4969 4960
           "requires": {
4970 4961
             "brace-expansion": "^1.1.7"
4971 4962
           }
@@ -4973,15 +4964,13 @@
4973 4964
         "minimist": {
4974 4965
           "version": "0.0.8",
4975 4966
           "bundled": true,
4976
-          "dev": true,
4977
-          "optional": true
4967
+          "dev": true
4978 4968
         },
4979 4969
         "minipass": {
4980 4970
           "version": "2.3.5",
4981 4971
           "resolved": false,
4982 4972
           "integrity": "sha512-Gi1W4k059gyRbyVUZQ4mEqLm0YIUiGYfvxhF6SIlk3ui1WVxMTGfGdQ2SInh3PDrRTVvPKgULkpJtT4RH10+VA==",
4983 4973
           "dev": true,
4984
-          "optional": true,
4985 4974
           "requires": {
4986 4975
             "safe-buffer": "^5.1.2",
4987 4976
             "yallist": "^3.0.0"
@@ -5002,7 +4991,6 @@
5002 4991
           "resolved": false,
5003 4992
           "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=",
5004 4993
           "dev": true,
5005
-          "optional": true,
5006 4994
           "requires": {
5007 4995
             "minimist": "0.0.8"
5008 4996
           }
@@ -5090,8 +5078,7 @@
5090 5078
         "number-is-nan": {
5091 5079
           "version": "1.0.1",
5092 5080
           "bundled": true,
5093
-          "dev": true,
5094
-          "optional": true
5081
+          "dev": true
5095 5082
         },
5096 5083
         "object-assign": {
5097 5084
           "version": "4.1.1",
@@ -5105,7 +5092,6 @@
5105 5092
           "resolved": false,
5106 5093
           "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=",
5107 5094
           "dev": true,
5108
-          "optional": true,
5109 5095
           "requires": {
5110 5096
             "wrappy": "1"
5111 5097
           }
@@ -5200,8 +5186,7 @@
5200 5186
         "safe-buffer": {
5201 5187
           "version": "5.1.2",
5202 5188
           "bundled": true,
5203
-          "dev": true,
5204
-          "optional": true
5189
+          "dev": true
5205 5190
         },
5206 5191
         "safer-buffer": {
5207 5192
           "version": "2.1.2",
@@ -5243,7 +5228,6 @@
5243 5228
           "resolved": false,
5244 5229
           "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=",
5245 5230
           "dev": true,
5246
-          "optional": true,
5247 5231
           "requires": {
5248 5232
             "code-point-at": "^1.0.0",
5249 5233
             "is-fullwidth-code-point": "^1.0.0",
@@ -5265,7 +5249,6 @@
5265 5249
           "resolved": false,
5266 5250
           "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=",
5267 5251
           "dev": true,
5268
-          "optional": true,
5269 5252
           "requires": {
5270 5253
             "ansi-regex": "^2.0.0"
5271 5254
           }
@@ -5313,15 +5296,13 @@
5313 5296
         "wrappy": {
5314 5297
           "version": "1.0.2",
5315 5298
           "bundled": true,
5316
-          "dev": true,
5317
-          "optional": true
5299
+          "dev": true
5318 5300
         },
5319 5301
         "yallist": {
5320 5302
           "version": "3.0.3",
5321 5303
           "resolved": false,
5322 5304
           "integrity": "sha512-S+Zk8DEWE6oKpV+vI3qWkaK+jSbIK86pCwe2IF/xwIpQ8jEuxpw9NyaGjmp9+BoJv5FV2piqCDcoCtStppiq2A==",
5323
-          "dev": true,
5324
-          "optional": true
5305
+          "dev": true
5325 5306
         }
5326 5307
       }
5327 5308
     },

+ 6 - 4
src/api/advice.js Просмотреть файл

@@ -30,11 +30,12 @@ export function EditDoctorAdvice(patient, id, advice) {
30 30
   })
31 31
 }
32 32
 
33
-export function ExecDoctorAdvice(patient, id, time) {
33
+export function ExecDoctorAdvice(patient, id, time,mode) {
34 34
   var params = {
35 35
     id: id,
36 36
     patient: patient,
37
-    execution_time: time
37
+    execution_time: time,
38
+    mode:mode
38 39
   }
39 40
   return request({
40 41
     url: '/api/patients/advice/exec',
@@ -42,10 +43,11 @@ export function ExecDoctorAdvice(patient, id, time) {
42 43
     params: params
43 44
   })
44 45
 }
45
-export function CheckDoctorAdvice(patient, id) {
46
+export function CheckDoctorAdvice(patient, id,mode) {
46 47
   var params = {
47 48
     id: id,
48
-    patient: patient
49
+    patient: patient,
50
+    mode:mode
49 51
     // execution_time: time,
50 52
   }
51 53
   return request({

+ 25 - 8
src/api/dialysis.js Просмотреть файл

@@ -149,6 +149,7 @@ export function postPrescription(params) {
149 149
     url: '/api/dialysis/prescription',
150 150
     method: 'Post',
151 151
     params: params,
152
+    headers:{"Permission":2},
152 153
   })
153 154
 }
154 155
 
@@ -156,7 +157,9 @@ export function postSoulution(params) {
156 157
   return request({
157 158
     url: '/api/dialysis/soulution',
158 159
     method: 'Post',
159
-    params: params
160
+    params: params,
161
+    headers:{"Permission":3},
162
+
160 163
   })
161 164
 }
162 165
 
@@ -164,7 +167,9 @@ export function postDoubleCheck(params) {
164 167
   return request({
165 168
     url: '/api/dialysis/dobule',
166 169
     method: 'Post',
167
-    params: params
170
+    params: params,
171
+    headers:{"Permission":2},
172
+
168 173
   })
169 174
 }
170 175
 
@@ -172,7 +177,9 @@ export function postAccepts(params) {
172 177
   return request({
173 178
     url: '/api/dialysis/accepts',
174 179
     method: 'Post',
175
-    params: params
180
+    params: params,
181
+    headers:{"Permission":2},
182
+
176 183
   })
177 184
 }
178 185
 
@@ -180,7 +187,9 @@ export function postAssessmentBeforeDislysis(params) {
180 187
   return request({
181 188
     url: '/api/dialysis/assessmentbeforedislysis',
182 189
     method: 'Post',
183
-    params: params
190
+    params: params,
191
+    headers:{"Permission":2},
192
+
184 193
   })
185 194
 }
186 195
 
@@ -188,7 +197,9 @@ export function postTreatmentsummary(params) {
188 197
   return request({
189 198
     url: '/api/dialysis/treatmentsummary',
190 199
     method: 'Post',
191
-    params: params
200
+    params: params,
201
+    headers:{"Permission":2},
202
+
192 203
   })
193 204
 }
194 205
 
@@ -197,7 +208,9 @@ export function postAssessmentAfterDislysis(params, data) {
197 208
     url: '/api/dialysis/assessmentafterdislysis',
198 209
     method: 'Post',
199 210
     params: params,
200
-    data: data
211
+    data: data,
212
+    headers:{"Permission":2},
213
+
201 214
   })
202 215
 }
203 216
 
@@ -214,7 +227,9 @@ export function CreateGroupAdvice(id, groupno, advices) {
214 227
   return request({
215 228
     url: '/api/advice_remind/create?id=' + id + '&groupno=' + groupno,
216 229
     method: 'post',
217
-    data: advices
230
+    data: advices,
231
+    headers:{"Permission":2},
232
+
218 233
   })
219 234
 }
220 235
 
@@ -230,6 +245,8 @@ export function CreateDryWeight(params) {
230 245
   return request({
231 246
     url: '/api/dryweight/commit',
232 247
     method: 'post',
233
-    params: params
248
+    params: params,
249
+    headers:{"Permission":2},
250
+
234 251
   })
235 252
 }

+ 23 - 8
src/api/dialysis_record.js Просмотреть файл

@@ -30,20 +30,23 @@ export function getDialysisScheduleDetail(patient_id, ymd) {
30 30
   })
31 31
 }
32 32
 
33
-export function editMonitor(patient_id, schedule_date, data) {
33
+export function editMonitor(patient_id, schedule_date, data,mode) {
34 34
   var params = {
35 35
     patient_id: patient_id,
36
-    schedule_date: schedule_date
36
+    schedule_date: schedule_date,
37
+    mode:mode
37 38
   }
38 39
   return request({
39 40
     url: '/api/dislysis/monitor/edit',
40 41
     method: 'post',
41 42
     params: params,
42
-    data: data
43
+    data: data,
44
+    headers:{"Permission":2},
45
+
43 46
   })
44 47
 }
45 48
 
46
-export function startDialysis(patient_id, schedule_date, nurse_id, bed_id, lood_drawing, puncture_nurse_id, start_time,schedual_type) {
49
+export function startDialysis(patient_id, schedule_date, nurse_id, bed_id, lood_drawing, puncture_nurse_id, start_time,schedual_type,mode) {
47 50
   var params = {
48 51
     patient_id: patient_id,
49 52
     date: schedule_date,
@@ -53,25 +56,31 @@ export function startDialysis(patient_id, schedule_date, nurse_id, bed_id, lood_
53 56
     start_time: start_time,
54 57
     lood_drawing: lood_drawing,
55 58
     schedual_type:schedual_type,
59
+    mode:mode,
56 60
   }
57 61
   return request({
58 62
     url: '/api/dialysis/start_record',
59 63
     method: 'post',
60
-    params: params
64
+    params: params,
65
+    headers:{"Permission":2},
66
+
61 67
   })
62 68
 }
63 69
 
64
-export function finishDialysis(patient_id, schedule_date,end_time, nurse_id) {
70
+export function finishDialysis(patient_id, schedule_date,end_time, nurse_id,mode) {
65 71
   var params = {
66 72
     patient_id: patient_id,
67 73
     date: schedule_date,
68 74
     nurse: nurse_id,
69 75
     end_time:end_time,
76
+    mode:mode,
70 77
   }
71 78
   return request({
72 79
     url: '/api/dialysis/finish',
73 80
     method: 'post',
74
-    params: params
81
+    params: params,
82
+    headers:{"Permission":2},
83
+
75 84
   })
76 85
 }
77 86
 
@@ -79,7 +88,9 @@ export function postDelMonitorInfo(params) {
79 88
   return request({
80 89
     url: '/api/dialysis/monitor/del',
81 90
     method: 'post',
82
-    params: params
91
+    params: params,
92
+    headers:{"Permission":2},
93
+
83 94
   })
84 95
 }
85 96
 
@@ -111,6 +122,8 @@ export function PostModifyStartDialysis(params) {
111 122
     url:'/api/start_dialysis/modify',
112 123
     method:'Post',
113 124
     params:params,
125
+    headers:{"Permission":2},
126
+
114 127
   })
115 128
 }
116 129
 
@@ -125,6 +138,8 @@ export function PostModifyFinishDialysis(params) {
125 138
     url:'/api/finish_dialysis/modify',
126 139
     method:'Post',
127 140
     params:params,
141
+    headers:{"Permission":2},
142
+
128 143
   })
129 144
 }
130 145
 

+ 11 - 6
src/api/patient.js Просмотреть файл

@@ -57,19 +57,24 @@ export function fetchPatientDialysisSolutions(params) {
57 57
   })
58 58
 }
59 59
 
60
-export function createPatientDialysisSolution(id, solution) {
60
+export function createPatientDialysisSolution(id, solution,mode) {
61 61
   return request({
62
-    url: '/api/patients/dialysissolution/create?patient=' + id,
62
+    url: '/api/patients/dialysissolution/create?patient=' + id +"&mode="+mode,
63 63
     method: 'post',
64
-    data: solution
64
+    data: solution,
65
+    headers:{"Permission":2},
66
+
67
+
65 68
   })
66 69
 }
67 70
 
68
-export function editPatientDialysisSolution(patient, id, solution) {
71
+export function editPatientDialysisSolution(patient, id, solution,mode) {
69 72
   return request({
70
-    url: '/api/patients/dialysissolution/edit?patient=' + patient + '&id=' + id,
73
+    url: '/api/patients/dialysissolution/edit?patient=' + patient + '&id=' + id+"&mode="+mode,
71 74
     method: 'put',
72
-    data: solution
75
+    data: solution,
76
+    headers:{"Permission":2},
77
+
73 78
   })
74 79
 }
75 80
 

+ 14 - 11
src/api/role/admin.js Просмотреть файл

@@ -25,14 +25,15 @@ export function getAddAdminInitData() {
25 25
     })
26 26
 }
27 27
 
28
-export function addAdmin(mobile, name, type, title, role, intro) {
28
+export function addAdmin(mobile, name, type, title, role, intro,user_title_name) {
29 29
     const params = {
30 30
         mobile: mobile,
31
-        name: name, 
32
-        type: type, 
33
-        title: title, 
34
-        role: role, 
31
+        name: name,
32
+        type: type,
33
+        title: title,
34
+        role: role,
35 35
         intro: intro,
36
+        user_title_name: user_title_name
36 37
     }
37 38
     return request({
38 39
         url: '/api/admin/add',
@@ -52,14 +53,16 @@ export function getModifyAdminInitData(uid) {
52 53
     })
53 54
 }
54 55
 
55
-export function modifyAdmin(uid, name, type, title, role, intro) {
56
+export function modifyAdmin(uid, name, type, title, role, intro,user_title_name) {
56 57
     const params = {
57 58
         uid: uid,
58
-        name: name, 
59
-        type: type, 
60
-        title: title, 
61
-        role: role, 
59
+        name: name,
60
+        type: type,
61
+        title: title,
62
+        role: role,
62 63
         intro: intro,
64
+      user_title_name: user_title_name
65
+
63 66
     }
64 67
     return request({
65 68
         url: '/api/admin/edit',
@@ -96,4 +99,4 @@ export function submitDialysisRecordPermissionUsers(ids_str) {
96 99
         method: 'post',
97 100
         params: params,
98 101
     })
99
-}
102
+}

+ 26 - 1
src/api/role/role.js Просмотреть файл

@@ -69,4 +69,29 @@ export function editPurview(role_id, purview_ids) {
69 69
         method: 'post',
70 70
         params: params,
71 71
     })
72
-}
72
+}
73
+
74
+
75
+export function getRolesList() {
76
+  return request({
77
+    url: '/api/roles/list',
78
+    method: 'get',
79
+  })
80
+}
81
+
82
+export function getStaffsList() {
83
+  return request({
84
+    url: '/api/staff',
85
+    method: 'get',
86
+  })
87
+}
88
+
89
+
90
+export function AddUserRole(params){
91
+  return request({
92
+    url:'/api/role/addStaff',
93
+    method:'post',
94
+    params:params,
95
+  })
96
+}
97
+

+ 7 - 0
src/xt_pages/dialysis/details/dialog/AssessmentAfterDislysis.vue Просмотреть файл

@@ -582,6 +582,13 @@ export default {
582 582
 
583 583
         ParamsQuery['patient'] = this.patient.id
584 584
         ParamsQuery['record_date'] = this.record_date
585
+        ParamsQuery['mode'] = "1"
586
+        if(this.assessment_after_dislysis.creater > 0){
587
+          ParamsQuery['mode'] = "2"
588
+          if(this.assessment_after_dislysis.creater != this.$store.getters.xt_user.user.id){
589
+            ParamsQuery['mode'] = "3"
590
+          }
591
+        }
585 592
 
586 593
         const data = {}
587 594
         data['weight_after'] = this.form.weight_after ? parseFloat(this.form.weight_after) : 0

+ 68 - 67
src/xt_pages/dialysis/details/dialog/DoctorAdviceDialog.vue Просмотреть файл

@@ -271,7 +271,6 @@
271 271
   import {
272 272
     CheckDoctorAdvice,
273 273
     CreateDoctorAdvice,
274
-    CreateGroupAdvice,
275 274
     DeleteDoctorAdvice,
276 275
     DeleteGroupAdvice,
277 276
     EditDoctorAdvice,
@@ -471,71 +470,71 @@
471 470
         })
472 471
       },
473 472
 
474
-      submitGroupAdvice() {
475
-        if (this.groupForm.start_time.length == 0) {
476
-          this.$message.error('请选择开始时间')
477
-          return
478
-        }
479
-        CreateGroupAdvice(this.patient.id, this.groupForm).then(response => {
480
-          if (response.data.state == 0) {
481
-            this.$message.error(response.data.msg)
482
-            return false
483
-          } else {
484
-            this.$notify({
485
-              title: '成功',
486
-              message: '新增成功',
487
-              type: 'success',
488
-              duration: 2000
489
-            })
490
-            this.currentIndex = -1
491
-            this.currentRow = null
492
-            this.setCurrent()
493
-            this.hideGroupForm()
494
-            for (const index in response.data.data.advices) {
495
-              this.doctor_advices.unshift(response.data.data.advices[index])
496
-            }
497
-            this.groupForm = {
498
-              advice_type: 2,
499
-              advice_date: '',
500
-              start_time: '',
501
-              adviceNames: [],
502
-              advice_doctor: '',
503
-              remark: '',
504
-              parent_id: 0
505
-            }
506
-            return false
507
-          }
508
-        })
509
-      },
510
-      submitTempForm() {
511
-        var _this = this
512
-        if (this.templateForm.id.length == 0) {
513
-          this.$message.error('请选择医嘱模板')
514
-          return
515
-        }
516
-        if (_this.templateForm.id in _this.adviceTemplateMaps) {
517
-          var mapid = _this.templateForm.id
518
-          for (const index in _this.adviceTemplateMaps[mapid].DoctorAdviceTemplate) {
519
-            var item = {
520
-              advice_name: _this.adviceTemplateMaps[mapid].DoctorAdviceTemplate[index].advice_name,
521
-              single_dose: _this.adviceTemplateMaps[mapid].DoctorAdviceTemplate[index].single_dose,
522
-              single_dose_unit: _this.adviceTemplateMaps[mapid].DoctorAdviceTemplate[index].single_dose_unit,
523
-              drug_spec: _this.adviceTemplateMaps[mapid].DoctorAdviceTemplate[index].drug_spec,
524
-              drug_spec_unit: _this.adviceTemplateMaps[mapid].DoctorAdviceTemplate[index].drug_spec_unit,
525
-              prescribing_number: _this.adviceTemplateMaps[mapid].DoctorAdviceTemplate[index].prescribing_number,
526
-              prescribing_number_unit: _this.adviceTemplateMaps[mapid].DoctorAdviceTemplate[index].prescribing_number_unit,
527
-              delivery_way: _this.adviceTemplateMaps[mapid].DoctorAdviceTemplate[index].delivery_way,
528
-              execution_frequency: _this.adviceTemplateMaps[mapid].DoctorAdviceTemplate[index].execution_frequency,
529
-              isEdit: 0,
530
-              index: 0
531
-            }
532
-            _this.groupForm.adviceNames.push(item)
533
-          }
534
-        }
535
-        this.title = '新增医嘱'
536
-        this.showTemplateForm = false
537
-        this.showGroupForm = true
538
-      },
473
+      // submitGroupAdvice() {
474
+      //   if (this.groupForm.start_time.length == 0) {
475
+      //     this.$message.error('请选择开始时间')
476
+      //     return
477
+      //   }
478
+      //   CreateGroupAdvice(this.patient.id, this.groupForm).then(response => {
479
+      //     if (response.data.state == 0) {
480
+      //       this.$message.error(response.data.msg)
481
+      //       return false
482
+      //     } else {
483
+      //       this.$notify({
484
+      //         title: '成功',
485
+      //         message: '新增成功',
486
+      //         type: 'success',
487
+      //         duration: 2000
488
+      //       })
489
+      //       this.currentIndex = -1
490
+      //       this.currentRow = null
491
+      //       this.setCurrent()
492
+      //       this.hideGroupForm()
493
+      //       for (const index in response.data.data.advices) {
494
+      //         this.doctor_advices.unshift(response.data.data.advices[index])
495
+      //       }
496
+      //       this.groupForm = {
497
+      //         advice_type: 2,
498
+      //         advice_date: '',
499
+      //         start_time: '',
500
+      //         adviceNames: [],
501
+      //         advice_doctor: '',
502
+      //         remark: '',
503
+      //         parent_id: 0
504
+      //       }
505
+      //       return false
506
+      //     }
507
+      //   })
508
+      // },
509
+      // submitTempForm() {
510
+      //   var _this = this
511
+      //   if (this.templateForm.id.length == 0) {
512
+      //     this.$message.error('请选择医嘱模板')
513
+      //     return
514
+      //   }
515
+      //   if (_this.templateForm.id in _this.adviceTemplateMaps) {
516
+      //     var mapid = _this.templateForm.id
517
+      //     for (const index in _this.adviceTemplateMaps[mapid].DoctorAdviceTemplate) {
518
+      //       var item = {
519
+      //         advice_name: _this.adviceTemplateMaps[mapid].DoctorAdviceTemplate[index].advice_name,
520
+      //         single_dose: _this.adviceTemplateMaps[mapid].DoctorAdviceTemplate[index].single_dose,
521
+      //         single_dose_unit: _this.adviceTemplateMaps[mapid].DoctorAdviceTemplate[index].single_dose_unit,
522
+      //         drug_spec: _this.adviceTemplateMaps[mapid].DoctorAdviceTemplate[index].drug_spec,
523
+      //         drug_spec_unit: _this.adviceTemplateMaps[mapid].DoctorAdviceTemplate[index].drug_spec_unit,
524
+      //         prescribing_number: _this.adviceTemplateMaps[mapid].DoctorAdviceTemplate[index].prescribing_number,
525
+      //         prescribing_number_unit: _this.adviceTemplateMaps[mapid].DoctorAdviceTemplate[index].prescribing_number_unit,
526
+      //         delivery_way: _this.adviceTemplateMaps[mapid].DoctorAdviceTemplate[index].delivery_way,
527
+      //         execution_frequency: _this.adviceTemplateMaps[mapid].DoctorAdviceTemplate[index].execution_frequency,
528
+      //         isEdit: 0,
529
+      //         index: 0
530
+      //       }
531
+      //       _this.groupForm.adviceNames.push(item)
532
+      //     }
533
+      //   }
534
+      //   this.title = '新增医嘱'
535
+      //   this.showTemplateForm = false
536
+      //   this.showGroupForm = true
537
+      // },
539 538
       openAdviceTemplate() {
540 539
         this.templateForm = { id: '' }
541 540
         this.title = '选择医嘱模板'
@@ -952,7 +951,9 @@
952 951
           type: 'warning'
953 952
         }).then(() => {
954 953
           this.deleLoading = true
955
-          CheckDoctorAdvice(this.patient.id, this.currentRow.id).then(response => {
954
+          let mode = "7"
955
+
956
+          CheckDoctorAdvice(this.patient.id, this.currentRow.id,mode).then(response => {
956 957
             if (response.data.state == 0) {
957 958
               this.$message.error(response.data.msg)
958 959
 

+ 9 - 0
src/xt_pages/dialysis/details/dialog/acceptsTreatmentDialog.vue Просмотреть файл

@@ -235,6 +235,15 @@
235 235
         let ParamsQuery = this.receiveTreatmentAsses
236 236
         ParamsQuery['patient'] = this.patient.id
237 237
         ParamsQuery['record_date'] = this.record_date
238
+        console.log(this.receiver_treatment_access)
239
+        ParamsQuery['mode'] = "1"
240
+        if(this.receiver_treatment_access.id > 0){
241
+          ParamsQuery['mode'] = "2"
242
+          if(this.$store.getters.xt_user.user.id != this.receiver_treatment_access.creater){
243
+            ParamsQuery['mode'] = "3"
244
+          }
245
+        }
246
+
238 247
         postAccepts(ParamsQuery).then(response => {
239 248
           if (response.data.state == 0) {
240 249
             this.$message.error(response.data.msg)

+ 9 - 0
src/xt_pages/dialysis/details/dialog/assessmentBeforeDislysisDialog.vue Просмотреть файл

@@ -761,6 +761,15 @@
761 761
         const ParamsQuery = this.assessmentBeforeDislysis
762 762
         ParamsQuery['patient'] = this.patient.id
763 763
         ParamsQuery['record_date'] = this.record_date
764
+        ParamsQuery['mode'] = 1
765
+        console.log(this.predialysis_evaluation)
766
+        if (this.predialysis_evaluation.creator > 0){
767
+          ParamsQuery['mode'] = 2
768
+          if(this.predialysis_evaluation.creator != this.$store.getters.xt_user.user.id){
769
+            ParamsQuery['mode'] = 3
770
+          }
771
+        }
772
+
764 773
         postAssessmentBeforeDislysis(ParamsQuery).then(response => {
765 774
           if (response.data.state == 0) {
766 775
             this.$message.error(response.data.msg)

+ 55 - 73
src/xt_pages/dialysis/details/dialog/computer_dialog.vue Просмотреть файл

@@ -5,26 +5,27 @@
5 5
 
6 6
         <el-form-item label="班次">
7 7
           <el-select v-model="schedual_type" placeholder="请选择班次" @change="changeSchedualType">
8
-            <el-option v-for="(item, index) in schedules_type" :key="index" :value="item.id" :label="item.name" ></el-option>
8
+            <el-option v-for="(item, index) in schedules_type" :key="index" :value="item.id"
9
+                       :label="item.name"></el-option>
9 10
           </el-select>
10 11
         </el-form-item>
11 12
 
12 13
         <el-form-item label="上机床位">
13
-          <el-select v-model="form.bed_id" placeholder="请选择上机床位" >
14
+          <el-select v-model="form.bed_id" placeholder="请选择上机床位">
14 15
             <el-option v-for="(bed, index) in zone_beds" :key="index" :value="bed.id" :label="bed.number"></el-option>
15 16
           </el-select>
16 17
         </el-form-item>
17 18
         <el-form-item label="上机护士">
18
-          <el-select v-model="form.nurse_id" placeholder="请选择上机护士" >
19
+          <el-select v-model="form.nurse_id" placeholder="请选择上机护士">
19 20
             <el-option v-for="(admin, index) in admins" :key="index" :value="admin.id" :label="admin.name"></el-option>
20 21
           </el-select>
21 22
         </el-form-item>
22 23
         <el-form-item label="穿刺护士">
23
-          <el-select v-model="form.puncture_nurse_id" placeholder="请选择穿刺护士" >
24
+          <el-select v-model="form.puncture_nurse_id" placeholder="请选择穿刺护士">
24 25
             <el-option v-for="(admin, index) in admins" :key="index" :value="admin.id" :label="admin.name"></el-option>
25 26
           </el-select>
26 27
         </el-form-item>
27
-        <el-form-item label="引血(ml/min)" v-if="template_id == 6" >
28
+        <el-form-item label="引血(ml/min)" v-if="template_id == 6">
28 29
           <el-input type="number" v-model="form.blood_drawing" style="width:200px;"></el-input>
29 30
         </el-form-item>
30 31
 
@@ -41,7 +42,10 @@
41 42
         <el-form-item>
42 43
           <el-button v-if="dialysis_order.id == 0" @click="submit" type="primary" :loading="loading">执行上机</el-button>
43 44
           <el-button v-else type="info" :disabled="true">已上机</el-button>
44
-          <el-button v-if="dialysis_order.id > 0 && (isPremission || this.$store.getters.xt_user.user.id == this.creator)" type="primary" @click="editOrder">修改上机</el-button>
45
+          <el-button
46
+            v-if="dialysis_order.id > 0 && (isPremission || this.$store.getters.xt_user.user.id == this.creator)"
47
+            type="primary" @click="editOrder">修改上机
48
+          </el-button>
45 49
 
46 50
         </el-form-item>
47 51
       </el-form>
@@ -51,21 +55,21 @@
51 55
 </template>
52 56
 
53 57
 <script>
54
-  import { startDialysis,GetSchedualNumber,PostModifyStartDialysis } from '@/api/dialysis_record'
58
+  import { GetSchedualNumber, PostModifyStartDialysis, startDialysis } from '@/api/dialysis_record'
55 59
   import { parseTime } from '@/utils'
56 60
 
57 61
   export default {
58 62
     name: 'ComputerDialog',
59 63
     data() {
60 64
       return {
61
-        zone_beds:[],
65
+        zone_beds: [],
62 66
         visible: false,
63 67
         loading: false,
64 68
         template_id: 0,
65 69
         patient_id: 0,
66 70
         schedule_date: 0,
67 71
         start_time: 0,
68
-        creator:0,
72
+        creator: 0,
69 73
         form: {
70 74
           bed_id: '',
71 75
           nurse_id: '',
@@ -73,13 +77,13 @@
73 77
           puncture_nurse_id: '',
74 78
           blood_drawing: 100
75 79
         },
76
-        schedual_type:0,
80
+        schedual_type: 0,
77 81
         schedules_type: [
78
-          {id: 1, name:"上午"},
79
-          {id: 2, name:"下午"},
80
-          {id: 3, name:"晚上"},
82
+          { id: 1, name: '上午' },
83
+          { id: 2, name: '下午' },
84
+          { id: 3, name: '晚上' }
81 85
         ], // 该排班的区里的床位
82
-        isPremission:false,
86
+        isPremission: false
83 87
       }
84 88
     },
85 89
     props: {
@@ -96,12 +100,9 @@
96 100
         type: Array
97 101
       },
98 102
       special_premission: {
99
-        type: Array,
100
-      },
101
-    },mounted(){
102
-
103
-
104
-
103
+        type: Array
104
+      }
105
+    }, mounted() {
105 106
 
106 107
     },
107 108
     created() {
@@ -115,20 +116,12 @@
115 116
         this.form.puncture_nurse_id = this.$store.getters.xt_user.user.id
116 117
       }
117 118
 
118
-
119
-
120
-
121
-
122
-
123
-
124 119
     },
125 120
     watch: {
126 121
       'schedule.id': function() {
127 122
       },
128 123
       'dialysis_order.id': function() {
129 124
 
130
-
131
-
132 125
         this.form.nurse_id = this.dialysis_order.id == 0 ? this.$store.getters.xt_user.user.id : this.dialysis_order.start_nurse
133 126
         this.form.puncture_nurse_id = this.dialysis_order.id == 0 ? this.$store.getters.xt_user.user.id : this.dialysis_order.puncture_nurse
134 127
 
@@ -147,28 +140,11 @@
147 140
           (nowDay < 10 ? '0' + nowDay : nowDay) + ' ' + (nowHours < 10 ? '0' + nowHours : nowHours) + ':' + (nowMinutes < 10 ? '0' + nowMinutes : nowMinutes)
148 141
         this.form.start_time = this.dialysis_order.id == 0 ? time : this.getTime(this.dialysis_order.start_time, '{y}-{m}-{d} {h}:{i}')
149 142
 
150
-
151
-
152
-
153
-
154
-
155
-
156
-
157 143
       }
158 144
     },
159
-    computed: {
160
-      // zone_beds: function() {
161
-      //   var beds = []
162
-      //   for (let index = 0; index < this.device_numbers.length; index++) {
163
-      //     const device_number = this.device_numbers[index]
164
-      //     beds.push(device_number)
165
-      //   }
166
-      //   console.log(this.device_numbers)
167
-      //   return beds
168
-      // }
169
-    },
145
+    computed: {},
170 146
     methods: {
171
-      changeSchedualType:function(schedual_type){
147
+      changeSchedualType: function(schedual_type) {
172 148
         let ParamsQuery = {}
173 149
         ParamsQuery['schedual_type'] = schedual_type
174 150
         GetSchedualNumber(ParamsQuery).then(response => {
@@ -178,7 +154,7 @@
178 154
             this.temp_device_numbers = response.data.data.number
179 155
             for (let index = 0; index < this.temp_device_numbers.length; index++) {
180 156
               const device_number = this.temp_device_numbers[index]
181
-              this.temp_device_numbers[index]['number'] = device_number['zone_name']+'-'+device_number['number']
157
+              this.temp_device_numbers[index]['number'] = device_number['zone_name'] + '-' + device_number['number']
182 158
             }
183 159
             this.zone_beds = this.temp_device_numbers
184 160
             this.form.bed_id = this.zone_beds[0].id
@@ -187,7 +163,7 @@
187 163
         })
188 164
 
189 165
       },
190
-      GetSchedualNumber:function(){
166
+      GetSchedualNumber: function() {
191 167
         let ParamsQuery = {}
192 168
         ParamsQuery['schedual_type'] = this.schedual_type
193 169
         GetSchedualNumber(ParamsQuery).then(response => {
@@ -198,32 +174,32 @@
198 174
             this.temp_device_numbers = response.data.data.number
199 175
             for (let index = 0; index < this.temp_device_numbers.length; index++) {
200 176
               const device_number = this.temp_device_numbers[index]
201
-              this.temp_device_numbers[index]['number'] = device_number['zone_name']+'-'+device_number['number']
177
+              this.temp_device_numbers[index]['number'] = device_number['zone_name'] + '-' + device_number['number']
202 178
             }
203 179
             this.zone_beds = this.temp_device_numbers
204 180
 
205 181
             this.form.bed_id = this.dialysis_order.id == 0 ? this.schedule.bed_id : this.dialysis_order.bed_id
206
-            if(this.dialysis_order.id == 0) {
182
+            if (this.dialysis_order.id == 0) {
207 183
               let isFilter = true
208 184
               for (let i = 0; i < this.zone_beds.length; i++) {
209
-                if(this.zone_beds[i].id == this.schedule.bed_id ){
185
+                if (this.zone_beds[i].id == this.schedule.bed_id) {
210 186
                   isFilter = false
211 187
 
212 188
                 }
213 189
               }
214
-              if(isFilter){
190
+              if (isFilter) {
215 191
                 this.form.bed_id = this.zone_beds[0].id
216 192
               }
217
-            }else{
218
-              for (let i = 0; i < this.device_numbers.length; i++){
219
-                if (this.device_numbers[i].id == this.dialysis_order.bed_id){
193
+            } else {
194
+              for (let i = 0; i < this.device_numbers.length; i++) {
195
+                if (this.device_numbers[i].id == this.dialysis_order.bed_id) {
220 196
                   let obj = {}
221 197
                   obj = this.device_numbers[i]
222
-                  if(obj['number'].indexOf(this.device_numbers[i]['zone_name']) == -1) {
223
-                    obj['number'] = this.device_numbers[i]['zone_name'] + "-" + this.device_numbers[i]['number']
198
+                  if (obj['number'].indexOf(this.device_numbers[i]['zone_name']) == -1) {
199
+                    obj['number'] = this.device_numbers[i]['zone_name'] + '-' + this.device_numbers[i]['number']
224 200
                   }
225 201
                   this.zone_beds.unshift(obj)
226
-                  this.zone_beds.sort((a, b) => a.id -b.id)
202
+                  this.zone_beds.sort((a, b) => a.id - b.id)
227 203
                 }
228 204
               }
229 205
             }
@@ -261,15 +237,14 @@
261 237
         if (this.dialysis_order.id == 0) {
262 238
           let now = new Date()
263 239
           let hour = now.getHours()
264
-          if (hour >= 6 && hour < 12){
240
+          if (hour >= 6 && hour < 12) {
265 241
             this.schedual_type = 1
266 242
 
267
-          }else if(hour >= 12 && hour < 18){
243
+          } else if (hour >= 12 && hour < 18) {
268 244
 
269 245
             this.schedual_type = 2
270 246
 
271
-
272
-          }else if(hour >= 18){
247
+          } else if (hour >= 18) {
273 248
             this.schedual_type = 3
274 249
           }
275 250
         } else {
@@ -277,7 +252,6 @@
277 252
           this.schedual_type = this.dialysis_order.schedual_type
278 253
         }
279 254
 
280
-
281 255
         if (this.dialysis_order.id > 0) {
282 256
           for (let i = 0; i < this.special_premission.length; i++) {
283 257
             if (this.$store.getters.xt_user.user.id == this.special_premission[i].admin_user_id) {
@@ -300,12 +274,15 @@
300 274
         this.visible = false
301 275
       },
302 276
       submit: function() {
303
-        if(this.form.start_time == "" || this.form.start_time == null){
304
-          this.$message.error("开始时间不能为空")
277
+        if (this.form.start_time == '' || this.form.start_time == null) {
278
+          this.$message.error('开始时间不能为空')
305 279
           return
306 280
         }
281
+        console.log(this.dialysis_order)
307 282
         this.loading = true
308
-        startDialysis(this.patient_id, parseTime(this.schedule_date, '{y}-{m}-{d}'), this.form.nurse_id, this.form.bed_id, this.form.lood_drawing, this.form.puncture_nurse_id, this.form.start_time,this.schedual_type).then(rs => {
283
+        let mode = '1'
284
+
285
+        startDialysis(this.patient_id, parseTime(this.schedule_date, '{y}-{m}-{d}'), this.form.nurse_id, this.form.bed_id, this.form.lood_drawing, this.form.puncture_nurse_id, this.form.start_time, this.schedual_type, mode).then(rs => {
309 286
           this.loading = false
310 287
           var resp = rs.data
311 288
           if (resp.state == 1) {
@@ -315,24 +292,29 @@
315 292
               this.$set(this_order, key, resp_dialysis_order[key])
316 293
             }
317 294
             this.hide()
318
-            this.$emit('monitor',  resp.data.monitor)
319
-            this.$message.success("上机成功")
295
+            this.$emit('monitor', resp.data.monitor)
296
+            this.$message.success('上机成功')
320 297
           } else {
321 298
             this.$message.error(resp.msg)
322 299
           }
323 300
         })
324
-      }, editOrder(){
301
+      }, editOrder() {
325 302
         let ParamsQuery = {}
326 303
         ParamsQuery['schedual_type'] = this.schedual_type
327 304
         ParamsQuery['id'] = this.dialysis_order.id
328 305
         ParamsQuery['nurse'] = this.form.nurse_id
329 306
         ParamsQuery['bed'] = this.form.bed_id
330
-        ParamsQuery['start_time'] =  this.form.start_time
307
+        ParamsQuery['start_time'] = this.form.start_time
331 308
         ParamsQuery['puncture_nurse'] = this.form.puncture_nurse_id
309
+
310
+        ParamsQuery['mode'] = "2"
311
+        if (this.dialysis_order.creator != this.$store.getters.xt_user.user.id) {
312
+          ParamsQuery['mode'] = "3"
313
+        }
332 314
         PostModifyStartDialysis(ParamsQuery).then(rs => {
333 315
           var resp = rs.data
334 316
           if (resp.state == 1) {
335
-            this.$message.success("修改成功")
317
+            this.$message.success('修改成功')
336 318
 
337 319
             var resp_dialysis_order = resp.data.dialysis_order
338 320
             var this_order = this.dialysis_order
@@ -346,7 +328,7 @@
346 328
             this.$message.error(resp.msg)
347 329
           }
348 330
         })
349
-      },
331
+      }
350 332
 
351 333
     }
352 334
   }

+ 101 - 1
src/xt_pages/dialysis/details/dialog/dialysisPrescriptionDialog.vue Просмотреть файл

@@ -836,7 +836,10 @@
836 836
 
837 837
           no_anticoagulant_shouji: '0',
838 838
           no_anticoagulant_weichi: '0',
839
-          no_anticoagulant_zongliang: '0'
839
+          no_anticoagulant_zongliang: '0',
840
+
841
+
842
+          creater:0,
840 843
 
841 844
         },
842 845
 
@@ -995,6 +998,15 @@
995 998
             ParamsQuery['patient'] = this.patient.id
996 999
             ParamsQuery['record_date'] = this.record_date
997 1000
 
1001
+            console.log(this.prescription)
1002
+
1003
+            if(this.prescription.creater <= 0){
1004
+              mode = 1
1005
+            }else {
1006
+              mode = 2
1007
+            }
1008
+
1009
+
998 1010
             postPrescription(ParamsQuery).then(response => {
999 1011
               if (response.data.state == 0) {
1000 1012
                 this.$message.error(response.data.msg)
@@ -1105,6 +1117,14 @@
1105 1117
             const ParamsQuery = this.dialysisPrescription
1106 1118
             ParamsQuery['patient'] = this.patient.id
1107 1119
             ParamsQuery['record_date'] = this.record_date
1120
+            console.log(this.prescription)
1121
+
1122
+            if(this.prescription.creater <= 0){
1123
+              mode = 1
1124
+            }else {
1125
+              mode = 2
1126
+            }
1127
+
1108 1128
 
1109 1129
             postPrescription(ParamsQuery).then(response => {
1110 1130
               if (response.data.state == 0) {
@@ -1243,6 +1263,14 @@
1243 1263
             const ParamsQuery = this.dialysisPrescription
1244 1264
             ParamsQuery['patient'] = this.patient.id
1245 1265
             ParamsQuery['record_date'] = this.record_date
1266
+            console.log(this.prescription)
1267
+
1268
+            if(this.prescription.creater <= 0){
1269
+              mode = 1
1270
+            }else {
1271
+              mode = 2
1272
+            }
1273
+
1246 1274
 
1247 1275
             postPrescription(ParamsQuery).then(response => {
1248 1276
               if (response.data.state == 0) {
@@ -1280,6 +1308,14 @@
1280 1308
               const ParamsQuery = this.dialysisPrescription
1281 1309
               ParamsQuery['patient'] = this.patient.id
1282 1310
               ParamsQuery['record_date'] = this.record_date
1311
+              console.log(this.prescription)
1312
+
1313
+              if(this.prescription.creater <= 0){
1314
+                mode = 1
1315
+              }else {
1316
+                mode = 2
1317
+              }
1318
+
1283 1319
 
1284 1320
               postPrescription(ParamsQuery).then(response => {
1285 1321
                 if (response.data.state == 0) {
@@ -1333,6 +1369,14 @@
1333 1369
               const ParamsQuery = this.dialysisPrescription
1334 1370
               ParamsQuery['patient'] = this.patient.id
1335 1371
               ParamsQuery['record_date'] = this.record_date
1372
+              console.log(this.prescription)
1373
+
1374
+              if(this.prescription.creater <= 0){
1375
+                mode = 1
1376
+              }else {
1377
+                mode = 2
1378
+              }
1379
+
1336 1380
 
1337 1381
               postPrescription(ParamsQuery).then(response => {
1338 1382
                 if (response.data.state == 0) {
@@ -1365,6 +1409,14 @@
1365 1409
               const ParamsQuery = this.dialysisPrescription
1366 1410
               ParamsQuery['patient'] = this.patient.id
1367 1411
               ParamsQuery['record_date'] = this.record_date
1412
+              console.log(this.prescription)
1413
+
1414
+              if(this.prescription.creater <= 0){
1415
+                mode = 1
1416
+              }else {
1417
+                mode = 2
1418
+              }
1419
+
1368 1420
 
1369 1421
               postPrescription(ParamsQuery).then(response => {
1370 1422
                 if (response.data.state == 0) {
@@ -1401,6 +1453,14 @@
1401 1453
               const ParamsQuery = this.dialysisPrescription
1402 1454
               ParamsQuery['patient'] = this.patient.id
1403 1455
               ParamsQuery['record_date'] = this.record_date
1456
+              console.log(this.prescription)
1457
+
1458
+              if(this.prescription.creater <= 0){
1459
+                mode = 1
1460
+              }else {
1461
+                mode = 2
1462
+              }
1463
+
1404 1464
 
1405 1465
               postPrescription(ParamsQuery).then(response => {
1406 1466
                 if (response.data.state == 0) {
@@ -1438,6 +1498,14 @@
1438 1498
                 const ParamsQuery = this.dialysisPrescription
1439 1499
                 ParamsQuery['patient'] = this.patient.id
1440 1500
                 ParamsQuery['record_date'] = this.record_date
1501
+                console.log(this.prescription)
1502
+
1503
+                if(this.prescription.creater <= 0){
1504
+                  mode = 1
1505
+                }else {
1506
+                  mode = 2
1507
+                }
1508
+
1441 1509
 
1442 1510
                 postPrescription(ParamsQuery).then(response => {
1443 1511
                   if (response.data.state == 0) {
@@ -1491,6 +1559,14 @@
1491 1559
                 const ParamsQuery = this.dialysisPrescription
1492 1560
                 ParamsQuery['patient'] = this.patient.id
1493 1561
                 ParamsQuery['record_date'] = this.record_date
1562
+                console.log(this.prescription)
1563
+
1564
+                if(this.prescription.creater <= 0){
1565
+                  mode = 1
1566
+                }else {
1567
+                  mode = 2
1568
+                }
1569
+
1494 1570
 
1495 1571
                 postPrescription(ParamsQuery).then(response => {
1496 1572
                   if (response.data.state == 0) {
@@ -1523,6 +1599,14 @@
1523 1599
                 const ParamsQuery = this.dialysisPrescription
1524 1600
                 ParamsQuery['patient'] = this.patient.id
1525 1601
                 ParamsQuery['record_date'] = this.record_date
1602
+                console.log(this.prescription)
1603
+
1604
+                if(this.prescription.creater <= 0){
1605
+                  mode = 1
1606
+                }else {
1607
+                  mode = 2
1608
+                }
1609
+
1526 1610
 
1527 1611
                 postPrescription(ParamsQuery).then(response => {
1528 1612
                   if (response.data.state == 0) {
@@ -1557,6 +1641,14 @@
1557 1641
             const ParamsQuery = this.dialysisPrescription
1558 1642
             ParamsQuery['patient'] = this.patient.id
1559 1643
             ParamsQuery['record_date'] = this.record_date
1644
+            console.log(this.prescription)
1645
+
1646
+            if(this.prescription.creater <= 0){
1647
+              mode = 1
1648
+            }else {
1649
+              mode = 2
1650
+            }
1651
+
1560 1652
 
1561 1653
             postPrescription(ParamsQuery).then(response => {
1562 1654
               if (response.data.state == 0) {
@@ -1708,6 +1800,14 @@
1708 1800
               const ParamsQuery = this.dialysisPrescription
1709 1801
               ParamsQuery['patient'] = this.patient.id
1710 1802
               ParamsQuery['record_date'] = this.record_date
1803
+              console.log(this.prescription)
1804
+
1805
+              if(this.prescription.creater <= 0){
1806
+                mode = 1
1807
+              }else {
1808
+                mode = 2
1809
+              }
1810
+
1711 1811
 
1712 1812
               postPrescription(ParamsQuery).then(response => {
1713 1813
                 if (response.data.state == 0) {

+ 6 - 1
src/xt_pages/dialysis/details/dialog/finish_dialog.vue Просмотреть файл

@@ -169,6 +169,10 @@
169 169
         ParamsQuery["id"] = this.dialysis_order.id;
170 170
         ParamsQuery["nurse"] = this.form.nurse_id;
171 171
         ParamsQuery["end_time"] = this.end_time;
172
+        ParamsQuery["mode"] = "2"
173
+        if(this.dialysis_order.finish_creator  != this.$store.getters.xt_user.user.id){
174
+          ParamsQuery["mode"] = "3"
175
+        }
172 176
         PostModifyFinishDialysis(ParamsQuery).then(response => {
173 177
           if (response.data.state == 0) {
174 178
             this.$message.error(response.data.msg)
@@ -189,7 +193,8 @@
189 193
       },
190 194
       submit: function() {
191 195
         this.loading = true
192
-        finishDialysis(this.patient_id, parseTime(this.schedule_date, '{y}-{m}-{d}'), this.end_time, this.form.nurse_id).then(rs => {
196
+        let mode = "1"
197
+        finishDialysis(this.patient_id, parseTime(this.schedule_date, '{y}-{m}-{d}'), this.end_time, this.form.nurse_id,mode).then(rs => {
193 198
           this.loading = false
194 199
           var resp = rs.data
195 200
           if (resp.state == 1) {

+ 9 - 2
src/xt_pages/dialysis/details/dialog/monitor_dialog.vue Просмотреть файл

@@ -961,11 +961,18 @@ export default {
961 961
         parseFloat(this.form.ktv) == NaN ? 0 : parseFloat(this.form.ktv);
962 962
       this.form.monitoring_date = parseInt(this.form.monitoring_date);
963 963
 
964
-      editMonitor(this.patient_id, this.schedule_date, this.form).then(rs => {
964
+
965
+      let mode = "1"
966
+       if(this.form.id > 0){
967
+         mode = "2"
968
+         if(this.form.creator > 0 && this.form.creator != this.$store.getters.xt_user.user.id){
969
+          mode = "3"
970
+         }
971
+      }
972
+      editMonitor(this.patient_id, this.schedule_date, this.form,mode).then(rs => {
965 973
         var resp = rs.data;
966 974
         if (resp.state == 1) {
967 975
           var monitor = resp.data.monitor;
968
-          console.log("monitor-----", monitor);
969 976
           if (this.isAdd) {
970 977
             this.monitors.unshift(monitor);
971 978
             this.monitors.sort((a, b) => b.operate_time - a.operate_time);

+ 7 - 0
src/xt_pages/dialysis/details/dialog/treatmentSummaryDialog.vue Просмотреть файл

@@ -118,6 +118,13 @@ export default {
118 118
         const ParamsQuery = this.treatmentSummary
119 119
         ParamsQuery['patient'] = this.patient.id
120 120
         ParamsQuery['record_date'] = this.record_date
121
+        ParamsQuery['mode'] = "1"
122
+        if(this.treatment_summary.id > 0){
123
+          ParamsQuery['mode'] = "2"
124
+          if(this.treatment_summary.creater != this.$store.getters.xt_user.user.id){
125
+            ParamsQuery['mode'] = "3"
126
+          }
127
+        }
121 128
         postTreatmentsummary(ParamsQuery).then(response => {
122 129
           if (response.data.state == 0) {
123 130
             this.$message.error(response.data.msg)

+ 56 - 4
src/xt_pages/role/admin.vue Просмотреть файл

@@ -104,7 +104,7 @@
104 104
                 type="danger"
105 105
                 size="small"
106 106
                 icon="el-icon-delete"
107
-                v-if="scope.row.status == 1"
107
+                v-if="scope.row.status == 1 && org.creator != scope.row.user_id && (scope.row.user_id != local_user_id )"
108 108
                 @click="disableAdminAction(scope.row)"
109 109
               ></el-button>
110 110
             </el-tooltip>
@@ -118,7 +118,7 @@
118 118
                 size="small"
119 119
                 type="info"
120 120
                 icon="el-icon-refresh"
121
-                v-if="scope.row.status == 0"
121
+                v-if="scope.row.status == 0 && org.creator != scope.row.user_id  && (scope.row.user_id != local_user_id )"
122 122
                 @click="recoverAdminAction(scope.row)"
123 123
               ></el-button>
124 124
             </el-tooltip>
@@ -144,6 +144,8 @@
144 144
 
145 145
 <script>
146 146
 import { adminMainView, getAdmins, setAdminStatus } from "@/api/role/admin";
147
+import { getRoles } from "@/api/role/role";
148
+
147 149
 import { parseTime } from "@/utils";
148 150
 import BreadCrumb from "@/xt_pages/components/bread-crumb";
149 151
 import AdminInfoForm from "./components/AdminInfoForm";
@@ -160,7 +162,12 @@ export default {
160 162
       admins: [], // [{user_id, user_name, role_name, title_name, ip, last_login_time, status}]
161 163
       admin_total_count: 0,
162 164
       current_page: 1,
163
-      is_exist_role: false
165
+      roles:[],
166
+      is_exist_role: false,
167
+      org: null,
168
+      isSubSuperAdmin:false,
169
+
170
+      local_user_id: 0,
164 171
     };
165 172
   },
166 173
   components: {
@@ -168,15 +175,44 @@ export default {
168 175
     AdminInfoForm
169 176
   },
170 177
   created: function() {
178
+    this.local_user_id = this.$store.getters.xt_user.user.id
179
+    this.local_user_id = 597
180
+    let page = 1
181
+    this.getRoles(page)
171 182
     adminMainView()
172 183
       .then(rs => {
173 184
         this.is_loading_admins = false;
174 185
         var resp = rs.data;
175 186
         if (resp.state === 1) {
187
+
176 188
           this.admins.push(...resp.data.admins);
177 189
           this.admin_total_count = resp.data.total_count;
178 190
           this.is_exist_role = resp.data.is_exist_role;
179 191
           this.current_page = 1;
192
+          this.org = resp.data.org
193
+          this.isSubSuperAdmin = resp.data.isSubSuperAdmin
194
+
195
+          //能进入当前页面的角色只有超级管理员和子管理员,如果当前角色是子管理员,需要把超级管理员和其他子管理员的信息去除,子管理员不能编辑超级管理员和其他子管理员信息,
196
+          if(this.isSubSuperAdmin) {
197
+            //去除管理员信息
198
+            for (let i = 0; i < this.admins.length; i++){
199
+              if (this.admins[i].user_id == this.org.creator) {
200
+                this.admins.splice(i, 1)
201
+                i--
202
+              }
203
+            }
204
+
205
+            //去除其他子管理员信息
206
+            for (let i = 0; i < this.admins.length; i++){
207
+              if (this.admins[i].user_id  != this.local_user_id && this.admins[i].is_sub_super_admin) { //将自己排除在外
208
+                console.log(this.admins[i])
209
+
210
+                this.admins.splice(i, 1)
211
+                i--
212
+              }
213
+            }
214
+
215
+          }
180 216
         } else {
181 217
           this.$message.error(resp.msg);
182 218
         }
@@ -192,8 +228,24 @@ export default {
192 228
     }
193 229
   },
194 230
   methods: {
231
+    getRoles(page){
232
+      getRoles(page)
233
+        .then(rs => {
234
+          this.loading_roles = false;
235
+          const resp = rs.data;
236
+          if (resp.state === 1) {
237
+            this.roles.push(...resp.data.roles);
238
+          } else {
239
+            this.$message.error(resp.msg);
240
+          }
241
+        })
242
+        .catch(err => {
243
+          this.loading_roles = false;
244
+          this.$message.error(err);
245
+        });
246
+    },
195 247
     openForm(adminId) {
196
-      this.$refs["admininfoform"].open(adminId);
248
+      this.$refs["admininfoform"].open(adminId,this.roles);
197 249
     },
198 250
     _parseTime(time, format) {
199 251
       return parseTime(time, format);

+ 265 - 213
src/xt_pages/role/components/AdminInfoForm.vue Просмотреть файл

@@ -2,22 +2,18 @@
2 2
   <el-dialog :title="formTitle" :visible.sync="dialogFormVisible">
3 3
     <el-form :model="form" ref="form" :rules="rules" label-width="60px">
4 4
       <el-form-item label="账号 : " prop="mobile">
5
-        <el-input v-model="form.mobile" placeholder="用户手机号" :disabled="form.id !==  0"></el-input>
5
+        <el-input v-model="form.mobile" placeholder="用户手机号"         maxlength="11"
6
+                  :disabled="form.id !==  0"></el-input>
6 7
       </el-form-item>
7 8
 
8 9
       <el-form-item label="姓名 : " prop="name">
9 10
         <el-input v-model="form.name" placeholder="用户姓名"></el-input>
10 11
       </el-form-item>
11 12
 
12
-      <el-form-item label="角色 : " prop="role">
13
-        <el-checkbox-group v-model="checkList">
14
-          <el-checkbox label="复选框 A"></el-checkbox>
15
-          <el-checkbox label="复选框 B"></el-checkbox>
16
-          <el-checkbox label="复选框 C"></el-checkbox>
17
-          <el-checkbox label="复选框 C"></el-checkbox>
18
-          <el-checkbox label="复选框 C"></el-checkbox>
19
-          <el-checkbox label="禁用"></el-checkbox>
20
-          <el-checkbox label="选中且禁用"></el-checkbox>
13
+      <el-form-item label="角色 : " prop="role_ids">
14
+        <el-checkbox-group v-model="form.role_ids">
15
+          <el-checkbox v-for="( item,index) in roles" :key="index" :label="item.id" :value="item.id">{{item.name}}
16
+          </el-checkbox>
21 17
         </el-checkbox-group>
22 18
       </el-form-item>
23 19
 
@@ -41,12 +37,12 @@
41 37
         </el-select>
42 38
       </el-form-item>
43 39
 
44
-      <el-form-item label="职位 : " prop="name">
45
-        <el-input v-model="form.name" placeholder="输入职位"></el-input>
40
+      <el-form-item label="职位 : ">
41
+        <el-input v-model="form.user_title_name" placeholder="输入职位"></el-input>
46 42
       </el-form-item>
47 43
 
48 44
       <el-form-item label="介绍 : ">
49
-        <Tinymce :height="400" menubar ref="editor" v-model="form.intro" :show_upload_img="false" />
45
+        <Tinymce :height="400" menubar ref="editor" v-model="form.intro" :show_upload_img="false"/>
50 46
       </el-form-item>
51 47
     </el-form>
52 48
     <div slot="footer" class="dialog-footer">
@@ -57,217 +53,273 @@
57 53
 </template>
58 54
 
59 55
 <script>
60
-import Tinymce from "@/components/Tinymce";
61
-import {
62
-  getAddAdminInitData,
63
-  addAdmin,
64
-  getModifyAdminInitData,
65
-  modifyAdmin
66
-} from "@/api/role/admin";
67
-export default {
68
-  name: "AdminInfoForm",
69
-  components: {
70
-    Tinymce
71
-  },
72
-  // props: {
73
-  //     admin_id: {
74
-  //         type: Number,
75
-  //         require: true
76
-  //     }
77
-  // },
78
-  data() {
79
-    var checkMobile = (rule, value, callback) => {
80
-      if (!value || value.length == 0) {
81
-        return callback(new Error("手机号不能为空"));
82
-      }
83
-      if (/^1\d{10}$/.test(value) == false) {
84
-        return callback(new Error("手机号格式错误"));
85
-      } else {
86
-        callback();
56
+  import Tinymce from '@/components/Tinymce'
57
+  import { addAdmin, getAddAdminInitData, getModifyAdminInitData, modifyAdmin } from '@/api/role/admin'
58
+
59
+  export default {
60
+    name: 'AdminInfoForm',
61
+    components: {
62
+      Tinymce
63
+    },
64
+    data() {
65
+      var checkMobile = (rule, value, callback) => {
66
+        if (!value || value.length == 0) {
67
+          return callback(new Error('手机号不能为空'))
68
+        }
69
+        if (/^1\d{10}$/.test(value) == false) {
70
+          return callback(new Error('手机号格式错误'))
71
+        } else {
72
+          callback()
73
+        }
87 74
       }
88
-    };
89
-    var checkName = (rule, value, callback) => {
90
-      if (!value || value.length == 0) {
91
-        return callback(new Error("姓名不能为空"));
92
-      } else {
93
-        callback();
75
+      var checkName = (rule, value, callback) => {
76
+        if (!value || value.length == 0) {
77
+          return callback(new Error('姓名不能为空'))
78
+        } else {
79
+          callback()
80
+        }
94 81
       }
95
-    };
96
-    return {
97
-      checkList: [],
98
-      admin_id: 0,
99
-      dialogFormVisible: false,
82
+      return {
83
+        admin_id: 0,
84
+        dialogFormVisible: false,
100 85
 
101
-      user_types: [
102
-        { index: 2, name: "医生" },
103
-        { index: 3, name: "护士" }
104
-      ],
105
-      user_titles: [
106
-        { index: 1, name: "医士" },
107
-        { index: 2, name: "医师" },
108
-        { index: 3, name: "住院医师" },
109
-        { index: 4, name: "主治医师" },
110
-        { index: 5, name: "副主任医师" },
111
-        { index: 6, name: "主任医师" },
112
-        { index: 7, name: "护士" },
113
-        { index: 8, name: "护师" },
114
-        { index: 9, name: "主管护师" },
115
-        { index: 10, name: "副主任护师" },
116
-        { index: 11, name: "主任护师" },
117
-        { index: 12, name: "运营专员" },
118
-        { index: 13, name: "运营主管" }
119
-      ],
120
-      roles: [], // [{id, name, intro, status}]
121
-      loading: true,
122
-      qntoken: "",
123
-      formTitle: "",
124
-      form: {
125
-        id: 0,
126
-        mobile: "",
127
-        name: "",
128
-        user_type: "",
129
-        user_title: "",
130
-        role: "", // 其实应该是 int 类型
131
-        intro: ""
132
-      },
133
-      rules: {
134
-        mobile: [{ required: true, validator: checkMobile, trigger: "blur" }],
135
-        name: [{ required: true, validator: checkName, trigger: "blur" }],
136
-        role: [{ required: true, message: "请选择角色", trigger: "change" }]
137
-      }
138
-    };
139
-  },
140
-  methods: {
141
-    open: function(adminId) {
142
-      this.admin_id = adminId;
143
-      if (this.admin_id < 0) {
144
-        this.$message.error("参数错误");
145
-        this.loading = false;
146
-        return;
86
+        user_types: [
87
+          { index: 2, name: '医生' },
88
+          { index: 3, name: '护士' }
89
+        ],
90
+        user_titles: [
91
+          { index: 1, name: '医士' },
92
+          { index: 2, name: '医师' },
93
+          { index: 3, name: '住院医师' },
94
+          { index: 4, name: '主治医师' },
95
+          { index: 5, name: '副主任医师' },
96
+          { index: 6, name: '主任医师' },
97
+          { index: 7, name: '护士' },
98
+          { index: 8, name: '护师' },
99
+          { index: 9, name: '主管护师' },
100
+          { index: 10, name: '副主任护师' },
101
+          { index: 11, name: '主任护师' },
102
+          { index: 12, name: '运营专员' },
103
+          { index: 13, name: '运营主管' }
104
+        ],
105
+        roles: [], // [{id, name, intro, status}]
106
+        loading: true,
107
+        qntoken: '',
108
+        formTitle: '',
109
+        isSubSuperAdmin:false,
110
+        org:null,
111
+        form: {
112
+          role_ids: [],
113
+          user_title_name: '',
114
+          id: 0,
115
+          mobile: '',
116
+          name: '',
117
+          user_type: '',
118
+          user_title: '',
119
+          role: '', // 其实应该是 int 类型
120
+          intro: ''
121
+        },
122
+        rules: {
123
+          mobile: [{ required: true, validator: checkMobile, trigger: 'blur' }],
124
+          name: [{ required: true, validator: checkName, trigger: 'blur' }],
125
+          role_ids: [
126
+            { type: 'array', required: true, message: '请至少选择一个角色', trigger: 'change' }
127
+          ]
128
+        }
147 129
       }
130
+    },
131
+    methods: {
132
+      open: function(adminId) {
133
+        this.admin_id = adminId
134
+        if (this.admin_id < 0) {
135
+          this.$message.error('参数错误')
136
+          this.loading = false
137
+          return
138
+        }
139
+         // let localthis.$store.getters.xt_user.user.id
140
+        let local_user_id = this.$store.getters.xt_user.user.id
141
+        local_user_id = 597
142
+        this.form.id = this.admin_id
143
+        if (this.admin_id === 0) {
144
+          let tempForm = {
145
+            role_ids: [],
146
+            user_title_name: '',
147
+            id: 0,
148
+            mobile: '',
149
+            name: '',
150
+            user_type: '',
151
+            user_title: '',
152
+            role: '', // 其实应该是 int 类型
153
+            intro: ''
154
+          }
155
+          this.form = tempForm
156
+          this.formTitle = '新增员工'
157
+          this.form.user_type = this.user_types[0].index
158
+          this.form.user_title = this.user_titles[0].index
159
+          getAddAdminInitData()
160
+            .then(rs => {
161
+              this.loading = false
162
+              var resp = rs.data
163
+              if (resp.state === 1) {
164
+                // this.roles.push(...resp.data.roles)
165
+                this.roles = resp.data.roles
166
+                this.qntoken = resp.data.qntoken
148 167
 
149
-      this.form.id = this.admin_id;
150
-      if (this.admin_id === 0) {
151
-        this.formTitle = "新增员工";
152
-        this.form.user_type = this.user_types[0].index;
153
-        this.form.user_title = this.user_titles[0].index;
154
-        getAddAdminInitData()
155
-          .then(rs => {
156
-            this.loading = false;
157
-            var resp = rs.data;
158
-            if (resp.state === 1) {
159
-              // this.roles.push(...resp.data.roles)
160
-              this.roles = resp.data.roles;
161
-              this.qntoken = resp.data.qntoken;
162
-              // if (this.roles.length > 0) {
163
-              //   this.form.role = this.roles[0].id;
164
-              //   console.log("国庆快乐",this.form.role)
165
-              // }
166
-            } else {
167
-              this.$message.error(resp.msg);
168
-            }
169
-          })
170
-          .catch(err => {
171
-            this.loading = false;
172
-            this.$message.error(err);
173
-          });
174
-      } else {
175
-        this.formTitle = "编辑用户";
176
-        getModifyAdminInitData(this.form.id)
177
-          .then(rs => {
178
-            this.loading = false;
179
-            var resp = rs.data;
180
-            if (resp.state === 1) {
181
-              this.roles.push(...resp.data.roles);
182
-              this.qntoken = resp.data.qntoken;
168
+                this.isSubSuperAdmin = resp.data.isSubSuperAdmin
169
+                this.org = resp.data.org
183 170
 
184
-              var admin = resp.data.admin;
185
-              this.form.name = admin.user_name;
186
-              this.form.mobile = admin.mobile;
187
-              this.form.user_type = admin.user_type;
188
-              this.form.user_title = admin.user_title;
189
-              this.form.role = admin.role_id;
190
-              this.form.intro = admin.intro;
191
-            } else {
192
-              this.$message.error("该用户不存在");
193
-            }
194
-          })
195
-          .catch(err => {
196
-            this.loading = false;
197
-            this.$message.error("该用户不存在");
198
-          });
199
-      }
171
+                //如果当前用户是子管理员则,则需要将子管理员角色去除,因为子管理员不能添加子管理员
172
+                if(this.isSubSuperAdmin){
173
+                  for (let i =0 ; i < this.roles.length; i++){
174
+                    if(this.roles[i].is_system == 1 && this.roles[i].role_name != "子管理员"){
175
+                      this.roles.splice(i, 1)
176
+                      i--
177
+                    }
178
+                  }
179
+                }
200 180
 
201
-      this.dialogFormVisible = true;
202
-    },
203
-    submitAction: function() {
204
-      if (this.admin_id < 0) {
205
-        return;
206
-      }
207
-      this.$refs.form.validate(valid => {
208
-        if (valid) {
209
-          this.loading = true;
210
-          if (this.form.id === 0) {
211
-            addAdmin(
212
-              this.form.mobile,
213
-              this.form.name,
214
-              this.form.user_type,
215
-              this.form.user_title,
216
-              this.form.role,
217
-              this.form.intro
218
-            )
219
-              .then(rs => {
220
-                this.loading = false;
221
-                var resp = rs.data;
222
-                if (resp.state === 1) {
223
-                  this.$store.dispatch("DidChangeAdmins");
224
-                  var _this = this;
225
-                  setTimeout(() => {
226
-                    _this.$store.dispatch("RecoverAdminsChangeState");
227
-                  }, 500);
228
-                  this.dialogFormVisible = false;
229
-                } else {
230
-                  this.$message.error(resp.msg);
181
+
182
+
183
+
184
+                // if (this.roles.length > 0) {
185
+                //   this.form.role = this.roles[0].id;
186
+                //   console.log("国庆快乐",this.form.role)
187
+                // }
188
+              } else {
189
+                this.$message.error(resp.msg)
190
+              }
191
+            })
192
+            .catch(err => {
193
+              this.loading = false
194
+              this.$message.error(err)
195
+            })
196
+        } else {
197
+          this.formTitle = '编辑用户'
198
+          getModifyAdminInitData(this.form.id)
199
+            .then(rs => {
200
+              this.loading = false
201
+              var resp = rs.data
202
+              if (resp.state === 1) {
203
+                this.roles = []
204
+                this.roles.push(...resp.data.roles)
205
+                this.qntoken = resp.data.qntoken
206
+
207
+                var admin = resp.data.admin
208
+                this.form.name = admin.user_name
209
+                this.form.mobile = admin.admin.mobile
210
+                this.form.user_type = admin.user_type
211
+                this.form.user_title = admin.user_title
212
+                this.form.role = admin.role_ids
213
+                this.form.role_ids = []
214
+                for (let i = 0; i < this.form.role.split(",").length; i++) {
215
+                  if (this.form.role.split(',')[i].length > 0) {
216
+                    this.form.role_ids.push(parseInt(this.form.role.split(',')[i]))
217
+                  }
231 218
                 }
232
-              })
233
-              .catch(err => {
234
-                this.loading = false;
235
-                this.$message.error(err);
236
-              });
237
-          } else {
238
-            modifyAdmin(
239
-              this.form.id,
240
-              this.form.name,
241
-              this.form.user_type,
242
-              this.form.user_title,
243
-              this.form.role,
244
-              this.form.intro
245
-            )
246
-              .then(rs => {
247
-                this.loading = false;
248
-                var resp = rs.data;
249
-                if (resp.state === 1) {
250
-                  this.$store.dispatch("DidChangeAdmins");
251
-                  var _this = this;
252
-                  setTimeout(() => {
253
-                    _this.$store.dispatch("RecoverAdminsChangeState");
254
-                  }, 500);
255 219
 
256
-                  this.dialogFormVisible = false;
257
-                } else {
258
-                  this.$message.error(resp.msg);
220
+                this.form.intro = admin.intro
221
+                this.form.user_title_name = admin.user_title_name
222
+
223
+
224
+
225
+                //如果当前用户是超级管理员而且编辑自己的信息
226
+                if(!this.isSubSuperAdmin && local_user_id == this.form.id){
227
+                  for (let i =0 ; i < this.roles.length; i++){
228
+                    if(this.roles[i].is_system == 1 && this.roles[i].role_name != "子管理员"){
229
+                      this.roles.splice(i, 1)
230
+                      i--
231
+                    }
232
+                  }
259 233
                 }
260
-              })
261
-              .catch(err => {
262
-                this.loading = false;
263
-                this.$message.error(err);
264
-              });
265
-          }
266
-        } else {
267
-          return false;
234
+
235
+
236
+
237
+
238
+              } else {
239
+                this.$message.error('该用户不存在')
240
+              }
241
+            })
242
+            .catch(err => {
243
+              this.loading = false
244
+              this.$message.error('该用户不存在')
245
+            })
246
+        }
247
+
248
+        this.dialogFormVisible = true
249
+      },
250
+      submitAction: function() {
251
+        if (this.admin_id < 0) {
252
+          return
268 253
         }
269
-      });
254
+        this.$refs.form.validate(valid => {
255
+          if (valid) {
256
+            this.loading = true
257
+            if (this.form.id === 0) {
258
+              this.form.role = this.form.role_ids.join(',')
259
+              addAdmin(
260
+                this.form.mobile,
261
+                this.form.name,
262
+                this.form.user_type,
263
+                this.form.user_title,
264
+                this.form.role,
265
+                this.form.intro,
266
+                this.form.user_title_name
267
+              )
268
+                .then(rs => {
269
+                  this.loading = false
270
+                  var resp = rs.data
271
+                  if (resp.state === 1) {
272
+                    this.$store.dispatch('DidChangeAdmins')
273
+                    var _this = this
274
+                    setTimeout(() => {
275
+                      _this.$store.dispatch('RecoverAdminsChangeState')
276
+                    }, 500)
277
+                    this.dialogFormVisible = false
278
+                  } else {
279
+                    this.$message.error(resp.msg)
280
+                  }
281
+                })
282
+                .catch(err => {
283
+                  this.loading = false
284
+                  this.$message.error(err)
285
+                })
286
+            } else {
287
+              this.form.role = this.form.role_ids.join(',')
288
+
289
+              modifyAdmin(
290
+                this.form.id,
291
+                this.form.name,
292
+                this.form.user_type,
293
+                this.form.user_title,
294
+                this.form.role,
295
+                this.form.intro,
296
+                this.form.user_title_name
297
+              )
298
+                .then(rs => {
299
+                  this.loading = false
300
+                  var resp = rs.data
301
+                  if (resp.state === 1) {
302
+                    this.$store.dispatch('DidChangeAdmins')
303
+                    var _this = this
304
+                    setTimeout(() => {
305
+                      _this.$store.dispatch('RecoverAdminsChangeState')
306
+                    }, 500)
307
+
308
+                    this.dialogFormVisible = false
309
+                  } else {
310
+                    this.$message.error(resp.msg)
311
+                  }
312
+                })
313
+                .catch(err => {
314
+                  this.loading = false
315
+                  this.$message.error(err)
316
+                })
317
+            }
318
+          } else {
319
+            return false
320
+          }
321
+        })
322
+      }
270 323
     }
271 324
   }
272
-};
273 325
 </script>

+ 469 - 201
src/xt_pages/role/components/EditRole.vue Просмотреть файл

@@ -27,29 +27,39 @@
27 27
               :indeterminate="isIndeterminate"
28 28
               v-model="checkAll"
29 29
               @change="handleCheckAllChange"
30
-              >全选</el-checkbox
30
+            >全选
31
+            </el-checkbox
31 32
             >
32 33
           </div>
33 34
           <el-checkbox-group
34 35
             v-model="checkedCities"
35
-            @change="handleCheckedCitiesChange"
36 36
           >
37
-            <!-- <el-checkbox v-for="city in cities" :label="city" :key="city">{{city}}</el-checkbox> -->
38
-            <div class="checkone" v-for="city in cities" :key="city">
39
-              <el-checkbox :label="city">
40
-                <img src="https://kuyi.shengws.com/S1.png" alt />
41
-                <span>名字</span>
37
+            <div class="checkone" v-for="(item,index) in admin_user" :key="index">
38
+              <el-checkbox :label="item.id" :value="item.id" @change="change">
39
+                <img v-if="item.avatar.length > 0" :src="item.avatar" alt=""/>
40
+                <img
41
+                  v-if="item.avatar.length == 0"
42
+                  src="https://kuyi.shengws.com/S1.png"
43
+                  alt=""
44
+                />
45
+                <span>{{item.user_name}}</span>
42 46
               </el-checkbox>
43 47
             </div>
44 48
           </el-checkbox-group>
45 49
         </div>
46 50
       </div>
51
+
47 52
       <div class="roleContentRight">
48 53
         <p style="color:#303133">已选:</p>
49 54
         <div class="chooseBox">
50
-          <div class="hasChoosedOne">
51
-            <img src="https://kuyi.shengws.com/S1.png" alt />
52
-            <span>名字</span>
55
+          <div class="hasChoosedOne" v-for="(item,index) in is_check_admin_user" :key="index">
56
+            <img v-if="item.avatar.length > 0" :src="item.avatar" alt=""/>
57
+            <img
58
+              v-if="item.avatar.length == 0"
59
+              src="https://kuyi.shengws.com/S1.png"
60
+              alt=""
61
+            />
62
+            <span>{{item.user_name}}</span>
53 63
           </div>
54 64
         </div>
55 65
       </div>
@@ -58,18 +68,39 @@
58 68
       <el-form
59 69
         :model="ruleForm"
60 70
         :rules="newrules"
61
-        label-position="right"
62
-        label-width="80px"
63
-        style="width:40%"
71
+        ref="form"
72
+        label-position="left"
64 73
       >
65
-        <el-form-item label="姓名" prop="name">
74
+        <el-form-item label="姓名" prop="name" label-width="50px">
66 75
           <el-input v-model="ruleForm.name"></el-input>
67 76
         </el-form-item>
68
-        <el-form-item label="手机号" prop="phone">
69
-          <el-input v-model="ruleForm.phone"></el-input>
77
+        <el-form-item label="手机号" prop="phone" label-width="70px">
78
+
79
+          <el-input  v-model="ruleForm.phone"  maxlength="11"></el-input>
80
+        </el-form-item>
81
+
82
+        <el-form-item label="职称 : " label-width="50px">
83
+          <el-select v-model="ruleForm.user_type" placeholder="用户类型">
84
+            <el-option
85
+              v-for="item in user_types"
86
+              :label="item.name"
87
+              :value="item.index"
88
+              :key="item.index"
89
+            ></el-option>
90
+          </el-select>
91
+
92
+          <el-select v-model="ruleForm.user_title" placeholder="用户职称">
93
+            <el-option
94
+              v-for="item in user_titles"
95
+              :label="item.name"
96
+              :value="item.index"
97
+              :key="item.index"
98
+            ></el-option>
99
+          </el-select>
70 100
         </el-form-item>
71
-        <el-form-item label="职位">
72
-          <el-input></el-input>
101
+
102
+        <el-form-item label="职位" label-width="50px">
103
+          <el-input v-model="ruleForm.position"></el-input>
73 104
         </el-form-item>
74 105
       </el-form>
75 106
       <div class="newItem">
@@ -79,7 +110,7 @@
79 110
             style="font-size:20px;color:#338AFB"
80 111
           ></i>
81 112
         </p>
82
-        <p style="color:#409FFF">继续新增员工</p>
113
+        <p style="color:#409FFF" @click="continueAddStaff()">继续新增员工</p>
83 114
       </div>
84 115
     </div>
85 116
     <div slot="footer" class="dialog-footer">
@@ -90,213 +121,450 @@
90 121
 </template>
91 122
 
92 123
 <script>
93
-import { addRole, modifyRole } from "@/api/role/role";
94
-
95
-export default {
96
-  name: "EditRole",
97
-  data() {
98
-    return {
99
-      form: {
100
-        id: 0,
101
-        name: "",
102
-        intro: ""
103
-      },
104
-      visible: false,
105
-      rules: {
106
-        name: [
107
-          { required: true, message: "请输入角色名称", trigger: "blur" },
108
-          { max: 10, message: "10个字以内", trigger: "blur" }
109
-        ],
110
-        intro: [{ required: true, message: "请输入角色说明", trigger: "blur" }]
111
-      },
124
+  import { addRole, AddUserRole, getStaffsList, modifyRole } from '@/api/role/role'
125
+  import { addAdmin, getAddAdminInitData, getModifyAdminInitData, modifyAdmin } from '@/api/role/admin'
112 126
 
113
-      //
114
-      checked: "1",
115
-      checkAll: false,
116
-      checkedCities: [],
117
-      cities: ["上海", "北京", "广州", "深圳"],
118
-      isIndeterminate: true,
119
-      ruleForm: {
120
-        name: "",
121
-        phone: "",
122
-        position: ""
123
-      },
124
-      newrules: {
125
-        name: [
126
-          { required: true, message: "请输入角色名称", trigger: "blur" },
127
-          { max: 10, message: "10个字以内", trigger: "blur" }
127
+  export default {
128
+    name: 'EditRole',
129
+    data() {
130
+      var checkMobile = (rule, value, callback) => {
131
+        if (!value || value.length == 0) {
132
+          return callback(new Error('手机号不能为空'))
133
+        }
134
+        if (/^1\d{10}$/.test(value) == false) {
135
+          return callback(new Error('手机号格式错误'))
136
+        } else {
137
+          callback()
138
+        }
139
+      }
140
+      var checkName = (rule, value, callback) => {
141
+        if (!value || value.length == 0) {
142
+          return callback(new Error('姓名不能为空'))
143
+        } else {
144
+          callback()
145
+        }
146
+      }
147
+
148
+      return {
149
+        form: {
150
+          id: 0,
151
+          name: '',
152
+          intro: ''
153
+        },
154
+        role_id: 0,
155
+        visible: false,
156
+        rules: {
157
+          phone: [{ required: true, validator: checkMobile, trigger: 'blur' }],
158
+          name: [{ required: true, validator: checkName, trigger: 'blur' }],
159
+          intro: [{ required: true, message: '请输入角色说明', trigger: 'blur' }]
160
+        },
161
+        admin_user: [],
162
+        is_check_admin_user: [],
163
+        user_types: [
164
+          { index: 2, name: '医生' },
165
+          { index: 3, name: '护士' }
166
+        ],
167
+        user_titles: [
168
+          { index: 1, name: '医士' },
169
+          { index: 2, name: '医师' },
170
+          { index: 3, name: '住院医师' },
171
+          { index: 4, name: '主治医师' },
172
+          { index: 5, name: '副主任医师' },
173
+          { index: 6, name: '主任医师' },
174
+          { index: 7, name: '护士' },
175
+          { index: 8, name: '护师' },
176
+          { index: 9, name: '主管护师' },
177
+          { index: 10, name: '副主任护师' },
178
+          { index: 11, name: '主任护师' },
179
+          { index: 12, name: '运营专员' },
180
+          { index: 13, name: '运营主管' }
128 181
         ],
129
-        phone: [{ required: true, message: "请输入手机号", trigger: "blur" }]
182
+        //
183
+        checked: '1',
184
+        checkAll: false,
185
+        checkedCities: [],
186
+        isIndeterminate: true,
187
+        ruleForm: {
188
+          name: '',
189
+          phone: '',
190
+          position: '',
191
+          user_type: 2,
192
+          user_title: 1,
193
+          role: ''
194
+        },
195
+        newrules: {
196
+          phone: [{ required: true, validator: checkMobile, trigger: 'blur' }],
197
+
198
+          name: [
199
+            { required: true, message: '请输入用户名字', trigger: 'blur' },
200
+            { max: 10, message: '10个字以内', trigger: 'blur' }
201
+          ]
202
+        }
130 203
       }
131
-    };
132
-  },
133
-  methods: {
134
-    _close: function(done) {
135
-      this.clear();
136
-      done();
137
-    },
138
-    clear: function() {
139
-      this.form.id = 0;
140
-      this.form.name = "";
141
-      this.form.intro = "";
142
-    },
143
-    show() {
144
-      this.clear();
145
-      this.visible = true;
146 204
     },
147
-    hide() {
148
-      this.clear();
149
-      this.visible = false;
150
-    },
151
-    modify(id, name, intro) {
152
-      this.form.id = id;
153
-      this.form.name = name;
154
-      this.form.intro = intro;
155
-      this.visible = true;
156
-    },
157
-    submitAction() {
158
-      this.$refs.form.validate(valid => {
159
-        if (valid) {
160
-          // 验证通过
161
-          if (this.form.id === 0) {
162
-            // 新增 role
163
-            addRole(this.form.name, this.form.intro)
164
-              .then(rs => {
165
-                var resp = rs.data;
166
-                if (resp.state === 1) {
167
-                  var new_id = resp.data.id;
168
-                  var new_name = resp.data.name;
169
-                  var new_intro = resp.data.intro;
170
-                  var new_status = resp.data.status;
171
-                  this.$emit(
172
-                    "did-add-role",
173
-                    new_id,
174
-                    new_name,
175
-                    new_intro,
176
-                    new_status
177
-                  );
178
-
179
-                  this.hide();
180
-                } else {
181
-                  this.$message.error(resp.msg);
182
-                }
183
-              })
184
-              .catch(err => {
185
-                this.$message.error(err);
186
-              });
205
+    methods: {
206
+      continueAddStaff(){
207
+        this.$refs.form.validate(valid => {
208
+          if (valid) {
209
+            if (this.form.id === 0) {
210
+              this.ruleForm.role = this.role_id
211
+              addAdmin(
212
+                this.ruleForm.phone,
213
+                this.ruleForm.name,
214
+                this.ruleForm.user_type,
215
+                this.ruleForm.user_title,
216
+                this.ruleForm.role,
217
+                '',
218
+                this.ruleForm.position
219
+              )
220
+                .then(rs => {
221
+                  var resp = rs.data
222
+                  if (resp.state === 1) {
223
+                    this.$store.dispatch('DidChangeAdmins')
224
+                    var _this = this
225
+                    setTimeout(() => {
226
+                      _this.$store.dispatch('RecoverAdminsChangeState')
227
+                    }, 500)
228
+                    this.$emit('did-edit-role')
229
+                    this.ruleForm.phone = ''
230
+
231
+                    this.ruleForm.name = ''
232
+                    this.ruleForm.user_type = 2
233
+                    this.ruleForm.user_title = 1
234
+                    this.ruleForm.role = ''
235
+                    this.ruleForm.position = ''
236
+                  } else {
237
+                    this.$message.error(resp.msg)
238
+                  }
239
+                })
240
+                .catch(err => {
241
+                  this.loading = false
242
+                  this.$message.error(err)
243
+                })
244
+            }
187 245
           } else {
188
-            // 修改 role
189
-            modifyRole(this.form.id, this.form.name, this.form.intro)
190
-              .then(rs => {
191
-                var resp = rs.data;
192
-                if (resp.state === 1) {
193
-                  this.$emit(
194
-                    "did-edit-role",
195
-                    this.form.id,
196
-                    this.form.name,
197
-                    this.form.intro
198
-                  );
199
-                  this.hide();
200
-                } else {
201
-                  this.$message.error(resp.msg);
246
+            return false
247
+          }
248
+        })
249
+
250
+
251
+
252
+      },
253
+      change(val) {
254
+
255
+        if (this.checkedCities.length == this.admin_user.length) {
256
+
257
+          this.checkAll = true
258
+        } else {
259
+          this.checkAll = false
260
+
261
+        }
262
+
263
+      }
264
+
265
+      ,
266
+      GetAllStaff: function() {
267
+        getStaffsList()
268
+          .then(rs => {
269
+            var resp = rs.data
270
+            if (resp.state === 1) {
271
+
272
+              this.admin_user = resp.data.admins
273
+
274
+              for (let i = 0; i < this.admin_user.length; i++) {
275
+                if (this.admin_user[i].role_ids.length > 0) {
276
+                  let isExist = -1
277
+                  let ids = this.admin_user[i].role_ids.split(',')
278
+                  isExist = ids.indexOf(this.role_id.toString())
279
+                  if (isExist >= 0) {
280
+                    this.is_check_admin_user.push(this.admin_user[i])
281
+                    this.admin_user.splice(i, 1)
282
+
283
+                    i = i - 1
284
+                  }
285
+                }
286
+              }
287
+
288
+              for (let i = 0; i < this.admin_user.length; i++) {
289
+                if (this.admin_user[i].user_id == resp.data.org.creator) {
290
+
291
+                  this.admin_user.splice(i, 1)
292
+                  i = i - 1
202 293
                 }
203
-              })
204
-              .catch(err => {
205
-                this.$message.error(err);
206
-              });
294
+              }
295
+            } else {
296
+              this.$message.error(resp.msg)
297
+            }
298
+          })
299
+          .catch(err => {
300
+            this.$message.error(err)
301
+          })
302
+
303
+      },
304
+      _close: function(done) {
305
+        this.clear()
306
+        done()
307
+      },
308
+      clear: function() {
309
+        this.form.id = 0
310
+        this.form.name = ''
311
+        this.form.intro = ''
312
+      },
313
+      show(role_id) {
314
+        this.clear()
315
+        this.checked = '1'
316
+        this.visible = true
317
+        this.role_id = role_id
318
+        this.admin_user = []
319
+        this.is_check_admin_user = []
320
+        this.checkedCities = []
321
+        this.GetAllStaff()
322
+      },
323
+      hide() {
324
+        this.clear()
325
+        this.visible = false
326
+      },
327
+      modify(id, name, intro) {
328
+        this.form.id = id
329
+        this.form.name = name
330
+        this.form.intro = intro
331
+        this.visible = true
332
+      },
333
+      submitAction() {
334
+        if (this.checked == '1') {
335
+          if (this.checkedCities.length == 0) {
336
+            this.$message.error('至少选择一个用户')
337
+            return
207 338
           }
339
+          let params = {
340
+            id: this.role_id,
341
+            ids: this.checkedCities.join(',')
342
+          }
343
+          AddUserRole(params).then(response => {
344
+            if (response.data.state === 1) {
345
+              this.$message.success('添加成功')
346
+              this.$emit('did-edit-role')
347
+              this.hide()
348
+
349
+            } else {
350
+              this.$message.error(response.data.msg)
351
+
352
+            }
353
+          })
208 354
         } else {
209
-          // 验证失败
210
-          return false;
355
+          this.$refs.form.validate(valid => {
356
+            if (valid) {
357
+              if (this.form.id === 0) {
358
+                this.ruleForm.role = this.role_id
359
+                addAdmin(
360
+                  this.ruleForm.phone,
361
+                  this.ruleForm.name,
362
+                  this.ruleForm.user_type,
363
+                  this.ruleForm.user_title,
364
+                  this.ruleForm.role,
365
+                  '',
366
+                  this.ruleForm.position
367
+                )
368
+                  .then(rs => {
369
+                    var resp = rs.data
370
+                    if (resp.state === 1) {
371
+                      this.$store.dispatch('DidChangeAdmins')
372
+                      var _this = this
373
+                      setTimeout(() => {
374
+                        _this.$store.dispatch('RecoverAdminsChangeState')
375
+                      }, 500)
376
+                      this.$emit('did-edit-role')
377
+                      this.hide()
378
+
379
+                      this.ruleForm.phone = ''
380
+                      this.ruleForm.name = ''
381
+                      this.ruleForm.user_type = 2
382
+                      this.ruleForm.user_title = 1
383
+                      this.ruleForm.role = ''
384
+                      this.ruleForm.position = ''
385
+                    } else {
386
+                      this.$message.error(resp.msg)
387
+                    }
388
+                  })
389
+                  .catch(err => {
390
+                    this.loading = false
391
+                    this.$message.error(err)
392
+                  })
393
+              }
394
+            } else {
395
+              return false
396
+            }
397
+          })
398
+
211 399
         }
212
-      });
213
-    },
214
-    handleCheckAllChange(val) {
215
-      this.checkedCities = val ? this.cities : [];
216
-      this.isIndeterminate = false;
217
-    },
218
-    handleCheckedCitiesChange(value) {
219
-      let checkedCount = value.length;
220
-      this.checkAll = checkedCount === this.cities.length;
221
-      this.isIndeterminate =
222
-        checkedCount > 0 && checkedCount < this.cities.length;
400
+
401
+        // this.$refs.form.validate(valid => {
402
+        //   if (valid) {
403
+        //     // 验证通过
404
+        //     if (this.form.id === 0) {
405
+        //       // 新增 role
406
+        //       addRole(this.form.name, this.form.intro)
407
+        //         .then(rs => {
408
+        //           var resp = rs.data;
409
+        //           if (resp.state === 1) {
410
+        //             var new_id = resp.data.id;
411
+        //             var new_name = resp.data.name;
412
+        //             var new_intro = resp.data.intro;
413
+        //             var new_status = resp.data.status;
414
+        //             this.$emit(
415
+        //               "did-add-role",
416
+        //               new_id,
417
+        //               new_name,
418
+        //               new_intro,
419
+        //               new_status
420
+        //             );
421
+        //
422
+        //             this.hide();
423
+        //           } else {
424
+        //             this.$message.error(resp.msg);
425
+        //           }
426
+        //         })
427
+        //         .catch(err => {
428
+        //           this.$message.error(err);
429
+        //         });
430
+        //     } else {
431
+        //       // 修改 role
432
+        //       modifyRole(this.form.id, this.form.name, this.form.intro)
433
+        //         .then(rs => {
434
+        //           var resp = rs.data;
435
+        //           if (resp.state === 1) {
436
+        //             this.$emit(
437
+        //               "did-edit-role",
438
+        //               this.form.id,
439
+        //               this.form.name,
440
+        //               this.form.intro
441
+        //             );
442
+        //             this.hide();
443
+        //           } else {
444
+        //             this.$message.error(resp.msg);
445
+        //           }
446
+        //         })
447
+        //         .catch(err => {
448
+        //           this.$message.error(err);
449
+        //         });
450
+        //     }
451
+        //   } else {
452
+        //     // 验证失败
453
+        //     return false;
454
+        //   }
455
+        // });
456
+      },
457
+      handleCheckAllChange(val) {
458
+        this.checkedCities = []
459
+        if (val) {
460
+          for (let i = 0; i < this.admin_user.length; i++) {
461
+            this.checkedCities.push(this.admin_user[i].id)
462
+          }
463
+        } else {
464
+          this.checkedCities = []
465
+        }
466
+
467
+        this.isIndeterminate = false
468
+      },
469
+      handleCheckedCitiesChange(value) {
470
+        let checkedCount = value.length
471
+        this.checkAll = checkedCount === this.cities.length
472
+        this.isIndeterminate =
473
+          checkedCount > 0 && checkedCount < this.cities.length
474
+      }
223 475
     }
224 476
   }
225
-};
226 477
 </script>
227 478
 
228 479
 <style lang="scss" scoped>
229
-.roleContent {
230
-  margin-top: 20px;
231
-  display: flex;
232
-  justify-content: space-between;
480
+  .roleContent {
481
+    margin-top: 20px;
482
+    display: flex;
483
+    justify-content: space-between;
484
+
233 485
   .roleContentLeft {
234
-    .chooseBox {
235
-      width: 280px;
236
-      height: 320px;
237
-      overflow-y: auto;
238
-      border: 1px solid rgba(235, 238, 240, 1);
239
-      margin-top: 26px;
240
-      padding: 20px;
241
-      .checkone {
242
-        display: flex;
243
-        align-items: center;
244
-        height: 50px;
245
-      }
246
-      .el-checkbox__label {
247
-        display: flex;
248
-        align-items: center;
249
-        img {
250
-          width: 30px;
251
-          height: 30px;
252
-          margin-right: 10px;
253
-        }
254
-      }
255
-    }
486
+
487
+  .chooseBox {
488
+    width: 280px;
489
+    height: 320px;
490
+    overflow-y: auto;
491
+    border: 1px solid rgba(235, 238, 240, 1);
492
+    margin-top: 26px;
493
+    padding: 20px;
494
+
495
+  .checkone {
496
+    display: flex;
497
+    align-items: center;
498
+    height: 50px;
499
+  }
500
+
501
+  .el-checkbox__label {
502
+    display: flex;
503
+    align-items: center;
504
+
505
+  img {
506
+    width: 30px;
507
+    height: 30px;
508
+    margin-right: 10px;
509
+  }
510
+
511
+  }
512
+  }
256 513
   }
257 514
   .roleContentRight {
258
-    .chooseBox {
259
-      width: 280px;
260
-      height: 320px;
261
-      overflow-y: auto;
262
-      border: 1px solid rgba(235, 238, 240, 1);
263
-      margin-top: 26px;
264
-      padding: 20px;
265
-      .hasChoosedOne {
266
-        display: flex;
267
-        align-items: center;
268
-        height: 50px;
269
-        img {
270
-          width: 30px;
271
-          height: 30px;
272
-          margin-right: 10px;
273
-        }
274
-      }
275
-    }
515
+
516
+  .chooseBox {
517
+    width: 280px;
518
+    height: 320px;
519
+    overflow-y: auto;
520
+    border: 1px solid rgba(235, 238, 240, 1);
521
+    margin-top: 26px;
522
+    padding: 20px;
523
+
524
+  .hasChoosedOne {
525
+    display: flex;
526
+    align-items: center;
527
+    height: 50px;
528
+
529
+  img {
530
+    width: 30px;
531
+    height: 30px;
532
+    margin-right: 10px;
533
+  }
534
+
535
+  }
276 536
   }
277
-}
278
-.newStaff {
279
-  margin-top: 26px;
537
+  }
538
+  }
539
+  .newStaff {
540
+    margin-top: 26px;
541
+
280 542
   .newItem {
281 543
     display: flex;
282 544
     align-items: center;
283 545
   }
284
-}
546
+
547
+  }
285 548
 </style>
286 549
 
287 550
 <style lang="scss">
288
-.roleContent {
551
+  .roleContent {
552
+
289 553
   .roleContentLeft {
290
-    .chooseBox {
291
-      .el-checkbox {
292
-        display: flex;
293
-        align-items: center;
294
-      }
295
-      .el-checkbox__label {
296
-        display: flex;
297
-        align-items: center;
298
-      }
299
-    }
554
+
555
+  .chooseBox {
556
+
557
+  .el-checkbox {
558
+    display: flex;
559
+    align-items: center;
560
+  }
561
+
562
+  .el-checkbox__label {
563
+    display: flex;
564
+    align-items: center;
565
+  }
566
+
567
+  }
568
+  }
300 569
   }
301
-}
302 570
 </style>

+ 44 - 148
src/xt_pages/role/role.vue Просмотреть файл

@@ -87,9 +87,14 @@
87 87
 
88 88
       <edit-role
89 89
         ref="edit_role"
90
-        @did-add-role="didAddRole"
91 90
         @did-edit-role="didModifyRole"
92 91
       ></edit-role>
92
+
93
+      <add-role
94
+        ref="add_role"
95
+        @did-add-role="didAddRole"
96
+      ></add-role>
97
+
93 98
       <permission-settings ref="permission_settings"></permission-settings>
94 99
 
95 100
       <div class="roleTitle">
@@ -99,153 +104,38 @@
99 104
         </p>
100 105
       </div>
101 106
       <div class="roleBox">
102
-        <div class="roleOne">
107
+        <div class="roleOne" v-for="item in this.roles">
103 108
           <div class="setting">
104 109
             <i class="el-icon-setting"></i>
105 110
             <span style="margin-right:20px" @click="onClick">权限配置</span>
106 111
           </div>
107 112
           <div class="avatar">
108
-            <img src="../../assets/img/pc1.png" alt />
109
-            <p class="avatarname">子管理员</p>
110
-          </div>
111
-          <div class="roleTip">
112
-            子管理员角色具备平台全部功能的使用权限,请谨慎配置...
113
-          </div>
114
-          <div class="roleTxt">
115
-            该角色目前已配置
116
-            <span style="color:#4A8AF3">0</span> 个员工
117
-          </div>
118
-          <div class="btnBox">
119
-            <el-button>新增用户</el-button>
120
-            <el-button>用户管理</el-button>
121
-          </div>
122
-        </div>
123
-        <div class="roleOne">
124
-          <div class="setting">
125
-            <i class="el-icon-setting"></i>
126
-            <span style="margin-right:20px">权限配置</span>
127
-          </div>
128
-          <div class="avatar">
129
-            <img src="../../assets/img/pc2.png" alt />
130
-            <p class="avatarname">医生</p>
131
-          </div>
132
-          <div class="roleTip">
133
-            医生角色能够进行建立患者档案,制定和调整患者透析治疗方案,定期评价病人的透析质量等...
134
-          </div>
135
-          <div class="roleTxt">
136
-            该角色目前已配置
137
-            <span style="color:#4A8AF3">0</span> 个员工
138
-          </div>
139
-          <div class="btnBox">
140
-            <el-button>新增用户</el-button>
141
-            <el-button>用户管理</el-button>
142
-          </div>
143
-        </div>
144
-        <div class="roleOne">
145
-          <div class="setting">
146
-            <i class="el-icon-setting"></i>
147
-            <span style="margin-right:20px">权限配置</span>
148
-          </div>
149
-          <div class="avatar">
150
-            <img src="../../assets/img/pc3.png" alt />
151
-            <p class="avatarname">护士</p>
152
-          </div>
153
-          <div class="roleTip">
154
-            护士角色能够进行病人透析管理,以及医院的感染控制与消毒记录等...
155
-          </div>
156
-          <div class="roleTxt">
157
-            该角色目前已配置
158
-            <span style="color:#4A8AF3">0</span> 个员工
159
-          </div>
160
-          <div class="btnBox">
161
-            <el-button>新增用户</el-button>
162
-            <el-button>用户管理</el-button>
163
-          </div>
164
-        </div>
165
-        <div class="roleOne">
166
-          <div class="setting">
167
-            <i class="el-icon-setting"></i>
168
-            <span style="margin-right:20px">权限配置</span>
169
-          </div>
170
-          <div class="avatar">
171
-            <img src="../../assets/img/pc7.png" alt />
172
-            <p class="avatarname">技师</p>
173
-          </div>
174
-          <div class="roleTip">
175
-            技师角色能够进行设备的管理,日常维护维修记录等...
176
-          </div>
177
-          <div class="roleTxt">
178
-            该角色目前已配置
179
-            <span style="color:#4A8AF3">0</span> 个员工
180
-          </div>
181
-          <div class="btnBox">
182
-            <el-button>新增用户</el-button>
183
-            <el-button>用户管理</el-button>
184
-          </div>
185
-        </div>
186
-        <div class="roleOne">
187
-          <div class="setting">
188
-            <i class="el-icon-setting"></i>
189
-            <span style="margin-right:20px">权限配置</span>
190
-          </div>
191
-          <div class="avatar">
192
-            <img src="../../assets/img/pc6.png" alt />
193
-            <p class="avatarname">运营</p>
194
-          </div>
195
-          <div class="roleTip">
196
-            运营角色能够在SCRM中管理微网站、使用营销工具、做会员管理和分销商品经营的操作...
197
-          </div>
198
-          <div class="roleTxt">
199
-            该角色目前已配置
200
-            <span style="color:#4A8AF3">0</span> 个员工
201
-          </div>
202
-          <div class="btnBox">
203
-            <el-button>新增用户</el-button>
204
-            <el-button>用户管理</el-button>
205
-          </div>
206
-        </div>
207
-        <div class="roleOne">
208
-          <div class="setting">
209
-            <i class="el-icon-setting"></i>
210
-            <span style="margin-right:20px">权限配置</span>
211
-          </div>
212
-          <div class="avatar">
213
-            <img src="../../assets/img/pc4.png" alt />
214
-            <p class="avatarname">库存</p>
215
-          </div>
216
-          <div class="roleTip">
217
-            库存角色负责透析耗材的日常管理,对耗材的入库、出库、退库的登记操作...
218
-          </div>
219
-          <div class="roleTxt">
220
-            该角色目前已配置
221
-            <span style="color:#4A8AF3">0</span> 个员工
222
-          </div>
223
-          <div class="btnBox">
224
-            <el-button>新增用户</el-button>
225
-            <el-button>用户管理</el-button>
226
-          </div>
227
-        </div>
228
-        <div class="roleOne">
229
-          <div class="setting">
230
-            <i class="el-icon-setting"></i>
231
-            <span style="margin-right:20px">权限配置</span>
232
-          </div>
233
-          <div class="avatar">
234
-            <img src="../../assets/img/pc5.png" alt />
235
-            <p class="avatarname">院长</p>
113
+            <img v-if="item.name == '子管理员'" src="../../assets/img/pc1.png" alt=""/>
114
+            <img v-else-if="item.name == '医生'" src="../../assets/img/pc2.png" alt=""/>
115
+            <img v-else-if="item.name == '护士'" src="../../assets/img/pc3.png" alt=""/>
116
+            <img v-else-if="item.name == '库存'" src="../../assets/img/pc4.png" alt=""/>
117
+            <img v-else-if="item.name == '院长'" src="../../assets/img/pc5.png" alt=""/>
118
+            <img v-else-if="item.name == '运营'"  src="../../assets/img/pc6.png" alt=""/>
119
+            <img v-else-if="item.name == '技师'"  src="../../assets/img/pc7.png" alt=""/>
120
+            <img v-else  src="../../assets/img/pc1.png" alt=""/>
121
+
122
+
123
+
124
+            <p class="avatarname">{{item.name}}</p>
236 125
           </div>
237 126
           <div class="roleTip">
238
-            院长角色了解血透患者血液透析质量和相关的大数据,以及掌握透析中心整体运营情况
127
+           {{item.intro}}
239 128
           </div>
240 129
           <div class="roleTxt">
241 130
             该角色目前已配置
242
-            <span style="color:#4A8AF3">0</span> 个员工
131
+            <span style="color:#4A8AF3">{{item.staff_number}}</span> 个员工
243 132
           </div>
244 133
           <div class="btnBox">
245
-            <el-button>新增用户</el-button>
134
+            <el-button @click="addStaff(item.id)">新增用户</el-button>
246 135
             <el-button>用户管理</el-button>
247 136
           </div>
248 137
         </div>
138
+
249 139
       </div>
250 140
     </div>
251 141
   </div>
@@ -254,11 +144,13 @@
254 144
 <script>
255 145
 import EditRole from "./components/EditRole.vue";
256 146
 import PermissionSettings from "./components/PermissionSettings.vue";
257
-import { getRoles, setRoleStatus } from "@/api/role/role";
147
+import { getRoles, setRoleStatus,getRolesList } from "@/api/role/role";
258 148
 import BreadCrumb from "@/xt_pages/components/bread-crumb";
149
+import AddRole from './components/AddRole'
259 150
 
260 151
 export default {
261 152
   components: {
153
+    AddRole,
262 154
     EditRole,
263 155
     BreadCrumb,
264 156
     PermissionSettings
@@ -279,16 +171,25 @@ export default {
279 171
     this.requestRoleWithPage(1);
280 172
   },
281 173
   methods: {
174
+    addStaff(role_id){
175
+      this.$refs.edit_role.show(role_id);
176
+
177
+    },
282 178
     requestRoleWithPage: function(page) {
283 179
       this.roles.splice(0, this.roles.length);
284 180
       this.loading_roles = true;
285
-      getRoles(page)
181
+      getRolesList(page)
286 182
         .then(rs => {
287 183
           this.loading_roles = false;
288 184
           const resp = rs.data;
289 185
           if (resp.state === 1) {
290
-            this.roles.push(...resp.data.roles);
291
-            this.role_total_count = resp.data.total_count;
186
+
187
+            for (let i = 0; i < resp.data.roles.length; i++) {
188
+              if (!resp.data.roles[i].is_super_admin) {
189
+                this.roles.push(resp.data.roles[i])
190
+              }
191
+            }
192
+            // this.roles.push(...resp.data.roles);
292 193
           } else {
293 194
             this.$message.error(resp.msg);
294 195
           }
@@ -300,7 +201,7 @@ export default {
300 201
     },
301 202
     addRoleAction: function() {
302 203
       // 父组件调用子组件方法 https://segmentfault.com/a/1190000009525355
303
-      this.$refs.edit_role.show();
204
+      this.$refs.add_role.show();
304 205
     },
305 206
     modifyRoleAction: function(row) {
306 207
       this.$refs.edit_role.modify(row.id, row.name, row.intro);
@@ -365,17 +266,12 @@ export default {
365 266
           this.$message.error(err);
366 267
         });
367 268
     },
368
-    didAddRole: function(id, name, intro, status) {
369
-      this.roles.push({ id: id, name: name, intro: intro, status: status });
269
+    didAddRole: function(id, name, intro, status,staff_number) {
270
+      this.roles.push({ id: id, name: name, intro: intro, status: status ,staff_number: staff_number});
370 271
     },
371
-    didModifyRole: function(id, name, intro) {
372
-      this.roles.forEach(role => {
373
-        if (role.id === id) {
374
-          role.name = name;
375
-          role.intro = intro;
376
-          return false;
377
-        }
378
-      });
272
+    didModifyRole: function() {
273
+      this.requestRoleWithPage(1);
274
+
379 275
     },
380 276
     pageChange: function(nextPage) {
381 277
       this.requestRoleWithPage(nextPage);

+ 13 - 13
src/xt_permission.js Просмотреть файл

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