Procházet zdrojové kódy

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

See999 před 5 roky
rodič
revize
1a6fa1667b
30 změnil soubory, kde provedl 2445 přidání a 1020 odebrání
  1. 2 2
      config/dev.env.js
  2. 1 1
      config/index.js
  3. 1 1
      config/sit.env.js
  4. 11 30
      package-lock.json
  5. 6 4
      src/api/advice.js
  6. 20 0
      src/api/config.js
  7. 25 8
      src/api/dialysis.js
  8. 23 8
      src/api/dialysis_record.js
  9. 11 6
      src/api/patient.js
  10. 14 11
      src/api/role/admin.js
  11. 86 55
      src/api/role/role.js
  12. 8 8
      src/router/modules/systems.js
  13. 75 19
      src/views/layout/components/Navbar.vue
  14. 7 0
      src/xt_pages/dialysis/details/dialog/AssessmentAfterDislysis.vue
  15. 68 67
      src/xt_pages/dialysis/details/dialog/DoctorAdviceDialog.vue
  16. 9 0
      src/xt_pages/dialysis/details/dialog/acceptsTreatmentDialog.vue
  17. 9 0
      src/xt_pages/dialysis/details/dialog/assessmentBeforeDislysisDialog.vue
  18. 55 73
      src/xt_pages/dialysis/details/dialog/computer_dialog.vue
  19. 101 1
      src/xt_pages/dialysis/details/dialog/dialysisPrescriptionDialog.vue
  20. 6 1
      src/xt_pages/dialysis/details/dialog/finish_dialog.vue
  21. 9 2
      src/xt_pages/dialysis/details/dialog/monitor_dialog.vue
  22. 7 0
      src/xt_pages/dialysis/details/dialog/treatmentSummaryDialog.vue
  23. 56 4
      src/xt_pages/role/admin.vue
  24. 252 0
      src/xt_pages/role/components/AddRole.vue
  25. 280 215
      src/xt_pages/role/components/AdminInfoForm.vue
  26. 257 0
      src/xt_pages/role/components/AdminRoleInfoForm.vue
  27. 491 204
      src/xt_pages/role/components/EditRole.vue
  28. 294 117
      src/xt_pages/role/components/PermissionSettings.vue
  29. 196 38
      src/xt_pages/role/components/UserManagement.vue
  30. 65 145
      src/xt_pages/role/role.vue

+ 2 - 2
config/dev.env.js Zobrazit soubor

@@ -6,8 +6,8 @@
6 6
 module.exports = {
7 7
   NODE_ENV: '"development"',
8 8
   ENV_CONFIG: '"dev"',
9
-  BASE_API:  '"http://api.xt.test.sgjyun.com"',// //http://api.xt.test.sgjyun.com http://112.74.16.180:9527,////'"http://localhost:9529"',
10
-  //BASE_API:'"http://localhost:9529"',
9
+  BASE_API:  '"http://new_mobile.xt.api.sgjyun.com"',// //http://api.xt.test.sgjyun.com http://112.74.16.180:9527,////'"http://localhost:9529"',
10
+  // BASE_API:'"http://localhost:9531"',
11 11
   SSO_HOST: '"http://testsso.sgjyun.com"',
12 12
   SRCM_HOST: '"http://test1.sgjyun.com"',
13 13
   XT_HOST: '"http://xt.test.sgjyun.com"',

+ 1 - 1
config/index.js Zobrazit soubor

@@ -20,7 +20,7 @@ module.exports = {
20 20
     // host: 'xt.test.sgjyun.com',
21 21
     // host: 'xt.kuyicloud.com',
22 22
     host: 'xt.test.sgjyun.com',
23
-    //host:'localhost',
23
+    // host:'localhost',
24 24
     port: 9528, // can be overwritten by process.env.PORT, if port is in use, a free one will be determined
25 25
     autoOpenBrowser: true,
26 26
     errorOverlay: true,

+ 1 - 1
config/sit.env.js Zobrazit soubor

@@ -1,7 +1,7 @@
1 1
 module.exports = {
2 2
   NODE_ENV: '"production"',
3 3
   ENV_CONFIG: '"sit"',
4
-  BASE_API: '"http://api.xt.test.sgjyun.com"',
4
+  BASE_API: '"http://new_mobile.xt.api.sgjyun.com"',
5 5
 
6 6
   SSO_HOST: '"https://testsso.sgjyun.com"',
7 7
   SRCM_HOST: '"https://test1.sgjyun.com"',

+ 11 - 30
package-lock.json Zobrazit soubor

@@ -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 Zobrazit soubor

@@ -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({

+ 20 - 0
src/api/config.js Zobrazit soubor

@@ -90,5 +90,25 @@ export function updateSystemPrescription(id,params) {
90 90
 }
91 91
 
92 92
 
93
+export function getOrgs() {
94
+  return request({
95
+    url: '/api/public/orgs',
96
+    method: 'get',
97
+  })
98
+}
99
+
100
+
101
+
102
+export function changeOrg(params) {
103
+  return request({
104
+    url: '/api/org/change',
105
+    method: 'post',
106
+    params:params,
107
+  })
108
+}
109
+
110
+
111
+
112
+
93 113
 
94 114
 

+ 25 - 8
src/api/dialysis.js Zobrazit soubor

@@ -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 Zobrazit soubor

@@ -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 Zobrazit soubor

@@ -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 Zobrazit soubor

@@ -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
+}

+ 86 - 55
src/api/role/role.js Zobrazit soubor

@@ -1,72 +1,103 @@
1 1
 import request from '@/utils/request'
2 2
 
3 3
 export function getRoles(page) {
4
-    const params = {
5
-        page: page,
6
-    }
7
-    return request({
8
-        url: '/api/roles',
9
-        method: 'get',
10
-        params: params,
11
-    })
4
+  const params = {
5
+    page: page
6
+  }
7
+  return request({
8
+    url: '/api/roles',
9
+    method: 'get',
10
+    params: params
11
+  })
12 12
 }
13 13
 
14 14
 export function addRole(name, intro) {
15
-    const params = {
16
-        name: name,
17
-        intro: intro
18
-    }
19
-    return request({
20
-        url: '/api/role/create',
21
-        method: 'post',
22
-        params: params,
23
-    })
15
+  const params = {
16
+    name: name,
17
+    intro: intro
18
+  }
19
+  return request({
20
+    url: '/api/role/create',
21
+    method: 'post',
22
+    params: params
23
+  })
24 24
 }
25 25
 
26 26
 export function modifyRole(role_id, name, intro) {
27
-    const params = {
28
-        role_id: role_id,
29
-        name: name,
30
-        intro: intro
31
-    }
32
-    return request({
33
-        url: '/api/role/modify',
34
-        method: 'post',
35
-        params: params,
36
-    })
27
+  const params = {
28
+    role_id: role_id,
29
+    name: name,
30
+    intro: intro
31
+  }
32
+  return request({
33
+    url: '/api/role/modify',
34
+    method: 'post',
35
+    params: params
36
+  })
37 37
 }
38 38
 
39 39
 export function setRoleStatus(role_id, enable) {
40
-    const params = {
41
-        role_id: role_id,
42
-        enable: enable,
43
-    }
44
-    return request({
45
-        url: '/api/role/setstatus',
46
-        method: 'post',
47
-        params: params,
48
-    })
40
+  const params = {
41
+    role_id: role_id,
42
+    enable: enable
43
+  }
44
+  return request({
45
+    url: '/api/role/setstatus',
46
+    method: 'post',
47
+    params: params
48
+  })
49 49
 }
50 50
 
51 51
 export function getEditPurviewInitData(role_id) {
52
-    const params = {
53
-        role_id: role_id,
54
-    }
55
-    return request({
56
-        url: '/role/purview/editinit',
57
-        method: 'get',
58
-        params: params,
59
-    })
52
+  const params = {
53
+    role_id: role_id
54
+  }
55
+  return request({
56
+    url: '/role/purview/editinit',
57
+    method: 'get',
58
+    params: params
59
+  })
60
+}
61
+
62
+export function editPurview(role_id, purview_ids, func_purview_ids) {
63
+  const params = {
64
+    role_id: role_id,
65
+    purview_ids: purview_ids,
66
+    func_purview_ids: func_purview_ids
67
+  }
68
+  return request({
69
+    url: '/role/purview/edit',
70
+    method: 'post',
71
+    params: params
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
+export function AddUserRole(params) {
90
+  return request({
91
+    url: '/api/role/addStaff',
92
+    method: 'post',
93
+    params: params
94
+  })
95
+}
96
+
97
+export function getRoleStaff() {
98
+  return request({
99
+    url: '/api/role/staff',
100
+    method: 'get'
101
+  })
60 102
 }
61 103
 
62
-export function editPurview(role_id, purview_ids) {
63
-    const params = {
64
-        role_id: role_id,
65
-        purview_ids: purview_ids,
66
-    }
67
-    return request({
68
-        url: '/role/purview/edit',
69
-        method: 'post',
70
-        params: params,
71
-    })
72
-}

+ 8 - 8
src/router/modules/systems.js Zobrazit soubor

@@ -59,14 +59,14 @@ export default {
59 59
     hidden: true,
60 60
     is_menu: false
61 61
   },
62
-  {
63
-    path: '/role/admin/specialpermission',
64
-    component: () => import('@/xt_pages/role/special_permission'),
65
-    name: 'special_permission_manage',
66
-    meta: {
67
-      title: 'special_permission_manage'
68
-    }
69
-  },
62
+  // {
63
+  //   path: '/role/admin/specialpermission',
64
+  //   component: () => import('@/xt_pages/role/special_permission'),
65
+  //   name: 'special_permission_manage',
66
+  //   meta: {
67
+  //     title: 'special_permission_manage'
68
+  //   }
69
+  // },
70 70
   {
71 71
     path: '/data/dictionary',
72 72
     component: () => import('@/xt_pages/data/index'),

+ 75 - 19
src/views/layout/components/Navbar.vue Zobrazit soubor

@@ -53,7 +53,7 @@
53 53
             </el-dropdown-item>
54 54
             <el-dropdown-item divided command="logout">
55 55
               {{$t('navbar.logOut')}}
56
-              
56
+
57 57
             </el-dropdown-item>
58 58
           </el-dropdown-menu>
59 59
         </el-dropdown>
@@ -64,21 +64,13 @@
64 64
       </div>
65 65
     </el-menu>-->
66 66
     <div class="dropdownBox">
67
-      <el-dropdown trigger="click">
67
+      <el-dropdown trigger="click" @command="handleOrgCommand">
68 68
         <span class="el-dropdown-link">
69
-          {{ this.$store.getters.xt_user.org.org_name }}
69
+          {{ org_name }}
70 70
           <i class="el-icon-arrow-down el-icon--right"></i>
71 71
         </span>
72 72
         <el-dropdown-menu slot="dropdown">
73
-          <el-dropdown-item icon="el-icon-plus">黄金糕</el-dropdown-item>
74
-          <el-dropdown-item icon="el-icon-circle-plus">狮子头</el-dropdown-item>
75
-          <el-dropdown-item icon="el-icon-circle-plus-outline"
76
-            >螺蛳粉</el-dropdown-item
77
-          >
78
-          <el-dropdown-item icon="el-icon-check">双皮奶</el-dropdown-item>
79
-          <el-dropdown-item icon="el-icon-circle-check"
80
-            >蚵仔煎</el-dropdown-item
81
-          >
73
+          <el-dropdown-item   icon="el-icon-plus" v-for="(item,index) in orgs" :key="index"  :command="item.id">{{item.org_name}}</el-dropdown-item>
82 74
         </el-dropdown-menu>
83 75
       </el-dropdown>
84 76
     </div>
@@ -133,16 +125,26 @@ import { mapGetters } from "vuex";
133 125
 import Screenfull from "@/components/Screenfull";
134 126
 import ModifyUserInfoDialog from "@/xt_pages/home/modify_user_info_dialog";
135 127
 import ModifyOrgInfoDialog from "@/xt_pages/home/modifyOrgInfoDialog";
136
-
128
+import { getFiledConfigList, setFiledConfigList } from '@/utils/data_config' // getConfigList from sessionStorage
129
+import {
130
+  getAdminUserInfoCache,
131
+  cacheAdminUserInfo,
132
+  removeAdminUserInfoCache
133
+} from '@/utils/admin_info_cache'
134
+import {
135
+  getOrgs,changeOrg
136
+} from '@/api/config'
137 137
 export default {
138 138
   data() {
139 139
     return {
140
+      orgs:[],
141
+      org_id:this.$store.getters.xt_user.org.id,
142
+      org_name:this.$store.getters.xt_user.org.org_name,
143
+
140 144
       // scrm_role_exist: $store.getters.xt_user.scrm_role_exist
141 145
     };
142 146
   },
143 147
   components: {
144
-    // Breadcrumb,
145
-    // Hamburger,
146 148
     Screenfull,
147 149
     ModifyUserInfoDialog,
148 150
     ModifyOrgInfoDialog
@@ -157,9 +159,47 @@ export default {
157 159
     }
158 160
   },
159 161
   methods: {
160
-    // toggleSideBar() {
161
-    //   this.$store.dispatch("toggleSideBar");
162
-    // },
162
+    handleOrgCommand(org_id){
163
+      let params = {
164
+        org_id: org_id
165
+      }
166
+      changeOrg(params).then(response => {
167
+        if (response.data.state === 1) {
168
+          window.location.reload()
169
+
170
+          this.$message.success('切换成功')
171
+          let data = response.data.data
172
+          this.org_id = data.org.id
173
+          this.org_name = data.org.org_name
174
+
175
+          this.commit('SET_CURRENT_INFO', {
176
+            user: data.user,
177
+            cur_org_id: data.current_org_id,
178
+            cur_app_id: data.current_app_id,
179
+            org: data.org,
180
+            subscibe: data.subscibe,
181
+            template_info:data.template_info,
182
+          })
183
+
184
+          this.commit('SET_URLFORS', {
185
+            urlfors: data.urlfors
186
+          })
187
+
188
+          this.commit('SET_FILEDS', {
189
+            fileds: data.fileds
190
+          })
191
+          setFiledConfigList(JSON.stringify(data.fileds))
192
+          cacheAdminUserInfo(JSON.stringify(data))
193
+
194
+
195
+        }else{
196
+          this.$message.success(response.data.msg)
197
+        }
198
+      }).catch(e => {
199
+        // this.$message.success("网络异常")
200
+      });
201
+    },
202
+
163 203
     handleCommand(command) {
164 204
       switch (command) {
165 205
         case "modifyUserInfoAction":
@@ -206,7 +246,23 @@ export default {
206 246
       );
207 247
     }
208 248
   },
209
-  created() {}
249
+  created() {
250
+    this.org_id = 12
251
+
252
+    getOrgs().then(response => {
253
+      if (response.data.state === 1) {
254
+          this.orgs = response.data.data.orgs;
255
+          for (let i =0; i < this.orgs.length; i++){
256
+            if (this.orgs[i].id == this.org_id){
257
+              this.org_name = this.orgs[i].org_name
258
+            }
259
+          }
260
+      }
261
+    });
262
+
263
+
264
+
265
+  }
210 266
 };
211 267
 </script>
212 268
 

+ 7 - 0
src/xt_pages/dialysis/details/dialog/AssessmentAfterDislysis.vue Zobrazit soubor

@@ -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 Zobrazit soubor

@@ -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 Zobrazit soubor

@@ -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 Zobrazit soubor

@@ -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 Zobrazit soubor

@@ -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 Zobrazit soubor

@@ -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 Zobrazit soubor

@@ -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 Zobrazit soubor

@@ -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 Zobrazit soubor

@@ -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 Zobrazit soubor

@@ -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);

+ 252 - 0
src/xt_pages/role/components/AddRole.vue Zobrazit soubor

@@ -0,0 +1,252 @@
1
+<template>
2
+  <el-dialog
3
+    title="新增用户"
4
+    width="660px"
5
+    :visible.sync="visible"
6
+    :before-close="_close"
7
+  >
8
+    <el-form :model="form" :rules="rules" ref="form" label-width="90px">
9
+      <el-form-item label="角色名称 : " prop="name">
10
+        <el-input v-model="form.name" placeholder="" maxlength="30"></el-input>
11
+      </el-form-item>
12
+      <el-form-item label="角色描述 : " >
13
+        <el-input type="textarea" v-model="form.intro" placeholder="" resize="none" rows="4"></el-input>
14
+      </el-form-item>
15
+    </el-form>
16
+    <div slot="footer" class="dialog-footer">
17
+      <el-button @click="hide">取 消</el-button>
18
+      <el-button type="primary" @click="submitAction()">保 存</el-button>
19
+    </div>
20
+  </el-dialog>
21
+</template>
22
+
23
+<script>
24
+  import { addRole, modifyRole } from '@/api/role/role'
25
+
26
+  export default {
27
+    name: 'AddRole',
28
+    data() {
29
+      return {
30
+        form: {
31
+          id: 0,
32
+          name: '',
33
+          intro: ''
34
+        },
35
+        visible: false,
36
+        rules: {
37
+          name: [
38
+            { required: true, message: '请输入角色名称', trigger: 'blur' },
39
+            { max: 10, message: '10个字以内', trigger: 'blur' }
40
+          ],
41
+          // intro: [{ required: true, message: '请输入角色说明', trigger: 'blur' }]
42
+        },
43
+
44
+        //
45
+        checked: '1',
46
+        checkAll: false,
47
+        checkedCities: [],
48
+        cities: ['上海', '北京', '广州', '深圳'],
49
+        isIndeterminate: true,
50
+        ruleForm: {
51
+          name: '',
52
+          phone: '',
53
+          position: ''
54
+        },
55
+        newrules: {
56
+          name: [
57
+            { required: true, message: '请输入角色名称', trigger: 'blur' },
58
+            { max: 10, message: '10个字以内', trigger: 'blur' }
59
+          ],
60
+          phone: [{ required: true, message: '请输入手机号', trigger: 'blur' }]
61
+        }
62
+      }
63
+    },
64
+    methods: {
65
+      _close: function(done) {
66
+        this.clear()
67
+        done()
68
+      },
69
+      clear: function() {
70
+        this.form.id = 0
71
+        this.form.name = ''
72
+        this.form.intro = ''
73
+      },
74
+      show() {
75
+        this.clear()
76
+        this.visible = true
77
+      },
78
+      hide() {
79
+        this.clear()
80
+        this.visible = false
81
+      },
82
+      modify(id, name, intro) {
83
+        this.form.id = id
84
+        this.form.name = name
85
+        this.form.intro = intro
86
+        this.visible = true
87
+      },
88
+      submitAction() {
89
+        this.$refs.form.validate(valid => {
90
+          if (valid) {
91
+            // 验证通过
92
+            if (this.form.id === 0) {
93
+              // 新增 role
94
+              addRole(this.form.name, this.form.intro)
95
+                .then(rs => {
96
+                  var resp = rs.data
97
+                  if (resp.state === 1) {
98
+                    var new_id = resp.data.id
99
+                    var new_name = resp.data.name
100
+                    var new_intro = resp.data.intro
101
+                    var new_status = resp.data.status
102
+                    var staff_number = 0
103
+                    this.$emit(
104
+                      'did-add-role',
105
+                      new_id,
106
+                      new_name,
107
+                      new_intro,
108
+                      new_status,
109
+                      staff_number
110
+                    )
111
+
112
+                    this.hide()
113
+                  } else {
114
+                    this.$message.error(resp.msg)
115
+                  }
116
+                })
117
+                .catch(err => {
118
+                  this.$message.error(err)
119
+                })
120
+            } else {
121
+              // 修改 role
122
+              modifyRole(this.form.id, this.form.name, this.form.intro)
123
+                .then(rs => {
124
+                  var resp = rs.data
125
+                  if (resp.state === 1) {
126
+                    this.$emit(
127
+                      'did-edit-role',
128
+                      this.form.id,
129
+                      this.form.name,
130
+                      this.form.intro
131
+                    )
132
+                    this.hide()
133
+                  } else {
134
+                    this.$message.error(resp.msg)
135
+                  }
136
+                })
137
+                .catch(err => {
138
+                  this.$message.error(err)
139
+                })
140
+            }
141
+          } else {
142
+            // 验证失败
143
+            return false
144
+          }
145
+        })
146
+      },
147
+      handleCheckAllChange(val) {
148
+        this.checkedCities = val ? this.cities : []
149
+        this.isIndeterminate = false
150
+      },
151
+      handleCheckedCitiesChange(value) {
152
+        let checkedCount = value.length
153
+        this.checkAll = checkedCount === this.cities.length
154
+        this.isIndeterminate =
155
+          checkedCount > 0 && checkedCount < this.cities.length
156
+      }
157
+    }
158
+  }
159
+</script>
160
+
161
+<style lang="scss" scoped>
162
+  .roleContent {
163
+    margin-top: 20px;
164
+    display: flex;
165
+    justify-content: space-between;
166
+
167
+  .roleContentLeft {
168
+
169
+  .chooseBox {
170
+    width: 280px;
171
+    height: 320px;
172
+    overflow-y: auto;
173
+    border: 1px solid rgba(235, 238, 240, 1);
174
+    margin-top: 26px;
175
+    padding: 20px;
176
+
177
+  .checkone {
178
+    display: flex;
179
+    align-items: center;
180
+    height: 50px;
181
+  }
182
+
183
+  .el-checkbox__label {
184
+    display: flex;
185
+    align-items: center;
186
+
187
+  img {
188
+    width: 30px;
189
+    height: 30px;
190
+    margin-right: 10px;
191
+  }
192
+
193
+  }
194
+  }
195
+  }
196
+  .roleContentRight {
197
+
198
+  .chooseBox {
199
+    width: 280px;
200
+    height: 320px;
201
+    overflow-y: auto;
202
+    border: 1px solid rgba(235, 238, 240, 1);
203
+    margin-top: 26px;
204
+    padding: 20px;
205
+
206
+  .hasChoosedOne {
207
+    display: flex;
208
+    align-items: center;
209
+    height: 50px;
210
+
211
+  img {
212
+    width: 30px;
213
+    height: 30px;
214
+    margin-right: 10px;
215
+  }
216
+
217
+  }
218
+  }
219
+  }
220
+  }
221
+  .newStaff {
222
+    margin-top: 26px;
223
+
224
+  .newItem {
225
+    display: flex;
226
+    align-items: center;
227
+  }
228
+
229
+  }
230
+</style>
231
+
232
+<style lang="scss">
233
+  .roleContent {
234
+
235
+  .roleContentLeft {
236
+
237
+  .chooseBox {
238
+
239
+  .el-checkbox {
240
+    display: flex;
241
+    align-items: center;
242
+  }
243
+
244
+  .el-checkbox__label {
245
+    display: flex;
246
+    align-items: center;
247
+  }
248
+
249
+  }
250
+  }
251
+  }
252
+</style>

+ 280 - 215
src/xt_pages/role/components/AdminInfoForm.vue Zobrazit soubor

@@ -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,286 @@
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();
87
-      }
88
-    };
89
-    var checkName = (rule, value, callback) => {
90
-      if (!value || value.length == 0) {
91
-        return callback(new Error("姓名不能为空"));
92
-      } else {
93
-        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
+        }
94 74
       }
95
-    };
96
-    return {
97
-      checkList: [],
98
-      admin_id: 0,
99
-      dialogFormVisible: false,
100
-
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" }]
75
+      var checkName = (rule, value, callback) => {
76
+        if (!value || value.length == 0) {
77
+          return callback(new Error('姓名不能为空'))
78
+        } else {
79
+          callback()
80
+        }
137 81
       }
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;
82
+      return {
83
+        admin_id: 0,
84
+        dialogFormVisible: false,
85
+
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
+        this.form.id = this.admin_id
142
+        if (this.admin_id === 0) {
143
+          let tempForm = {
144
+            role_ids: [],
145
+            user_title_name: '',
146
+            id: 0,
147
+            mobile: '',
148
+            name: '',
149
+            user_type: '',
150
+            user_title: '',
151
+            role: '', // 其实应该是 int 类型
152
+            intro: ''
153
+          }
154
+          this.form = tempForm
155
+          this.formTitle = '新增员工'
156
+          this.form.user_type = this.user_types[0].index
157
+          this.form.user_title = this.user_titles[0].index
158
+          getAddAdminInitData()
159
+            .then(rs => {
160
+              this.loading = false
161
+              var resp = rs.data
162
+              if (resp.state === 1) {
163
+                // this.roles.push(...resp.data.roles)
164
+                this.roles = resp.data.roles
165
+                this.qntoken = resp.data.qntoken
148 166
 
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);
167
+                this.isSubSuperAdmin = resp.data.isSubSuperAdmin
168
+                this.org = resp.data.org
169
+
170
+                //如果当前用户是子管理员则,则需要将子管理员角色去除,因为子管理员不能添加子管理员
171
+                if(this.isSubSuperAdmin){
172
+                  for (let i =0 ; i < this.roles.length; i++){
173
+                    if(this.roles[i].is_system == 1 && this.roles[i].role_name == "子管理员"){
174
+                      this.roles.splice(i, 1)
175
+                      i--
176
+                    }
177
+                  }
178
+                }
179
+
180
+
181
+
182
+
183
+
184
+
185
+
186
+                // if (this.roles.length > 0) {
187
+                //   this.form.role = this.roles[0].id;
188
+                //   console.log("国庆快乐",this.form.role)
189
+                // }
190
+              } else {
191
+                this.$message.error(resp.msg)
192
+              }
193
+            })
194
+            .catch(err => {
195
+              this.loading = false
196
+              this.$message.error(err)
197
+            })
198
+        } else {
199
+          this.formTitle = '编辑用户'
200
+          getModifyAdminInitData(this.form.id)
201
+            .then(rs => {
202
+              this.loading = false
203
+              var resp = rs.data
204
+              if (resp.state === 1) {
205
+                this.roles = []
206
+                this.roles.push(...resp.data.roles)
207
+                this.qntoken = resp.data.qntoken
208
+                var org = resp.data.org
209
+
210
+
211
+                var admin = resp.data.admin
212
+                this.form.name = admin.user_name
213
+                this.form.mobile = admin.admin.mobile
214
+                this.form.user_type = admin.user_type
215
+                if(admin.user_type == 1){
216
+
217
+                  this.form.user_type = ""
218
+                }
219
+                this.form.user_title = admin.user_title
220
+                this.form.role = admin.role_ids
221
+                this.form.role_ids = []
222
+                for (let i = 0; i < this.form.role.split(",").length; i++) {
223
+                  if (this.form.role.split(',')[i].length > 0) {
224
+                    this.form.role_ids.push(parseInt(this.form.role.split(',')[i]))
225
+                  }
226
+                }
227
+
228
+                this.form.intro = admin.intro
229
+                this.form.user_title_name = admin.user_title_name
230
+
231
+
232
+
233
+                //如果当前用户是超级管理员而且编辑自己的信息
234
+                if(this.isSubSuperAdmin || this.admin_id == org.creator){
235
+                  for (let i =0 ; i < this.roles.length; i++){
236
+                    if(this.roles[i].is_system == 1 && this.roles[i].role_name == "子管理员"){
237
+                      this.roles.splice(i, 1)
238
+                      i--
239
+                    }
240
+                  }
241
+                }
242
+
243
+
244
+
245
+
246
+              } else {
247
+                this.$message.error('该用户不存在')
248
+              }
249
+            })
250
+            .catch(err => {
251
+              this.loading = false
252
+              this.$message.error('该用户不存在')
253
+            })
254
+        }
255
+
256
+        this.dialogFormVisible = true
257
+      },
258
+      submitAction: function() {
259
+        if (this.admin_id < 0) {
260
+          return
261
+        }
262
+        this.$refs.form.validate(valid => {
263
+          if (valid) {
264
+            if(this.form.user_type == "" || this.form.user_type == 0 ){
265
+              this.$message.error("职称不能为空")
266
+              return
168 267
             }
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;
183
-
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;
268
+
269
+            this.loading = true
270
+            if (this.form.id === 0) {
271
+              this.form.role = this.form.role_ids.join(',')
272
+              addAdmin(
273
+                this.form.mobile,
274
+                this.form.name,
275
+                this.form.user_type,
276
+                this.form.user_title,
277
+                this.form.role,
278
+                this.form.intro,
279
+                this.form.user_title_name
280
+              )
281
+                .then(rs => {
282
+                  this.loading = false
283
+                  var resp = rs.data
284
+                  if (resp.state === 1) {
285
+                    this.$store.dispatch('DidChangeAdmins')
286
+                    var _this = this
287
+                    setTimeout(() => {
288
+                      _this.$store.dispatch('RecoverAdminsChangeState')
289
+                    }, 500)
290
+                    this.dialogFormVisible = false
291
+                  } else {
292
+                    this.$message.error(resp.msg)
293
+                  }
294
+                })
295
+                .catch(err => {
296
+                  this.loading = false
297
+                  this.$message.error(err)
298
+                })
191 299
             } else {
192
-              this.$message.error("该用户不存在");
193
-            }
194
-          })
195
-          .catch(err => {
196
-            this.loading = false;
197
-            this.$message.error("该用户不存在");
198
-          });
199
-      }
300
+              this.form.role = this.form.role_ids.join(',')
200 301
 
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);
231
-                }
232
-              })
233
-              .catch(err => {
234
-                this.loading = false;
235
-                this.$message.error(err);
236
-              });
302
+              modifyAdmin(
303
+                this.form.id,
304
+                this.form.name,
305
+                this.form.user_type,
306
+                this.form.user_title,
307
+                this.form.role,
308
+                this.form.intro,
309
+                this.form.user_title_name
310
+              )
311
+                .then(rs => {
312
+                  this.loading = false
313
+                  var resp = rs.data
314
+                  if (resp.state === 1) {
315
+                    this.$store.dispatch('DidChangeAdmins')
316
+                    var _this = this
317
+                    setTimeout(() => {
318
+                      _this.$store.dispatch('RecoverAdminsChangeState')
319
+                    }, 500)
320
+
321
+                    this.dialogFormVisible = false
322
+                  } else {
323
+                    this.$message.error(resp.msg)
324
+                  }
325
+                })
326
+                .catch(err => {
327
+                  this.loading = false
328
+                  this.$message.error(err)
329
+                })
330
+            }
237 331
           } 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
-
256
-                  this.dialogFormVisible = false;
257
-                } else {
258
-                  this.$message.error(resp.msg);
259
-                }
260
-              })
261
-              .catch(err => {
262
-                this.loading = false;
263
-                this.$message.error(err);
264
-              });
332
+            return false
265 333
           }
266
-        } else {
267
-          return false;
268
-        }
269
-      });
334
+        })
335
+      }
270 336
     }
271 337
   }
272
-};
273 338
 </script>

+ 257 - 0
src/xt_pages/role/components/AdminRoleInfoForm.vue Zobrazit soubor

@@ -0,0 +1,257 @@
1
+<template>
2
+  <el-dialog :title="formTitle" :visible.sync="dialogFormVisible">
3
+    <el-form :model="form" ref="form" :rules="rules" label-width="60px">
4
+      <el-form-item label="账号 : " prop="mobile">
5
+        <el-input v-model="form.mobile" placeholder="用户手机号" maxlength="11"
6
+                  :disabled="form.id !==  0"></el-input>
7
+      </el-form-item>
8
+
9
+      <el-form-item label="姓名 : " prop="name">
10
+        <el-input v-model="form.name" placeholder="用户姓名"></el-input>
11
+      </el-form-item>
12
+
13
+      <el-form-item label="职称 : ">
14
+        <el-select v-model="form.user_type" placeholder="用户类型">
15
+          <el-option
16
+            v-for="item in user_types"
17
+            :label="item.name"
18
+            :value="item.index"
19
+            :key="item.index"
20
+          ></el-option>
21
+        </el-select>
22
+
23
+        <el-select v-model="form.user_title" placeholder="用户职称">
24
+          <el-option
25
+            v-for="item in user_titles"
26
+            :label="item.name"
27
+            :value="item.index"
28
+            :key="item.index"
29
+          ></el-option>
30
+        </el-select>
31
+      </el-form-item>
32
+
33
+      <el-form-item label="职位 : ">
34
+        <el-input v-model="form.user_title_name" placeholder="输入职位"></el-input>
35
+      </el-form-item>
36
+
37
+      <el-form-item label="介绍 : ">
38
+        <Tinymce :height="400" menubar ref="editor" v-model="form.intro" :show_upload_img="false"/>
39
+      </el-form-item>
40
+    </el-form>
41
+    <div slot="footer" class="dialog-footer">
42
+      <el-button @click="dialogFormVisible = false">取 消</el-button>
43
+      <el-button type="primary" @click="submitAction">保 存</el-button>
44
+    </div>
45
+  </el-dialog>
46
+</template>
47
+
48
+<script>
49
+  import Tinymce from '@/components/Tinymce'
50
+  import { addAdmin, getAddAdminInitData, getModifyAdminInitData, modifyAdmin } from '@/api/role/admin'
51
+
52
+  export default {
53
+    name: 'AdminRoleInfoForm',
54
+    components: {
55
+      Tinymce
56
+    },
57
+    data() {
58
+      var checkMobile = (rule, value, callback) => {
59
+        if (!value || value.length == 0) {
60
+          return callback(new Error('手机号不能为空'))
61
+        }
62
+        if (/^1\d{10}$/.test(value) == false) {
63
+          return callback(new Error('手机号格式错误'))
64
+        } else {
65
+          callback()
66
+        }
67
+      }
68
+      var checkName = (rule, value, callback) => {
69
+        if (!value || value.length == 0) {
70
+          return callback(new Error('姓名不能为空'))
71
+        } else {
72
+          callback()
73
+        }
74
+      }
75
+      return {
76
+        admin_id: 0,
77
+        dialogFormVisible: false,
78
+
79
+        user_types: [
80
+          { index: 2, name: '医生' },
81
+          { index: 3, name: '护士' }
82
+        ],
83
+        user_titles: [
84
+          { index: 1, name: '医士' },
85
+          { index: 2, name: '医师' },
86
+          { index: 3, name: '住院医师' },
87
+          { index: 4, name: '主治医师' },
88
+          { index: 5, name: '副主任医师' },
89
+          { index: 6, name: '主任医师' },
90
+          { index: 7, name: '护士' },
91
+          { index: 8, name: '护师' },
92
+          { index: 9, name: '主管护师' },
93
+          { index: 10, name: '副主任护师' },
94
+          { index: 11, name: '主任护师' },
95
+          { index: 12, name: '运营专员' },
96
+          { index: 13, name: '运营主管' }
97
+        ],
98
+        roles: [], // [{id, name, intro, status}]
99
+        loading: true,
100
+        qntoken: '',
101
+        formTitle: '',
102
+        isSubSuperAdmin: false,
103
+        org: null,
104
+        form: {
105
+          role_ids: [],
106
+          user_title_name: '',
107
+          id: 0,
108
+          mobile: '',
109
+          name: '',
110
+          user_type: '',
111
+          user_title: '',
112
+          role: '', // 其实应该是 int 类型
113
+          intro: ''
114
+        },
115
+        rules: {
116
+          mobile: [{ required: true, validator: checkMobile, trigger: 'blur' }],
117
+          name: [{ required: true, validator: checkName, trigger: 'blur' }]
118
+
119
+        }
120
+      }
121
+    },
122
+    methods: {
123
+      open: function(adminId,role_id) {
124
+        this.admin_id = adminId
125
+        this.roles.push(role_id)
126
+        if (this.admin_id < 0) {
127
+          this.$message.error('参数错误')
128
+          this.loading = false
129
+          return
130
+        }
131
+        let local_user_id = this.$store.getters.xt_user.user.id
132
+        local_user_id = 597
133
+        this.form.id = this.admin_id
134
+        this.formTitle = '编辑用户'
135
+        getModifyAdminInitData(this.form.id)
136
+          .then(rs => {
137
+            this.loading = false
138
+            var resp = rs.data
139
+            if (resp.state === 1) {
140
+              this.roles = []
141
+              this.roles.push(...resp.data.roles)
142
+              this.qntoken = resp.data.qntoken
143
+              var admin = resp.data.admin
144
+              this.form.name = admin.user_name
145
+              this.form.mobile = admin.admin.mobile
146
+              this.form.user_type = admin.user_type
147
+              this.form.user_title = admin.user_title
148
+              this.form.role = admin.role_ids
149
+              this.form.role_ids = []
150
+              for (let i = 0; i < this.form.role.split(",").length; i++) {
151
+                if (this.form.role.split(',')[i].length > 0) {
152
+                  this.form.role_ids.push(parseInt(this.form.role.split(',')[i]))
153
+                }
154
+              }
155
+
156
+              this.form.intro = admin.intro
157
+              this.form.user_title_name = admin.user_title_name
158
+
159
+              //如果当前用户是超级管理员而且编辑自己的信息
160
+              if (!this.isSubSuperAdmin && local_user_id == this.form.id) {
161
+                for (let i = 0; i < this.roles.length; i++) {
162
+                  if (this.roles[i].is_system == 1 && this.roles[i].role_name != '子管理员') {
163
+                    this.roles.splice(i, 1)
164
+                    i--
165
+                  }
166
+                }
167
+              }
168
+
169
+            } else {
170
+              this.$message.error('该用户不存在')
171
+            }
172
+          })
173
+          .catch(err => {
174
+            this.loading = false
175
+            this.$message.error('该用户不存在')
176
+          })
177
+
178
+        this.dialogFormVisible = true
179
+      },
180
+      submitAction: function() {
181
+        if (this.admin_id < 0) {
182
+          return
183
+        }
184
+        this.$refs.form.validate(valid => {
185
+          if (valid) {
186
+            this.loading = true
187
+            if (this.form.id === 0) {
188
+              this.form.role = this.form.role_ids.join(',')
189
+              addAdmin(
190
+                this.form.mobile,
191
+                this.form.name,
192
+                this.form.user_type,
193
+                this.form.user_title,
194
+                this.form.role,
195
+                this.form.intro,
196
+                this.form.user_title_name
197
+              )
198
+                .then(rs => {
199
+                  this.loading = false
200
+                  var resp = rs.data
201
+                  if (resp.state === 1) {
202
+                    this.$store.dispatch('DidChangeAdmins')
203
+                    var _this = this
204
+                    setTimeout(() => {
205
+                      _this.$store.dispatch('RecoverAdminsChangeState')
206
+                    }, 500)
207
+
208
+                    this.$emit('did-edit-admin')
209
+
210
+                  } else {
211
+                    this.$message.error(resp.msg)
212
+                  }
213
+                })
214
+                .catch(err => {
215
+                  this.loading = false
216
+                  this.$message.error(err)
217
+                })
218
+            } else {
219
+              this.form.role = this.form.role_ids.join(',')
220
+
221
+              modifyAdmin(
222
+                this.form.id,
223
+                this.form.name,
224
+                this.form.user_type,
225
+                this.form.user_title,
226
+                this.form.role,
227
+                this.form.intro,
228
+                this.form.user_title_name
229
+              )
230
+                .then(rs => {
231
+                  this.loading = false
232
+                  var resp = rs.data
233
+                  if (resp.state === 1) {
234
+                   console.log("11111111")
235
+                    this.$emit('did-edit-admin')
236
+
237
+                  } else {
238
+                    this.$message.error(resp.msg)
239
+                  }
240
+                })
241
+                .catch(err => {
242
+                  this.loading = false
243
+                  this.$message.error(err)
244
+                })
245
+            }
246
+          } else {
247
+            return false
248
+          }
249
+        })
250
+      },
251
+      close:function() {
252
+        this.dialogFormVisible= false
253
+
254
+      }
255
+    }
256
+  }
257
+</script>

+ 491 - 204
src/xt_pages/role/components/EditRole.vue Zobrazit soubor

@@ -18,7 +18,7 @@
18 18
       <el-radio v-model="checked" label="1">从已有员工中选择</el-radio>
19 19
       <el-radio v-model="checked" label="2">新增员工</el-radio>
20 20
     </div>
21
-    <div v-if="checked == '1'" class="roleContent">
21
+    <div v-if="checked == '1'"   v-loading="loading" class="roleContent">
22 22
       <div class="roleContentLeft">
23 23
         <p style="color:#303133">选择:</p>
24 24
         <div class="chooseBox">
@@ -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>
47
-      <div class="roleContentRight">
51
+
52
+      <div class="roleContentRight" v-loading="loading">
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,224 +110,480 @@
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">
86 117
       <el-button @click="hide">取 消</el-button>
87
-      <el-button type="primary" @click="submitAction()">保 存</el-button>
118
+      <el-button type="primary" :loading="submitLoading" @click="submitAction()">保 存</el-button>
88 119
     </div>
89 120
   </el-dialog>
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
+        submitLoading:false,
150
+        loading:true,
151
+        form: {
152
+          id: 0,
153
+          name: '',
154
+          intro: ''
155
+        },
156
+        role_id: 0,
157
+        visible: false,
158
+        rules: {
159
+          phone: [{ required: true, validator: checkMobile, trigger: 'blur' }],
160
+          name: [{ required: true, validator: checkName, trigger: 'blur' }],
161
+          intro: [{ required: true, message: '请输入角色说明', trigger: 'blur' }]
162
+        },
163
+        admin_user: [],
164
+        is_check_admin_user: [],
165
+        user_types: [
166
+          { index: 2, name: '医生' },
167
+          { index: 3, name: '护士' }
128 168
         ],
129
-        phone: [{ required: true, message: "请输入手机号", trigger: "blur" }]
169
+        user_titles: [
170
+          { index: 1, name: '医士' },
171
+          { index: 2, name: '医师' },
172
+          { index: 3, name: '住院医师' },
173
+          { index: 4, name: '主治医师' },
174
+          { index: 5, name: '副主任医师' },
175
+          { index: 6, name: '主任医师' },
176
+          { index: 7, name: '护士' },
177
+          { index: 8, name: '护师' },
178
+          { index: 9, name: '主管护师' },
179
+          { index: 10, name: '副主任护师' },
180
+          { index: 11, name: '主任护师' },
181
+          { index: 12, name: '运营专员' },
182
+          { index: 13, name: '运营主管' }
183
+        ],
184
+        //
185
+        checked: '1',
186
+        checkAll: false,
187
+        checkedCities: [],
188
+        isIndeterminate: true,
189
+        ruleForm: {
190
+          name: '',
191
+          phone: '',
192
+          position: '',
193
+          user_type: 2,
194
+          user_title: 1,
195
+          role: ''
196
+        },
197
+        newrules: {
198
+          phone: [{ required: true, validator: checkMobile, trigger: 'blur' }],
199
+
200
+          name: [
201
+            { required: true, message: '请输入用户名字', trigger: 'blur' },
202
+            { max: 10, message: '10个字以内', trigger: 'blur' }
203
+          ]
204
+        }
130 205
       }
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
-    },
147
-    hide() {
148
-      this.clear();
149
-      this.visible = false;
150 206
     },
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
-              });
207
+    methods: {
208
+      continueAddStaff(){
209
+        this.$refs.form.validate(valid => {
210
+          if (valid) {
211
+            if (this.form.id === 0) {
212
+              this.ruleForm.role = this.role_id
213
+              addAdmin(
214
+                this.ruleForm.phone,
215
+                this.ruleForm.name,
216
+                this.ruleForm.user_type,
217
+                this.ruleForm.user_title,
218
+                this.ruleForm.role,
219
+                '',
220
+                this.ruleForm.position
221
+              )
222
+                .then(rs => {
223
+                  var resp = rs.data
224
+                  if (resp.state === 1) {
225
+                    this.$store.dispatch('DidChangeAdmins')
226
+                    var _this = this
227
+                    setTimeout(() => {
228
+                      _this.$store.dispatch('RecoverAdminsChangeState')
229
+                    }, 500)
230
+                    this.$emit('did-edit-role')
231
+                    this.ruleForm.phone = ''
232
+
233
+                    this.ruleForm.name = ''
234
+                    this.ruleForm.user_type = 2
235
+                    this.ruleForm.user_title = 1
236
+                    this.ruleForm.role = ''
237
+                    this.ruleForm.position = ''
238
+                  } else {
239
+                    this.$message.error(resp.msg)
240
+                  }
241
+                })
242
+                .catch(err => {
243
+                  this.loading = false
244
+                  this.$message.error(err)
245
+                })
246
+            }
187 247
           } 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);
248
+            return false
249
+          }
250
+        })
251
+
252
+
253
+
254
+      },
255
+      change(val) {
256
+
257
+        if (this.checkedCities.length == this.admin_user.length) {
258
+
259
+          this.checkAll = true
260
+        } else {
261
+          this.checkAll = false
262
+
263
+        }
264
+
265
+      }
266
+
267
+      ,
268
+      GetAllStaff: function() {
269
+        getStaffsList()
270
+          .then(rs => {
271
+            var resp = rs.data
272
+            if (resp.state === 1) {
273
+              this.admin_user = resp.data.admins
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
+                    i = i - 1
283
+                  }
284
+                }
285
+              }
286
+              for (let i = 0; i < this.admin_user.length; i++) {
287
+                if (this.admin_user[i].user_id == resp.data.org.creator) {
288
+
289
+                  this.admin_user.splice(i, 1)
290
+                  i = i - 1
202 291
                 }
203
-              })
204
-              .catch(err => {
205
-                this.$message.error(err);
206
-              });
292
+              }
293
+              this.loading = false
294
+
295
+            } else {
296
+              this.$message.error(resp.msg)
297
+              this.loading = false
298
+
299
+            }
300
+          })
301
+          .catch(err => {
302
+            this.$message.error(err)
303
+          })
304
+
305
+      },
306
+      _close: function(done) {
307
+        this.clear()
308
+        done()
309
+      },
310
+      clear: function() {
311
+        this.form.id = 0
312
+        this.form.name = ''
313
+        this.form.intro = ''
314
+      },
315
+      show(role_id) {
316
+        this.clear()
317
+        this.loading = true
318
+        this.checked = '1'
319
+        this.visible = true
320
+        this.role_id = role_id
321
+        this.admin_user = []
322
+        this.is_check_admin_user = []
323
+        this.checkedCities = []
324
+        this.GetAllStaff()
325
+      },
326
+      hide() {
327
+        this.clear()
328
+        this.visible = false
329
+      },
330
+      modify(id, name, intro) {
331
+        this.form.id = id
332
+        this.form.name = name
333
+        this.form.intro = intro
334
+        this.visible = true
335
+      },
336
+      submitAction() {
337
+        if (this.checked == '1') {
338
+          if (this.checkedCities.length == 0) {
339
+            this.$message.error('至少选择一个用户')
340
+            return
341
+          }
342
+          let params = {
343
+            id: this.role_id,
344
+            ids: this.checkedCities.join(',')
345
+          }
346
+          this.submitLoading = true
347
+
348
+          AddUserRole(params).then(response => {
349
+            if (response.data.state === 1) {
350
+              this.$message.success('添加成功')
351
+              this.$emit('did-edit-role')
352
+              this.hide()
353
+              this.submitLoading = false
354
+
355
+            } else {
356
+              this.submitLoading = false
357
+
358
+              this.$message.error(response.data.msg)
359
+
360
+            }
361
+          }).catch(e => {
362
+            this.submitLoading = false
363
+
364
+
365
+          });
366
+        } else {
367
+          this.$refs.form.validate(valid => {
368
+            if (valid) {
369
+              this.submitLoading = true
370
+              if (this.form.id === 0) {
371
+                this.ruleForm.role = this.role_id
372
+                addAdmin(
373
+                  this.ruleForm.phone,
374
+                  this.ruleForm.name,
375
+                  this.ruleForm.user_type,
376
+                  this.ruleForm.user_title,
377
+                  this.ruleForm.role,
378
+                  '',
379
+                  this.ruleForm.position
380
+                )
381
+                  .then(rs => {
382
+                    this.submitLoading = false
383
+
384
+                    var resp = rs.data
385
+                    if (resp.state === 1) {
386
+
387
+                      this.$store.dispatch('DidChangeAdmins')
388
+                      var _this = this
389
+                      setTimeout(() => {
390
+                        _this.$store.dispatch('RecoverAdminsChangeState')
391
+                      }, 500)
392
+                      this.$emit('did-edit-role')
393
+                      this.hide()
394
+
395
+                      this.ruleForm.phone = ''
396
+                      this.ruleForm.name = ''
397
+                      this.ruleForm.user_type = 2
398
+                      this.ruleForm.user_title = 1
399
+                      this.ruleForm.role = ''
400
+                      this.ruleForm.position = ''
401
+                    } else {
402
+                      this.$message.error(resp.msg)
403
+                    }
404
+                  })
405
+                  .catch(err => {
406
+                    this.submitLoading = false
407
+
408
+                    this.loading = false
409
+                    this.$message.error(err)
410
+                  })
411
+              }
412
+            } else {
413
+              this.submitLoading = false
414
+              return false
415
+            }
416
+          })
417
+
418
+        }
419
+
420
+        // this.$refs.form.validate(valid => {
421
+        //   if (valid) {
422
+        //     // 验证通过
423
+        //     if (this.form.id === 0) {
424
+        //       // 新增 role
425
+        //       addRole(this.form.name, this.form.intro)
426
+        //         .then(rs => {
427
+        //           var resp = rs.data;
428
+        //           if (resp.state === 1) {
429
+        //             var new_id = resp.data.id;
430
+        //             var new_name = resp.data.name;
431
+        //             var new_intro = resp.data.intro;
432
+        //             var new_status = resp.data.status;
433
+        //             this.$emit(
434
+        //               "did-add-role",
435
+        //               new_id,
436
+        //               new_name,
437
+        //               new_intro,
438
+        //               new_status
439
+        //             );
440
+        //
441
+        //             this.hide();
442
+        //           } else {
443
+        //             this.$message.error(resp.msg);
444
+        //           }
445
+        //         })
446
+        //         .catch(err => {
447
+        //           this.$message.error(err);
448
+        //         });
449
+        //     } else {
450
+        //       // 修改 role
451
+        //       modifyRole(this.form.id, this.form.name, this.form.intro)
452
+        //         .then(rs => {
453
+        //           var resp = rs.data;
454
+        //           if (resp.state === 1) {
455
+        //             this.$emit(
456
+        //               "did-edit-role",
457
+        //               this.form.id,
458
+        //               this.form.name,
459
+        //               this.form.intro
460
+        //             );
461
+        //             this.hide();
462
+        //           } else {
463
+        //             this.$message.error(resp.msg);
464
+        //           }
465
+        //         })
466
+        //         .catch(err => {
467
+        //           this.$message.error(err);
468
+        //         });
469
+        //     }
470
+        //   } else {
471
+        //     // 验证失败
472
+        //     return false;
473
+        //   }
474
+        // });
475
+      },
476
+      handleCheckAllChange(val) {
477
+        this.checkedCities = []
478
+        if (val) {
479
+          for (let i = 0; i < this.admin_user.length; i++) {
480
+            this.checkedCities.push(this.admin_user[i].id)
207 481
           }
208 482
         } else {
209
-          // 验证失败
210
-          return false;
483
+          this.checkedCities = []
211 484
         }
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;
485
+
486
+        this.isIndeterminate = false
487
+      },
488
+      handleCheckedCitiesChange(value) {
489
+        let checkedCount = value.length
490
+        this.checkAll = checkedCount === this.cities.length
491
+        this.isIndeterminate =
492
+          checkedCount > 0 && checkedCount < this.cities.length
493
+      }
223 494
     }
224 495
   }
225
-};
226 496
 </script>
227 497
 
228 498
 <style lang="scss" scoped>
229
-.roleContent {
230
-  margin-top: 20px;
231
-  display: flex;
232
-  justify-content: space-between;
499
+  .roleContent {
500
+    margin-top: 20px;
501
+    display: flex;
502
+    justify-content: space-between;
503
+
233 504
   .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
-    }
505
+
506
+  .chooseBox {
507
+    width: 280px;
508
+    height: 320px;
509
+    overflow-y: auto;
510
+    border: 1px solid rgba(235, 238, 240, 1);
511
+    margin-top: 26px;
512
+    padding: 20px;
513
+
514
+  .checkone {
515
+    display: flex;
516
+    align-items: center;
517
+    height: 50px;
518
+  }
519
+
520
+  .el-checkbox__label {
521
+    display: flex;
522
+    align-items: center;
523
+
524
+  img {
525
+    width: 30px;
526
+    height: 30px;
527
+    margin-right: 10px;
528
+  }
529
+
530
+  }
531
+  }
256 532
   }
257 533
   .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
-    }
534
+
535
+  .chooseBox {
536
+    width: 280px;
537
+    height: 320px;
538
+    overflow-y: auto;
539
+    border: 1px solid rgba(235, 238, 240, 1);
540
+    margin-top: 26px;
541
+    padding: 20px;
542
+
543
+  .hasChoosedOne {
544
+    display: flex;
545
+    align-items: center;
546
+    height: 50px;
547
+
548
+  img {
549
+    width: 30px;
550
+    height: 30px;
551
+    margin-right: 10px;
552
+  }
553
+
554
+  }
555
+  }
556
+  }
276 557
   }
277
-}
278
-.newStaff {
279
-  margin-top: 26px;
558
+  .newStaff {
559
+    margin-top: 26px;
560
+
280 561
   .newItem {
281 562
     display: flex;
282 563
     align-items: center;
283 564
   }
284
-}
565
+
566
+  }
285 567
 </style>
286 568
 
287 569
 <style lang="scss">
288
-.roleContent {
570
+  .roleContent {
571
+
289 572
   .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
-    }
573
+
574
+  .chooseBox {
575
+
576
+  .el-checkbox {
577
+    display: flex;
578
+    align-items: center;
579
+  }
580
+
581
+  .el-checkbox__label {
582
+    display: flex;
583
+    align-items: center;
584
+  }
585
+
586
+  }
587
+  }
300 588
   }
301
-}
302 589
 </style>

+ 294 - 117
src/xt_pages/role/components/PermissionSettings.vue Zobrazit soubor

@@ -1,169 +1,346 @@
1 1
 <template>
2
-  <el-dialog
3
-    class="settingDialog"
4
-    title="角色权限配置"
5
-    width="750px"
6
-    :visible.sync="visible"
7
-  >
2
+  <el-dialog class="settingDialog" title="角色权限配置" width="750px" :visible.sync="visible">
8 3
     <div class="roleSettings">
9 4
       <div class="roleName">
10 5
         <div class="roleNameLeft">
11 6
           <p>角色名称</p>
12
-          <el-input
13
-            placeholder="请输入内容"
14
-            v-model="input"
15
-            :disabled="true"
16
-          ></el-input>
7
+          <el-input placeholder="请输入内容" v-model="role.name" :disabled="true"></el-input>
17 8
         </div>
18
-        <p style="color:#338AFB">删除该角色</p>
9
+        <p style="color:#338AFB" v-if="role.is_system == 0" @click="disableRoleAction(role.id)">删除该角色</p>
19 10
       </div>
20
-      <div class="roleMain">
21
-        <div class="roleMainLeft">
11
+      <div class="roleMain" >
12
+        <div class="roleMainLeft" >
22 13
           <p class="roletitle">选择权限</p>
23 14
           <div class="roleMainLeftBox">
24
-            <el-tree
25
-              :props="defaultProps"
26
-              :data="data"
27
-              :default-checked-keys="data"
28
-              node-key="id"
29
-              ref="tree"
30
-              default-expand-all
31
-              show-checkbox
32
-            >
33
-              <!-- <span class="custom-tree-node" slot-scope="{ node, data }">
15
+            <!--<el-tree-->
16
+            <!--:props="defaultProps"-->
17
+            <!--:data="data"-->
18
+            <!--:default-checked-keys="data"-->
19
+            <!--node-key="id"-->
20
+            <!--ref="tree"-->
21
+            <!--default-expand-all-->
22
+            <!--show-checkbox-->
23
+            <!--&gt;-->
24
+            <!--&lt;!&ndash; <span class="custom-tree-node" slot-scope="{ node, data }">-->
25
+            <!--<span>{{ data.name }}</span>-->
26
+            <!--</span>&ndash;&gt;-->
27
+            <!--</el-tree>-->
28
+            <el-tree  v-loading="loading" :props="treeProps" :data="purviews" :default-checked-keys="default_checkeds" node-key="id"
29
+                     ref="tree" default-expand-all show-checkbox>
30
+                            <span class="custom-tree-node" slot-scope="{ node, data }">
34 31
                                 <span>{{ data.name }}</span>
35
-              </span>-->
32
+                            </span>
36 33
             </el-tree>
37 34
           </div>
38 35
         </div>
39
-        <div class="roleMainRight">
40
-          <div class="hasChoose">已选择权限</div>
41
-          <el-tree
42
-            :data="data"
43
-            :props="defaultProps"
44
-            @node-click="handleNodeClick"
45
-          ></el-tree>
46
-        </div>
36
+        <!--<div class="roleMainRight">-->
37
+        <!--<div class="hasChoose">已选择权限</div>-->
38
+        <!--<el-tree-->
39
+        <!--:props="treeProps" :data="check_purviews"   node-key="id" ref="tree" default-expand-all-->
40
+
41
+        <!--&gt;</el-tree>-->
42
+        <!--</div>-->
47 43
       </div>
48 44
     </div>
49 45
     <div slot="footer" class="dialog-footer">
50 46
       <el-button @click="hide">取 消</el-button>
51
-      <el-button type="primary">保 存</el-button>
47
+      <el-button type="primary" @click="submitAction" :loading="submitLoading">保 存</el-button>
52 48
     </div>
53 49
   </el-dialog>
54 50
 </template>
55 51
 
56 52
 <script>
57
-export default {
58
-  data() {
59
-    return {
60
-      visible: false,
61
-      data: [
62
-        {
63
-          id: 1,
64
-          label: "一级 2",
65
-          children: [
66
-            {
67
-              id: 3,
68
-              label: "二级 2-1",
69
-              children: [
70
-                {
71
-                  id: 4,
72
-                  label: "三级 3-1-1"
73
-                },
74
-                {
75
-                  id: 5,
76
-                  label: "三级 3-1-2"
77
-                }
78
-              ]
79
-            },
80
-            {
81
-              id: 2,
82
-              label: "二级 2-2",
83
-              children: [
84
-                {
85
-                  id: 6,
86
-                  label: "三级 3-2-1"
87
-                },
88
-                {
89
-                  id: 7,
90
-                  label: "三级 3-2-2"
53
+  import { editPurview, getEditPurviewInitData, setRoleStatus } from '@/api/role/role'
54
+
55
+  export default {
56
+    data() {
57
+      return {
58
+        visible: false,
59
+        loading: true,
60
+        submitLoading:false,
61
+        role_id: 0,
62
+        name: '',
63
+        role: {
64
+          name:"",
65
+        },
66
+        purviews: [],
67
+        treeProps: {
68
+          label: 'name',
69
+          children: 'childs'
70
+        },
71
+        default_checkeds: [],
72
+        check_purviews: [],
73
+        defaultProps: {
74
+          children: 'children',
75
+          label: 'label'
76
+        }
77
+      }
78
+    },
79
+    methods: {
80
+      disableRoleAction: function(id) {
81
+        this.$msgbox({
82
+          title: '提示',
83
+          message: '是否确定要移除该角色',
84
+          showCancelButton: true,
85
+          confirmButtonText: '确定',
86
+          cancelButtonText: '取消',
87
+          type: 'warning',
88
+          beforeClose: (action, instance, done) => {
89
+            if (action === "confirm") {
90
+
91
+              instance.confirmButtonLoading = true;
92
+              instance.confirmButtonText = "移除中...";
93
+              setRoleStatus(id, false)
94
+                .then(rs => {
95
+                  done();
96
+                  instance.confirmButtonLoading = false;
97
+                  const resp = rs.data
98
+                  if (resp.state === 1) {
99
+                    this.$emit('delete')
100
+                  } else {
101
+                    this.$message.error(resp.msg)
102
+                  }
103
+                })
104
+                .catch(err => {
105
+                  done();
106
+                  this.$message.error(err);
107
+                  instance.confirmButtonLoading = false;
108
+                })
109
+            }else{
110
+
111
+              done();
112
+            }
113
+          }
114
+        })
115
+      },
116
+
117
+      submitAction: function() {
118
+
119
+        if (this.role_id <= 0) {
120
+          return
121
+        }
122
+
123
+        var checkeds = this.$refs.tree.getCheckedKeys(true)
124
+
125
+        var ids = []
126
+        var func_ids = []
127
+
128
+        if (checkeds.length > 0) {
129
+          this.purviews.forEach(purview => {
130
+            if (purview.childs != null && purview.childs.length > 0) {
131
+              purview.childs.forEach(childs => {
132
+                if (childs.childs == null) {
133
+                  if (checkeds.indexOf(childs.id) != -1) {
134
+                    if (ids.indexOf(purview.id) == -1) {
135
+                      ids.push(purview.id)
136
+                    }
137
+                    ids.push(childs.id)
138
+
139
+                  }
140
+                } else {
141
+                  console.log(childs.name)
142
+                  if (childs.name == '透析记录') {
143
+
144
+                    childs.childs.forEach(child => {
145
+                      if (checkeds.indexOf(child.id) != -1) {
146
+                        if (func_ids.indexOf(childs.id) == -1) {
147
+                          func_ids.push(childs.id)
148
+                        }
149
+                        func_ids.push(child.id)
150
+                      }
151
+                    })
152
+                  } else {
153
+                    childs.childs.forEach(child => {
154
+                      if (checkeds.indexOf(child.id) != -1) {
155
+                        if (ids.indexOf(childs.id) == -1) {
156
+                          ids.push(childs.id)
157
+                        }
158
+                        ids.push(child.id)
159
+                      }
160
+                    })
161
+
162
+                  }
163
+
91 164
                 }
92
-              ]
165
+              })
166
+
167
+            } else {
168
+              if (checkeds.indexOf(purview.id) != -1) {
169
+                ids.push(purview.id)
170
+              }
93 171
             }
94
-          ]
172
+          })
173
+        }
174
+        var idsStr = ''
175
+        if (ids.length > 0) {
176
+          idsStr = ids.join(',')
177
+        }
178
+
179
+        var funcIdsStr = ''
180
+        if (func_ids.length > 0) {
181
+          funcIdsStr = func_ids.join(',')
182
+        }
183
+        this.submitLoading = true
184
+        editPurview(this.role_id, idsStr, funcIdsStr).then(rs => {
185
+          var resp = rs.data
186
+          this.submitLoading = false
187
+
188
+          if (resp.state === 1) {
189
+            this.hide()
190
+          } else {
191
+            this.$message.error(resp.msg)
192
+          }
193
+        }).catch(err => {
194
+          this.submitLoading = false
195
+          this.$message.error(err)
196
+        })
197
+      },
198
+
199
+      show(role_id) {
200
+        this.loading = true
201
+        this.visible = true
202
+        this.default_checkeds = []
203
+        this.purviews = []
204
+
205
+
206
+
207
+        var id = parseInt(role_id)
208
+        if (id <= 0) {
209
+          this.$message.error('参数错误')
210
+          return
95 211
         }
96
-      ],
97
-      defaultProps: {
98
-        children: "children",
99
-        label: "label"
212
+        this.role_id = role_id
213
+        getEditPurviewInitData(this.role_id).then(rs => {
214
+          var resp = rs.data
215
+          if (resp.state === 1) {
216
+            this.role = resp.data.role
217
+            this.purviews.push(...resp.data.purviews)
218
+            // 初始化默认选中项
219
+            var role_purview_ids = resp.data.role_purview_ids
220
+            var checkeds = []
221
+            if (role_purview_ids.length > 0) {
222
+              var ids = role_purview_ids.split(',')
223
+              this.purviews.forEach(purview => {
224
+                if (purview.childs != null && purview.childs.length > 0) {
225
+                  purview.childs.forEach(childs => {
226
+
227
+                    if (childs.childs != null && childs.childs.length > 0) {
228
+                      childs.childs.forEach(child => {
229
+                        if (ids.indexOf(child.id + '') != -1) {
230
+                          checkeds.push(child.id)
231
+                        }
232
+                      })
233
+
234
+                      }else{
235
+                      if (ids.indexOf(childs.id + '') != -1) {
236
+                        checkeds.push(childs.id)
237
+                      }
238
+                    }
239
+                  })
240
+
241
+                } else {
242
+                  if (ids.indexOf(purview.id + '') != -1) {
243
+                    checkeds.push(purview.id)
244
+                  }
245
+                }
246
+              })
247
+            }
248
+
249
+
250
+
251
+            this.$nextTick(() => {
252
+              this.default_checkeds = checkeds
253
+            })
254
+
255
+            this.loading = false
256
+
257
+          } else {
258
+            this.loading = false
259
+
260
+            this.$message.error(resp.msg)
261
+          }
262
+        }).catch(err => {
263
+          this.loading = false
264
+
265
+          this.$message.error(err)
266
+        })
267
+      },
268
+      hide() {
269
+        this.visible =false
270
+
100 271
       }
101
-    };
102
-  },
103
-  methods: {
104
-    show() {
105
-      this.visible = true;
106
-    },
107
-    hide() {
108
-      this.visible = false;
272
+
273
+    }, created() {
274
+
109 275
     }
110 276
   }
111
-};
112 277
 </script>
113 278
 
114 279
 <style lang="scss" scoped>
115
-.roleSettings {
280
+  .roleSettings {
281
+
116 282
   .roleName {
117 283
     display: flex;
118 284
     align-items: center;
119 285
     justify-content: space-between;
120 286
   }
287
+
121 288
   .roleNameLeft {
122 289
     display: flex;
123 290
     align-items: center;
124
-    p {
125
-      width: 100px;
126
-    }
291
+
292
+  p {
293
+    width: 100px;
294
+  }
295
+
127 296
   }
128 297
   .roleMain {
129 298
     display: flex;
130 299
     justify-content: space-between;
131 300
     margin-top: 18px;
132
-    .roleMainLeft {
133
-      display: flex;
134
-      .roletitle {
135
-        width: 74px;
136
-      }
137
-      .roleMainLeftBox {
138
-        width: 300px;
139
-        height: 706px;
140
-        overflow-y: auto;
141
-        border: 1px solid rgba(234, 238, 240, 1);
142
-        border-radius: 4px;
143
-        padding: 20px 0 0 10px;
144
-      }
145
-    }
146
-    .roleMainRight {
147
-      width: 280px;
148
-      height: 706px;
149
-      overflow-y: auto;
150
-      border: 1px solid rgba(235, 238, 240, 1);
151
-      color: #303133;
152
-      .hasChoose {
153
-        height: 42px;
154
-        line-height: 42px;
155
-        padding-left: 20px;
156
-        background: #f6f8f9;
157
-      }
158
-    }
301
+
302
+  .roleMainLeft {
303
+    display: flex;
304
+
305
+  .roletitle {
306
+    width: 74px;
307
+  }
308
+
309
+  .roleMainLeftBox {
310
+    width: 500px;
311
+    height: 706px;
312
+    overflow-y: auto;
313
+    border: 1px solid rgba(234, 238, 240, 1);
314
+    border-radius: 4px;
315
+    padding: 20px 0 0 10px;
316
+  }
317
+
318
+  }
319
+  .roleMainRight {
320
+    width: 280px;
321
+    height: 706px;
322
+    overflow-y: auto;
323
+    border: 1px solid rgba(235, 238, 240, 1);
324
+    color: #303133;
325
+
326
+  .hasChoose {
327
+    height: 42px;
328
+    line-height: 42px;
329
+    padding-left: 20px;
330
+    background: #f6f8f9;
331
+  }
332
+
333
+  }
334
+  }
159 335
   }
160
-}
161 336
 </style>
162 337
 
163 338
 <style lang="scss">
164
-.settingDialog {
339
+  .settingDialog {
340
+
165 341
   .el-dialog__body {
166 342
     max-height: 600px !important;
167 343
   }
168
-}
344
+
345
+  }
169 346
 </style>

+ 196 - 38
src/xt_pages/role/components/UserManagement.vue Zobrazit soubor

@@ -1,7 +1,9 @@
1 1
 <template>
2
+  <div>
2 3
   <el-dialog class="userDialog" title="用户管理" width="660px" :visible.sync="visible">
3 4
     <div class="userManagement">
4 5
       <el-table
6
+        v-loading="loading"
5 7
         :row-style="{ color: '#303133' }"
6 8
         :header-cell-style="{
7 9
           backgroundColor: 'rgb(245, 247, 250)',
@@ -10,75 +12,231 @@
10 12
         style="width:100%;"
11 13
         ref="table"
12 14
         border
13
-        :data="data"
15
+        :data="admin_user"
14 16
       >
15
-        <el-table-column type="selection" label="禁用" width="55"></el-table-column>
16 17
         <el-table-column prop="name" label="员工姓名" width="120">
17
-          <template slot-scope="scope"></template>
18
-        </el-table-column>
19
-        <el-table-column prop="date" label="登录账号" width="120">
20
-          <template slot-scope="scope"></template>
18
+          <template slot-scope="scope">
19
+            {{scope.row.user_name}}
20
+          </template>
21 21
         </el-table-column>
22
+        <!--<el-table-column prop="date" label="登录账号" width="120">-->
23
+          <!--<template slot-scope="scope">-->
24
+            <!--{{}}-->
25
+          <!--</template>-->
26
+        <!--</el-table-column>-->
22 27
         <el-table-column prop="date" label="最后登录时间" width="180">
23
-          <template slot-scope="scope"></template>
28
+          <template slot-scope="scope">
29
+             <span>{{
30
+              scope.row.last_login_time == 0
31
+                ? ""
32
+                : _parseTime(scope.row.last_login_time, "{y}-{m}-{d} {h}:{i}")
33
+            }}</span>
34
+          </template>
35
+
24 36
         </el-table-column>
25
-        <el-table-column label="操作" width="130">
37
+        <el-table-column label="操作" >
26 38
           <template slot-scope="scope" style="text-align: center">
27 39
             <el-tooltip class="item" effect="dark" content="编辑" placement="top">
28
-              <el-button type="primary" icon="el-icon-edit-outline" size="small"></el-button>
40
+              <el-button  type="primary" icon="el-icon-edit-outline" size="small"
41
+                         v-if="org.creator != scope.row.user_id && (scope.row.user_id != local_user_id) && !scope.row.is_sub_super_admin"
42
+                         @click="openForm(scope.row.user_id, role_id)" ></el-button>
29 43
             </el-tooltip>
30
-            <!-- </router-link> -->
31
-            <el-tooltip class="item" effect="dark" content="移除" placement="top">
32
-              <el-button type="danger" size="small" icon="el-icon-delete"></el-button>
44
+
45
+            <el-tooltip
46
+              class="item"
47
+              effect="dark"
48
+              content="移除"
49
+              placement="top"
50
+            >
51
+              <el-button
52
+                type="danger"
53
+                size="small"
54
+                icon="el-icon-delete"
55
+                v-if="scope.row.status == 1 && org.creator != scope.row.user_id && (scope.row.user_id != local_user_id) && !scope.row.is_sub_super_admin"
56
+                @click="disableAdminAction(scope.row)"
57
+              ></el-button>
58
+            </el-tooltip>
59
+
60
+            <el-tooltip
61
+              class="item"
62
+              effect="dark"
63
+              content="恢复"
64
+              placement="top"
65
+            >
66
+              <el-button
67
+                size="small"
68
+                type="info"
69
+                icon="el-icon-refresh"
70
+                v-if="scope.row.status == 0 && org.creator != scope.row.user_id  && (scope.row.user_id != local_user_id ) && !scope.row.is_sub_super_admin"
71
+                @click="recoverAdminAction(scope.row)"
72
+              ></el-button>
33 73
             </el-tooltip>
74
+
34 75
           </template>
35 76
         </el-table-column>
36 77
       </el-table>
37 78
     </div>
38 79
   </el-dialog>
80
+  <!--<admin-info-form ref="admininfoform"></admin-info-form>-->
81
+    <admin-role-info-form ref="admininfoform"  @did-edit-admin="didModifyAdmin"></admin-role-info-form>
82
+  </div>
39 83
 </template>
40 84
 
41 85
 
42 86
 <script>
43
-export default {
44
-  data() {
45
-    return {
46
-      visible: false,
47
-      data: [
48
-        {
49
-          date: "2016-05-03",
50
-          name: "王小虎",
51
-          address: "上海市普陀区金沙江路 1518 弄"
52
-        },
53
-        {
54
-          date: "2016-05-03",
55
-          name: "王小虎",
56
-          address: "上海市普陀区金沙江路 1518 弄"
57
-        }
58
-      ]
59
-    };
60
-  },
61
-  methods: {
62
-    show() {
63
-      this.visible = true;
87
+  import { getRoleStaff } from '@/api/role/role'
88
+  import { parseTime } from "@/utils";
89
+  import { setAdminStatus } from "@/api/role/admin";
90
+  // import AdminInfoForm from './AdminInfoForm'
91
+  import AdminRoleInfoForm from './AdminRoleInfoForm'
92
+
93
+  export default {
94
+    components: { AdminRoleInfoForm },
95
+    data() {
96
+      return {
97
+        visible: false,
98
+        role_id: 0,
99
+        admin_user: [],
100
+        local_user_id: 0,
101
+        org:null,
102
+        loading:false,
103
+
104
+      }
105
+    },
106
+    methods: {
107
+      didModifyAdmin(){
108
+        this.GetAllStaff()
109
+        this.$refs["admininfoform"].close();
110
+
111
+      },
112
+      openForm(adminId,role_id) {
113
+        this.$refs["admininfoform"].open(adminId,role_id);
114
+      },
115
+      disableAdminAction: function(row) {
116
+        this.$msgbox({
117
+          title: "提示",
118
+          message: "是否确定要移除该用户",
119
+          showCancelButton: true,
120
+          confirmButtonText: "确定",
121
+          cancelButtonText: "取消",
122
+          type: "warning",
123
+          beforeClose: (action, instance, done) => {
124
+            if (action === "confirm") {
125
+              instance.confirmButtonLoading = true;
126
+              instance.confirmButtonText = "删除中...";
127
+
128
+              setAdminStatus(row.user_id, false)
129
+                .then(rs => {
130
+                  done();
131
+                  instance.confirmButtonLoading = false;
132
+
133
+                  const resp = rs.data;
134
+                  if (resp.state === 1) {
135
+                    row.status = 0;
136
+                  } else {
137
+                    this.$message.error(resp.msg);
138
+                  }
139
+                })
140
+                .catch(err => {
141
+                  done();
142
+                  instance.confirmButtonLoading = false;
143
+                  this.$message.error(err);
144
+                });
145
+            } else {
146
+              done();
147
+            }
148
+          }
149
+        });
150
+      },
151
+      recoverAdminAction: function(row) {
152
+        const loading = this.$loading({
153
+          lock: true,
154
+          text: "正在恢复管理员...",
155
+          spinner: "el-icon-loading",
156
+          background: "rgba(0, 0, 0, 0.7)"
157
+        });
158
+
159
+        setAdminStatus(row.user_id, true)
160
+          .then(rs => {
161
+            loading.close();
162
+
163
+            const resp = rs.data;
164
+            if (resp.state === 1) {
165
+              row.status = 1;
166
+            } else {
167
+              this.$message.error(resp.msg);
168
+            }
169
+          })
170
+          .catch(err => {
171
+            loading.close();
172
+            this.$message.error(err);
173
+          });
174
+      },
175
+      _parseTime(time, format) {
176
+        return parseTime(time, format);
177
+      },
178
+      GetAllStaff: function() {
179
+        this.loading = true
180
+
181
+        getRoleStaff().then(response => {
182
+          this.loading = false
183
+
184
+          if (response.data.state === 1) {
185
+            this.admin_user = response.data.data.admins
186
+            this.org = response.data.data.org
187
+
188
+            for (let i = 0; i < this.admin_user.length; i++) {
189
+              if (this.admin_user[i].role_ids.length > 0) {
190
+                let isExist = -1
191
+                let ids = this.admin_user[i].role_ids.split(',')
192
+                isExist = ids.indexOf(this.role_id.toString())
193
+                if (isExist < 0) {
194
+                  this.admin_user.splice(i, 1)
195
+                  i = i - 1
196
+                }
197
+              }
198
+            }
199
+          } else {
200
+
201
+            this.$toast({
202
+              message: response.data.msg
203
+            })
204
+          }
205
+        }).catch(err => {
206
+          this.loading = false
207
+          this.$message.error(err)
208
+        })
209
+      },
210
+
211
+      show(role_id) {
212
+        this.visible = true
213
+        this.role_id = role_id
214
+        this.admin_user = []
215
+        this.local_user_id = this.$store.getters.xt_user.user.id
216
+        this.local_user_id = 597
217
+        this.GetAllStaff()
218
+      }
64 219
     }
65 220
   }
66
-};
67 221
 </script>
68 222
 
69 223
 <style lang="scss" scoped>
70
-.userManagement {
224
+  .userManagement {
225
+
71 226
   .cell {
72 227
     text-align: center;
73 228
   }
74
-}
229
+
230
+  }
75 231
 </style>
76 232
 
77 233
 
78 234
 <style lang="scss">
79
-.userManagement {
235
+  .userManagement {
236
+
80 237
   .cell {
81 238
     text-align: center;
82 239
   }
83
-}
240
+
241
+  }
84 242
 </style>

+ 65 - 145
src/xt_pages/role/role.vue Zobrazit soubor

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