ylyx-cli 1.0.15 → 1.0.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (285) hide show
  1. package/bin/ylyx.js +168 -168
  2. package/lib/config.js +283 -299
  3. package/lib/deploy.js +529 -495
  4. package/lib/generator.js +192 -192
  5. package/lib/index.js +113 -113
  6. package/lib/interactive.js +87 -87
  7. package/lib/remote.js +179 -179
  8. package/lib/template.js +174 -174
  9. package/lib/utils.js +148 -148
  10. package/package.json +5 -5
  11. package/templates/react-app/files/README.md +23 -23
  12. package/templates/react-app/files/package.json +28 -28
  13. package/templates/react-app/files/public/index.html +11 -11
  14. package/templates/react-app/files/src/App.css +15 -15
  15. package/templates/react-app/files/src/App.js +15 -15
  16. package/templates/react-app/files/src/index.css +10 -10
  17. package/templates/react-app/files/src/index.js +11 -11
  18. package/templates/react-app/template.json +11 -11
  19. package/templates/react-component/files/Component.module.css +5 -5
  20. package/templates/react-component/files/Component.tsx +31 -31
  21. package/templates/react-component/files/index.ts +2 -2
  22. package/templates/react-component/template.json +48 -48
  23. package/templates/vue-app/files/.editorconfig +14 -14
  24. package/templates/vue-app/files/.env.development +21 -21
  25. package/templates/vue-app/files/.env.production +18 -18
  26. package/templates/vue-app/files/.eslintignore +5 -5
  27. package/templates/vue-app/files/.eslintrc.js +267 -267
  28. package/templates/vue-app/files/.prettierignore +11 -11
  29. package/templates/vue-app/files/.travis.yml +5 -5
  30. package/templates/vue-app/files/.vscode/extensions.json +7 -7
  31. package/templates/vue-app/files/.vscode/settings.json +39 -39
  32. package/templates/vue-app/files/LICENSE +191 -191
  33. package/templates/vue-app/files/README.md +87 -87
  34. package/templates/vue-app/files/babel.config.js +11 -11
  35. package/templates/vue-app/files/jest.config.js +24 -24
  36. package/templates/vue-app/files/package.json +136 -136
  37. package/templates/vue-app/files/plopfile.js +7 -7
  38. package/templates/vue-app/files/postcss.config.js +5 -5
  39. package/templates/vue-app/files/public/default.js +25 -25
  40. package/templates/vue-app/files/public/index.html +26 -26
  41. package/templates/vue-app/files/src/App.vue +54 -54
  42. package/templates/vue-app/files/src/api/bigDataV/index.js +198 -198
  43. package/templates/vue-app/files/src/api/data.js +42 -42
  44. package/templates/vue-app/files/src/api/dataArchive/index.js +186 -186
  45. package/templates/vue-app/files/src/api/generator/genConfig.js +16 -16
  46. package/templates/vue-app/files/src/api/generator/generator.js +32 -32
  47. package/templates/vue-app/files/src/api/indexManagement/index.js +39 -39
  48. package/templates/vue-app/files/src/api/institutionMonitor/index.js +396 -396
  49. package/templates/vue-app/files/src/api/institutionSet/index.js +120 -120
  50. package/templates/vue-app/files/src/api/login.js +44 -44
  51. package/templates/vue-app/files/src/api/selfStatistics/index.js +50 -50
  52. package/templates/vue-app/files/src/api/system/code.js +15 -15
  53. package/templates/vue-app/files/src/api/system/dict.js +34 -34
  54. package/templates/vue-app/files/src/api/system/dictDetail.js +52 -52
  55. package/templates/vue-app/files/src/api/system/equipment.js +35 -35
  56. package/templates/vue-app/files/src/api/system/examManage.js +49 -49
  57. package/templates/vue-app/files/src/api/system/examProject.js +48 -48
  58. package/templates/vue-app/files/src/api/system/hosModel.js +35 -35
  59. package/templates/vue-app/files/src/api/system/hospital.js +88 -88
  60. package/templates/vue-app/files/src/api/system/job.js +40 -40
  61. package/templates/vue-app/files/src/api/system/menu.js +67 -67
  62. package/templates/vue-app/files/src/api/system/model.js +42 -42
  63. package/templates/vue-app/files/src/api/system/risConfig.js +9 -9
  64. package/templates/vue-app/files/src/api/system/role.js +64 -64
  65. package/templates/vue-app/files/src/api/system/sysSet.js +19 -19
  66. package/templates/vue-app/files/src/api/system/timing.js +41 -41
  67. package/templates/vue-app/files/src/api/system/user.js +121 -121
  68. package/templates/vue-app/files/src/api/tools/alipay.js +25 -25
  69. package/templates/vue-app/files/src/api/tools/email.js +24 -24
  70. package/templates/vue-app/files/src/api/tools/localStorage.js +27 -27
  71. package/templates/vue-app/files/src/api/tools/qiniu.js +40 -40
  72. package/templates/vue-app/files/src/assets/css/font-awesome.css +2342 -2342
  73. package/templates/vue-app/files/src/assets/css/font-awesome.min.css +2336 -2336
  74. package/templates/vue-app/files/src/assets/fonts/fontawesome-webfont.svg +2671 -2671
  75. package/templates/vue-app/files/src/assets/icons/index.js +9 -9
  76. package/templates/vue-app/files/src/assets/icons/svg/hospital.svg +1 -1
  77. package/templates/vue-app/files/src/assets/icons/svg/hospital1.svg +1 -1
  78. package/templates/vue-app/files/src/assets/icons/svg/loginOne.svg +35 -35
  79. package/templates/vue-app/files/src/assets/icons/svg/loginOneWhite.svg +19 -19
  80. package/templates/vue-app/files/src/assets/icons/svg/loginOr.svg +93 -93
  81. package/templates/vue-app/files/src/assets/icons/svg/loginUp.svg +96 -96
  82. package/templates/vue-app/files/src/assets/icons/svg/monitor.svg +1 -1
  83. package/templates/vue-app/files/src/assets/icons/svg/offline.svg +1 -1
  84. package/templates/vue-app/files/src/assets/icons/svg/online.svg +1 -1
  85. package/templates/vue-app/files/src/assets/icons/svg/system.svg +1 -1
  86. package/templates/vue-app/files/src/assets/icons/svgo.yml +21 -21
  87. package/templates/vue-app/files/src/assets/styles/btn.scss +103 -103
  88. package/templates/vue-app/files/src/assets/styles/eladmin.scss +124 -124
  89. package/templates/vue-app/files/src/assets/styles/element-ui.scss +217 -217
  90. package/templates/vue-app/files/src/assets/styles/element-variables.scss +31 -31
  91. package/templates/vue-app/files/src/assets/styles/global.scss +73 -73
  92. package/templates/vue-app/files/src/assets/styles/index.scss +220 -220
  93. package/templates/vue-app/files/src/assets/styles/mixin.scss +60 -60
  94. package/templates/vue-app/files/src/assets/styles/publicStyle.scss +224 -224
  95. package/templates/vue-app/files/src/assets/styles/sidebar.scss +239 -239
  96. package/templates/vue-app/files/src/assets/styles/transition.scss +48 -48
  97. package/templates/vue-app/files/src/assets/styles/variables.scss +44 -44
  98. package/templates/vue-app/files/src/common/flexible.js +145 -145
  99. package/templates/vue-app/files/src/components/Breadcrumb/index.vue +87 -87
  100. package/templates/vue-app/files/src/components/Crud/CRUD.operation.vue +248 -248
  101. package/templates/vue-app/files/src/components/Crud/Pagination.vue +20 -20
  102. package/templates/vue-app/files/src/components/Crud/RR.operation.vue +39 -39
  103. package/templates/vue-app/files/src/components/Crud/UD.operation.vue +106 -106
  104. package/templates/vue-app/files/src/components/Crud/crud.js +907 -907
  105. package/templates/vue-app/files/src/components/Crud/user/UR.operation.vue +154 -154
  106. package/templates/vue-app/files/src/components/DateRangePicker/index.vue +42 -42
  107. package/templates/vue-app/files/src/components/DateRangePickerProhibitNext/index.vue +42 -42
  108. package/templates/vue-app/files/src/components/DateRangePickerProhibitTodayNext/index.vue +48 -48
  109. package/templates/vue-app/files/src/components/Dict/Dict.js +31 -31
  110. package/templates/vue-app/files/src/components/Dict/index.js +29 -29
  111. package/templates/vue-app/files/src/components/Doc/index.vue +16 -16
  112. package/templates/vue-app/files/src/components/Echarts/BarChart.vue +115 -115
  113. package/templates/vue-app/files/src/components/Echarts/Category.vue +768 -768
  114. package/templates/vue-app/files/src/components/Echarts/Funnel.vue +120 -120
  115. package/templates/vue-app/files/src/components/Echarts/Gauge.vue +74 -74
  116. package/templates/vue-app/files/src/components/Echarts/Graph.vue +101 -101
  117. package/templates/vue-app/files/src/components/Echarts/HeatMap.vue +301 -301
  118. package/templates/vue-app/files/src/components/Echarts/Line3D.vue +110 -110
  119. package/templates/vue-app/files/src/components/Echarts/PieChart.vue +84 -84
  120. package/templates/vue-app/files/src/components/Echarts/Point.vue +161 -161
  121. package/templates/vue-app/files/src/components/Echarts/RadarChart.vue +123 -123
  122. package/templates/vue-app/files/src/components/Echarts/Rich.vue +160 -160
  123. package/templates/vue-app/files/src/components/Echarts/Sankey.vue +114 -114
  124. package/templates/vue-app/files/src/components/Echarts/Scatter.vue +192 -192
  125. package/templates/vue-app/files/src/components/Echarts/Sunburst.vue +127 -127
  126. package/templates/vue-app/files/src/components/Echarts/ThemeRiver.vue +233 -233
  127. package/templates/vue-app/files/src/components/Echarts/WordCloud.vue +201 -201
  128. package/templates/vue-app/files/src/components/GithubCorner/index.vue +55 -55
  129. package/templates/vue-app/files/src/components/Hamburger/index.vue +44 -44
  130. package/templates/vue-app/files/src/components/HeaderSearch/index.vue +196 -196
  131. package/templates/vue-app/files/src/components/IconSelect/index.vue +74 -74
  132. package/templates/vue-app/files/src/components/IconSelect/requireIcons.js +10 -10
  133. package/templates/vue-app/files/src/components/Iframe/index.vue +30 -30
  134. package/templates/vue-app/files/src/components/JavaEdit/index.vue +78 -78
  135. package/templates/vue-app/files/src/components/Pagination/index.vue +100 -100
  136. package/templates/vue-app/files/src/components/PanThumb/index.vue +149 -149
  137. package/templates/vue-app/files/src/components/ParentView/index.vue +3 -3
  138. package/templates/vue-app/files/src/components/Permission/index.js +13 -13
  139. package/templates/vue-app/files/src/components/Permission/permission.js +21 -21
  140. package/templates/vue-app/files/src/components/RightPanel/index.vue +149 -149
  141. package/templates/vue-app/files/src/components/Screenfull/index.vue +60 -60
  142. package/templates/vue-app/files/src/components/SizeSelect/index.vue +60 -60
  143. package/templates/vue-app/files/src/components/SvgIcon/index.vue +66 -66
  144. package/templates/vue-app/files/src/components/ThemePicker/index.vue +177 -177
  145. package/templates/vue-app/files/src/components/UploadExcel/index.vue +149 -149
  146. package/templates/vue-app/files/src/components/WaterMark/setWaterMark.js +68 -68
  147. package/templates/vue-app/files/src/components/WaterMark/waterMark.vue +69 -69
  148. package/templates/vue-app/files/src/components/Xgplayer/index.vue +49 -49
  149. package/templates/vue-app/files/src/components/YamlEdit/index.vue +81 -81
  150. package/templates/vue-app/files/src/layout/components/AppMain.vue +67 -67
  151. package/templates/vue-app/files/src/layout/components/Navbar.vue +209 -209
  152. package/templates/vue-app/files/src/layout/components/Settings/index.vue +125 -125
  153. package/templates/vue-app/files/src/layout/components/Sidebar/FixiOSBug.js +26 -26
  154. package/templates/vue-app/files/src/layout/components/Sidebar/Item.vue +29 -29
  155. package/templates/vue-app/files/src/layout/components/Sidebar/Link.vue +35 -35
  156. package/templates/vue-app/files/src/layout/components/Sidebar/Logo.vue +93 -93
  157. package/templates/vue-app/files/src/layout/components/Sidebar/SidebarItem.vue +104 -104
  158. package/templates/vue-app/files/src/layout/components/Sidebar/index.vue +79 -79
  159. package/templates/vue-app/files/src/layout/components/TagsView/ScrollPane.vue +90 -90
  160. package/templates/vue-app/files/src/layout/components/TagsView/index.vue +299 -299
  161. package/templates/vue-app/files/src/layout/components/index.js +5 -5
  162. package/templates/vue-app/files/src/layout/index.vue +119 -119
  163. package/templates/vue-app/files/src/layout/mixin/ResizeHandler.js +45 -45
  164. package/templates/vue-app/files/src/main.js +89 -89
  165. package/templates/vue-app/files/src/mixins/crud.js +348 -348
  166. package/templates/vue-app/files/src/router/index.js +156 -156
  167. package/templates/vue-app/files/src/router/routers.js +203 -203
  168. package/templates/vue-app/files/src/settings.js +57 -57
  169. package/templates/vue-app/files/src/store/getters.js +29 -29
  170. package/templates/vue-app/files/src/store/index.js +25 -25
  171. package/templates/vue-app/files/src/store/modules/api.js +33 -33
  172. package/templates/vue-app/files/src/store/modules/app.js +55 -55
  173. package/templates/vue-app/files/src/store/modules/permission.js +79 -79
  174. package/templates/vue-app/files/src/store/modules/register.js +17 -17
  175. package/templates/vue-app/files/src/store/modules/settings.js +46 -46
  176. package/templates/vue-app/files/src/store/modules/tagsView.js +168 -168
  177. package/templates/vue-app/files/src/store/modules/user.js +119 -119
  178. package/templates/vue-app/files/src/utils/auth.js +18 -18
  179. package/templates/vue-app/files/src/utils/base64ToFile.js +27 -27
  180. package/templates/vue-app/files/src/utils/clipboard.js +36 -36
  181. package/templates/vue-app/files/src/utils/datetime.js +289 -289
  182. package/templates/vue-app/files/src/utils/getBlobFile.js +10 -10
  183. package/templates/vue-app/files/src/utils/getTime.js +29 -29
  184. package/templates/vue-app/files/src/utils/index.js +520 -520
  185. package/templates/vue-app/files/src/utils/permission.js +29 -29
  186. package/templates/vue-app/files/src/utils/pinyin.js +450 -450
  187. package/templates/vue-app/files/src/utils/request.js +139 -139
  188. package/templates/vue-app/files/src/utils/rsaEncrypt.js +37 -37
  189. package/templates/vue-app/files/src/utils/shortcuts.js +210 -210
  190. package/templates/vue-app/files/src/utils/upload.js +12 -12
  191. package/templates/vue-app/files/src/utils/validate.js +262 -262
  192. package/templates/vue-app/files/src/views/components/Echarts.vue +124 -124
  193. package/templates/vue-app/files/src/views/components/Editor.vue +75 -75
  194. package/templates/vue-app/files/src/views/components/MarkDown.vue +44 -44
  195. package/templates/vue-app/files/src/views/components/UVideo.vue +37 -37
  196. package/templates/vue-app/files/src/views/components/YamlEdit.vue +206 -206
  197. package/templates/vue-app/files/src/views/components/camera/camera.vue +115 -115
  198. package/templates/vue-app/files/src/views/components/camera/cameraTest.vue +158 -158
  199. package/templates/vue-app/files/src/views/components/excel/upload-excel.vue +41 -41
  200. package/templates/vue-app/files/src/views/components/icons/element-icons.js +74 -74
  201. package/templates/vue-app/files/src/views/components/icons/index.vue +106 -106
  202. package/templates/vue-app/files/src/views/components/icons/svg-icons.js +10 -10
  203. package/templates/vue-app/files/src/views/components/scroll/index.vue +107 -107
  204. package/templates/vue-app/files/src/views/components/scrollFull/index.vue +99 -99
  205. package/templates/vue-app/files/src/views/dashboard/LineChart.vue +138 -138
  206. package/templates/vue-app/files/src/views/dashboard/PanelGroup.vue +173 -173
  207. package/templates/vue-app/files/src/views/dashboard/mixins/resize.js +57 -57
  208. package/templates/vue-app/files/src/views/dataArchive/delTable.vue +354 -354
  209. package/templates/vue-app/files/src/views/dataArchive/exportDetail.vue +121 -121
  210. package/templates/vue-app/files/src/views/dataArchive/exportList.vue +160 -160
  211. package/templates/vue-app/files/src/views/dataArchive/index.vue +2104 -2104
  212. package/templates/vue-app/files/src/views/features/401.vue +83 -83
  213. package/templates/vue-app/files/src/views/features/404.vue +226 -226
  214. package/templates/vue-app/files/src/views/features/redirect.vue +12 -12
  215. package/templates/vue-app/files/src/views/generator/config.vue +348 -348
  216. package/templates/vue-app/files/src/views/generator/index.vue +143 -143
  217. package/templates/vue-app/files/src/views/generator/preview.vue +39 -39
  218. package/templates/vue-app/files/src/views/home.vue +80 -80
  219. package/templates/vue-app/files/src/views/indexManagement/index.vue +422 -422
  220. package/templates/vue-app/files/src/views/indexManagement/other.vue +286 -286
  221. package/templates/vue-app/files/src/views/institutionMonitor/components/LineChart.vue +191 -191
  222. package/templates/vue-app/files/src/views/institutionMonitor/index.scss +339 -339
  223. package/templates/vue-app/files/src/views/institutionMonitor/index.vue +1385 -1385
  224. package/templates/vue-app/files/src/views/institutionMonitor/mixins/resize.js +57 -57
  225. package/templates/vue-app/files/src/views/institutionMonitor/monitorDetail/checkProjectCode.vue +267 -267
  226. package/templates/vue-app/files/src/views/institutionMonitor/monitorDetail/imageAbnormalMonitor.vue +361 -361
  227. package/templates/vue-app/files/src/views/institutionMonitor/monitorDetail/index.vue +686 -686
  228. package/templates/vue-app/files/src/views/institutionMonitor/monitorDetail/leakageAnomaly.vue +270 -270
  229. package/templates/vue-app/files/src/views/institutionMonitor/monitorDetail/moveMonitore.vue +114 -114
  230. package/templates/vue-app/files/src/views/institutionMonitor/monitorDetail/qualityMonitore.vue +338 -338
  231. package/templates/vue-app/files/src/views/institutionSet/cloudSet.vue +534 -534
  232. package/templates/vue-app/files/src/views/institutionSet/index.vue +2550 -2550
  233. package/templates/vue-app/files/src/views/login.vue +243 -243
  234. package/templates/vue-app/files/src/views/qualityLogin.vue +280 -280
  235. package/templates/vue-app/files/src/views/selfStatistics/components/LineChart.vue +296 -296
  236. package/templates/vue-app/files/src/views/selfStatistics/hospitalDetail/index.vue +533 -533
  237. package/templates/vue-app/files/src/views/selfStatistics/index.scss +447 -447
  238. package/templates/vue-app/files/src/views/selfStatistics/index.vue +903 -903
  239. package/templates/vue-app/files/src/views/selfStatistics/mixins/resize.js +57 -57
  240. package/templates/vue-app/files/src/views/selfStatistics/monitorDetail/index.vue +285 -285
  241. package/templates/vue-app/files/src/views/selfStatistics/offlineDetail/index.vue +104 -104
  242. package/templates/vue-app/files/src/views/selfStatistics/selfActiveDetail/index.vue +104 -104
  243. package/templates/vue-app/files/src/views/selfStatistics/selfMonitorDetail/index.vue +420 -420
  244. package/templates/vue-app/files/src/views/selfStatistics/setWaterMark/setWaterMark.js +68 -68
  245. package/templates/vue-app/files/src/views/selfStatistics/setWaterMark/waterMark.vue +69 -69
  246. package/templates/vue-app/files/src/views/system/dept/index.vue +144 -144
  247. package/templates/vue-app/files/src/views/system/dict/dictDetail.vue +146 -146
  248. package/templates/vue-app/files/src/views/system/dict/index.vue +159 -159
  249. package/templates/vue-app/files/src/views/system/examModality/index.vue +174 -174
  250. package/templates/vue-app/files/src/views/system/examPart/index.vue +184 -184
  251. package/templates/vue-app/files/src/views/system/examProject/index.vue +321 -321
  252. package/templates/vue-app/files/src/views/system/examine/index.vue +66 -66
  253. package/templates/vue-app/files/src/views/system/job/index.vue +119 -119
  254. package/templates/vue-app/files/src/views/system/job/module/form.vue +72 -72
  255. package/templates/vue-app/files/src/views/system/job/module/header.vue +48 -48
  256. package/templates/vue-app/files/src/views/system/menu/index.vue +327 -327
  257. package/templates/vue-app/files/src/views/system/model/index.vue +285 -285
  258. package/templates/vue-app/files/src/views/system/role/index.vue +434 -434
  259. package/templates/vue-app/files/src/views/system/sysSet/index.vue +84 -84
  260. package/templates/vue-app/files/src/views/system/timing/index.vue +289 -289
  261. package/templates/vue-app/files/src/views/system/timing/log.vue +143 -143
  262. package/templates/vue-app/files/src/views/system/user/admin.vue +414 -414
  263. package/templates/vue-app/files/src/views/system/user/center/updateEmail.vue +146 -146
  264. package/templates/vue-app/files/src/views/system/user/center/updatePass.vue +168 -168
  265. package/templates/vue-app/files/src/views/system/user/center.vue +140 -140
  266. package/templates/vue-app/files/src/views/system/user/index.vue +972 -972
  267. package/templates/vue-app/files/src/views/systemSet/role/index.vue +314 -314
  268. package/templates/vue-app/files/src/views/systemSet/user/admin.vue +414 -414
  269. package/templates/vue-app/files/src/views/systemSet/user/center/updateEmail.vue +146 -146
  270. package/templates/vue-app/files/src/views/systemSet/user/center/updatePass.vue +115 -115
  271. package/templates/vue-app/files/src/views/systemSet/user/center.vue +351 -351
  272. package/templates/vue-app/files/src/views/systemSet/user/index.vue +928 -928
  273. package/templates/vue-app/files/src/views/tools/aliPay/config.vue +102 -102
  274. package/templates/vue-app/files/src/views/tools/aliPay/index.vue +48 -48
  275. package/templates/vue-app/files/src/views/tools/aliPay/toPay.vue +91 -91
  276. package/templates/vue-app/files/src/views/tools/email/config.vue +91 -91
  277. package/templates/vue-app/files/src/views/tools/email/index.vue +42 -42
  278. package/templates/vue-app/files/src/views/tools/email/send.vue +159 -159
  279. package/templates/vue-app/files/src/views/tools/storage/index.vue +35 -35
  280. package/templates/vue-app/files/src/views/tools/storage/local/index.vue +207 -207
  281. package/templates/vue-app/files/src/views/tools/storage/qiniu/form.vue +108 -108
  282. package/templates/vue-app/files/src/views/tools/storage/qiniu/index.vue +241 -241
  283. package/templates/vue-app/files/src/views/tools/swagger/index.vue +14 -14
  284. package/templates/vue-app/files/vue.config.js +173 -173
  285. package/templates/vue-app/template.json +29 -29
@@ -1,928 +1,928 @@
1
- <template>
2
- <div class="app-container">
3
- <!--工具栏-->
4
- <div class="head-container">
5
- <div v-if="crud.props.searchToggle">
6
- <!-- 搜索 -->
7
- <el-input
8
- v-model="query.name"
9
- clearable
10
- size="small"
11
- placeholder="请输入姓名"
12
- style="width: 200px"
13
- class="filter-item"
14
- @keyup.enter.native="crud.toQuery" />
15
- <el-select
16
- v-model="query.roleId"
17
- clearable
18
- size="small"
19
- placeholder="请选择角色"
20
- class="filter-item"
21
- style="width: 150px"
22
- @change="crud.toQuery">
23
- <el-option
24
- v-for="item in roles"
25
- :key="item.name"
26
- :disabled="level !== 1 && item.level <= level"
27
- :label="item.name"
28
- :value="item.id" />
29
- </el-select>
30
- <rrOperation />
31
- </div>
32
- <crudOperation show="" :permission="permission" />
33
- </div>
34
- <!--表单渲染-->
35
- <el-dialog
36
- append-to-body
37
- :close-on-click-modal="false"
38
- :before-close="crud.cancelCU"
39
- :visible.sync="crud.status.cu > 0"
40
- :title="crud.status.title"
41
- width="850px">
42
- <el-form
43
- ref="form"
44
- :inline="true"
45
- :model="addData"
46
- :rules="rules"
47
- size="small"
48
- label-width="100px">
49
- <el-form-item label="角色" prop="roleDatas">
50
- <el-select
51
- :multiple-limit="multiplelimit"
52
- ref="selectAppType"
53
- v-model="roleDatas"
54
- style="width: 260px"
55
- multiple
56
- placeholder="请选择"
57
- @remove-tag="deleteTag"
58
- @change="changeRole">
59
- <el-option
60
- v-for="item in roles"
61
- :key="item.name"
62
- :disabled="level !== 1 && item.level <= level"
63
- :label="item.name"
64
- :value="item.id" />
65
- </el-select>
66
- </el-form-item>
67
- <el-form-item label="用户名" prop="username">
68
- <el-input v-model="addData.username" :disabled="isDisabled" style="width: 260px" />
69
- </el-form-item>
70
- <el-form-item label="姓名" prop="name">
71
- <el-input v-model="addData.name" style="width: 260px" />
72
- </el-form-item>
73
- <el-form-item v-if="!isDisabled" label="密码" prop="password">
74
- <el-input v-model="addData.password" style="width: 260px" />
75
- </el-form-item>
76
- <el-form-item label="手机号" prop="phone">
77
- <el-input v-model.number="addData.phone" style="width: 260px" />
78
- </el-form-item>
79
- <el-form-item label="单位" prop="company">
80
- <el-input v-model.number="addData.company" style="width: 260px" />
81
- </el-form-item>
82
- <el-form-item label="职务" prop="duty">
83
- <el-input v-model.number="addData.duty" style="width: 260px" />
84
- </el-form-item>
85
- <el-form-item label="管辖区域" prop="managerArea">
86
- <el-tabs v-model="activeName" type="card" @tab-click="handleClick">
87
- <el-tab-pane label="省" name="province">
88
- <el-select
89
- ref="selectAppType"
90
- v-model="addData.province"
91
- style="width: 260px"
92
- placeholder="请选择省"
93
- @remove-tag="deleteTag"
94
- @change="queryCity">
95
- <el-option
96
- v-for="item in provinceOptions"
97
- :key="item.saleid"
98
- :label="item.province"
99
- :value="item.saleid" />
100
- </el-select>
101
- </el-tab-pane>
102
- <el-tab-pane label="市" name="city">
103
- <el-row :gutter="20">
104
- <el-col :span="12">
105
- <el-select
106
- ref="selectAppType"
107
- v-model="addData.province"
108
- style="width: 260px"
109
- placeholder="请选择省"
110
- @remove-tag="deleteTag"
111
- @change="queryCity">
112
- <el-option
113
- v-for="item in provinceOptions"
114
- :key="item.saleid"
115
- :label="item.province"
116
- :value="item.saleid" />
117
- </el-select>
118
- </el-col>
119
- <el-col :span="12">
120
- <el-select
121
- ref="selectAppType"
122
- v-model="addData.city"
123
- style="width: 260px"
124
- placeholder="请选择市"
125
- @remove-tag="deleteTag"
126
- @change="queryCounty">
127
- <el-option
128
- v-for="item in cityOptions"
129
- :key="item.saleid"
130
- :label="item.city"
131
- :value="item.saleid" />
132
- </el-select>
133
- </el-col>
134
- </el-row>
135
- </el-tab-pane>
136
- <el-tab-pane label="区/县" name="county">
137
- <el-row :gutter="20">
138
- <el-col :span="8">
139
- <el-select
140
- ref="selectAppType"
141
- v-model="addData.province"
142
- style="width: 160px"
143
- placeholder="请选择省"
144
- @remove-tag="deleteTag"
145
- @change="queryCity">
146
- <el-option
147
- v-for="item in provinceOptions"
148
- :key="item.saleid"
149
- :label="item.province"
150
- :value="item.saleid" />
151
- </el-select>
152
- </el-col>
153
- <el-col :span="8">
154
- <el-select
155
- ref="selectAppType"
156
- v-model="addData.city"
157
- style="width: 160px"
158
- placeholder="请选择市"
159
- @remove-tag="deleteTag"
160
- @change="queryCounty">
161
- <el-option
162
- v-for="item in cityOptions"
163
- :key="item.saleid"
164
- :label="item.city"
165
- :value="item.saleid" />
166
- </el-select>
167
- </el-col>
168
- <el-col :span="8">
169
- <el-select
170
- ref="selectAppType"
171
- v-model="addData.county"
172
- style="width: 160px"
173
- placeholder="请选择区/县"
174
- @remove-tag="deleteTag"
175
- @change="queryHosTeam">
176
- <el-option
177
- v-for="item in countyOptions"
178
- :key="item.saleid"
179
- :label="item.county"
180
- :value="item.saleid" />
181
- </el-select>
182
- </el-col>
183
- </el-row>
184
- </el-tab-pane>
185
- <el-tab-pane label="医院/团队" name="hospital">
186
- <el-select
187
- multiple
188
- ref="selectAppType"
189
- v-model="addData.hospital"
190
- style="width: 260px"
191
- placeholder="请选择医院"
192
- @remove-tag="deleteTag"
193
- @change="changehospital">
194
- <el-option
195
- v-for="item in hospitalList"
196
- :key="item.scenceID"
197
- :label="item.hospitalName"
198
- :value="item.scenceID" />
199
- </el-select>
200
- <el-select
201
- multiple
202
- ref="selectAppType"
203
- v-model="addData.team"
204
- style="width: 260px"
205
- placeholder="请选择团队"
206
- @remove-tag="deleteTag"
207
- @change="changeTeam">
208
- <el-option
209
- v-for="item in teamList"
210
- :key="item.groupId"
211
- :label="item.groupName"
212
- :value="item.groupId" />
213
- </el-select>
214
- </el-tab-pane>
215
- </el-tabs>
216
- </el-form-item>
217
- </el-form>
218
- <div slot="footer" class="dialog-footer">
219
- <el-button type="text" @click="crud.cancelCU">取消</el-button>
220
- <el-button :loading="crud.status.cu === 2" type="primary" @click="crud.submitCU"
221
- >确定</el-button
222
- >
223
- </div>
224
- </el-dialog>
225
- <!--表格渲染-->
226
- <el-table
227
- ref="table"
228
- v-loading="crud.loading"
229
- :data="crud.data"
230
- style="width: 100%"
231
- @selection-change="crud.selectionChangeHandler">
232
- <el-table-column label="序号" type="index" align="center">
233
- <template slot-scope="scope">
234
-  <span>{{ (crud.page.page - 1) * crud.page.size + scope.$index + 1 }}</span>
235
- </template>
236
- </el-table-column>
237
- <el-table-column :show-overflow-tooltip="true" prop="name" label="姓名" />
238
- <el-table-column :show-overflow-tooltip="true" prop="username" label="用户名" />
239
- <el-table-column :show-overflow-tooltip="true" prop="roles" label="角色">
240
- <template slot-scope="scope">
241
- <div v-for="(item, index) in scope.row.roles" :key="index">
242
- {{ item.name || omitData }}
243
- </div>
244
- </template>
245
- </el-table-column>
246
- <el-table-column
247
- show-overflow-tooltip
248
- class="tc"
249
- v-for="(item, index) in checkTables"
250
- :key="index.key"
251
- :label="item.label"
252
- :prop="item.prop">
253
- <template slot-scope="scope">
254
- <div v-if="item.prop === 'administer'">
255
- {{ scope.row.administer || omitData }}
256
- </div>
257
- <div v-else>
258
- {{ scope.row[scope.column.property] || omitData }}
259
- </div>
260
- </template>
261
- </el-table-column>
262
- <el-table-column
263
- v-if="checkPer(['admin', 'user:edit', 'user:del'])"
264
- label="操作"
265
- width="250"
266
- align="center"
267
- fixed="right">
268
- <template slot-scope="scope">
269
- <urOperation
270
- :data="scope.row"
271
- :permission="permission"
272
- :disabled-dle="scope.row.id === user.id" />
273
- </template>
274
- </el-table-column>
275
- </el-table>
276
- <!--分页组件-->
277
- <pagination />
278
- </div>
279
- </template>
280
-
281
- <script>
282
- import crudHospital, { queryNation, checkHosRepetition } from '@/api/system/hospital';
283
- import crudUser, { addUsers, editUsers } from '@/api/system/user';
284
- import { getHospitals } from '@/api/system/hospital';
285
- import { getAll, getLevel } from '@/api/system/role';
286
- import CRUD, { presenter, header, form, crud } from '@crud/crud';
287
- import rrOperation from '@crud/RR.operation';
288
- import crudOperation from '@crud/CRUD.operation';
289
- import urOperation from '@crud/user/UR.operation';
290
- import pagination from '@crud/Pagination';
291
- import DateRangePicker from '@/components/DateRangePicker';
292
- import { getToken } from '@/utils/auth';
293
- import { getExamManages } from '@/api/system/examManage';
294
-
295
- import { mapGetters } from 'vuex';
296
- import '@riophae/vue-treeselect/dist/vue-treeselect.css';
297
- import { queryHospital, queryAllGroupList } from '../../../api/system/user';
298
- let formRoleSign;
299
- let userRoles = [];
300
- const defaultForm = {};
301
- let HospitalList;
302
- export default {
303
- name: 'User',
304
- components: { crudOperation, rrOperation, urOperation, pagination, DateRangePicker },
305
- cruds() {
306
- return CRUD({
307
- title: '用户',
308
- url: 'api/users',
309
- sort: ['updateTime,desc'],
310
- crudMethod: { ...crudUser },
311
- params: { loginType: defaultForm.loginType },
312
- });
313
- },
314
- mixins: [presenter(), header(), form(defaultForm), crud()],
315
- // 数据字典
316
- dicts: ['user_status', 'sex', 'job_title', 'position', 'exam_type'],
317
- data() {
318
- const validRole = (rule, value, callback) => {
319
- if (this.roleDatas.length <= 0) {
320
- callback(new Error('请选择角色'));
321
- }
322
- {
323
- callback();
324
- }
325
- };
326
- const managerAreaRequried = (rule, value, callback) => {
327
- console.log(this.addData.managerArea, this.addData.managerArea);
328
- if (
329
- this.addData.province === '' &&
330
- this.addData.city === '' &&
331
- this.addData.county === '' &&
332
- this.addData.hospital.length === 0 &&
333
- this.addData.team.length === 0
334
- ) {
335
- callback(new Error('请选择管辖区域'));
336
- } else {
337
- callback();
338
- }
339
- };
340
- return {
341
- height: document.documentElement.clientHeight - 180 + 'px;',
342
- level: 3,
343
- roles: [],
344
- //roleDatas: [], // 多选时使用
345
- defaultProps: { children: 'children', label: 'name', isLeaf: 'leaf' },
346
- permission: {
347
- add: ['admin', 'user:add'],
348
- edit: ['admin', 'user:edit'],
349
- del: ['admin', 'user:del'],
350
- },
351
- enabledTypeOptions: [
352
- { key: 'true', display_name: '启用' },
353
- { key: 'false', display_name: '禁用' },
354
- ],
355
- rules: {
356
- username: [
357
- { required: true, message: '请输入用户名', trigger: 'blur' },
358
- { min: 2, max: 20, message: '长度在 2 到 20 个字符', trigger: 'blur' },
359
- ],
360
- name: [
361
- { required: true, message: '请输入姓名', trigger: 'blur' },
362
- { min: 2, max: 20, message: '长度在 2 到 20 个字符', trigger: 'blur' },
363
- ],
364
-
365
- roleDatas: [
366
- { required: true, message: '请选择角色', trigger: 'blur', validator: validRole },
367
- ],
368
- managerArea: [{ required: true, validator: managerAreaRequried, trigger: 'change' }],
369
- password: [{ required: true, message: '请输入密码', trigger: 'blur' }],
370
- },
371
- headers: { Authorization: getToken() },
372
- sexDictTypeDropDown: [],
373
- hospitalList: [],
374
- signPath: null,
375
- idCardFront: null,
376
- idCardBack: null,
377
- doctorLicence: null,
378
- multiplelimit: 1,
379
- radio: 1,
380
- examModality: [],
381
- checkAll: false,
382
- modalityOptions: [],
383
- activeName: 'province',
384
- provinceOptions: [],
385
- cityOptions: [],
386
- countyOptions: [],
387
- addData: {
388
- roleId: [],
389
- roleSign: '',
390
- phone: '',
391
- username: '',
392
- name: '',
393
- company: '',
394
- duty: '',
395
- managerArea: '',
396
- province: '',
397
- city: '',
398
- county: '',
399
- hospital: [],
400
- password: '',
401
- team: [],
402
- },
403
- params: [],
404
- isDisabled: false,
405
- teamList: [],
406
- roleDatas: [],
407
- checkTables: [
408
- { label: '管辖区域', prop: 'administer' },
409
- { label: '更新时间', prop: 'updateTime' },
410
- ],
411
- omitData: '-',
412
- hosName: [],
413
- currentDetail: {},
414
- };
415
- },
416
- computed: {
417
- ...mapGetters(['user', 'baseApi', 'fileUploadApi']),
418
-
419
- roleSign() {
420
- this.newroleSign = this.$store.state.user.user.roleSign;
421
- return this.$store.state.user.user.roleSign;
422
- },
423
- id() {
424
- return this.$store.state.user.user.id;
425
- },
426
- },
427
-
428
- created() {
429
- this.crud.msg.add = '新增成功';
430
- this.getRoles();
431
- this.queryHospital();
432
- },
433
- mounted: function () {
434
- const that = this;
435
- window.onresize = function temp() {
436
- that.height = document.documentElement.clientHeight - 180 + 'px;';
437
- };
438
- // this.getHospitalList()
439
- },
440
- methods: {
441
- handleClick(tab) {
442
- if (tab.name === 'county') {
443
- this.newroleSign = 3;
444
- this.addData.city = '';
445
- this.addData.county = '';
446
- } else if (tab.name === 'city') {
447
- this.addData.province = null;
448
- this.newroleSign = 2;
449
- this.addData.city = '';
450
- this.addData.county = null;
451
- this.addData.roleId = [];
452
- } else if (tab.name === 'province') {
453
- this.newroleSign = 1;
454
- this.addData.city = null;
455
- this.addData.county = null;
456
- } else if (tab.name === 'hospital') {
457
- this.newroleSign = 4;
458
- this.addData.city = null;
459
- this.addData.county = null;
460
- this.addData.province = null;
461
- }
462
- },
463
- queryProvince() {
464
- queryNation({ parent: 1 }).then(res => {
465
- console.log(res.content, 'res.content');
466
- this.provinceOptions = res.content;
467
- this.addData.province = res.content[0].saleid;
468
- this.queryCity(res.content[0].saleid);
469
- });
470
- },
471
- async queryCity(row) {
472
- this.cityOptions = [];
473
- this.countyOptions = [];
474
- await queryNation({ parent: row }).then(res => {
475
- this.cityOptions = res.content;
476
- });
477
- },
478
- async queryCounty(row) {
479
- await queryNation({ parent: row }).then(res => {
480
- this.countyOptions = res.content;
481
- });
482
- },
483
- async queryHosTeam(row) {
484
- console.log(row);
485
- console.log(this.hospitalList);
486
- },
487
- //查询医院
488
- queryHospital() {
489
- const params = {};
490
- queryHospital(params).then(res => {
491
- this.hospitalList = res.content;
492
- HospitalList = JSON.stringify(res.content);
493
- console.log(this.hospitalList, 'this.hospitalList123');
494
- });
495
- queryAllGroupList(params).then(res => {
496
- console.log(res.content);
497
- this.teamList = res.content;
498
- });
499
- },
500
- changehospital(row) {
501
- console.log(row, 123);
502
- this.hosName = [];
503
- console.log(' this.hospitalList', this.hospitalList);
504
- row.forEach((i, v) => {
505
- i = String(i);
506
- // debugger
507
- this.hospitalList = JSON.parse(HospitalList);
508
- this.hospitalList.forEach((item, index) => {
509
- if (item.scenceID === i) {
510
- const newitem = item;
511
- newitem['hospitalId'] = item['scenceID'];
512
- delete item['scenceID'];
513
- this.hosName.push(newitem);
514
- }
515
- });
516
- });
517
- console.log(this.hosName, 345);
518
- },
519
- changeTeam(row) {
520
- this.teamName = [];
521
- row.forEach((i, v) => {
522
- i = String(i);
523
- this.teamList.forEach((item, index) => {
524
- if (item.groupId === i) {
525
- this.teamName.push(item);
526
- }
527
- });
528
- });
529
- console.log(this.teamName);
530
- },
531
- changeRole(value) {
532
- console.log(value);
533
- userRoles = [];
534
- value.forEach(function (data, index) {
535
- const role = { id: data };
536
- userRoles.push(role);
537
- });
538
- this.addData.roleId = userRoles;
539
- console.log(' this.addData.roleId ', this.addData.roleId);
540
- this.$forceUpdate();
541
- let _this = this;
542
- setTimeout(function () {
543
- _this.$refs.selectAppType.blur();
544
- }, 50);
545
- },
546
- deleteTag(value) {
547
- userRoles.forEach(function (data, index) {
548
- if (data.id === value) {
549
- userRoles.splice(index, value);
550
- }
551
- });
552
- this.addData.roleId = userRoles;
553
- this.$forceUpdate();
554
- },
555
- // 刷新 - 之前
556
- [CRUD.HOOK.beforeRefresh](crud, form) {},
557
- // 新增与编辑前做的操作
558
- [CRUD.HOOK.afterToCU](crud, form) {
559
- console.log(form, 'form');
560
- this.currentDetail = form;
561
- this.queryProvince();
562
- this.queryCity(this.addData.province);
563
- this.queryCounty(this.addData.city);
564
- this.queryHospital();
565
-
566
- //回显数据
567
- },
568
- dataEcho(form) {
569
- formRoleSign = form.roleSign;
570
- if (form.roleSign === 1) this.activeName = 'province';
571
- if (form.roleSign === 2) this.activeName = 'city';
572
- if (form.roleSign === 3) this.activeName = 'county';
573
- if (form.roleSign === 4) this.activeName = 'hospital';
574
- this.addData.roleSign = form.roleSign;
575
- this.addData.phone = form.phone;
576
- this.addData.username = form.username;
577
- this.addData.name = form.name;
578
- this.addData.company = form.company;
579
- this.addData.duty = form.duty;
580
- this.addData.hospital = form.hospitalIds;
581
- this.addData.team = form.groupIds;
582
- this.addData.id = form.id;
583
- this.addData.roleId = form.roles;
584
- if (form.hospitalIds) this.changehospital(form.hospitalIds);
585
- if (form.groupIds) this.changeTeam(form.groupIds);
586
- this.newroleSign = form.roleSign;
587
- if (form.pcd && form.pcd.length !== 0) this.addData.county = form.pcd[0].county;
588
- if (form.pcd && form.pcd.length !== 0) this.addData.city = form.pcd[0].city;
589
- if (form.pcd && form.pcd.length !== 0) this.addData.province = form.pcd[0].province;
590
- if (form.pcd && form.pcd.length !== 0) this.addData.password = form.pcd[0].password;
591
- this.$forceUpdate();
592
- },
593
- // 新增前将多选的值设置为空
594
- [CRUD.HOOK.beforeToAdd]() {
595
- this.isDisabled = false;
596
- console.log(' this.isDisabled', this.isDisabled);
597
- this.roleDatas = [];
598
- Object.keys(this.addData).forEach(key => {
599
- this.addData[key] = '';
600
- });
601
- },
602
- [CRUD.HOOK.afterAddCancel]() {
603
- this.signPath = null;
604
- this.idCardFront = null;
605
- this.idCardBack = null;
606
- this.doctorLicence = null;
607
- },
608
- [CRUD.HOOK.afterEditCancel]() {
609
- this.signPath = null;
610
- this.idCardFront = null;
611
- this.idCardBack = null;
612
- this.doctorLicence = null;
613
- },
614
- [CRUD.HOOK.afterSubmit]() {
615
- this.activeName = 'province';
616
- this.crud.refresh();
617
- this.signPath = null;
618
- this.idCardFront = null;
619
- this.idCardBack = null;
620
- this.doctorLicence = null;
621
- },
622
- // 初始化编辑时候的角色与岗位
623
- [CRUD.HOOK.beforeToEdit](crud, form) {
624
- this.dataEcho(form);
625
- this.isDisabled = true;
626
- // this.signPath = this.form.signPath;
627
- // this.idCardFront = this.form.idCardFront;
628
- // this.idCardBack = this.form.idCardBack;
629
- // this.doctorLicence = this.form.doctorLicence;
630
- this.roleDatas = [];
631
- this.addData.hospital = [];
632
- this.addData.team = [];
633
- const _this = this;
634
- userRoles = [];
635
- if (form.roles) {
636
- form.roles.forEach(function (role, index) {
637
- _this.roleDatas.push(role.id);
638
- const rol = { id: role.id };
639
- userRoles.push(rol);
640
- });
641
- }
642
-
643
- if (form.hospitalIds) {
644
- form.hospitalIds.forEach(function (item, index) {
645
- if (item !== null) _this.addData.hospital.push(String(item));
646
- console.log(_this.addData.hospital);
647
- });
648
- }
649
- if (form.groupIds) {
650
- form.groupIds.forEach(function (item, index) {
651
- if (item !== null) _this.addData.team.push(String(item));
652
- });
653
- }
654
- },
655
- // 提交前做的操作
656
- [CRUD.HOOK.afterValidateCU](crud) {
657
- console.log('提交之前');
658
- this.paramsInit();
659
- // if (this.roleDatas.length === 0) {
660
- // this.$message({
661
- // message: '角色不能为空',
662
- // type: 'warning'
663
- // })
664
- // return false
665
- // }
666
- // crud.form.roles = userRoles;
667
- // this.form.signPath = this.signPath;
668
- // this.form.idCardFront = this.idCardFront;
669
- // this.form.idCardBack = this.idCardBack;
670
- // this.form.doctorLicence = this.doctorLicence;
671
- },
672
- // 改变状态
673
- changeEnabled(data, val) {
674
- this.$confirm(
675
- '此操作将 "' + this.dict.label.user_status[val] + '" ' + data.username + ', 是否继续?',
676
- '提示',
677
- {
678
- confirmButtonText: '确定',
679
- cancelButtonText: '取消',
680
- type: 'warning',
681
- }
682
- )
683
- .then(() => {
684
- crudUser
685
- .edit(data)
686
- .then(res => {
687
- this.crud.notify(
688
- this.dict.label.user_status[val] + '成功',
689
- CRUD.NOTIFICATION_TYPE.SUCCESS
690
- );
691
- })
692
- .catch(() => {
693
- data.enabled = !data.enabled;
694
- });
695
- })
696
- .catch(() => {
697
- data.enabled = !data.enabled;
698
- });
699
- },
700
- // 获取弹窗内角色数据
701
- getRoles() {
702
- getAll({ loginType: defaultForm.loginType })
703
- .then(res => {
704
- //console.log(roles,'roles')
705
- this.roles = res;
706
- })
707
- .catch(() => {});
708
- },
709
- // 获取权限级别
710
- getRoleLevel() {
711
- getLevel()
712
- .then(res => {
713
- this.level = res.level;
714
- })
715
- .catch(() => {});
716
- },
717
- checkboxT(row, rowIndex) {
718
- return row.id !== this.user.id;
719
- },
720
- /**
721
- * 获取所有医院
722
- */
723
- // getHospitalList() {
724
- // getHospitals().then((res) => {
725
- // this.hospitalList = res.content
726
- // })
727
- // },
728
- sexFilter(sex) {
729
- return this.dict.label.sex[sex];
730
- },
731
- handleAvatarSuccess(source) {
732
- this.signPath = source.datas;
733
- },
734
- idCardFrontSuccess(source) {
735
- this.idCardFront = source.datas;
736
- },
737
- idCardBackSuccess(source) {
738
- this.idCardBack = source.datas;
739
- },
740
- doctorLicenceSuccess(source) {
741
- this.doctorLicence = source.datas;
742
- },
743
- beforeAvatarUpload(file) {
744
- const isLt2M = file.size / 1024 / 1024 < 2;
745
- if (file.type !== 'image/jpeg' && file.type !== 'image/png') {
746
- this.$message.error('上传头像图片只能是 JPG、PNG格式!');
747
- return false;
748
- }
749
- if (!isLt2M) {
750
- this.$message.error('上传头像图片大小不能超过 2MB!');
751
- return false;
752
- }
753
- return file.type && isLt2M;
754
- },
755
- getModality() {
756
- let info = {
757
- page: 0,
758
- size: 9999,
759
- type: 1,
760
- examTypeId: this.radio,
761
- };
762
- getExamManages(info).then(res => {
763
- this.examModality = res.content;
764
- this.checkAll = true;
765
- this.examModality.forEach(item => {
766
- if (this.form.modalityIds.indexOf(item.id) < 0) {
767
- this.checkAll = false;
768
- }
769
- });
770
- if (this.examModality.length === 0) {
771
- this.checkAll = false;
772
- }
773
- });
774
- },
775
- handleCheckedModalityChange(value) {
776
- this.checkAll = true;
777
- this.examModality.forEach(item => {
778
- if (value.indexOf(item.id) < 0) {
779
- this.checkAll = false;
780
- }
781
- });
782
- },
783
- handleCheckAllChange(val) {
784
- if (this.form.modalityIds.length === 0) {
785
- this.examModality.forEach(options => {
786
- this.form.modalityIds.push(options.id);
787
- });
788
- return;
789
- }
790
- for (let i = 0; i < this.form.modalityIds.length; i++) {
791
- for (let j = 0; j < this.examModality.length; j++) {
792
- if (this.checkAll) {
793
- if (this.form.modalityIds.indexOf(this.examModality[j].id) < 0) {
794
- this.form.modalityIds.push(this.examModality[j].id);
795
- }
796
- } else {
797
- if (this.form.modalityIds[i] == this.examModality[j].id) {
798
- if (this.form.modalityIds.indexOf(this.examModality[j].id) > -1) {
799
- this.form.modalityIds.splice(i, 1);
800
- }
801
- }
802
- }
803
- }
804
- }
805
- },
806
- //处理添加用户的参数
807
- paramsInit() {
808
- userRoles = [];
809
- this.roleDatas.forEach(function (data, index) {
810
- const role = { id: data };
811
- userRoles.push(role);
812
- });
813
- this.roleDatas = userRoles;
814
-
815
- this.managerArea = {
816
- province: this.addData.province,
817
- city: this.addData.city,
818
- county: this.addData.county,
819
- };
820
- if (
821
- this.addData.province === null &&
822
- this.addData.city === null &&
823
- this.addData.county === null
824
- ) {
825
- this.managerArea = null;
826
- }
827
- if (this.newroleSign !== 4) {
828
- this.teamName = [];
829
- this.hosName = [];
830
- }
831
- if (this.hosName.length != 0 || this.teamName.length != 0) this.managerArea = null;
832
- // let params = {
833
- // roles:this.roleDatas,
834
- // roleSign:this.newroleSign,
835
- // phone:this.addData.phone,
836
- // username:this.addData.username,
837
- // name:this.addData.name,
838
- // duty:this.addData.duty,
839
- // managerArea:this.managerArea,
840
- // // hospital:this.addData.hospital,
841
- // id: this.addData.id,
842
- // company:this.addData.company,
843
- // password :this.addData.password,
844
- // hospitalIds:this.hosName,
845
- // groupIds:this.teamName
846
- // }
847
-
848
- ((this.form.roles = this.roleDatas),
849
- (this.form.roleSign = this.newroleSign),
850
- (this.form.phone = this.addData.phone),
851
- (this.form.username = this.addData.username),
852
- (this.form.name = this.addData.name),
853
- (this.form.duty = this.addData.duty),
854
- (this.form.managerArea = this.managerArea),
855
- (this.form.id = this.addData.id),
856
- (this.form.company = this.addData.company),
857
- (this.form.password = this.addData.password),
858
- (this.form.hospitalIds = this.hosName),
859
- (this.form.groupIds = this.teamName));
860
- // this.form.username = this.currentDetail.username
861
- },
862
- //确定添加用户
863
- async submitAdd() {
864
- await this.paramsInit();
865
- this.$refs.form.validate(async valid => {
866
- if (valid) {
867
- addUsers(this.params).then(res => {
868
- if (res === undefined) this.$message.success('添加成功');
869
- this.crud.status.cu = 1;
870
- this.$forceUpdate();
871
- });
872
- } else {
873
- console.log('error submit!!');
874
- return false;
875
- }
876
- });
877
- },
878
- //确定修改用户
879
- async submitedit() {
880
- await this.paramsInit();
881
- this.$refs.form.validate(async valid => {
882
- if (valid) {
883
- editUsers(this.params).then(res => {
884
- if (res === undefined) this.$message.success('添加成功');
885
- this.crud.status.cu = 1;
886
- this.$forceUpdate();
887
- });
888
- } else {
889
- console.log('error submit!!');
890
- return false;
891
- }
892
- });
893
- },
894
- },
895
- };
896
- </script>
897
-
898
- <style rel="stylesheet/scss" lang="scss" scoped>
899
- ::v-deep .vue-treeselect__control,
900
- ::v-deep .vue-treeselect__placeholder,
901
- ::v-deep .vue-treeselect__single-value {
902
- height: 30px;
903
- line-height: 30px;
904
- }
905
- .upload .el-upload {
906
- border: 1px dashed #d9d9d9;
907
- border-radius: 6px;
908
- cursor: pointer;
909
- position: relative;
910
- overflow: hidden;
911
- }
912
- .upload .el-upload:hover {
913
- border-color: #409eff;
914
- }
915
- .upload-icon {
916
- font-size: 28px;
917
- color: #8c939d;
918
- width: 178px;
919
- height: 178px;
920
- line-height: 178px;
921
- text-align: center;
922
- }
923
- .avatar {
924
- width: 178px;
925
- height: 178px;
926
- display: block;
927
- }
928
- </style>
1
+ <template>
2
+ <div class="app-container">
3
+ <!--工具栏-->
4
+ <div class="head-container">
5
+ <div v-if="crud.props.searchToggle">
6
+ <!-- 搜索 -->
7
+ <el-input
8
+ v-model="query.name"
9
+ clearable
10
+ size="small"
11
+ placeholder="请输入姓名"
12
+ style="width: 200px"
13
+ class="filter-item"
14
+ @keyup.enter.native="crud.toQuery" />
15
+ <el-select
16
+ v-model="query.roleId"
17
+ clearable
18
+ size="small"
19
+ placeholder="请选择角色"
20
+ class="filter-item"
21
+ style="width: 150px"
22
+ @change="crud.toQuery">
23
+ <el-option
24
+ v-for="item in roles"
25
+ :key="item.name"
26
+ :disabled="level !== 1 && item.level <= level"
27
+ :label="item.name"
28
+ :value="item.id" />
29
+ </el-select>
30
+ <rrOperation />
31
+ </div>
32
+ <crudOperation show="" :permission="permission" />
33
+ </div>
34
+ <!--表单渲染-->
35
+ <el-dialog
36
+ append-to-body
37
+ :close-on-click-modal="false"
38
+ :before-close="crud.cancelCU"
39
+ :visible.sync="crud.status.cu > 0"
40
+ :title="crud.status.title"
41
+ width="850px">
42
+ <el-form
43
+ ref="form"
44
+ :inline="true"
45
+ :model="addData"
46
+ :rules="rules"
47
+ size="small"
48
+ label-width="100px">
49
+ <el-form-item label="角色" prop="roleDatas">
50
+ <el-select
51
+ :multiple-limit="multiplelimit"
52
+ ref="selectAppType"
53
+ v-model="roleDatas"
54
+ style="width: 260px"
55
+ multiple
56
+ placeholder="请选择"
57
+ @remove-tag="deleteTag"
58
+ @change="changeRole">
59
+ <el-option
60
+ v-for="item in roles"
61
+ :key="item.name"
62
+ :disabled="level !== 1 && item.level <= level"
63
+ :label="item.name"
64
+ :value="item.id" />
65
+ </el-select>
66
+ </el-form-item>
67
+ <el-form-item label="用户名" prop="username">
68
+ <el-input v-model="addData.username" :disabled="isDisabled" style="width: 260px" />
69
+ </el-form-item>
70
+ <el-form-item label="姓名" prop="name">
71
+ <el-input v-model="addData.name" style="width: 260px" />
72
+ </el-form-item>
73
+ <el-form-item v-if="!isDisabled" label="密码" prop="password">
74
+ <el-input v-model="addData.password" style="width: 260px" />
75
+ </el-form-item>
76
+ <el-form-item label="手机号" prop="phone">
77
+ <el-input v-model.number="addData.phone" style="width: 260px" />
78
+ </el-form-item>
79
+ <el-form-item label="单位" prop="company">
80
+ <el-input v-model.number="addData.company" style="width: 260px" />
81
+ </el-form-item>
82
+ <el-form-item label="职务" prop="duty">
83
+ <el-input v-model.number="addData.duty" style="width: 260px" />
84
+ </el-form-item>
85
+ <el-form-item label="管辖区域" prop="managerArea">
86
+ <el-tabs v-model="activeName" type="card" @tab-click="handleClick">
87
+ <el-tab-pane label="省" name="province">
88
+ <el-select
89
+ ref="selectAppType"
90
+ v-model="addData.province"
91
+ style="width: 260px"
92
+ placeholder="请选择省"
93
+ @remove-tag="deleteTag"
94
+ @change="queryCity">
95
+ <el-option
96
+ v-for="item in provinceOptions"
97
+ :key="item.saleid"
98
+ :label="item.province"
99
+ :value="item.saleid" />
100
+ </el-select>
101
+ </el-tab-pane>
102
+ <el-tab-pane label="市" name="city">
103
+ <el-row :gutter="20">
104
+ <el-col :span="12">
105
+ <el-select
106
+ ref="selectAppType"
107
+ v-model="addData.province"
108
+ style="width: 260px"
109
+ placeholder="请选择省"
110
+ @remove-tag="deleteTag"
111
+ @change="queryCity">
112
+ <el-option
113
+ v-for="item in provinceOptions"
114
+ :key="item.saleid"
115
+ :label="item.province"
116
+ :value="item.saleid" />
117
+ </el-select>
118
+ </el-col>
119
+ <el-col :span="12">
120
+ <el-select
121
+ ref="selectAppType"
122
+ v-model="addData.city"
123
+ style="width: 260px"
124
+ placeholder="请选择市"
125
+ @remove-tag="deleteTag"
126
+ @change="queryCounty">
127
+ <el-option
128
+ v-for="item in cityOptions"
129
+ :key="item.saleid"
130
+ :label="item.city"
131
+ :value="item.saleid" />
132
+ </el-select>
133
+ </el-col>
134
+ </el-row>
135
+ </el-tab-pane>
136
+ <el-tab-pane label="区/县" name="county">
137
+ <el-row :gutter="20">
138
+ <el-col :span="8">
139
+ <el-select
140
+ ref="selectAppType"
141
+ v-model="addData.province"
142
+ style="width: 160px"
143
+ placeholder="请选择省"
144
+ @remove-tag="deleteTag"
145
+ @change="queryCity">
146
+ <el-option
147
+ v-for="item in provinceOptions"
148
+ :key="item.saleid"
149
+ :label="item.province"
150
+ :value="item.saleid" />
151
+ </el-select>
152
+ </el-col>
153
+ <el-col :span="8">
154
+ <el-select
155
+ ref="selectAppType"
156
+ v-model="addData.city"
157
+ style="width: 160px"
158
+ placeholder="请选择市"
159
+ @remove-tag="deleteTag"
160
+ @change="queryCounty">
161
+ <el-option
162
+ v-for="item in cityOptions"
163
+ :key="item.saleid"
164
+ :label="item.city"
165
+ :value="item.saleid" />
166
+ </el-select>
167
+ </el-col>
168
+ <el-col :span="8">
169
+ <el-select
170
+ ref="selectAppType"
171
+ v-model="addData.county"
172
+ style="width: 160px"
173
+ placeholder="请选择区/县"
174
+ @remove-tag="deleteTag"
175
+ @change="queryHosTeam">
176
+ <el-option
177
+ v-for="item in countyOptions"
178
+ :key="item.saleid"
179
+ :label="item.county"
180
+ :value="item.saleid" />
181
+ </el-select>
182
+ </el-col>
183
+ </el-row>
184
+ </el-tab-pane>
185
+ <el-tab-pane label="医院/团队" name="hospital">
186
+ <el-select
187
+ multiple
188
+ ref="selectAppType"
189
+ v-model="addData.hospital"
190
+ style="width: 260px"
191
+ placeholder="请选择医院"
192
+ @remove-tag="deleteTag"
193
+ @change="changehospital">
194
+ <el-option
195
+ v-for="item in hospitalList"
196
+ :key="item.scenceID"
197
+ :label="item.hospitalName"
198
+ :value="item.scenceID" />
199
+ </el-select>
200
+ <el-select
201
+ multiple
202
+ ref="selectAppType"
203
+ v-model="addData.team"
204
+ style="width: 260px"
205
+ placeholder="请选择团队"
206
+ @remove-tag="deleteTag"
207
+ @change="changeTeam">
208
+ <el-option
209
+ v-for="item in teamList"
210
+ :key="item.groupId"
211
+ :label="item.groupName"
212
+ :value="item.groupId" />
213
+ </el-select>
214
+ </el-tab-pane>
215
+ </el-tabs>
216
+ </el-form-item>
217
+ </el-form>
218
+ <div slot="footer" class="dialog-footer">
219
+ <el-button type="text" @click="crud.cancelCU">取消</el-button>
220
+ <el-button :loading="crud.status.cu === 2" type="primary" @click="crud.submitCU"
221
+ >确定</el-button
222
+ >
223
+ </div>
224
+ </el-dialog>
225
+ <!--表格渲染-->
226
+ <el-table
227
+ ref="table"
228
+ v-loading="crud.loading"
229
+ :data="crud.data"
230
+ style="width: 100%"
231
+ @selection-change="crud.selectionChangeHandler">
232
+ <el-table-column label="序号" type="index" align="center">
233
+ <template slot-scope="scope">
234
+  <span>{{ (crud.page.page - 1) * crud.page.size + scope.$index + 1 }}</span>
235
+ </template>
236
+ </el-table-column>
237
+ <el-table-column :show-overflow-tooltip="true" prop="name" label="姓名" />
238
+ <el-table-column :show-overflow-tooltip="true" prop="username" label="用户名" />
239
+ <el-table-column :show-overflow-tooltip="true" prop="roles" label="角色">
240
+ <template slot-scope="scope">
241
+ <div v-for="(item, index) in scope.row.roles" :key="index">
242
+ {{ item.name || omitData }}
243
+ </div>
244
+ </template>
245
+ </el-table-column>
246
+ <el-table-column
247
+ show-overflow-tooltip
248
+ class="tc"
249
+ v-for="(item, index) in checkTables"
250
+ :key="index.key"
251
+ :label="item.label"
252
+ :prop="item.prop">
253
+ <template slot-scope="scope">
254
+ <div v-if="item.prop === 'administer'">
255
+ {{ scope.row.administer || omitData }}
256
+ </div>
257
+ <div v-else>
258
+ {{ scope.row[scope.column.property] || omitData }}
259
+ </div>
260
+ </template>
261
+ </el-table-column>
262
+ <el-table-column
263
+ v-if="checkPer(['admin', 'user:edit', 'user:del'])"
264
+ label="操作"
265
+ width="250"
266
+ align="center"
267
+ fixed="right">
268
+ <template slot-scope="scope">
269
+ <urOperation
270
+ :data="scope.row"
271
+ :permission="permission"
272
+ :disabled-dle="scope.row.id === user.id" />
273
+ </template>
274
+ </el-table-column>
275
+ </el-table>
276
+ <!--分页组件-->
277
+ <pagination />
278
+ </div>
279
+ </template>
280
+
281
+ <script>
282
+ import crudHospital, { queryNation, checkHosRepetition } from '@/api/system/hospital';
283
+ import crudUser, { addUsers, editUsers } from '@/api/system/user';
284
+ import { getHospitals } from '@/api/system/hospital';
285
+ import { getAll, getLevel } from '@/api/system/role';
286
+ import CRUD, { presenter, header, form, crud } from '@crud/crud';
287
+ import rrOperation from '@crud/RR.operation';
288
+ import crudOperation from '@crud/CRUD.operation';
289
+ import urOperation from '@crud/user/UR.operation';
290
+ import pagination from '@crud/Pagination';
291
+ import DateRangePicker from '@/components/DateRangePicker';
292
+ import { getToken } from '@/utils/auth';
293
+ import { getExamManages } from '@/api/system/examManage';
294
+
295
+ import { mapGetters } from 'vuex';
296
+ import '@riophae/vue-treeselect/dist/vue-treeselect.css';
297
+ import { queryHospital, queryAllGroupList } from '../../../api/system/user';
298
+ let formRoleSign;
299
+ let userRoles = [];
300
+ const defaultForm = {};
301
+ let HospitalList;
302
+ export default {
303
+ name: 'User',
304
+ components: { crudOperation, rrOperation, urOperation, pagination, DateRangePicker },
305
+ cruds() {
306
+ return CRUD({
307
+ title: '用户',
308
+ url: 'api/users',
309
+ sort: ['updateTime,desc'],
310
+ crudMethod: { ...crudUser },
311
+ params: { loginType: defaultForm.loginType },
312
+ });
313
+ },
314
+ mixins: [presenter(), header(), form(defaultForm), crud()],
315
+ // 数据字典
316
+ dicts: ['user_status', 'sex', 'job_title', 'position', 'exam_type'],
317
+ data() {
318
+ const validRole = (rule, value, callback) => {
319
+ if (this.roleDatas.length <= 0) {
320
+ callback(new Error('请选择角色'));
321
+ }
322
+ {
323
+ callback();
324
+ }
325
+ };
326
+ const managerAreaRequried = (rule, value, callback) => {
327
+ console.log(this.addData.managerArea, this.addData.managerArea);
328
+ if (
329
+ this.addData.province === '' &&
330
+ this.addData.city === '' &&
331
+ this.addData.county === '' &&
332
+ this.addData.hospital.length === 0 &&
333
+ this.addData.team.length === 0
334
+ ) {
335
+ callback(new Error('请选择管辖区域'));
336
+ } else {
337
+ callback();
338
+ }
339
+ };
340
+ return {
341
+ height: document.documentElement.clientHeight - 180 + 'px;',
342
+ level: 3,
343
+ roles: [],
344
+ //roleDatas: [], // 多选时使用
345
+ defaultProps: { children: 'children', label: 'name', isLeaf: 'leaf' },
346
+ permission: {
347
+ add: ['admin', 'user:add'],
348
+ edit: ['admin', 'user:edit'],
349
+ del: ['admin', 'user:del'],
350
+ },
351
+ enabledTypeOptions: [
352
+ { key: 'true', display_name: '启用' },
353
+ { key: 'false', display_name: '禁用' },
354
+ ],
355
+ rules: {
356
+ username: [
357
+ { required: true, message: '请输入用户名', trigger: 'blur' },
358
+ { min: 2, max: 20, message: '长度在 2 到 20 个字符', trigger: 'blur' },
359
+ ],
360
+ name: [
361
+ { required: true, message: '请输入姓名', trigger: 'blur' },
362
+ { min: 2, max: 20, message: '长度在 2 到 20 个字符', trigger: 'blur' },
363
+ ],
364
+
365
+ roleDatas: [
366
+ { required: true, message: '请选择角色', trigger: 'blur', validator: validRole },
367
+ ],
368
+ managerArea: [{ required: true, validator: managerAreaRequried, trigger: 'change' }],
369
+ password: [{ required: true, message: '请输入密码', trigger: 'blur' }],
370
+ },
371
+ headers: { Authorization: getToken() },
372
+ sexDictTypeDropDown: [],
373
+ hospitalList: [],
374
+ signPath: null,
375
+ idCardFront: null,
376
+ idCardBack: null,
377
+ doctorLicence: null,
378
+ multiplelimit: 1,
379
+ radio: 1,
380
+ examModality: [],
381
+ checkAll: false,
382
+ modalityOptions: [],
383
+ activeName: 'province',
384
+ provinceOptions: [],
385
+ cityOptions: [],
386
+ countyOptions: [],
387
+ addData: {
388
+ roleId: [],
389
+ roleSign: '',
390
+ phone: '',
391
+ username: '',
392
+ name: '',
393
+ company: '',
394
+ duty: '',
395
+ managerArea: '',
396
+ province: '',
397
+ city: '',
398
+ county: '',
399
+ hospital: [],
400
+ password: '',
401
+ team: [],
402
+ },
403
+ params: [],
404
+ isDisabled: false,
405
+ teamList: [],
406
+ roleDatas: [],
407
+ checkTables: [
408
+ { label: '管辖区域', prop: 'administer' },
409
+ { label: '更新时间', prop: 'updateTime' },
410
+ ],
411
+ omitData: '-',
412
+ hosName: [],
413
+ currentDetail: {},
414
+ };
415
+ },
416
+ computed: {
417
+ ...mapGetters(['user', 'baseApi', 'fileUploadApi']),
418
+
419
+ roleSign() {
420
+ this.newroleSign = this.$store.state.user.user.roleSign;
421
+ return this.$store.state.user.user.roleSign;
422
+ },
423
+ id() {
424
+ return this.$store.state.user.user.id;
425
+ },
426
+ },
427
+
428
+ created() {
429
+ this.crud.msg.add = '新增成功';
430
+ this.getRoles();
431
+ this.queryHospital();
432
+ },
433
+ mounted: function () {
434
+ const that = this;
435
+ window.onresize = function temp() {
436
+ that.height = document.documentElement.clientHeight - 180 + 'px;';
437
+ };
438
+ // this.getHospitalList()
439
+ },
440
+ methods: {
441
+ handleClick(tab) {
442
+ if (tab.name === 'county') {
443
+ this.newroleSign = 3;
444
+ this.addData.city = '';
445
+ this.addData.county = '';
446
+ } else if (tab.name === 'city') {
447
+ this.addData.province = null;
448
+ this.newroleSign = 2;
449
+ this.addData.city = '';
450
+ this.addData.county = null;
451
+ this.addData.roleId = [];
452
+ } else if (tab.name === 'province') {
453
+ this.newroleSign = 1;
454
+ this.addData.city = null;
455
+ this.addData.county = null;
456
+ } else if (tab.name === 'hospital') {
457
+ this.newroleSign = 4;
458
+ this.addData.city = null;
459
+ this.addData.county = null;
460
+ this.addData.province = null;
461
+ }
462
+ },
463
+ queryProvince() {
464
+ queryNation({ parent: 1 }).then(res => {
465
+ console.log(res.content, 'res.content');
466
+ this.provinceOptions = res.content;
467
+ this.addData.province = res.content[0].saleid;
468
+ this.queryCity(res.content[0].saleid);
469
+ });
470
+ },
471
+ async queryCity(row) {
472
+ this.cityOptions = [];
473
+ this.countyOptions = [];
474
+ await queryNation({ parent: row }).then(res => {
475
+ this.cityOptions = res.content;
476
+ });
477
+ },
478
+ async queryCounty(row) {
479
+ await queryNation({ parent: row }).then(res => {
480
+ this.countyOptions = res.content;
481
+ });
482
+ },
483
+ async queryHosTeam(row) {
484
+ console.log(row);
485
+ console.log(this.hospitalList);
486
+ },
487
+ //查询医院
488
+ queryHospital() {
489
+ const params = {};
490
+ queryHospital(params).then(res => {
491
+ this.hospitalList = res.content;
492
+ HospitalList = JSON.stringify(res.content);
493
+ console.log(this.hospitalList, 'this.hospitalList123');
494
+ });
495
+ queryAllGroupList(params).then(res => {
496
+ console.log(res.content);
497
+ this.teamList = res.content;
498
+ });
499
+ },
500
+ changehospital(row) {
501
+ console.log(row, 123);
502
+ this.hosName = [];
503
+ console.log(' this.hospitalList', this.hospitalList);
504
+ row.forEach((i, v) => {
505
+ i = String(i);
506
+ // debugger
507
+ this.hospitalList = JSON.parse(HospitalList);
508
+ this.hospitalList.forEach((item, index) => {
509
+ if (item.scenceID === i) {
510
+ const newitem = item;
511
+ newitem['hospitalId'] = item['scenceID'];
512
+ delete item['scenceID'];
513
+ this.hosName.push(newitem);
514
+ }
515
+ });
516
+ });
517
+ console.log(this.hosName, 345);
518
+ },
519
+ changeTeam(row) {
520
+ this.teamName = [];
521
+ row.forEach((i, v) => {
522
+ i = String(i);
523
+ this.teamList.forEach((item, index) => {
524
+ if (item.groupId === i) {
525
+ this.teamName.push(item);
526
+ }
527
+ });
528
+ });
529
+ console.log(this.teamName);
530
+ },
531
+ changeRole(value) {
532
+ console.log(value);
533
+ userRoles = [];
534
+ value.forEach(function (data, index) {
535
+ const role = { id: data };
536
+ userRoles.push(role);
537
+ });
538
+ this.addData.roleId = userRoles;
539
+ console.log(' this.addData.roleId ', this.addData.roleId);
540
+ this.$forceUpdate();
541
+ let _this = this;
542
+ setTimeout(function () {
543
+ _this.$refs.selectAppType.blur();
544
+ }, 50);
545
+ },
546
+ deleteTag(value) {
547
+ userRoles.forEach(function (data, index) {
548
+ if (data.id === value) {
549
+ userRoles.splice(index, value);
550
+ }
551
+ });
552
+ this.addData.roleId = userRoles;
553
+ this.$forceUpdate();
554
+ },
555
+ // 刷新 - 之前
556
+ [CRUD.HOOK.beforeRefresh](crud, form) {},
557
+ // 新增与编辑前做的操作
558
+ [CRUD.HOOK.afterToCU](crud, form) {
559
+ console.log(form, 'form');
560
+ this.currentDetail = form;
561
+ this.queryProvince();
562
+ this.queryCity(this.addData.province);
563
+ this.queryCounty(this.addData.city);
564
+ this.queryHospital();
565
+
566
+ //回显数据
567
+ },
568
+ dataEcho(form) {
569
+ formRoleSign = form.roleSign;
570
+ if (form.roleSign === 1) this.activeName = 'province';
571
+ if (form.roleSign === 2) this.activeName = 'city';
572
+ if (form.roleSign === 3) this.activeName = 'county';
573
+ if (form.roleSign === 4) this.activeName = 'hospital';
574
+ this.addData.roleSign = form.roleSign;
575
+ this.addData.phone = form.phone;
576
+ this.addData.username = form.username;
577
+ this.addData.name = form.name;
578
+ this.addData.company = form.company;
579
+ this.addData.duty = form.duty;
580
+ this.addData.hospital = form.hospitalIds;
581
+ this.addData.team = form.groupIds;
582
+ this.addData.id = form.id;
583
+ this.addData.roleId = form.roles;
584
+ if (form.hospitalIds) this.changehospital(form.hospitalIds);
585
+ if (form.groupIds) this.changeTeam(form.groupIds);
586
+ this.newroleSign = form.roleSign;
587
+ if (form.pcd && form.pcd.length !== 0) this.addData.county = form.pcd[0].county;
588
+ if (form.pcd && form.pcd.length !== 0) this.addData.city = form.pcd[0].city;
589
+ if (form.pcd && form.pcd.length !== 0) this.addData.province = form.pcd[0].province;
590
+ if (form.pcd && form.pcd.length !== 0) this.addData.password = form.pcd[0].password;
591
+ this.$forceUpdate();
592
+ },
593
+ // 新增前将多选的值设置为空
594
+ [CRUD.HOOK.beforeToAdd]() {
595
+ this.isDisabled = false;
596
+ console.log(' this.isDisabled', this.isDisabled);
597
+ this.roleDatas = [];
598
+ Object.keys(this.addData).forEach(key => {
599
+ this.addData[key] = '';
600
+ });
601
+ },
602
+ [CRUD.HOOK.afterAddCancel]() {
603
+ this.signPath = null;
604
+ this.idCardFront = null;
605
+ this.idCardBack = null;
606
+ this.doctorLicence = null;
607
+ },
608
+ [CRUD.HOOK.afterEditCancel]() {
609
+ this.signPath = null;
610
+ this.idCardFront = null;
611
+ this.idCardBack = null;
612
+ this.doctorLicence = null;
613
+ },
614
+ [CRUD.HOOK.afterSubmit]() {
615
+ this.activeName = 'province';
616
+ this.crud.refresh();
617
+ this.signPath = null;
618
+ this.idCardFront = null;
619
+ this.idCardBack = null;
620
+ this.doctorLicence = null;
621
+ },
622
+ // 初始化编辑时候的角色与岗位
623
+ [CRUD.HOOK.beforeToEdit](crud, form) {
624
+ this.dataEcho(form);
625
+ this.isDisabled = true;
626
+ // this.signPath = this.form.signPath;
627
+ // this.idCardFront = this.form.idCardFront;
628
+ // this.idCardBack = this.form.idCardBack;
629
+ // this.doctorLicence = this.form.doctorLicence;
630
+ this.roleDatas = [];
631
+ this.addData.hospital = [];
632
+ this.addData.team = [];
633
+ const _this = this;
634
+ userRoles = [];
635
+ if (form.roles) {
636
+ form.roles.forEach(function (role, index) {
637
+ _this.roleDatas.push(role.id);
638
+ const rol = { id: role.id };
639
+ userRoles.push(rol);
640
+ });
641
+ }
642
+
643
+ if (form.hospitalIds) {
644
+ form.hospitalIds.forEach(function (item, index) {
645
+ if (item !== null) _this.addData.hospital.push(String(item));
646
+ console.log(_this.addData.hospital);
647
+ });
648
+ }
649
+ if (form.groupIds) {
650
+ form.groupIds.forEach(function (item, index) {
651
+ if (item !== null) _this.addData.team.push(String(item));
652
+ });
653
+ }
654
+ },
655
+ // 提交前做的操作
656
+ [CRUD.HOOK.afterValidateCU](crud) {
657
+ console.log('提交之前');
658
+ this.paramsInit();
659
+ // if (this.roleDatas.length === 0) {
660
+ // this.$message({
661
+ // message: '角色不能为空',
662
+ // type: 'warning'
663
+ // })
664
+ // return false
665
+ // }
666
+ // crud.form.roles = userRoles;
667
+ // this.form.signPath = this.signPath;
668
+ // this.form.idCardFront = this.idCardFront;
669
+ // this.form.idCardBack = this.idCardBack;
670
+ // this.form.doctorLicence = this.doctorLicence;
671
+ },
672
+ // 改变状态
673
+ changeEnabled(data, val) {
674
+ this.$confirm(
675
+ '此操作将 "' + this.dict.label.user_status[val] + '" ' + data.username + ', 是否继续?',
676
+ '提示',
677
+ {
678
+ confirmButtonText: '确定',
679
+ cancelButtonText: '取消',
680
+ type: 'warning',
681
+ }
682
+ )
683
+ .then(() => {
684
+ crudUser
685
+ .edit(data)
686
+ .then(res => {
687
+ this.crud.notify(
688
+ this.dict.label.user_status[val] + '成功',
689
+ CRUD.NOTIFICATION_TYPE.SUCCESS
690
+ );
691
+ })
692
+ .catch(() => {
693
+ data.enabled = !data.enabled;
694
+ });
695
+ })
696
+ .catch(() => {
697
+ data.enabled = !data.enabled;
698
+ });
699
+ },
700
+ // 获取弹窗内角色数据
701
+ getRoles() {
702
+ getAll({ loginType: defaultForm.loginType })
703
+ .then(res => {
704
+ //console.log(roles,'roles')
705
+ this.roles = res;
706
+ })
707
+ .catch(() => {});
708
+ },
709
+ // 获取权限级别
710
+ getRoleLevel() {
711
+ getLevel()
712
+ .then(res => {
713
+ this.level = res.level;
714
+ })
715
+ .catch(() => {});
716
+ },
717
+ checkboxT(row, rowIndex) {
718
+ return row.id !== this.user.id;
719
+ },
720
+ /**
721
+ * 获取所有医院
722
+ */
723
+ // getHospitalList() {
724
+ // getHospitals().then((res) => {
725
+ // this.hospitalList = res.content
726
+ // })
727
+ // },
728
+ sexFilter(sex) {
729
+ return this.dict.label.sex[sex];
730
+ },
731
+ handleAvatarSuccess(source) {
732
+ this.signPath = source.datas;
733
+ },
734
+ idCardFrontSuccess(source) {
735
+ this.idCardFront = source.datas;
736
+ },
737
+ idCardBackSuccess(source) {
738
+ this.idCardBack = source.datas;
739
+ },
740
+ doctorLicenceSuccess(source) {
741
+ this.doctorLicence = source.datas;
742
+ },
743
+ beforeAvatarUpload(file) {
744
+ const isLt2M = file.size / 1024 / 1024 < 2;
745
+ if (file.type !== 'image/jpeg' && file.type !== 'image/png') {
746
+ this.$message.error('上传头像图片只能是 JPG、PNG格式!');
747
+ return false;
748
+ }
749
+ if (!isLt2M) {
750
+ this.$message.error('上传头像图片大小不能超过 2MB!');
751
+ return false;
752
+ }
753
+ return file.type && isLt2M;
754
+ },
755
+ getModality() {
756
+ let info = {
757
+ page: 0,
758
+ size: 9999,
759
+ type: 1,
760
+ examTypeId: this.radio,
761
+ };
762
+ getExamManages(info).then(res => {
763
+ this.examModality = res.content;
764
+ this.checkAll = true;
765
+ this.examModality.forEach(item => {
766
+ if (this.form.modalityIds.indexOf(item.id) < 0) {
767
+ this.checkAll = false;
768
+ }
769
+ });
770
+ if (this.examModality.length === 0) {
771
+ this.checkAll = false;
772
+ }
773
+ });
774
+ },
775
+ handleCheckedModalityChange(value) {
776
+ this.checkAll = true;
777
+ this.examModality.forEach(item => {
778
+ if (value.indexOf(item.id) < 0) {
779
+ this.checkAll = false;
780
+ }
781
+ });
782
+ },
783
+ handleCheckAllChange(val) {
784
+ if (this.form.modalityIds.length === 0) {
785
+ this.examModality.forEach(options => {
786
+ this.form.modalityIds.push(options.id);
787
+ });
788
+ return;
789
+ }
790
+ for (let i = 0; i < this.form.modalityIds.length; i++) {
791
+ for (let j = 0; j < this.examModality.length; j++) {
792
+ if (this.checkAll) {
793
+ if (this.form.modalityIds.indexOf(this.examModality[j].id) < 0) {
794
+ this.form.modalityIds.push(this.examModality[j].id);
795
+ }
796
+ } else {
797
+ if (this.form.modalityIds[i] == this.examModality[j].id) {
798
+ if (this.form.modalityIds.indexOf(this.examModality[j].id) > -1) {
799
+ this.form.modalityIds.splice(i, 1);
800
+ }
801
+ }
802
+ }
803
+ }
804
+ }
805
+ },
806
+ //处理添加用户的参数
807
+ paramsInit() {
808
+ userRoles = [];
809
+ this.roleDatas.forEach(function (data, index) {
810
+ const role = { id: data };
811
+ userRoles.push(role);
812
+ });
813
+ this.roleDatas = userRoles;
814
+
815
+ this.managerArea = {
816
+ province: this.addData.province,
817
+ city: this.addData.city,
818
+ county: this.addData.county,
819
+ };
820
+ if (
821
+ this.addData.province === null &&
822
+ this.addData.city === null &&
823
+ this.addData.county === null
824
+ ) {
825
+ this.managerArea = null;
826
+ }
827
+ if (this.newroleSign !== 4) {
828
+ this.teamName = [];
829
+ this.hosName = [];
830
+ }
831
+ if (this.hosName.length != 0 || this.teamName.length != 0) this.managerArea = null;
832
+ // let params = {
833
+ // roles:this.roleDatas,
834
+ // roleSign:this.newroleSign,
835
+ // phone:this.addData.phone,
836
+ // username:this.addData.username,
837
+ // name:this.addData.name,
838
+ // duty:this.addData.duty,
839
+ // managerArea:this.managerArea,
840
+ // // hospital:this.addData.hospital,
841
+ // id: this.addData.id,
842
+ // company:this.addData.company,
843
+ // password :this.addData.password,
844
+ // hospitalIds:this.hosName,
845
+ // groupIds:this.teamName
846
+ // }
847
+
848
+ ((this.form.roles = this.roleDatas),
849
+ (this.form.roleSign = this.newroleSign),
850
+ (this.form.phone = this.addData.phone),
851
+ (this.form.username = this.addData.username),
852
+ (this.form.name = this.addData.name),
853
+ (this.form.duty = this.addData.duty),
854
+ (this.form.managerArea = this.managerArea),
855
+ (this.form.id = this.addData.id),
856
+ (this.form.company = this.addData.company),
857
+ (this.form.password = this.addData.password),
858
+ (this.form.hospitalIds = this.hosName),
859
+ (this.form.groupIds = this.teamName));
860
+ // this.form.username = this.currentDetail.username
861
+ },
862
+ //确定添加用户
863
+ async submitAdd() {
864
+ await this.paramsInit();
865
+ this.$refs.form.validate(async valid => {
866
+ if (valid) {
867
+ addUsers(this.params).then(res => {
868
+ if (res === undefined) this.$message.success('添加成功');
869
+ this.crud.status.cu = 1;
870
+ this.$forceUpdate();
871
+ });
872
+ } else {
873
+ console.log('error submit!!');
874
+ return false;
875
+ }
876
+ });
877
+ },
878
+ //确定修改用户
879
+ async submitedit() {
880
+ await this.paramsInit();
881
+ this.$refs.form.validate(async valid => {
882
+ if (valid) {
883
+ editUsers(this.params).then(res => {
884
+ if (res === undefined) this.$message.success('添加成功');
885
+ this.crud.status.cu = 1;
886
+ this.$forceUpdate();
887
+ });
888
+ } else {
889
+ console.log('error submit!!');
890
+ return false;
891
+ }
892
+ });
893
+ },
894
+ },
895
+ };
896
+ </script>
897
+
898
+ <style rel="stylesheet/scss" lang="scss" scoped>
899
+ ::v-deep .vue-treeselect__control,
900
+ ::v-deep .vue-treeselect__placeholder,
901
+ ::v-deep .vue-treeselect__single-value {
902
+ height: 30px;
903
+ line-height: 30px;
904
+ }
905
+ .upload .el-upload {
906
+ border: 1px dashed #d9d9d9;
907
+ border-radius: 6px;
908
+ cursor: pointer;
909
+ position: relative;
910
+ overflow: hidden;
911
+ }
912
+ .upload .el-upload:hover {
913
+ border-color: #409eff;
914
+ }
915
+ .upload-icon {
916
+ font-size: 28px;
917
+ color: #8c939d;
918
+ width: 178px;
919
+ height: 178px;
920
+ line-height: 178px;
921
+ text-align: center;
922
+ }
923
+ .avatar {
924
+ width: 178px;
925
+ height: 178px;
926
+ display: block;
927
+ }
928
+ </style>