eoss-ui 0.3.97

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 (378) hide show
  1. package/CHANGELOG.md +929 -0
  2. package/README.md +30 -0
  3. package/lib/button-group.js +2857 -0
  4. package/lib/button.js +2884 -0
  5. package/lib/card.js +603 -0
  6. package/lib/cascader.js +373 -0
  7. package/lib/checkbox-group.js +3099 -0
  8. package/lib/clients.js +375 -0
  9. package/lib/config/api.js +205 -0
  10. package/lib/data-table-form.js +3848 -0
  11. package/lib/data-table.js +6315 -0
  12. package/lib/date-picker.js +2821 -0
  13. package/lib/dialog.js +3730 -0
  14. package/lib/enterprise.js +372 -0
  15. package/lib/eoss-ui.common.js +65365 -0
  16. package/lib/error-page.js +293 -0
  17. package/lib/flow-group.js +4200 -0
  18. package/lib/flow-list.js +4350 -0
  19. package/lib/flow.js +12893 -0
  20. package/lib/form.js +15635 -0
  21. package/lib/handle-user.js +2900 -0
  22. package/lib/handler.js +3118 -0
  23. package/lib/index.js +1 -0
  24. package/lib/input-number.js +2743 -0
  25. package/lib/input.js +2935 -0
  26. package/lib/label.js +411 -0
  27. package/lib/login.js +5048 -0
  28. package/lib/main.js +5816 -0
  29. package/lib/mainComp.js +6530 -0
  30. package/lib/menu.js +529 -0
  31. package/lib/nav.js +3048 -0
  32. package/lib/notify.js +1079 -0
  33. package/lib/page.js +3036 -0
  34. package/lib/pagination.js +354 -0
  35. package/lib/player.js +2904 -0
  36. package/lib/qr-code.js +2860 -0
  37. package/lib/radio-group.js +3091 -0
  38. package/lib/select-ganged.js +3242 -0
  39. package/lib/select.js +3295 -0
  40. package/lib/selector-panel.js +4425 -0
  41. package/lib/selector.js +3722 -0
  42. package/lib/sizer.js +3067 -0
  43. package/lib/steps.js +2943 -0
  44. package/lib/switch.js +2784 -0
  45. package/lib/table-form.js +6211 -0
  46. package/lib/tabs-panel.js +274 -0
  47. package/lib/tabs.js +4988 -0
  48. package/lib/theme-chalk/base.css +1 -0
  49. package/lib/theme-chalk/button-group.css +1 -0
  50. package/lib/theme-chalk/button.css +0 -0
  51. package/lib/theme-chalk/card.css +1 -0
  52. package/lib/theme-chalk/cascader.css +0 -0
  53. package/lib/theme-chalk/checkbox-group.css +1 -0
  54. package/lib/theme-chalk/clients.css +1 -0
  55. package/lib/theme-chalk/data-table-form.css +1 -0
  56. package/lib/theme-chalk/data-table.css +1 -0
  57. package/lib/theme-chalk/date-picker.css +1 -0
  58. package/lib/theme-chalk/dialog.css +1 -0
  59. package/lib/theme-chalk/enterprise.css +1 -0
  60. package/lib/theme-chalk/error-page.css +1 -0
  61. package/lib/theme-chalk/flow-chart.css +0 -0
  62. package/lib/theme-chalk/flow-group.css +1 -0
  63. package/lib/theme-chalk/flow-list.css +1 -0
  64. package/lib/theme-chalk/flow.css +1 -0
  65. package/lib/theme-chalk/fonts/iconfont.ttf +0 -0
  66. package/lib/theme-chalk/fonts/iconfont.woff +0 -0
  67. package/lib/theme-chalk/form.css +1 -0
  68. package/lib/theme-chalk/handle-user.css +1 -0
  69. package/lib/theme-chalk/handler.css +1 -0
  70. package/lib/theme-chalk/icon.css +1 -0
  71. package/lib/theme-chalk/index.css +1 -0
  72. package/lib/theme-chalk/input-number.css +0 -0
  73. package/lib/theme-chalk/input.css +1 -0
  74. package/lib/theme-chalk/label.css +1 -0
  75. package/lib/theme-chalk/login.css +1 -0
  76. package/lib/theme-chalk/main.css +1 -0
  77. package/lib/theme-chalk/mainComp.css +0 -0
  78. package/lib/theme-chalk/menu.css +1 -0
  79. package/lib/theme-chalk/nav.css +1 -0
  80. package/lib/theme-chalk/notify.css +0 -0
  81. package/lib/theme-chalk/page.css +1 -0
  82. package/lib/theme-chalk/pagination.css +1 -0
  83. package/lib/theme-chalk/player.css +1 -0
  84. package/lib/theme-chalk/qr-code.css +1 -0
  85. package/lib/theme-chalk/radio-group.css +1 -0
  86. package/lib/theme-chalk/radio.css +1 -0
  87. package/lib/theme-chalk/select-ganged.css +1 -0
  88. package/lib/theme-chalk/select.css +0 -0
  89. package/lib/theme-chalk/selector-panel.css +1 -0
  90. package/lib/theme-chalk/selector.css +1 -0
  91. package/lib/theme-chalk/sizer.css +1 -0
  92. package/lib/theme-chalk/steps.css +1 -0
  93. package/lib/theme-chalk/switch.css +1 -0
  94. package/lib/theme-chalk/table-form.css +0 -0
  95. package/lib/theme-chalk/tabs-panel.css +0 -0
  96. package/lib/theme-chalk/tabs.css +1 -0
  97. package/lib/theme-chalk/tips.css +1 -0
  98. package/lib/theme-chalk/toolbar.css +1 -0
  99. package/lib/theme-chalk/tree-group.css +1 -0
  100. package/lib/theme-chalk/tree.css +1 -0
  101. package/lib/theme-chalk/upload.css +1 -0
  102. package/lib/theme-chalk/wujie.css +0 -0
  103. package/lib/theme-chalk/wxlogin.css +1 -0
  104. package/lib/tips.js +2830 -0
  105. package/lib/toolbar.js +531 -0
  106. package/lib/tree-group.js +3373 -0
  107. package/lib/tree.js +3482 -0
  108. package/lib/upload.js +3913 -0
  109. package/lib/utils/bus.js +9 -0
  110. package/lib/utils/date-util.js +318 -0
  111. package/lib/utils/http.js +58 -0
  112. package/lib/utils/rules.js +19 -0
  113. package/lib/utils/store.js +22 -0
  114. package/lib/utils/util.js +2056 -0
  115. package/lib/wujie.js +2845 -0
  116. package/lib/wxlogin.js +2799 -0
  117. package/package.json +151 -0
  118. package/packages/button/index.js +5 -0
  119. package/packages/button/src/main.vue +264 -0
  120. package/packages/button-group/index.js +5 -0
  121. package/packages/button-group/src/main.vue +130 -0
  122. package/packages/card/index.js +5 -0
  123. package/packages/card/src/main.vue +144 -0
  124. package/packages/cascader/index.js +5 -0
  125. package/packages/cascader/src/main.vue +144 -0
  126. package/packages/checkbox-group/index.js +5 -0
  127. package/packages/checkbox-group/src/main.vue +285 -0
  128. package/packages/clients/index.js +5 -0
  129. package/packages/clients/src/main.vue +50 -0
  130. package/packages/data-table/index.js +5 -0
  131. package/packages/data-table/src/children.vue +40 -0
  132. package/packages/data-table/src/column.vue +796 -0
  133. package/packages/data-table/src/main copy.vue +1383 -0
  134. package/packages/data-table/src/main.vue +1229 -0
  135. package/packages/data-table/src/mixins/table.js +12 -0
  136. package/packages/data-table/src/sizer.vue +160 -0
  137. package/packages/data-table-form/index.js +5 -0
  138. package/packages/data-table-form/src/colgroup.vue +17 -0
  139. package/packages/data-table-form/src/main.vue +167 -0
  140. package/packages/data-table-form/src/table.vue +192 -0
  141. package/packages/data-table-form/src/tbody.vue +219 -0
  142. package/packages/data-table-form/src/thead.vue +68 -0
  143. package/packages/date-picker/index.js +5 -0
  144. package/packages/date-picker/src/main.vue +185 -0
  145. package/packages/dialog/index.js +5 -0
  146. package/packages/dialog/src/main.vue +442 -0
  147. package/packages/enterprise/index.js +5 -0
  148. package/packages/enterprise/src/main.vue +66 -0
  149. package/packages/error-page/index.js +5 -0
  150. package/packages/error-page/src/main.vue +44 -0
  151. package/packages/flow/index.js +5 -0
  152. package/packages/flow/src/component/CommonOpinions.vue +290 -0
  153. package/packages/flow/src/component/CustomPreset.vue +311 -0
  154. package/packages/flow/src/component/FileList.vue +97 -0
  155. package/packages/flow/src/component/Preset.vue +253 -0
  156. package/packages/flow/src/component/SendMsg.vue +221 -0
  157. package/packages/flow/src/component/TimeLimit.vue +190 -0
  158. package/packages/flow/src/component/taskUnionExamine.vue +507 -0
  159. package/packages/flow/src/form.vue +120 -0
  160. package/packages/flow/src/main.vue +2107 -0
  161. package/packages/flow/src/processForm.vue +866 -0
  162. package/packages/flow/src/processReject.vue +262 -0
  163. package/packages/flow/src/selectUser.vue +425 -0
  164. package/packages/flow/src/startTaskRead.vue +556 -0
  165. package/packages/flow/src/table.vue +51 -0
  166. package/packages/flow-group/index.js +5 -0
  167. package/packages/flow-group/src/main.vue +540 -0
  168. package/packages/flow-list/index.js +5 -0
  169. package/packages/flow-list/src/flow-table.vue +445 -0
  170. package/packages/flow-list/src/main.vue +456 -0
  171. package/packages/form/index.js +5 -0
  172. package/packages/form/src/main.vue +4429 -0
  173. package/packages/form/src/table.vue +1196 -0
  174. package/packages/handle-user/index.js +5 -0
  175. package/packages/handle-user/src/main.vue +122 -0
  176. package/packages/handler/index.js +5 -0
  177. package/packages/handler/src/main.vue +306 -0
  178. package/packages/input/index.js +5 -0
  179. package/packages/input/src/main.vue +307 -0
  180. package/packages/input-number/index.js +5 -0
  181. package/packages/input-number/src/main.vue +106 -0
  182. package/packages/label/index.js +5 -0
  183. package/packages/label/src/main.vue +208 -0
  184. package/packages/login/index.js +5 -0
  185. package/packages/login/src/main.vue +1193 -0
  186. package/packages/login/src/resetPassword.vue +332 -0
  187. package/packages/main/index.js +5 -0
  188. package/packages/main/src/main.vue +1496 -0
  189. package/packages/main/src/message.vue +239 -0
  190. package/packages/main/src/notice.vue +145 -0
  191. package/packages/main/src/settings.vue +105 -0
  192. package/packages/main/src/userinfo.vue +430 -0
  193. package/packages/mainComp/index.js +5 -0
  194. package/packages/mainComp/src/async-component/index.vue +85 -0
  195. package/packages/mainComp/src/main.vue +1934 -0
  196. package/packages/mainComp/src/message.vue +239 -0
  197. package/packages/mainComp/src/notice.vue +152 -0
  198. package/packages/mainComp/src/settings.vue +105 -0
  199. package/packages/mainComp/src/userinfo.vue +423 -0
  200. package/packages/menu/index.js +5 -0
  201. package/packages/menu/src/main.vue +401 -0
  202. package/packages/nav/index.js +5 -0
  203. package/packages/nav/src/main.vue +250 -0
  204. package/packages/notify/index.js +5 -0
  205. package/packages/notify/src/main.vue +538 -0
  206. package/packages/page/index.js +5 -0
  207. package/packages/page/src/main.vue +167 -0
  208. package/packages/pagination/index.js +5 -0
  209. package/packages/pagination/src/main.vue +77 -0
  210. package/packages/player/index.js +5 -0
  211. package/packages/player/src/main.vue +194 -0
  212. package/packages/qr-code/index.js +5 -0
  213. package/packages/qr-code/src/main.vue +154 -0
  214. package/packages/radio/index.js +5 -0
  215. package/packages/radio/src/main.vue +259 -0
  216. package/packages/radio-group/index.js +6 -0
  217. package/packages/radio-group/src/main.vue +267 -0
  218. package/packages/select/index.js +5 -0
  219. package/packages/select/src/main.vue +683 -0
  220. package/packages/select-ganged/index.js +5 -0
  221. package/packages/select-ganged/src/main.vue +686 -0
  222. package/packages/selector/index.js +5 -0
  223. package/packages/selector/src/main.vue +588 -0
  224. package/packages/selector-panel/index.js +5 -0
  225. package/packages/selector-panel/src/main.vue +968 -0
  226. package/packages/selector-panel/src/selection.vue +142 -0
  227. package/packages/selector-panel/src/tree.vue +129 -0
  228. package/packages/sizer/index.js +5 -0
  229. package/packages/sizer/src/main.vue +254 -0
  230. package/packages/steps/index.js +5 -0
  231. package/packages/steps/src/main.vue +175 -0
  232. package/packages/switch/index.js +5 -0
  233. package/packages/switch/src/main.vue +154 -0
  234. package/packages/table-form/index.js +5 -0
  235. package/packages/tabs/index.js +5 -0
  236. package/packages/tabs/src/main.vue +749 -0
  237. package/packages/tabs-panel/index.js +5 -0
  238. package/packages/tabs-panel/src/main.vue +18 -0
  239. package/packages/theme-chalk/README.md +33 -0
  240. package/packages/theme-chalk/lib/base.css +1 -0
  241. package/packages/theme-chalk/lib/button-group.css +1 -0
  242. package/packages/theme-chalk/lib/button.css +0 -0
  243. package/packages/theme-chalk/lib/card.css +1 -0
  244. package/packages/theme-chalk/lib/cascader.css +0 -0
  245. package/packages/theme-chalk/lib/checkbox-group.css +1 -0
  246. package/packages/theme-chalk/lib/clients.css +1 -0
  247. package/packages/theme-chalk/lib/data-table-form.css +1 -0
  248. package/packages/theme-chalk/lib/data-table.css +1 -0
  249. package/packages/theme-chalk/lib/date-picker.css +1 -0
  250. package/packages/theme-chalk/lib/dialog.css +1 -0
  251. package/packages/theme-chalk/lib/enterprise.css +1 -0
  252. package/packages/theme-chalk/lib/error-page.css +1 -0
  253. package/packages/theme-chalk/lib/flow-chart.css +0 -0
  254. package/packages/theme-chalk/lib/flow-group.css +1 -0
  255. package/packages/theme-chalk/lib/flow-list.css +1 -0
  256. package/packages/theme-chalk/lib/flow.css +1 -0
  257. package/packages/theme-chalk/lib/fonts/iconfont.ttf +0 -0
  258. package/packages/theme-chalk/lib/fonts/iconfont.woff +0 -0
  259. package/packages/theme-chalk/lib/form.css +1 -0
  260. package/packages/theme-chalk/lib/handle-user.css +1 -0
  261. package/packages/theme-chalk/lib/handler.css +1 -0
  262. package/packages/theme-chalk/lib/icon.css +1 -0
  263. package/packages/theme-chalk/lib/index.css +1 -0
  264. package/packages/theme-chalk/lib/input-number.css +0 -0
  265. package/packages/theme-chalk/lib/input.css +1 -0
  266. package/packages/theme-chalk/lib/label.css +1 -0
  267. package/packages/theme-chalk/lib/login.css +1 -0
  268. package/packages/theme-chalk/lib/main.css +1 -0
  269. package/packages/theme-chalk/lib/mainComp.css +0 -0
  270. package/packages/theme-chalk/lib/menu.css +1 -0
  271. package/packages/theme-chalk/lib/nav.css +1 -0
  272. package/packages/theme-chalk/lib/notify.css +0 -0
  273. package/packages/theme-chalk/lib/page.css +1 -0
  274. package/packages/theme-chalk/lib/pagination.css +1 -0
  275. package/packages/theme-chalk/lib/player.css +1 -0
  276. package/packages/theme-chalk/lib/qr-code.css +1 -0
  277. package/packages/theme-chalk/lib/radio-group.css +1 -0
  278. package/packages/theme-chalk/lib/radio.css +1 -0
  279. package/packages/theme-chalk/lib/select-ganged.css +1 -0
  280. package/packages/theme-chalk/lib/select.css +0 -0
  281. package/packages/theme-chalk/lib/selector-panel.css +1 -0
  282. package/packages/theme-chalk/lib/selector.css +1 -0
  283. package/packages/theme-chalk/lib/sizer.css +1 -0
  284. package/packages/theme-chalk/lib/steps.css +1 -0
  285. package/packages/theme-chalk/lib/switch.css +1 -0
  286. package/packages/theme-chalk/lib/table-form.css +0 -0
  287. package/packages/theme-chalk/lib/tabs-panel.css +0 -0
  288. package/packages/theme-chalk/lib/tabs.css +1 -0
  289. package/packages/theme-chalk/lib/tips.css +1 -0
  290. package/packages/theme-chalk/lib/toolbar.css +1 -0
  291. package/packages/theme-chalk/lib/tree-group.css +1 -0
  292. package/packages/theme-chalk/lib/tree.css +1 -0
  293. package/packages/theme-chalk/lib/upload.css +1 -0
  294. package/packages/theme-chalk/lib/wujie.css +0 -0
  295. package/packages/theme-chalk/lib/wxlogin.css +1 -0
  296. package/packages/theme-chalk/package.json +35 -0
  297. package/packages/theme-chalk/src/base.scss +165 -0
  298. package/packages/theme-chalk/src/button-group.scss +9 -0
  299. package/packages/theme-chalk/src/button.scss +0 -0
  300. package/packages/theme-chalk/src/card.scss +55 -0
  301. package/packages/theme-chalk/src/cascader.scss +0 -0
  302. package/packages/theme-chalk/src/checkbox-group.scss +8 -0
  303. package/packages/theme-chalk/src/clients.scss +72 -0
  304. package/packages/theme-chalk/src/common/var.scss +1516 -0
  305. package/packages/theme-chalk/src/data-table-form.scss +55 -0
  306. package/packages/theme-chalk/src/data-table.scss +202 -0
  307. package/packages/theme-chalk/src/date-picker.scss +8 -0
  308. package/packages/theme-chalk/src/dialog.scss +52 -0
  309. package/packages/theme-chalk/src/enterprise.scss +5 -0
  310. package/packages/theme-chalk/src/error-page.scss +18 -0
  311. package/packages/theme-chalk/src/flow-chart.scss +0 -0
  312. package/packages/theme-chalk/src/flow-group.scss +101 -0
  313. package/packages/theme-chalk/src/flow-list.scss +41 -0
  314. package/packages/theme-chalk/src/flow.scss +285 -0
  315. package/packages/theme-chalk/src/fonts/iconfont.ttf +0 -0
  316. package/packages/theme-chalk/src/fonts/iconfont.woff +0 -0
  317. package/packages/theme-chalk/src/form.scss +451 -0
  318. package/packages/theme-chalk/src/handle-user.scss +40 -0
  319. package/packages/theme-chalk/src/handler.scss +131 -0
  320. package/packages/theme-chalk/src/icon.scss +1714 -0
  321. package/packages/theme-chalk/src/index.scss +50 -0
  322. package/packages/theme-chalk/src/input-number.scss +0 -0
  323. package/packages/theme-chalk/src/input.scss +3 -0
  324. package/packages/theme-chalk/src/label.scss +24 -0
  325. package/packages/theme-chalk/src/login.scss +490 -0
  326. package/packages/theme-chalk/src/main.scss +483 -0
  327. package/packages/theme-chalk/src/mainComp.scss +0 -0
  328. package/packages/theme-chalk/src/menu.scss +201 -0
  329. package/packages/theme-chalk/src/mixins/color.scss +117 -0
  330. package/packages/theme-chalk/src/mixins/mixins.scss +25 -0
  331. package/packages/theme-chalk/src/nav.scss +73 -0
  332. package/packages/theme-chalk/src/notify.scss +0 -0
  333. package/packages/theme-chalk/src/page.scss +3 -0
  334. package/packages/theme-chalk/src/pagination.scss +14 -0
  335. package/packages/theme-chalk/src/player.scss +9 -0
  336. package/packages/theme-chalk/src/qr-code.scss +17 -0
  337. package/packages/theme-chalk/src/radio-group.scss +9 -0
  338. package/packages/theme-chalk/src/radio.scss +3 -0
  339. package/packages/theme-chalk/src/select-ganged.scss +9 -0
  340. package/packages/theme-chalk/src/select.scss +0 -0
  341. package/packages/theme-chalk/src/selector-panel.scss +203 -0
  342. package/packages/theme-chalk/src/selector.scss +85 -0
  343. package/packages/theme-chalk/src/sizer.scss +36 -0
  344. package/packages/theme-chalk/src/steps.scss +88 -0
  345. package/packages/theme-chalk/src/switch.scss +3 -0
  346. package/packages/theme-chalk/src/table-form.scss +1 -0
  347. package/packages/theme-chalk/src/tabs-panel.scss +0 -0
  348. package/packages/theme-chalk/src/tabs.scss +91 -0
  349. package/packages/theme-chalk/src/tips.scss +7 -0
  350. package/packages/theme-chalk/src/toolbar.scss +121 -0
  351. package/packages/theme-chalk/src/tree-group.scss +64 -0
  352. package/packages/theme-chalk/src/tree.scss +140 -0
  353. package/packages/theme-chalk/src/upload.scss +131 -0
  354. package/packages/theme-chalk/src/wujie.scss +0 -0
  355. package/packages/theme-chalk/src/wxlogin.scss +3 -0
  356. package/packages/tips/index.js +5 -0
  357. package/packages/tips/src/main.vue +126 -0
  358. package/packages/toolbar/index.js +5 -0
  359. package/packages/toolbar/src/main.vue +377 -0
  360. package/packages/tree/index.js +5 -0
  361. package/packages/tree/src/main.vue +636 -0
  362. package/packages/tree-group/index.js +5 -0
  363. package/packages/tree-group/src/main.vue +435 -0
  364. package/packages/upload/index.js +5 -0
  365. package/packages/upload/src/main.vue +1033 -0
  366. package/packages/upload/src/picture.js +15 -0
  367. package/packages/wujie/index.js +5 -0
  368. package/packages/wujie/src/main.vue +137 -0
  369. package/packages/wxlogin/index.js +5 -0
  370. package/packages/wxlogin/src/main.vue +110 -0
  371. package/src/config/api.js +211 -0
  372. package/src/index.js +167 -0
  373. package/src/utils/bus.js +3 -0
  374. package/src/utils/date-util.js +312 -0
  375. package/src/utils/http.js +50 -0
  376. package/src/utils/rules.js +18 -0
  377. package/src/utils/store.js +21 -0
  378. package/src/utils/util.js +2105 -0
@@ -0,0 +1,683 @@
1
+ <script>
2
+ import { findSysCode } from 'eoss-ui/src/config/api.js';
3
+ import store from 'eoss-ui/src/utils/store';
4
+ import util from 'eoss-ui/src/utils/util';
5
+ export default {
6
+ name: 'EsSelect',
7
+ componentName: 'EsSelect',
8
+ inheritAttrs: false,
9
+ provide() {
10
+ return {
11
+ esSelect: this
12
+ };
13
+ },
14
+ props: {
15
+ value: [String, Array, Object, Number],
16
+ method: {
17
+ type: String,
18
+ default: 'get'
19
+ },
20
+ param: {
21
+ type: Object,
22
+ default() {
23
+ return {};
24
+ }
25
+ },
26
+ // 显示隐藏组件
27
+ display: {
28
+ type: Boolean,
29
+ default: true
30
+ },
31
+ // 是否不渲染组件
32
+ hide: {
33
+ type: Boolean,
34
+ default: false
35
+ },
36
+ valueType: String,
37
+ // 选择项的值字段
38
+ valueKey: {
39
+ type: String,
40
+ default: 'value'
41
+ },
42
+ // 指定选择项显示值的键名,data元素是对象类型时必填
43
+ labelKey: {
44
+ type: String,
45
+ default: 'name'
46
+ },
47
+ data: {
48
+ type: Array,
49
+ default() {
50
+ return [];
51
+ }
52
+ },
53
+ // 远程搜索
54
+ remote: Boolean,
55
+ remoteKey: {
56
+ type: String,
57
+ default: 'searchKey'
58
+ },
59
+ remoteMethod: Function,
60
+ // 选择项远程地址
61
+ url: String,
62
+ wait: {
63
+ type: Boolean,
64
+ default: true
65
+ },
66
+ // 选择项获取代码表数据(优先级大于url)
67
+ sysCode: String,
68
+ filtrate: [String, Object, Array],
69
+ filtrateKey: {
70
+ type: String,
71
+ default: 'pid'
72
+ },
73
+ readonly: Boolean,
74
+ separator: {
75
+ type: String,
76
+ default: '-'
77
+ },
78
+ symbol: {
79
+ type: String,
80
+ default: ','
81
+ },
82
+ plain: Boolean,
83
+ where: Object,
84
+ parseData: Function,
85
+ disabled: Boolean,
86
+ // 是否下拉树选择
87
+ tree: {
88
+ type: [Boolean, Object],
89
+ default: false
90
+ },
91
+ // 父级是否可选
92
+ parentCheck: {
93
+ type: Boolean,
94
+ default: true
95
+ },
96
+ // 父级可选时父级是否作为单独的值
97
+ parentAsValue: {
98
+ type: Boolean,
99
+ default: true
100
+ },
101
+ group: Boolean,
102
+ multiple: Boolean,
103
+ defaultValue: Boolean,
104
+ onExpand: Function,
105
+ onLoadsub: Function,
106
+ subParamKey: Object,
107
+ lazy: Boolean,
108
+ //是否请求代码表
109
+ ajax: {
110
+ type: Boolean,
111
+ default: true
112
+ },
113
+ isNoParamRequest: {
114
+ type: Boolean,
115
+ default: true
116
+ }
117
+ },
118
+ data() {
119
+ return {
120
+ loading: false,
121
+ options: '',
122
+ valKey: this.valueKey,
123
+ label: this.labelKey,
124
+ hidden: false
125
+ };
126
+ },
127
+ computed: {
128
+ isObject() {
129
+ if (this.valueType === 'object') {
130
+ return true;
131
+ }
132
+ if (
133
+ util.isObject(this.value) ||
134
+ (this.value && this.value[0] && util.isObject(this.value[0]))
135
+ ) {
136
+ return true;
137
+ }
138
+ return false;
139
+ },
140
+ isRemote() {
141
+ return new Boolean(this.remote);
142
+ },
143
+ results() {
144
+ if (this.options.length) {
145
+ return this.options;
146
+ }
147
+ if (this.filtrate) {
148
+ if (Array.isArray(this.filtrate) && this.filtrate.length) {
149
+ let ary = [];
150
+ this.filtrate.forEach(items => {
151
+ let val = typeof items === 'string' ? items : items[this.valKey];
152
+ ary.concat(
153
+ this.data.filter(item => {
154
+ return item[this.filtrateKey] == val;
155
+ })
156
+ );
157
+ });
158
+ } else {
159
+ let val =
160
+ typeof this.filtrate === 'string'
161
+ ? this.filtrate
162
+ : this.filtrate[this.valKey];
163
+ return this.data.filter(item => {
164
+ return item[this.filtrateKey] == val;
165
+ });
166
+ }
167
+ }
168
+ return this.data;
169
+ },
170
+ models: {
171
+ get() {
172
+ return this.value;
173
+ },
174
+ set(val) {
175
+ return val;
176
+ }
177
+ }
178
+ },
179
+ watch: {
180
+ sysCode: {
181
+ immediate: true,
182
+ handler(val, old) {
183
+ if (val && val !== old) {
184
+ this.label = 'shortName';
185
+ this.valKey = 'cciValue';
186
+ const options = store.get(val);
187
+ if (options) {
188
+ this.options = JSON.parse(JSON.stringify(options));
189
+ } else {
190
+ this.getData(val);
191
+ }
192
+ }
193
+ }
194
+ },
195
+ url: {
196
+ handler(val, old) {
197
+ if (val && old !== val && !this.sysCode) {
198
+ this.getData();
199
+ }
200
+ }
201
+ },
202
+ param: {
203
+ deep: true,
204
+ handler(val, old) {
205
+ if (this.url && JSON.stringify(val) !== JSON.stringify(old)) {
206
+ this.options = [];
207
+ this.getData(this.sysCode);
208
+ }
209
+ }
210
+ }
211
+ },
212
+ mounted() {
213
+ if (this.wait) {
214
+ this.getData();
215
+ }
216
+ },
217
+ methods: {
218
+ createOption({ filtrate, data, readonly = false, h }) {
219
+ let filte =
220
+ filtrate && util.isObject(filtrate) ? filtrate[this.valKey] : filtrate;
221
+ let eles = [];
222
+ data.forEach(item => {
223
+ if (this.models === undefined && item.selected) {
224
+ this.$emit(
225
+ 'input',
226
+ this.valueType === 'object' ? item : item[this.valKey]
227
+ );
228
+ }
229
+ if (
230
+ (Object.prototype.hasOwnProperty.call(item, 'children') ||
231
+ Object.prototype.hasOwnProperty.call(item, 'options')) &&
232
+ (item.children || item.options)
233
+ ) {
234
+ const children = item.children || item.options;
235
+ if (readonly) {
236
+ eles.push(
237
+ this.createOption({ filtrate, data: children, readonly, h })
238
+ );
239
+ } else {
240
+ eles.push(
241
+ h(
242
+ 'el-option-group',
243
+ { attrs: { label: item[this.label] || item.label } },
244
+ this.createOption({ filtrate, data: children, readonly, h })
245
+ )
246
+ );
247
+ }
248
+ } else {
249
+ if (readonly) {
250
+ if (item[this.valKey] === filte) {
251
+ eles.push(item[this.label] || item.label);
252
+ }
253
+ } else {
254
+ if (
255
+ filte === null ||
256
+ filte === undefined ||
257
+ filte === '' ||
258
+ filte === item[this.filtrateKey]
259
+ ) {
260
+ if (typeof item === 'string') {
261
+ eles.push(
262
+ h('el-option', {
263
+ attrs: {
264
+ label: item,
265
+ value: item
266
+ }
267
+ })
268
+ );
269
+ } else {
270
+ eles.push(
271
+ h('el-option', {
272
+ attrs: {
273
+ label: item[this.label] || item.label,
274
+ value: this.isObject ? item : item[this.valKey]
275
+ }
276
+ })
277
+ );
278
+ }
279
+ }
280
+ }
281
+ }
282
+ });
283
+ return eles;
284
+ },
285
+ getData(sysCode, param) {
286
+ if (
287
+ !this.ajax ||
288
+ (!this.isNoParamRequest && Object.keys(this.param).length == 0)
289
+ ) {
290
+ return false;
291
+ }
292
+ let params = {};
293
+ if (this.results.length === 0) {
294
+ params = util.extend(
295
+ {},
296
+ this.param,
297
+ sysCode ? { sysAppCode: sysCode } : {},
298
+ param ? param : {}
299
+ );
300
+ } else {
301
+ return false;
302
+ }
303
+ if (!sysCode && !this.url) {
304
+ return false;
305
+ }
306
+ this.loading = true;
307
+ util
308
+ .ajax({
309
+ url: sysCode ? findSysCode : this.url,
310
+ method: this.method,
311
+ params: params,
312
+ data: params
313
+ })
314
+ .then(res => {
315
+ this.loading = false;
316
+ if (res.rCode === 0) {
317
+ if (this.parseData) {
318
+ this.options = this.parseData(res.results);
319
+ } else {
320
+ this.options = JSON.parse(JSON.stringify(res.results));
321
+ }
322
+ if (sysCode) {
323
+ store.set(sysCode, JSON.parse(JSON.stringify(this.options)));
324
+ }
325
+ }
326
+ })
327
+ .catch(err => {
328
+ this.loading = false;
329
+ if (err.message && err.message !== 'canceled') {
330
+ this.$message.error(err.message);
331
+ }
332
+ });
333
+ },
334
+ search(query) {
335
+ if (query !== '') {
336
+ if (this.url !== '') {
337
+ this.loading = true;
338
+ let params = {};
339
+ params[this.remoteKey] = query;
340
+ params = util.extend({}, this.param, params);
341
+ util
342
+ .ajax({
343
+ url: this.url,
344
+ method: this.method,
345
+ params: params,
346
+ data: params
347
+ })
348
+ .then(res => {
349
+ this.loading = false;
350
+ if (res.rCode === 0) {
351
+ this.options = res.results.filter(item => {
352
+ if (item[this.label]) {
353
+ return (
354
+ item[this.label]
355
+ .toLowerCase()
356
+ .indexOf(query.toLowerCase()) > -1
357
+ );
358
+ } else {
359
+ return (
360
+ item.label.toLowerCase().indexOf(query.toLowerCase()) > -1
361
+ );
362
+ }
363
+ });
364
+ }
365
+ })
366
+ .catch(err => {
367
+ this.loading = false;
368
+ if (err.message && err.message !== 'canceled') {
369
+ this.$message.error(err.message);
370
+ }
371
+ });
372
+ } else {
373
+ this.options = [];
374
+ }
375
+ } else {
376
+ this.options = this.data;
377
+ }
378
+ },
379
+ renderd(doms, h, type) {
380
+ if (typeof this.$attrs[type] === 'boolean') {
381
+ if (this.$attrs.render) {
382
+ if (typeof this.$attrs.render == 'string') {
383
+ try {
384
+ doms.push(
385
+ h(
386
+ 'template',
387
+ { slot: type },
388
+ util.toFunction(this.$attrs.render)(h, this)
389
+ )
390
+ );
391
+ } catch (error) {
392
+ throw error;
393
+ }
394
+ } else {
395
+ doms.push(
396
+ h('template', { slot: type }, this.$attrs.render(h, this))
397
+ );
398
+ }
399
+ }
400
+ } else if (typeof this.$attrs[type] === 'object') {
401
+ doms.push(
402
+ h(
403
+ 'es-button',
404
+ {
405
+ slot: type,
406
+ class: ['el-primeval', this.$attrs[type].class],
407
+ props: {
408
+ ...this.$attrs[type].props,
409
+ size: this.$attrs[type].size
410
+ ? this.$attrs[type].size
411
+ : type === 'prefix' || type === 'suffix'
412
+ ? 'small'
413
+ : '',
414
+ type: 'primary'
415
+ },
416
+ domProps: this.$attrs[type].icon
417
+ ? { innerHTML: this.$attrs[type].icon }
418
+ : {},
419
+ on: {
420
+ click: e => {
421
+ this.$attrs[type].click &&
422
+ this.$attrs[type].click(this, this.model);
423
+ this.$attrs[type].event &&
424
+ this.$attrs[type].event(this, this.model);
425
+ }
426
+ },
427
+ ref: 'selectBtn'
428
+ },
429
+ [this.$attrs[type].text]
430
+ )
431
+ );
432
+ } else {
433
+ doms.push(h('template', { slot: type }, [this.$attrs[type]]));
434
+ }
435
+ },
436
+ getLabel(value, data) {
437
+ if (value && data) {
438
+ if (util.isObject(data)) {
439
+ if (value === data[this.valKey]) {
440
+ return data[this.label];
441
+ } else if (value === data[this.label]) {
442
+ return value;
443
+ } else if (
444
+ Object.prototype.hasOwnProperty.call(data, 'children') &&
445
+ data.children &&
446
+ data.children.length
447
+ ) {
448
+ let val = this.getLabel(value, data.children);
449
+ if (val) {
450
+ return val;
451
+ }
452
+ }
453
+ } else {
454
+ if (typeof data === 'string' || !data.length) {
455
+ return value;
456
+ }
457
+ if (Array.isArray(data) && data.length) {
458
+ for (let i = 0; i < data.length; i++) {
459
+ let val = this.getLabel(value, data[i]);
460
+ if (val) {
461
+ return val;
462
+ }
463
+ }
464
+ }
465
+ }
466
+ }
467
+ return '';
468
+ },
469
+ reload(param) {
470
+ this.getData(null, param);
471
+ },
472
+ handleExpand(data, node) {
473
+ if (this.onExpand) {
474
+ this.onExpand(data, node);
475
+ } else {
476
+ if (this.lazy) {
477
+ this.loadsub(data, node);
478
+ }
479
+ this.$emit('node-expand', data, node);
480
+ }
481
+ },
482
+ //请求子节点数据
483
+ loadsub(data, node) {
484
+ if (data.state !== '' && (!data.children || data.children.length === 0)) {
485
+ let param = {};
486
+ if (this.subParamKey) {
487
+ for (let i in this.subParamKey) {
488
+ param[i] = data[this.subParamKey[i]];
489
+ }
490
+ } else {
491
+ param[this.valKey] = data[this.valKey];
492
+ }
493
+ let params = util.extend({}, this.param, this.where, param);
494
+ if (this.parseParams) {
495
+ params = this.parseParams({ data, params, node });
496
+ }
497
+ if (this.onLoadsub) {
498
+ this.onLoadsub({ data, params, node })
499
+ .then(res => {
500
+ this.loading = false;
501
+ this.$set(data, 'children', JSON.parse(JSON.stringify(res)));
502
+ })
503
+ .catch(e => {
504
+ this.loading = false;
505
+ });
506
+ } else {
507
+ util
508
+ .ajax({
509
+ method: this.method,
510
+ url: this.url,
511
+ data: params,
512
+ params: params
513
+ })
514
+ .then(res => {
515
+ if (res.rCode === 0) {
516
+ this.loading = false;
517
+ let results = JSON.parse(JSON.stringify(res.results));
518
+ if (Array.isArray(results)) {
519
+ if (data.id === results[0].id) {
520
+ this.$set(data, 'children', results[0].children);
521
+ } else {
522
+ this.$set(data, 'children', results);
523
+ }
524
+ } else if (data.id === results.id) {
525
+ this.$set(data, 'children', results.children);
526
+ } else {
527
+ console.error('tree数据格式错误');
528
+ }
529
+ }
530
+ })
531
+ .catch(err => {
532
+ this.loading = false;
533
+ if (err.message && err.message !== 'canceled') {
534
+ this.$message.error(err.message);
535
+ }
536
+ });
537
+ }
538
+ }
539
+ },
540
+ toggleMenu() {
541
+ this.$refs.elSelect.toggleMenu();
542
+ }
543
+ },
544
+ render(h) {
545
+ if (!this.hide) {
546
+ if (this.readonly) {
547
+ let dom = [];
548
+ if (Array.isArray(this.models)) {
549
+ dom = this.models.map(item => {
550
+ if (util.isObject(item)) {
551
+ if (!item[this.label] && !item.label) {
552
+ return this.getLabel(value[this.valKey], data);
553
+ }
554
+ return item[this.label] || item.label;
555
+ }
556
+ return this.getLabel(item, this.results);
557
+ });
558
+ } else if (util.isObject(this.models)) {
559
+ if (!this.models[this.label] && !this.models.label) {
560
+ dom = [this.getLabel(this.models[this.valKey], this.results)];
561
+ } else {
562
+ dom = [this.models[this.label] || this.models.label];
563
+ }
564
+ } else {
565
+ dom = [this.getLabel(this.models, this.results)];
566
+ }
567
+ return h(
568
+ 'div',
569
+ {
570
+ class: [
571
+ {
572
+ 'es-plain': this.plain,
573
+ 'es-textarea__inner el-textarea__inner': this.multiple,
574
+ 'el-input__inner es-input__inner': !this.multiple
575
+ }
576
+ ]
577
+ },
578
+ [dom.join(this.symbol)]
579
+ );
580
+ }
581
+ let doms = [];
582
+ let cls = [];
583
+ if (this.results.length && !this.tree) {
584
+ if (this.filtrate && Array.isArray(this.filtrate)) {
585
+ doms = this.filtrate.map(item => {
586
+ return h(
587
+ 'el-option-group',
588
+ {
589
+ attrs: {
590
+ label: item[this.label] || item.label,
591
+ key: item[this.valKey]
592
+ }
593
+ },
594
+ this.createOption({ filtrate: item, data: this.results, h })
595
+ );
596
+ });
597
+ } else {
598
+ doms = this.createOption({
599
+ filtrate: this.filtrate,
600
+ data: this.results,
601
+ h
602
+ });
603
+ }
604
+ }
605
+ if (this.$slots.prefix) {
606
+ doms.push(h('template', { slot: 'prefix' }, this.$slots.prefix));
607
+ } else if (this.$attrs.prefix) {
608
+ this.renderd(doms, h, 'prefix');
609
+ cls.push('es-select-button-prefix');
610
+ }
611
+ if (this.$slots.suffix) {
612
+ doms.push(h('template', { slot: 'suffix' }, this.$slots.suffix));
613
+ } else if (this.$attrs.suffix) {
614
+ this.renderd(doms, h, 'suffix');
615
+ cls.push('es-select-button-suffix');
616
+ }
617
+ if (this.$slots.prepend) {
618
+ doms.push(h('template', { slot: 'prepend' }, this.$slots.prepend));
619
+ } else if (this.$attrs.prepend) {
620
+ this.renderd(doms, h, 'prepend');
621
+ }
622
+ if (this.$slots.append) {
623
+ doms.push(h('template', { slot: 'append' }, this.$slots.append));
624
+ } else if (this.$attrs.append) {
625
+ this.renderd(doms, h, 'append');
626
+ }
627
+ if (!this.models && this.results.length && this.defaultValue) {
628
+ if (this.valueType === 'object') {
629
+ this.models = this.results[0];
630
+ //this.$emit('input', this.results[0]);
631
+ } else {
632
+ this.models = this.results[0][this.valKey];
633
+ //this.$emit('input', this.results[0][this.valKey]);
634
+ }
635
+ this.$emit('change', this.results[0], 0);
636
+ }
637
+ return h(
638
+ 'el-select',
639
+ {
640
+ class: cls,
641
+ ref: 'elSelect',
642
+ directives: [
643
+ {
644
+ name: 'show',
645
+ value: this.display
646
+ }
647
+ ],
648
+ props: {
649
+ ...this.$attrs,
650
+ multiple: this.multiple,
651
+ valueType: this.valueType,
652
+ valueKey: this.valKey,
653
+ labelKey: this.label,
654
+ loading: this.loading,
655
+ disabled: this.disabled,
656
+ tree:
657
+ typeof this.tree === 'boolean'
658
+ ? this.tree
659
+ : { ...this.tree, lazy: this.label },
660
+ data: this.results,
661
+ // 父级是否可选
662
+ parentCheck: this.parentCheck,
663
+ // 父级可选时父级是否作为单独的值
664
+ parentAsValue: this.parentAsValue,
665
+ value: this.models
666
+ },
667
+ attrs: {
668
+ remoteMethod: !this.remoteMethod ? this.search : this.remoteMethod,
669
+ remote: this.remote
670
+ },
671
+ on: {
672
+ ...this.$listeners,
673
+ 'node-expand': this.handleExpand
674
+ }
675
+ },
676
+ this.$slots.default ? this.$slots.default : doms
677
+ );
678
+ } else {
679
+ return '';
680
+ }
681
+ }
682
+ };
683
+ </script>
@@ -0,0 +1,5 @@
1
+ import EsSelectGanged from './src/main';
2
+
3
+ EsSelectGanged.install = Vue => Vue.component(EsSelectGanged.name, EsSelectGanged);
4
+
5
+ export default EsSelectGanged;