ylyx-cli 1.0.16 → 1.1.1

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