el-plus2 0.0.0

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 (299) hide show
  1. package/dist/index.full.js +2204 -0
  2. package/dist/index.full.min.js +2 -0
  3. package/dist/index.full.min.js.map +1 -0
  4. package/dist/index.full.min.mjs +2 -0
  5. package/dist/index.full.min.mjs.map +1 -0
  6. package/dist/index.full.mjs +2176 -0
  7. package/env.d.ts +17 -0
  8. package/es/components/buttons/index.d.ts +359 -0
  9. package/es/components/buttons/index.mjs +8 -0
  10. package/es/components/buttons/index.mjs.map +1 -0
  11. package/es/components/buttons/src/buttons-vue.d.ts +142 -0
  12. package/es/components/buttons/src/buttons-vue.mjs +70 -0
  13. package/es/components/buttons/src/buttons-vue.mjs.map +1 -0
  14. package/es/components/buttons/src/buttons.d.ts +57 -0
  15. package/es/components/buttons/src/buttons.mjs +23 -0
  16. package/es/components/buttons/src/buttons.mjs.map +1 -0
  17. package/es/components/form/index.d.ts +291 -0
  18. package/es/components/form/index.mjs +10 -0
  19. package/es/components/form/index.mjs.map +1 -0
  20. package/es/components/form/src/form-item-vue.d.ts +135 -0
  21. package/es/components/form/src/form-item-vue.mjs +40 -0
  22. package/es/components/form/src/form-item-vue.mjs.map +1 -0
  23. package/es/components/form/src/form-item.d.ts +68 -0
  24. package/es/components/form/src/form-item.mjs +33 -0
  25. package/es/components/form/src/form-item.mjs.map +1 -0
  26. package/es/components/form/src/form.d.ts +66 -0
  27. package/es/components/form/src/form.mjs +50 -0
  28. package/es/components/form/src/form.mjs.map +1 -0
  29. package/es/components/form/src/form.vue.d.ts +161 -0
  30. package/es/components/form/src/form.vue.mjs +6 -0
  31. package/es/components/form/src/form.vue.mjs.map +1 -0
  32. package/es/components/form/src/form.vue2.mjs +124 -0
  33. package/es/components/form/src/form.vue2.mjs.map +1 -0
  34. package/es/components/form/src/hooks/use-form-item.d.ts +12 -0
  35. package/es/components/form/src/hooks/use-form-item.mjs +97 -0
  36. package/es/components/form/src/hooks/use-form-item.mjs.map +1 -0
  37. package/es/components/form/src/hooks/use-form.d.ts +25 -0
  38. package/es/components/form/src/hooks/use-form.mjs +53 -0
  39. package/es/components/form/src/hooks/use-form.mjs.map +1 -0
  40. package/es/components/index.d.ts +6 -0
  41. package/es/components/index.mjs +9 -0
  42. package/es/components/index.mjs.map +1 -0
  43. package/es/components/input/index.d.ts +468 -0
  44. package/es/components/input/index.mjs +8 -0
  45. package/es/components/input/index.mjs.map +1 -0
  46. package/es/components/input/src/input.d.ts +122 -0
  47. package/es/components/input/src/input.mjs +28 -0
  48. package/es/components/input/src/input.mjs.map +1 -0
  49. package/es/components/input/src/input.vue.d.ts +268 -0
  50. package/es/components/input/src/input.vue.mjs +6 -0
  51. package/es/components/input/src/input.vue.mjs.map +1 -0
  52. package/es/components/input/src/input.vue2.mjs +144 -0
  53. package/es/components/input/src/input.vue2.mjs.map +1 -0
  54. package/es/components/searchListPage/index.d.ts +8583 -0
  55. package/es/components/searchListPage/index.mjs +8 -0
  56. package/es/components/searchListPage/index.mjs.map +1 -0
  57. package/es/components/searchListPage/src/searchListPage.d.ts +64 -0
  58. package/es/components/searchListPage/src/searchListPage.mjs +61 -0
  59. package/es/components/searchListPage/src/searchListPage.mjs.map +1 -0
  60. package/es/components/searchListPage/src/searchListPage.vue.d.ts +2760 -0
  61. package/es/components/searchListPage/src/searchListPage.vue.mjs +6 -0
  62. package/es/components/searchListPage/src/searchListPage.vue.mjs.map +1 -0
  63. package/es/components/searchListPage/src/searchListPage.vue2.mjs +99 -0
  64. package/es/components/searchListPage/src/searchListPage.vue2.mjs.map +1 -0
  65. package/es/components/searchListPage/src/use-search-list-page.d.ts +2671 -0
  66. package/es/components/searchListPage/src/use-search-list-page.mjs +177 -0
  67. package/es/components/searchListPage/src/use-search-list-page.mjs.map +1 -0
  68. package/es/components/select/index.d.ts +664 -0
  69. package/es/components/select/index.mjs +8 -0
  70. package/es/components/select/index.mjs.map +1 -0
  71. package/es/components/select/src/select.d.ts +283 -0
  72. package/es/components/select/src/select.mjs +47 -0
  73. package/es/components/select/src/select.mjs.map +1 -0
  74. package/es/components/select/src/select.vue.d.ts +384 -0
  75. package/es/components/select/src/select.vue.mjs +6 -0
  76. package/es/components/select/src/select.vue.mjs.map +1 -0
  77. package/es/components/select/src/select.vue2.mjs +113 -0
  78. package/es/components/select/src/select.vue2.mjs.map +1 -0
  79. package/es/components/select/src/use-select.d.ts +12 -0
  80. package/es/components/select/src/use-select.mjs +87 -0
  81. package/es/components/select/src/use-select.mjs.map +1 -0
  82. package/es/components/table/index.d.ts +2975 -0
  83. package/es/components/table/index.mjs +8 -0
  84. package/es/components/table/index.mjs.map +1 -0
  85. package/es/components/table/src/table.d.ts +781 -0
  86. package/es/components/table/src/table.mjs +81 -0
  87. package/es/components/table/src/table.mjs.map +1 -0
  88. package/es/components/table/src/table.vue.d.ts +1708 -0
  89. package/es/components/table/src/table.vue.mjs +6 -0
  90. package/es/components/table/src/table.vue.mjs.map +1 -0
  91. package/es/components/table/src/table.vue2.mjs +204 -0
  92. package/es/components/table/src/table.vue2.mjs.map +1 -0
  93. package/es/components/table/src/use-table.d.ts +241 -0
  94. package/es/components/table/src/use-table.mjs +260 -0
  95. package/es/components/table/src/use-table.mjs.map +1 -0
  96. package/es/components.d.ts +3 -0
  97. package/es/components.mjs +11 -0
  98. package/es/components.mjs.map +1 -0
  99. package/es/directives/index.d.ts +2 -0
  100. package/es/directives/index.mjs +3 -0
  101. package/es/directives/index.mjs.map +1 -0
  102. package/es/directives/permission/index.d.ts +6 -0
  103. package/es/directives/permission/index.mjs +55 -0
  104. package/es/directives/permission/index.mjs.map +1 -0
  105. package/es/directives/repeat-click/index.d.ts +16 -0
  106. package/es/directives/repeat-click/index.mjs +68 -0
  107. package/es/directives/repeat-click/index.mjs.map +1 -0
  108. package/es/directives/vite.config.d.ts +2 -0
  109. package/es/hooks/index.d.ts +1 -0
  110. package/es/hooks/index.mjs +2 -0
  111. package/es/hooks/index.mjs.map +1 -0
  112. package/es/hooks/use-request.d.ts +20 -0
  113. package/es/hooks/use-request.mjs +82 -0
  114. package/es/hooks/use-request.mjs.map +1 -0
  115. package/es/index.d.ts +9 -0
  116. package/es/index.mjs +24 -0
  117. package/es/index.mjs.map +1 -0
  118. package/es/package.json.mjs +4 -0
  119. package/es/package.json.mjs.map +1 -0
  120. package/es/theme-chalk/gulpfile.d.ts +0 -0
  121. package/es/theme-chalk/gulpfile.mjs +2 -0
  122. package/es/theme-chalk/gulpfile.mjs.map +1 -0
  123. package/es/types/env.d.mjs +2 -0
  124. package/es/types/env.d.mjs.map +1 -0
  125. package/es/types/global.d.mjs +2 -0
  126. package/es/types/global.d.mjs.map +1 -0
  127. package/es/types/vue-shim.d.mjs +2 -0
  128. package/es/types/vue-shim.d.mjs.map +1 -0
  129. package/es/utils/bem.d.ts +10 -0
  130. package/es/utils/bem.mjs +31 -0
  131. package/es/utils/bem.mjs.map +1 -0
  132. package/es/utils/cookie.d.ts +7 -0
  133. package/es/utils/cookie.mjs +29 -0
  134. package/es/utils/cookie.mjs.map +1 -0
  135. package/es/utils/env.d.ts +3 -0
  136. package/es/utils/env.mjs +27 -0
  137. package/es/utils/env.mjs.map +1 -0
  138. package/es/utils/props.d.ts +37 -0
  139. package/es/utils/props.mjs +66 -0
  140. package/es/utils/props.mjs.map +1 -0
  141. package/es/utils/request.d.ts +6 -0
  142. package/es/utils/request.mjs +157 -0
  143. package/es/utils/request.mjs.map +1 -0
  144. package/es/utils/type.d.ts +15 -0
  145. package/es/utils/type.mjs +2 -0
  146. package/es/utils/type.mjs.map +1 -0
  147. package/es/utils/with-install.d.ts +4 -0
  148. package/es/utils/with-install.mjs +9 -0
  149. package/es/utils/with-install.mjs.map +1 -0
  150. package/es/version.d.ts +1 -0
  151. package/es/version.mjs +4 -0
  152. package/es/version.mjs.map +1 -0
  153. package/global.d.ts +13 -0
  154. package/lib/components/buttons/index.d.ts +359 -0
  155. package/lib/components/buttons/index.js +13 -0
  156. package/lib/components/buttons/index.js.map +1 -0
  157. package/lib/components/buttons/src/buttons-vue.d.ts +142 -0
  158. package/lib/components/buttons/src/buttons-vue.js +74 -0
  159. package/lib/components/buttons/src/buttons-vue.js.map +1 -0
  160. package/lib/components/buttons/src/buttons.d.ts +57 -0
  161. package/lib/components/buttons/src/buttons.js +25 -0
  162. package/lib/components/buttons/src/buttons.js.map +1 -0
  163. package/lib/components/form/index.d.ts +291 -0
  164. package/lib/components/form/index.js +21 -0
  165. package/lib/components/form/index.js.map +1 -0
  166. package/lib/components/form/src/form-item-vue.d.ts +135 -0
  167. package/lib/components/form/src/form-item-vue.js +44 -0
  168. package/lib/components/form/src/form-item-vue.js.map +1 -0
  169. package/lib/components/form/src/form-item.d.ts +68 -0
  170. package/lib/components/form/src/form-item.js +36 -0
  171. package/lib/components/form/src/form-item.js.map +1 -0
  172. package/lib/components/form/src/form.d.ts +66 -0
  173. package/lib/components/form/src/form.js +55 -0
  174. package/lib/components/form/src/form.js.map +1 -0
  175. package/lib/components/form/src/form.vue.d.ts +161 -0
  176. package/lib/components/form/src/form.vue.js +10 -0
  177. package/lib/components/form/src/form.vue.js.map +1 -0
  178. package/lib/components/form/src/form.vue2.js +128 -0
  179. package/lib/components/form/src/form.vue2.js.map +1 -0
  180. package/lib/components/form/src/hooks/use-form-item.d.ts +12 -0
  181. package/lib/components/form/src/hooks/use-form-item.js +101 -0
  182. package/lib/components/form/src/hooks/use-form-item.js.map +1 -0
  183. package/lib/components/form/src/hooks/use-form.d.ts +25 -0
  184. package/lib/components/form/src/hooks/use-form.js +56 -0
  185. package/lib/components/form/src/hooks/use-form.js.map +1 -0
  186. package/lib/components/index.d.ts +6 -0
  187. package/lib/components/index.js +35 -0
  188. package/lib/components/index.js.map +1 -0
  189. package/lib/components/input/index.d.ts +468 -0
  190. package/lib/components/input/index.js +15 -0
  191. package/lib/components/input/index.js.map +1 -0
  192. package/lib/components/input/src/input.d.ts +122 -0
  193. package/lib/components/input/src/input.js +32 -0
  194. package/lib/components/input/src/input.js.map +1 -0
  195. package/lib/components/input/src/input.vue.d.ts +268 -0
  196. package/lib/components/input/src/input.vue.js +10 -0
  197. package/lib/components/input/src/input.vue.js.map +1 -0
  198. package/lib/components/input/src/input.vue2.js +148 -0
  199. package/lib/components/input/src/input.vue2.js.map +1 -0
  200. package/lib/components/searchListPage/index.d.ts +8583 -0
  201. package/lib/components/searchListPage/index.js +13 -0
  202. package/lib/components/searchListPage/index.js.map +1 -0
  203. package/lib/components/searchListPage/src/searchListPage.d.ts +64 -0
  204. package/lib/components/searchListPage/src/searchListPage.js +63 -0
  205. package/lib/components/searchListPage/src/searchListPage.js.map +1 -0
  206. package/lib/components/searchListPage/src/searchListPage.vue.d.ts +2760 -0
  207. package/lib/components/searchListPage/src/searchListPage.vue.js +10 -0
  208. package/lib/components/searchListPage/src/searchListPage.vue.js.map +1 -0
  209. package/lib/components/searchListPage/src/searchListPage.vue2.js +103 -0
  210. package/lib/components/searchListPage/src/searchListPage.vue2.js.map +1 -0
  211. package/lib/components/searchListPage/src/use-search-list-page.d.ts +2671 -0
  212. package/lib/components/searchListPage/src/use-search-list-page.js +179 -0
  213. package/lib/components/searchListPage/src/use-search-list-page.js.map +1 -0
  214. package/lib/components/select/index.d.ts +664 -0
  215. package/lib/components/select/index.js +17 -0
  216. package/lib/components/select/index.js.map +1 -0
  217. package/lib/components/select/src/select.d.ts +283 -0
  218. package/lib/components/select/src/select.js +53 -0
  219. package/lib/components/select/src/select.js.map +1 -0
  220. package/lib/components/select/src/select.vue.d.ts +384 -0
  221. package/lib/components/select/src/select.vue.js +10 -0
  222. package/lib/components/select/src/select.vue.js.map +1 -0
  223. package/lib/components/select/src/select.vue2.js +117 -0
  224. package/lib/components/select/src/select.vue2.js.map +1 -0
  225. package/lib/components/select/src/use-select.d.ts +12 -0
  226. package/lib/components/select/src/use-select.js +89 -0
  227. package/lib/components/select/src/use-select.js.map +1 -0
  228. package/lib/components/table/index.d.ts +2975 -0
  229. package/lib/components/table/index.js +16 -0
  230. package/lib/components/table/index.js.map +1 -0
  231. package/lib/components/table/src/table.d.ts +781 -0
  232. package/lib/components/table/src/table.js +86 -0
  233. package/lib/components/table/src/table.js.map +1 -0
  234. package/lib/components/table/src/table.vue.d.ts +1708 -0
  235. package/lib/components/table/src/table.vue.js +10 -0
  236. package/lib/components/table/src/table.vue.js.map +1 -0
  237. package/lib/components/table/src/table.vue2.js +208 -0
  238. package/lib/components/table/src/table.vue2.js.map +1 -0
  239. package/lib/components/table/src/use-table.d.ts +241 -0
  240. package/lib/components/table/src/use-table.js +264 -0
  241. package/lib/components/table/src/use-table.js.map +1 -0
  242. package/lib/components.d.ts +3 -0
  243. package/lib/components.js +15 -0
  244. package/lib/components.js.map +1 -0
  245. package/lib/directives/index.d.ts +2 -0
  246. package/lib/directives/index.js +10 -0
  247. package/lib/directives/index.js.map +1 -0
  248. package/lib/directives/permission/index.d.ts +6 -0
  249. package/lib/directives/permission/index.js +60 -0
  250. package/lib/directives/permission/index.js.map +1 -0
  251. package/lib/directives/repeat-click/index.d.ts +16 -0
  252. package/lib/directives/repeat-click/index.js +72 -0
  253. package/lib/directives/repeat-click/index.js.map +1 -0
  254. package/lib/directives/vite.config.d.ts +2 -0
  255. package/lib/hooks/index.d.ts +1 -0
  256. package/lib/hooks/index.js +8 -0
  257. package/lib/hooks/index.js.map +1 -0
  258. package/lib/hooks/use-request.d.ts +20 -0
  259. package/lib/hooks/use-request.js +84 -0
  260. package/lib/hooks/use-request.js.map +1 -0
  261. package/lib/index.d.ts +9 -0
  262. package/lib/index.js +53 -0
  263. package/lib/index.js.map +1 -0
  264. package/lib/package.json.js +6 -0
  265. package/lib/package.json.js.map +1 -0
  266. package/lib/theme-chalk/gulpfile.d.ts +0 -0
  267. package/lib/theme-chalk/gulpfile.js +3 -0
  268. package/lib/theme-chalk/gulpfile.js.map +1 -0
  269. package/lib/types/env.d.js +3 -0
  270. package/lib/types/env.d.js.map +1 -0
  271. package/lib/types/global.d.js +3 -0
  272. package/lib/types/global.d.js.map +1 -0
  273. package/lib/types/vue-shim.d.js +3 -0
  274. package/lib/types/vue-shim.d.js.map +1 -0
  275. package/lib/utils/bem.d.ts +10 -0
  276. package/lib/utils/bem.js +33 -0
  277. package/lib/utils/bem.js.map +1 -0
  278. package/lib/utils/cookie.d.ts +7 -0
  279. package/lib/utils/cookie.js +33 -0
  280. package/lib/utils/cookie.js.map +1 -0
  281. package/lib/utils/env.d.ts +3 -0
  282. package/lib/utils/env.js +30 -0
  283. package/lib/utils/env.js.map +1 -0
  284. package/lib/utils/props.d.ts +37 -0
  285. package/lib/utils/props.js +73 -0
  286. package/lib/utils/props.js.map +1 -0
  287. package/lib/utils/request.d.ts +6 -0
  288. package/lib/utils/request.js +162 -0
  289. package/lib/utils/request.js.map +1 -0
  290. package/lib/utils/type.d.ts +15 -0
  291. package/lib/utils/type.js +3 -0
  292. package/lib/utils/type.js.map +1 -0
  293. package/lib/utils/with-install.d.ts +4 -0
  294. package/lib/utils/with-install.js +11 -0
  295. package/lib/utils/with-install.js.map +1 -0
  296. package/lib/version.d.ts +1 -0
  297. package/lib/version.js +6 -0
  298. package/lib/version.js.map +1 -0
  299. package/package.json +27 -0
@@ -0,0 +1,2204 @@
1
+ /*! ElPlus vundefined */
2
+
3
+ (function (global, factory) {
4
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('vue'), require('element-plus'), require('axios'), require('element-plus/es/components/message/style/css'), require('element-plus/es/components/loading/style/css'), require('element-plus/es/components/table/src/table/defaults')) :
5
+ typeof define === 'function' && define.amd ? define(['exports', 'vue', 'element-plus', 'axios', 'element-plus/es/components/message/style/css', 'element-plus/es/components/loading/style/css', 'element-plus/es/components/table/src/table/defaults'], factory) :
6
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.ElPlus = {}, global.Vue, global.ElementPlus, global.axios, null, null, global.elTableProps));
7
+ })(this, (function (exports, vue, elementPlus, axios, css, css$1, elTableProps) { 'use strict';
8
+
9
+ const buttonsProps = {
10
+ ...elementPlus.buttonProps,
11
+ disabled: {
12
+ type: [Boolean, Function]
13
+ },
14
+ list: {
15
+ type: Array,
16
+ default: () => []
17
+ },
18
+ size: {
19
+ ...elementPlus.buttonProps.size,
20
+ default: "small"
21
+ },
22
+ type: {
23
+ ...elementPlus.buttonProps.type,
24
+ default: "default"
25
+ }
26
+ };
27
+
28
+ function _bem(prefix, block, element, modifier) {
29
+ if (block) {
30
+ prefix += "-" + block;
31
+ }
32
+ if (element) {
33
+ prefix += "__" + element;
34
+ }
35
+ if (modifier) {
36
+ prefix += "--" + modifier;
37
+ }
38
+ return prefix;
39
+ }
40
+ function createBEM(prefix) {
41
+ return {
42
+ b: (block = "") => _bem(prefix, block, "", ""),
43
+ e: (element = "") => element ? _bem(prefix, "", element, "") : "",
44
+ m: (modifier = "") => modifier ? _bem(prefix, "", "", modifier) : "",
45
+ be: (block = "", element = "") => block && element ? _bem(prefix, block, element, "") : "",
46
+ bm: (block = "", modifier = "") => block && modifier ? _bem(prefix, block, "", modifier) : "",
47
+ em: (element = "", modifier = "") => element && modifier ? _bem(prefix, "", element, modifier) : "",
48
+ bem: (block = "", element = "", modifier) => block && element && modifier ? _bem(prefix, block, element, modifier) : "",
49
+ is: (name = "", state) => state ? `is-${name}` : ""
50
+ };
51
+ }
52
+ function createNameSpace(name) {
53
+ const prefix = `ep-${name}`;
54
+ return createBEM(prefix);
55
+ }
56
+
57
+ const apiProps = {
58
+ api: {
59
+ type: [String, Function]
60
+ },
61
+ method: {
62
+ type: String
63
+ },
64
+ reqData: {
65
+ type: Object
66
+ },
67
+ reqParams: {
68
+ type: Object
69
+ },
70
+ reqBefore: {
71
+ type: Function
72
+ },
73
+ reqAfter: {
74
+ type: Function
75
+ }
76
+ };
77
+ const visibleProps = {
78
+ show: {
79
+ type: [Boolean, Function]
80
+ },
81
+ hide: {
82
+ type: [Boolean, Function]
83
+ }
84
+ };
85
+ const prepareProps = (props, excludeKeys = []) => {
86
+ return Object.keys(props).reduce((acc, key) => {
87
+ if (!excludeKeys.includes(key)) {
88
+ acc[key] = props[key];
89
+ }
90
+ return acc;
91
+ }, {});
92
+ };
93
+ const prepareEvents = (emit, eventKeys) => {
94
+ return eventKeys.reduce(
95
+ (acc, key) => {
96
+ let eventName;
97
+ if (key.startsWith("on")) {
98
+ eventName = key;
99
+ } else {
100
+ if (key.includes("-")) {
101
+ eventName = "on" + key.split("-").map((word) => word.charAt(0).toUpperCase() + word.slice(1)).join("");
102
+ } else {
103
+ eventName = `on${key.charAt(0).toUpperCase()}${key.slice(1)}`;
104
+ }
105
+ }
106
+ acc[eventName] = (...args) => emit(key, ...args);
107
+ return acc;
108
+ },
109
+ {}
110
+ );
111
+ };
112
+ const prepareClassNames = () => {
113
+ return vue.useAttrs().class || "";
114
+ };
115
+ const prepareStyles = () => {
116
+ return vue.useAttrs().style || {};
117
+ };
118
+
119
+ const SCOPE = "_RepeatClick";
120
+ const vRepeatClick = {
121
+ name: "repeatClick",
122
+ // 在绑定元素的 attribute 前
123
+ // 或事件监听器应用前调用
124
+ // created(el, binding, vnode) {
125
+ // // el.style.display = 'none'
126
+ // // 下面会介绍各个参数的细节
127
+ // console.log('created', el, binding, vnode)
128
+ // },
129
+ // 在元素被插入到 DOM 前调用
130
+ beforeMount(el, binding) {
131
+ const { delay = 300, immediate } = typeof binding.value === "object" ? binding.value : {};
132
+ const handler = typeof binding.value === "object" ? binding.value.handler : binding.value;
133
+ let isPending = false;
134
+ let timer;
135
+ const start = (e) => {
136
+ if (e.button !== 0) return;
137
+ timer && clearTimeout(timer);
138
+ timer = setTimeout(() => {
139
+ if (immediate) {
140
+ isPending = false;
141
+ } else {
142
+ handler?.(e);
143
+ }
144
+ }, delay);
145
+ if (immediate) {
146
+ if (isPending) {
147
+ return;
148
+ }
149
+ isPending = true;
150
+ handler?.(e);
151
+ }
152
+ };
153
+ el[SCOPE] = { start };
154
+ el.addEventListener("click", start);
155
+ },
156
+ // // 在绑定元素的父组件
157
+ // // 及他自己的所有子节点都挂载完成后调用
158
+ // mounted(el, binding, vnode) {
159
+ // console.log('mounted', el, binding, vnode)
160
+ // },
161
+ // // 绑定元素的父组件更新前调用
162
+ // beforeUpdate(el, binding, vnode, prevVnode) {
163
+ // console.log('beforeUpdate', el, binding, vnode, prevVnode)
164
+ // },
165
+ // // 在绑定元素的父组件
166
+ // // 及他自己的所有子节点都更新后调用
167
+ // updated(el, binding, vnode, prevVnode) {
168
+ // console.log('updated', el, binding, vnode, prevVnode)
169
+ // },
170
+ // // 绑定元素的父组件卸载前调用
171
+ // beforeUnmount(el, binding, vnode) {
172
+ // console.log('beforeUnmount', el, binding, vnode)
173
+ // },
174
+ // 绑定元素的父组件卸载后调用
175
+ unmounted(el) {
176
+ if (!el[SCOPE]) return;
177
+ const { start } = el[SCOPE];
178
+ if (start) {
179
+ el.removeEventListener("mousedown", start);
180
+ }
181
+ el[SCOPE] = null;
182
+ }
183
+ };
184
+
185
+ const getEnv = (mark = "hxjf", hostname = window.location.hostname) => {
186
+ const tag = hostname.match(new RegExp(`.*(?=${mark})`));
187
+ if (hostname === "hxdv-ui.hongxinshop.com") {
188
+ return "production";
189
+ }
190
+ if (!tag) {
191
+ return "local";
192
+ }
193
+ return tag[0] ? tag[0].replace("-", "") : "production";
194
+ };
195
+ const getBaseUrl = (env = "sit", isOpenApi) => {
196
+ let url = "";
197
+ if (getEnv() === "local") {
198
+ const query = {};
199
+ query.devProxy = location.search.slice(1).split("=")[1] || location.hash.slice(1).split("=")[1];
200
+ const devProxy = query.devProxy || `${env}-api`;
201
+ url = `${devProxy}${""}`;
202
+ } else {
203
+ url = "/vue-api";
204
+ }
205
+ return url;
206
+ };
207
+
208
+ const getCookie = (name) => {
209
+ const reg = new RegExp("(^| )" + name + "=([^;]*)(;|$)");
210
+ const arr = document.cookie.match(reg);
211
+ if (arr) {
212
+ return decodeURIComponent(arr[2]);
213
+ }
214
+ return null;
215
+ };
216
+
217
+ const instance = axios.create({
218
+ method: "post",
219
+ timeout: 2e4,
220
+ baseURL: getBaseUrl(),
221
+ headers: {
222
+ "Content-Type": "application/json"
223
+ }
224
+ });
225
+ let reqNum = 0;
226
+ let loading = { close: () => {
227
+ } };
228
+ function startLoading() {
229
+ if (reqNum === 0) {
230
+ loading = elementPlus.ElLoading.service({
231
+ fullscreen: true,
232
+ lock: true,
233
+ text: "\u8BF7\u7A0D\u7B49\uFF0C\u6B63\u5728\u52A0\u8F7D\u4E2D...",
234
+ spinner: "el-icon-loading",
235
+ background: "rgba(0,0,0,0.7)"
236
+ });
237
+ }
238
+ reqNum++;
239
+ }
240
+ function closeLoading() {
241
+ if (reqNum <= 0) {
242
+ return;
243
+ }
244
+ reqNum--;
245
+ if (reqNum === 0) {
246
+ loading.close();
247
+ }
248
+ }
249
+ function endLoading() {
250
+ closeLoading();
251
+ }
252
+ instance.interceptors.request.use(
253
+ async (config) => {
254
+ const token = getCookie("access_token");
255
+ if (token) {
256
+ config.headers["Authorization"] = `Bearer ${token}`;
257
+ }
258
+ if (config.loading) {
259
+ startLoading();
260
+ }
261
+ config.headers = {
262
+ ...config.headers,
263
+ ...window.hx && window.hx.getSignHeaders({
264
+ // 只有openapi接口需要传sign
265
+ sign: config.sign || window.ELPLUSSIGN,
266
+ config
267
+ })
268
+ };
269
+ const cancelRequest = config.cancelRequest;
270
+ config.cancelToken = new axios.CancelToken(function(cancel) {
271
+ cancelRequest && cancelRequest(cancel);
272
+ });
273
+ return config;
274
+ },
275
+ (error) => {
276
+ console.log(error);
277
+ return Promise.reject(error);
278
+ }
279
+ );
280
+ instance.interceptors.response.use(
281
+ (response) => {
282
+ const config = response.config;
283
+ if (config.loading) {
284
+ endLoading();
285
+ }
286
+ const responseCode = response.data.code;
287
+ const { hideToast, hideToastCode = {} } = response.config.headers;
288
+ hideToastCode.length = Object.keys(hideToastCode).length;
289
+ if (responseCode === 200) {
290
+ return Promise.resolve(response.data);
291
+ } else if (hideToast || Array.prototype.slice.call(hideToastCode).indexOf(responseCode) > -1) {
292
+ return Promise.reject(response.data);
293
+ } else {
294
+ setTimeout(() => {
295
+ elementPlus.ElMessage.error({
296
+ message: `<pre>${response.data.msg}</pre>`,
297
+ type: "error",
298
+ duration: 2e3,
299
+ dangerouslyUseHTMLString: true
300
+ });
301
+ }, 300);
302
+ return Promise.reject(response.data);
303
+ }
304
+ },
305
+ (error) => {
306
+ const { config = {}, message } = error;
307
+ const { url } = config;
308
+ if (config.loading) {
309
+ endLoading();
310
+ }
311
+ if (error && error.response) {
312
+ const { status } = error.response;
313
+ switch (status) {
314
+ case 400:
315
+ error.message = error.response.data.message || error.response.data.msg;
316
+ break;
317
+ case 403:
318
+ error.message = "\u62D2\u7EDD\u8BBF\u95EE(403)";
319
+ break;
320
+ case 404:
321
+ error.message = "\u8BF7\u6C42\u51FA\u9519(404)";
322
+ break;
323
+ case 408:
324
+ error.message = "\u8BF7\u6C42\u8D85\u65F6(408)";
325
+ break;
326
+ case 500:
327
+ error.message = "\u670D\u52A1\u5668\u9519\u8BEF(500)";
328
+ break;
329
+ case 501:
330
+ error.message = "\u670D\u52A1\u672A\u5B9E\u73B0(501)";
331
+ break;
332
+ case 502:
333
+ error.message = "\u7F51\u7EDC\u9519\u8BEF(502)";
334
+ break;
335
+ case 503:
336
+ error.message = "\u670D\u52A1\u4E0D\u53EF\u7528(503)";
337
+ break;
338
+ case 504:
339
+ error.message = "\u7F51\u7EDC\u8D85\u65F6(504)";
340
+ break;
341
+ case 505:
342
+ error.message = "HTTP\u7248\u672C\u4E0D\u53D7\u652F\u6301(505)";
343
+ break;
344
+ default:
345
+ error.message = `\u8FDE\u63A5\u51FA\u9519(${error.response.status})!`;
346
+ }
347
+ } else {
348
+ if (error.message.includes("timeout")) {
349
+ error.message = `\u8BF7\u6C42${url ? url : ""}\u8D85\u65F6\uFF0C\u8BF7\u68C0\u67E5\u7F51\u7EDC\u662F\u5426\u8FDE\u63A5\u6B63\u5E38`;
350
+ } else {
351
+ error.message = `\u8BF7\u6C42${url ? url : ""}\u5931\u8D25\uFF0C\u8BF7\u68C0\u67E5\u7F51\u7EDC\u662F\u5426\u5DF2\u8FDE\u63A5`;
352
+ }
353
+ }
354
+ if (!axios.isCancel(error) || !config.noErrorMsg) {
355
+ elementPlus.ElMessage.error({
356
+ message: error.message,
357
+ type: "error",
358
+ duration: 2e3,
359
+ dangerouslyUseHTMLString: true
360
+ });
361
+ }
362
+ return Promise.reject(error);
363
+ }
364
+ );
365
+ const fetch = instance.request;
366
+
367
+ const vPermisson = {
368
+ name: "permission",
369
+ mounted(el, binding) {
370
+ const { arg, value } = binding.value;
371
+ if (!arg && !value) {
372
+ return;
373
+ }
374
+ el.style.display = "none";
375
+ const permission = `${arg}:${value}`;
376
+ checkPermission(permission, el);
377
+ },
378
+ updated(el, binding) {
379
+ const { arg, value } = binding.value;
380
+ if (!arg && !value) {
381
+ if (el.style.display === "none") {
382
+ el.style.display = "";
383
+ }
384
+ return;
385
+ }
386
+ const permission = `${arg}:${value}`;
387
+ checkPermission(permission, el);
388
+ }
389
+ };
390
+ async function checkPermission(permission, el) {
391
+ const { data: roles = [] } = await queryRoles();
392
+ const hasPermission = roles.indexOf(permission) > -1;
393
+ if (!hasPermission) {
394
+ el && el.parentNode && el.parentNode.removeChild(el);
395
+ } else {
396
+ el.style.display = "";
397
+ }
398
+ return hasPermission;
399
+ }
400
+ let requestPromise = null;
401
+ async function queryRoles() {
402
+ try {
403
+ if (requestPromise) {
404
+ return requestPromise;
405
+ }
406
+ requestPromise = fetch({
407
+ url: "/api-u/api/saas/user/appButtonRoleList",
408
+ loading: true,
409
+ noErrorMsg: true
410
+ });
411
+ return requestPromise;
412
+ } catch (error) {
413
+ console.error(error);
414
+ return { data: [] };
415
+ }
416
+ }
417
+
418
+ const bem$1 = createNameSpace("button");
419
+ var Buttons$1 = /* @__PURE__ */ vue.defineComponent({
420
+ name: "EpButtons",
421
+ directives: {
422
+ [vRepeatClick.name]: vRepeatClick,
423
+ [vPermisson.name]: vPermisson
424
+ },
425
+ inheritAttrs: false,
426
+ props: buttonsProps,
427
+ setup(props, {
428
+ emit
429
+ }) {
430
+ const {
431
+ list,
432
+ ...buttonProps
433
+ } = props;
434
+ const customList = vue.computed(() => {
435
+ return list.filter((button) => {
436
+ if ("show" in button) {
437
+ return typeof button.show === "function" ? button.show(button) : button.show;
438
+ } else if ("hide" in button) {
439
+ return typeof button.hide === "function" ? !button.hide(button) : !button.hide;
440
+ }
441
+ return true;
442
+ });
443
+ });
444
+ const clickFn = async (item) => {
445
+ if (item.confirm) {
446
+ const confirmText = item.confirmText || `\u786E\u5B9A\u8981${item.name}\u5417\uFF1F`;
447
+ await elementPlus.ElMessageBox.confirm(confirmText, "Warning", {
448
+ confirmButtonText: "\u786E\u5B9A",
449
+ cancelButtonText: "\u53D6\u6D88",
450
+ type: "warning"
451
+ });
452
+ }
453
+ item.onClick();
454
+ };
455
+ return () => vue.createVNode(vue.Fragment, null, [customList.value.map((item) => {
456
+ const permissionArr = item.permission?.split(":") || [];
457
+ return vue.withDirectives(vue.createVNode(vue.resolveComponent("el-button"), vue.mergeProps({
458
+ "class": [bem$1.b(), prepareClassNames()],
459
+ "style": prepareStyles(),
460
+ "key": item.prop || item.name
461
+ }, {
462
+ ...prepareProps(buttonProps),
463
+ ...prepareProps(item, ["scopedSlots", "name", "onClick"])
464
+ }), {
465
+ default: () => item.name,
466
+ ...item.scopedSlots
467
+ }), [[vue.resolveDirective("repeat-click"), typeof item.onClick === "function" ? {
468
+ handler: () => clickFn(item),
469
+ immediate: true
470
+ } : () => clickFn(item)], [vue.resolveDirective("permission"), {
471
+ arg: permissionArr[0],
472
+ value: permissionArr[1]
473
+ }]]);
474
+ })]);
475
+ }
476
+ });
477
+
478
+ function withInstall(comp) {
479
+ comp.install = (app) => {
480
+ app.component(comp.name, comp);
481
+ };
482
+ return comp;
483
+ }
484
+
485
+ var Buttons = withInstall(Buttons$1);
486
+
487
+ const expandFormProps = {
488
+ // 表单列表
489
+ formItemList: {
490
+ type: Array,
491
+ default: () => []
492
+ },
493
+ // 是否显示折叠
494
+ isShowFold: Boolean,
495
+ // 最大显示的表单数
496
+ showFieldCount: {
497
+ type: Number,
498
+ default: 8
499
+ },
500
+ // 每行的列数
501
+ col: {
502
+ type: Number,
503
+ default: 4
504
+ }
505
+ };
506
+ const formProps = {
507
+ ...elementPlus.formProps,
508
+ ...expandFormProps,
509
+ size: {
510
+ ...elementPlus.formProps.size,
511
+ default: "small"
512
+ },
513
+ // 标签的长度
514
+ labelWidth: {
515
+ ...elementPlus.formProps.labelWidth,
516
+ default: 120
517
+ },
518
+ scrollIntoViewOptions: {
519
+ ...elementPlus.formProps.scrollIntoViewOptions,
520
+ default: () => {
521
+ return { inline: "center" };
522
+ }
523
+ }
524
+ };
525
+ const expandFormPropsKeys = Object.keys(expandFormProps);
526
+ const formEmits = {
527
+ ...elementPlus.formEmits,
528
+ toggleStatus: (status) => true
529
+ // 折叠状态切换时触发
530
+ };
531
+ const formEmitsKeys = Object.keys(formEmits);
532
+
533
+ const useCollapse = ({ isShowFold, showFieldCount, filterFormItemList }, emit) => {
534
+ const open = vue.ref(false);
535
+ const toggleStatus = () => {
536
+ open.value = !open.value;
537
+ emit("toggleStatus", open.value);
538
+ };
539
+ const isShowFoldBtn = vue.computed(() => {
540
+ return isShowFold && filterFormItemList.value.length > showFieldCount;
541
+ });
542
+ const isShowFormItem = (index) => {
543
+ return index < showFieldCount || open.value || !isShowFoldBtn.value;
544
+ };
545
+ return {
546
+ open,
547
+ toggleStatus,
548
+ isShowFoldBtn,
549
+ isShowFormItem
550
+ };
551
+ };
552
+ const useForm$1 = (props) => {
553
+ const elFormRef = vue.useTemplateRef("elFormRef");
554
+ const filterFormItemList = vue.computed(() => {
555
+ return props.formItemList.filter((item) => {
556
+ if ("show" in item) {
557
+ return typeof item.show === "function" ? item.show(item) : item.show;
558
+ } else if ("hide" in item) {
559
+ return typeof item.hide === "function" ? !item.hide(item) : !item.hide;
560
+ }
561
+ return true;
562
+ });
563
+ });
564
+ const validate = () => {
565
+ return elFormRef.value.validate();
566
+ };
567
+ const resetFields = (props2) => {
568
+ return elFormRef.value.resetFields(props2);
569
+ };
570
+ const clearValidate = (props2) => {
571
+ return elFormRef.value.clearValidate(props2);
572
+ };
573
+ return {
574
+ filterFormItemList,
575
+ elFormRef,
576
+ validate,
577
+ resetFields,
578
+ clearValidate
579
+ };
580
+ };
581
+
582
+ const useFormItemSlots = (props) => {
583
+ const attrs = vue.useAttrs();
584
+ const {
585
+ type,
586
+ label,
587
+ render,
588
+ required,
589
+ labelRender
590
+ } = props;
591
+ const prop = props.tableProp || props.prop;
592
+ const {
593
+ scopedSlots: renderScopedSlots,
594
+ ...renderProps
595
+ } = props.props || {};
596
+ const events = {};
597
+ for (const key in attrs) {
598
+ if (key.startsWith("on")) {
599
+ events[key] = attrs[key];
600
+ }
601
+ }
602
+ const formData = attrs["form-data"];
603
+ const scopedSlots = {
604
+ default: () => {
605
+ return type ? vue.h(vue.resolveComponent(type), {
606
+ modelValue: formData[prop],
607
+ "onUpdate:modelValue": (value) => {
608
+ formData[prop] = value;
609
+ },
610
+ ...renderProps,
611
+ ...events
612
+ }, renderScopedSlots) : formData[prop];
613
+ },
614
+ label: () => {
615
+ return vue.createVNode(vue.resolveComponent("el-tooltip"), {
616
+ "placement": "top",
617
+ "effect": "light",
618
+ "content": label,
619
+ "disabled": !props.isShowLabel
620
+ }, {
621
+ default: () => [vue.createVNode("span", null, [!props.hideRequiredAsterisk && required ? vue.createVNode("span", {
622
+ "style": "color: var(--el-color-danger);"
623
+ }, [vue.createTextVNode("*")]) : null, props.isShowLabel ? vue.createVNode("span", null, [label]) : ""])]
624
+ });
625
+ }
626
+ };
627
+ if (labelRender) {
628
+ scopedSlots.label = () => labelRender({
629
+ label
630
+ });
631
+ }
632
+ if (render) {
633
+ scopedSlots.default = render;
634
+ }
635
+ return {
636
+ scopedSlots
637
+ };
638
+ };
639
+ const useFormItemRules = (props) => {
640
+ const {
641
+ required,
642
+ rules,
643
+ label
644
+ } = props;
645
+ let mergeRules = [];
646
+ if (required) {
647
+ const requiredDefault = {
648
+ required: true
649
+ };
650
+ mergeRules.push(requiredDefault);
651
+ }
652
+ if (rules) {
653
+ if (Array.isArray(rules)) {
654
+ mergeRules = mergeRules.concat(rules);
655
+ }
656
+ if (Object.prototype.toString.call(rules) === "[object Object]") {
657
+ mergeRules.push(rules);
658
+ }
659
+ }
660
+ if (mergeRules) {
661
+ mergeRules.forEach((r) => {
662
+ if (r.required && typeof r.message === "undefined") {
663
+ r.message = `${label || ""}\u4E0D\u80FD\u4E3A\u7A7A`;
664
+ }
665
+ });
666
+ }
667
+ return {
668
+ rules: mergeRules
669
+ };
670
+ };
671
+
672
+ const expandFormItemProps = {
673
+ type: {
674
+ type: String
675
+ // default: 'EpInput',
676
+ },
677
+ col: Number,
678
+ render: Function,
679
+ labelRender: Function,
680
+ props: Object,
681
+ ...visibleProps,
682
+ class: String,
683
+ style: {
684
+ type: [String, Object]
685
+ },
686
+ isShowLabel: {
687
+ type: Boolean,
688
+ default: true
689
+ },
690
+ hideRequiredAsterisk: Boolean,
691
+ tableProp: String
692
+ // 用于table里的表单需要绑定的prop
693
+ };
694
+ const formItemProps = {
695
+ ...elementPlus.formItemProps,
696
+ ...expandFormItemProps
697
+ };
698
+ const expandFormItemPropsKeys = Object.keys(expandFormItemProps);
699
+
700
+ const bem = createNameSpace("form-item");
701
+ var EpFormItem = /* @__PURE__ */ vue.defineComponent({
702
+ name: "EpFormItem",
703
+ inheritAttrs: false,
704
+ props: formItemProps,
705
+ setup(props, {
706
+ emit
707
+ }) {
708
+ const attrs = vue.useAttrs();
709
+ const {
710
+ scopedSlots
711
+ } = useFormItemSlots(props);
712
+ const {
713
+ rules
714
+ } = useFormItemRules(props);
715
+ const {
716
+ props: childProps,
717
+ ...formItemProps2
718
+ } = props;
719
+ return () => {
720
+ return vue.createVNode(vue.resolveComponent("el-form-item"), vue.mergeProps({
721
+ "class": [bem.b(), prepareClassNames()],
722
+ "style": prepareStyles()
723
+ }, {
724
+ ...prepareProps(formItemProps2, [...expandFormItemPropsKeys]),
725
+ rules,
726
+ "label-width": attrs["form-label-width"]
727
+ }), scopedSlots);
728
+ };
729
+ }
730
+ });
731
+
732
+ var _sfc_main$4 = /* @__PURE__ */ vue.defineComponent({
733
+ ...{
734
+ name: "EpForm",
735
+ inheritAttrs: false
736
+ },
737
+ __name: "form",
738
+ props: /* @__PURE__ */ vue.mergeModels(formProps, {
739
+ "modelValue": { type: Object, ...{
740
+ default: () => vue.reactive({})
741
+ } },
742
+ "modelModifiers": {}
743
+ }),
744
+ emits: /* @__PURE__ */ vue.mergeModels(formEmits, ["update:modelValue"]),
745
+ setup(__props, { expose: __expose, emit: __emit }) {
746
+ const bem = createNameSpace("form");
747
+ const props = __props;
748
+ const emit = __emit;
749
+ const customAttrs = vue.computed(() => {
750
+ return {
751
+ ...prepareProps(props, ["modelValue", "model", ...expandFormPropsKeys]),
752
+ hideRequiredAsterisk: true,
753
+ // 隐藏必填星号, 使用自己的*
754
+ scrollToError: true,
755
+ ...prepareEvents(emit, formEmitsKeys)
756
+ };
757
+ });
758
+ const formData = vue.useModel(__props, "modelValue");
759
+ const { filterFormItemList, elFormRef, validate, resetFields, clearValidate } = useForm$1(props);
760
+ const { open, toggleStatus, isShowFoldBtn, isShowFormItem } = useCollapse(
761
+ {
762
+ filterFormItemList,
763
+ isShowFold: props.isShowFold,
764
+ showFieldCount: props.showFieldCount
765
+ },
766
+ emit
767
+ );
768
+ __expose({
769
+ elFormRef,
770
+ validate,
771
+ resetFields,
772
+ clearValidate
773
+ });
774
+ return (_ctx, _cache) => {
775
+ const _component_el_col = vue.resolveComponent("el-col");
776
+ const _component_el_row = vue.resolveComponent("el-row");
777
+ const _component_el_form = vue.resolveComponent("el-form");
778
+ return vue.openBlock(), vue.createElementBlock(
779
+ "div",
780
+ {
781
+ class: vue.normalizeClass([
782
+ vue.unref(bem).b(),
783
+ vue.unref(prepareClassNames)(),
784
+ vue.unref(bem).is("open", vue.unref(open)),
785
+ vue.unref(bem).is("fold", vue.unref(isShowFoldBtn))
786
+ ]),
787
+ style: vue.normalizeStyle({
788
+ ...vue.unref(prepareStyles)()
789
+ })
790
+ },
791
+ [
792
+ vue.createVNode(_component_el_form, vue.mergeProps({
793
+ ref_key: "elFormRef",
794
+ ref: elFormRef,
795
+ model: formData.value
796
+ }, customAttrs.value), {
797
+ default: vue.withCtx(() => [
798
+ vue.renderSlot(_ctx.$slots, "default", {}, () => [
799
+ vue.createVNode(_component_el_row, null, {
800
+ default: vue.withCtx(() => [
801
+ (vue.openBlock(true), vue.createElementBlock(
802
+ vue.Fragment,
803
+ null,
804
+ vue.renderList(vue.unref(filterFormItemList), (item, index) => {
805
+ return vue.withDirectives((vue.openBlock(), vue.createBlock(_component_el_col, {
806
+ key: item.prop || index,
807
+ class: vue.normalizeClass(vue.unref(bem).e("col")),
808
+ span: item.col || 24 / _ctx.col
809
+ }, {
810
+ default: vue.withCtx(() => [
811
+ vue.createVNode(vue.unref(EpFormItem), vue.mergeProps({
812
+ "form-data": formData.value,
813
+ "form-label-width": _ctx.labelWidth
814
+ }, { ref_for: true }, item), null, 16, ["form-data", "form-label-width"])
815
+ ]),
816
+ _: 2
817
+ /* DYNAMIC */
818
+ }, 1032, ["class", "span"])), [
819
+ [vue.vShow, vue.unref(isShowFormItem)(index)]
820
+ ]);
821
+ }),
822
+ 128
823
+ /* KEYED_FRAGMENT */
824
+ ))
825
+ ]),
826
+ _: 1
827
+ /* STABLE */
828
+ })
829
+ ])
830
+ ]),
831
+ _: 3
832
+ /* FORWARDED */
833
+ }, 16, ["model"]),
834
+ vue.unref(isShowFoldBtn) ? (vue.openBlock(), vue.createElementBlock("div", {
835
+ key: 0,
836
+ class: vue.normalizeClass(vue.unref(bem).e("fold")),
837
+ onClick: vue.unref(toggleStatus)
838
+ }, vue.toDisplayString(vue.unref(open) ? "\u6536\u8D77" : "\u66F4\u591A"), 11, ["onClick"])) : vue.createCommentVNode("v-if", true)
839
+ ],
840
+ 6
841
+ /* CLASS, STYLE */
842
+ );
843
+ };
844
+ }
845
+ });
846
+
847
+ var Form = withInstall(_sfc_main$4);
848
+
849
+ const inputProps = {
850
+ ...elementPlus.inputProps,
851
+ max: Number,
852
+ min: Number,
853
+ radix: Number,
854
+ nonzero: Boolean,
855
+ placeholder: {
856
+ type: String,
857
+ default: "\u8BF7\u8F93\u5165"
858
+ },
859
+ thousand: {
860
+ type: Boolean,
861
+ default: true
862
+ },
863
+ clearable: {
864
+ ...elementPlus.inputProps.clearable,
865
+ default: true
866
+ }
867
+ };
868
+ const inputEmits = {
869
+ ...elementPlus.inputEmits
870
+ };
871
+ const inputEmitsKeys = Object.keys(inputEmits);
872
+
873
+ var _sfc_main$3 = /* @__PURE__ */ vue.defineComponent({
874
+ ...{
875
+ name: "EpInput",
876
+ inheritAttrs: false
877
+ },
878
+ __name: "input",
879
+ props: /* @__PURE__ */ vue.mergeModels(inputProps, {
880
+ "modelValue": { type: null },
881
+ "modelModifiers": {}
882
+ }),
883
+ emits: /* @__PURE__ */ vue.mergeModels(inputEmits, ["update:modelValue"]),
884
+ setup(__props, { emit: __emit }) {
885
+ const bem = createNameSpace("input");
886
+ const props = __props;
887
+ const emit = __emit;
888
+ const slots = vue.computed(() => {
889
+ return Object.keys(vue.useSlots());
890
+ });
891
+ let isBluring = false;
892
+ let isFocusing = false;
893
+ const customAttrs = vue.computed(() => {
894
+ return {
895
+ ...prepareProps(props, ["modelValue"]),
896
+ ...prepareEvents(emit, inputEmitsKeys),
897
+ placeholder: props.disabled ? "" : props.placeholder,
898
+ onFocus: (e) => {
899
+ isFocusing = true;
900
+ if (props.thousand) {
901
+ e.target.value = value.value ? String(value.value) : "";
902
+ }
903
+ emit("focus", e);
904
+ },
905
+ onBlur: (e) => {
906
+ if (props.type === "number") {
907
+ let val = value.value;
908
+ if (props.nonzero && +val === 0) {
909
+ val = "";
910
+ }
911
+ if (val && val[val.length - 1] === ".") {
912
+ val = String(val).slice(0, -1);
913
+ }
914
+ if (val && val === "-") {
915
+ val = "";
916
+ }
917
+ value.value = val ? +val : val;
918
+ e.target.value = toThousand(value.value);
919
+ }
920
+ isBluring = true;
921
+ isFocusing = false;
922
+ emit("blur", e);
923
+ }
924
+ };
925
+ });
926
+ const value = vue.useModel(__props, "modelValue");
927
+ const inputRef = vue.ref();
928
+ const toThousand = (val) => {
929
+ if (props.thousand) {
930
+ return val ? window.hx.thousand(val) : val;
931
+ }
932
+ return val;
933
+ };
934
+ vue.watch(
935
+ () => value.value,
936
+ (val) => {
937
+ if (props.type === "number") {
938
+ vue.onMounted(() => {
939
+ inputRef.value.input.value = toThousand(val);
940
+ });
941
+ }
942
+ if (isBluring) {
943
+ isBluring = false;
944
+ return;
945
+ }
946
+ if (!isFocusing) {
947
+ return;
948
+ }
949
+ if (props.type === "number") {
950
+ if (typeof val === "number") {
951
+ val = "" + val;
952
+ }
953
+ if (typeof val === "string") {
954
+ const zeroReg = new RegExp("^[-+]?0[0-9]\\d*");
955
+ if (zeroReg.test(val)) {
956
+ val = val.replace("0", "");
957
+ }
958
+ const reg = new RegExp("^([-+])?\\d*(\\.?\\d*)", "g");
959
+ val = val.match(reg) ? val.match(reg)[0] : "";
960
+ if (props.radix || props.radix === 0) {
961
+ const reg2 = props.radix === 0 ? new RegExp("^([-+])?\\d*", "g") : new RegExp(`^([-+])?\\d*(\\.?\\d{0,${props.radix}})`, "g");
962
+ val = val.match(reg2) ? val.match(reg2)[0] : "";
963
+ }
964
+ if ((props.max || props.max === 0) && +val > props.max) {
965
+ val = props.max;
966
+ }
967
+ if ((props.min || props.min === 0) && (val || val === 0) && +val < props.min) {
968
+ val = props.min;
969
+ }
970
+ }
971
+ } else if (props.type === "text") {
972
+ val = val.trim();
973
+ }
974
+ value.value = val;
975
+ },
976
+ {
977
+ immediate: true
978
+ }
979
+ );
980
+ return (_ctx, _cache) => {
981
+ const _component_el_input = vue.resolveComponent("el-input");
982
+ return vue.openBlock(), vue.createBlock(_component_el_input, vue.mergeProps({
983
+ ref_key: "inputRef",
984
+ ref: inputRef,
985
+ modelValue: value.value,
986
+ "onUpdate:modelValue": ($event) => value.value = $event,
987
+ class: `${vue.unref(bem).b()} ${vue.unref(prepareClassNames)()}`,
988
+ style: {
989
+ ...vue.unref(prepareStyles)()
990
+ }
991
+ }, customAttrs.value, {
992
+ type: _ctx.type === "number" ? "text" : _ctx.type
993
+ }), vue.createSlots({
994
+ _: 2
995
+ /* DYNAMIC */
996
+ }, [
997
+ vue.renderList(slots.value, (name) => {
998
+ return {
999
+ name,
1000
+ fn: vue.withCtx((scope) => [
1001
+ vue.renderSlot(_ctx.$slots, name, vue.normalizeProps(vue.guardReactiveProps(scope)))
1002
+ ])
1003
+ };
1004
+ })
1005
+ ]), 1040, ["modelValue", "onUpdate:modelValue", "class", "style", "type"]);
1006
+ };
1007
+ }
1008
+ });
1009
+
1010
+ var Input = withInstall(_sfc_main$3);
1011
+
1012
+ const inheritTableProps = {
1013
+ ...elTableProps,
1014
+ // Table 的尺寸
1015
+ size: {
1016
+ ...elTableProps.size,
1017
+ default: "default"
1018
+ },
1019
+ // 是否带有纵向边框
1020
+ border: {
1021
+ ...elTableProps.border,
1022
+ default: true
1023
+ },
1024
+ // 表头样式
1025
+ headerCellStyle: {
1026
+ ...elTableProps.headerCellStyle,
1027
+ default: () => ({
1028
+ background: "#EEEFF3",
1029
+ // textAlign: 'center',
1030
+ fontSize: "14px",
1031
+ color: "#505050"
1032
+ })
1033
+ }
1034
+ };
1035
+ const expandTableProps = {
1036
+ ...apiProps,
1037
+ columns: {
1038
+ type: Array,
1039
+ default: () => []
1040
+ },
1041
+ // 是否显示勾选列
1042
+ showSelectionCol: Boolean,
1043
+ // 是否显示序号列
1044
+ showIndexCol: {
1045
+ type: Boolean,
1046
+ default: true
1047
+ },
1048
+ // 对齐方式
1049
+ align: {
1050
+ type: String,
1051
+ default: "center"
1052
+ },
1053
+ // 序号列自定义
1054
+ indexFormatter: {
1055
+ type: [Number, Function]
1056
+ },
1057
+ disabled: Boolean,
1058
+ reserveSelection: Boolean,
1059
+ selectable: {
1060
+ type: Function
1061
+ },
1062
+ paginationProps: {
1063
+ type: Object,
1064
+ default: () => ({})
1065
+ },
1066
+ showPagination: Boolean,
1067
+ isFrontPage: Boolean,
1068
+ // 操作列
1069
+ actionButtons: {
1070
+ type: Array,
1071
+ default: () => []
1072
+ },
1073
+ // 链接列
1074
+ linkProps: {
1075
+ type: Array,
1076
+ default: () => []
1077
+ }
1078
+ };
1079
+ const tableProps = {
1080
+ ...inheritTableProps,
1081
+ ...expandTableProps
1082
+ };
1083
+ const expandTablePropsKeys = Object.keys(expandTableProps);
1084
+ const tableEmits = elementPlus.ElTable.emits;
1085
+ const tableEmitsKeys = tableEmits;
1086
+
1087
+ const useRequest = ({
1088
+ api,
1089
+ method,
1090
+ reqData,
1091
+ reqParams,
1092
+ reqBefore,
1093
+ reqAfter,
1094
+ cancelToken,
1095
+ hooks
1096
+ }) => {
1097
+ if (!api) return {};
1098
+ const loading = vue.ref(false);
1099
+ let cancelRequest;
1100
+ let apiFn;
1101
+ if (typeof api === "string") {
1102
+ const config = {
1103
+ url: api,
1104
+ method
1105
+ };
1106
+ if (cancelToken) {
1107
+ config.cancelRequest = (cancel) => {
1108
+ cancelRequest = cancel;
1109
+ };
1110
+ }
1111
+ apiFn = (data = {}, params) => {
1112
+ if (config.method === "get") {
1113
+ config.params = data;
1114
+ } else {
1115
+ config.data = data;
1116
+ config.params = params;
1117
+ }
1118
+ config.data = {
1119
+ ...reqData,
1120
+ ...config.data
1121
+ };
1122
+ config.params = {
1123
+ ...reqParams,
1124
+ ...config.params
1125
+ };
1126
+ if (data.$query) {
1127
+ config.data[data.$query] = data.$searchValue;
1128
+ delete data.$searchValue;
1129
+ }
1130
+ if (reqBefore) {
1131
+ reqBefore(config);
1132
+ }
1133
+ return fetch(config);
1134
+ };
1135
+ } else {
1136
+ apiFn = api;
1137
+ }
1138
+ const requestFn = async (data = {}) => {
1139
+ if (loading.value && !cancelToken) return;
1140
+ loading.value = true;
1141
+ try {
1142
+ cancelRequest && cancelRequest();
1143
+ const res = await apiFn(data);
1144
+ if (reqAfter) {
1145
+ reqAfter(res);
1146
+ }
1147
+ if (hooks?.success) {
1148
+ hooks.success(res.data);
1149
+ }
1150
+ } catch (error) {
1151
+ if (hooks?.fail) {
1152
+ hooks.fail(error);
1153
+ }
1154
+ } finally {
1155
+ loading.value = false;
1156
+ }
1157
+ };
1158
+ return {
1159
+ loading,
1160
+ requestFn
1161
+ };
1162
+ };
1163
+
1164
+ const useTable$1 = (props) => {
1165
+ const elFormRef = vue.useTemplateRef("elFormRef");
1166
+ const elTableRef = vue.useTemplateRef("elTableRef");
1167
+ const customData = vue.ref([]);
1168
+ const {
1169
+ loading,
1170
+ requestFn
1171
+ } = useRequest({
1172
+ api: props.api,
1173
+ method: props.method,
1174
+ reqData: props.reqData,
1175
+ reqParams: props.reqParams,
1176
+ reqBefore: props.reqBefore,
1177
+ reqAfter: props.reqAfter,
1178
+ cancelToken: true,
1179
+ hooks: {
1180
+ success(data) {
1181
+ if (Array.isArray(data)) {
1182
+ customData.value = data;
1183
+ } else if (data && typeof data === "object") {
1184
+ const rawData = data;
1185
+ customData.value = rawData?.list || rawData?.data || [];
1186
+ } else {
1187
+ customData.value = [];
1188
+ }
1189
+ if (props.showPagination) {
1190
+ pagination.total = (props.isFrontPage ? customData.value.length : data.total) || 0;
1191
+ }
1192
+ },
1193
+ fail(error) {
1194
+ console.error(error);
1195
+ }
1196
+ }
1197
+ });
1198
+ const search = (init = false, isPagination = false) => {
1199
+ if (init) {
1200
+ pagination.pageNo = 1;
1201
+ }
1202
+ if (isPagination && props.isFrontPage) {
1203
+ const {
1204
+ pageNo,
1205
+ pageSize
1206
+ } = pagination;
1207
+ const data = customData.value.filter((item, index) => {
1208
+ return index < pageNo * pageSize && index >= (pageNo - 1) * pageSize;
1209
+ });
1210
+ customData.value = data;
1211
+ } else {
1212
+ if (props.api) {
1213
+ requestFn({
1214
+ pageNo: pagination.pageNo,
1215
+ pageSize: pagination.pageSize
1216
+ });
1217
+ } else if (props.data?.length) {
1218
+ customData.value = props.data;
1219
+ }
1220
+ }
1221
+ };
1222
+ const {
1223
+ pagination,
1224
+ paginationProps
1225
+ } = usePagination(props, search);
1226
+ search(true);
1227
+ const validate = () => {
1228
+ return elFormRef.value.validate();
1229
+ };
1230
+ const resetFields = (props2) => {
1231
+ return elFormRef.value.resetFields(props2);
1232
+ };
1233
+ const clearValidate = (props2) => {
1234
+ return elFormRef.value.clearValidate(props2);
1235
+ };
1236
+ const formatActionButtons = (list, scope) => {
1237
+ return list.map((item) => {
1238
+ if (item.onClick) {
1239
+ item.onClick = item.onClick.bind(null, scope);
1240
+ }
1241
+ return item;
1242
+ });
1243
+ };
1244
+ return {
1245
+ loading,
1246
+ data: customData,
1247
+ search,
1248
+ pagination,
1249
+ paginationProps,
1250
+ validate,
1251
+ resetFields,
1252
+ clearValidate,
1253
+ elFormRef,
1254
+ elTableRef,
1255
+ formatActionButtons
1256
+ };
1257
+ };
1258
+ const usePagination = function(props, search) {
1259
+ const pageSizes = [20, 50, 100, 200];
1260
+ const pagination = vue.reactive({
1261
+ total: 0,
1262
+ pageNo: 1,
1263
+ pageSize: pageSizes[0]
1264
+ });
1265
+ const paginationProps = vue.computed(() => {
1266
+ const defaultPaginationProps = props.paginationProps || {};
1267
+ const onSizeChange = defaultPaginationProps.onSizeChange;
1268
+ const onCurrentChange = defaultPaginationProps.onCurrentChange;
1269
+ return {
1270
+ ...defaultPaginationProps,
1271
+ pageSizes,
1272
+ layout: "total, sizes, prev, pager, next, jumper",
1273
+ onSizeChange: (value) => {
1274
+ onSizeChange && onSizeChange(value);
1275
+ search(true, true);
1276
+ },
1277
+ onCurrentChange: (value) => {
1278
+ onCurrentChange && onCurrentChange(value);
1279
+ search(false, true);
1280
+ }
1281
+ };
1282
+ });
1283
+ return {
1284
+ pagination,
1285
+ paginationProps
1286
+ };
1287
+ };
1288
+ const useTableColumn = (props, tableData) => {
1289
+ const columnProps = (column) => {
1290
+ const attrs = {
1291
+ align: column.align || props.align
1292
+ // ...prepareEvents<TableEmits>(emit, tableEmits),
1293
+ };
1294
+ if (!column.renderHeader) {
1295
+ let required = column.required;
1296
+ if (typeof column.required === "function") {
1297
+ required = column.required();
1298
+ }
1299
+ if (required) {
1300
+ attrs["renderHeader"] = (data) => {
1301
+ const {
1302
+ column: column2
1303
+ } = data;
1304
+ return vue.createVNode("span", null, [vue.createVNode("span", {
1305
+ "style": "color:var(--el-color-danger)"
1306
+ }, [vue.createTextVNode(" * ")]), column2.label]);
1307
+ };
1308
+ }
1309
+ }
1310
+ if (column.headerRender) {
1311
+ attrs.renderHeader = column.headerRender;
1312
+ }
1313
+ if (column.filter) {
1314
+ const arr = tableData.value.map((item) => item[column.prop]);
1315
+ attrs.filters = [...new Set(arr)].map((item) => {
1316
+ return {
1317
+ text: item,
1318
+ value: item
1319
+ };
1320
+ });
1321
+ attrs.filterMethod = (value, row) => {
1322
+ return row[column.prop] === value;
1323
+ };
1324
+ }
1325
+ return {
1326
+ ...attrs,
1327
+ ...prepareProps(column)
1328
+ };
1329
+ };
1330
+ const columnList = vue.computed(() => {
1331
+ return props.columns.filter((column) => {
1332
+ if (props.linkProps.length) {
1333
+ const linkColumn = props.linkProps.find((item) => item.prop === column.prop);
1334
+ if (linkColumn) {
1335
+ column.type = "EpButtons";
1336
+ column.className = "table-column-link";
1337
+ column.props = {
1338
+ list: [linkColumn],
1339
+ type: "text",
1340
+ ...column.props
1341
+ };
1342
+ }
1343
+ }
1344
+ if ("show" in column) {
1345
+ return typeof column.show === "function" ? column.show(column) : column.show;
1346
+ } else if ("hide" in column) {
1347
+ return typeof column.hide === "function" ? !column.hide(column) : !column.hide;
1348
+ }
1349
+ return true;
1350
+ });
1351
+ });
1352
+ return {
1353
+ columnProps,
1354
+ columnList
1355
+ };
1356
+ };
1357
+ const useTableFormItem = (props) => {
1358
+ const formItemProps = (scope, item) => {
1359
+ let required = item.required;
1360
+ if (typeof required === "function") {
1361
+ required = required();
1362
+ }
1363
+ if (item.cellRequired) {
1364
+ required = item.cellRequired(scope);
1365
+ }
1366
+ let disabled = props.disabled;
1367
+ if ("disabled" in item) {
1368
+ if (typeof item.disabled === "function") {
1369
+ disabled = item.disabled(scope);
1370
+ } else {
1371
+ disabled = item.disabled || false;
1372
+ }
1373
+ }
1374
+ if (item.type === "EpSelect" && item.props) {
1375
+ if ("options" in item.props && typeof item.props.options === "function") {
1376
+ item.props.options = item.props.options(scope);
1377
+ }
1378
+ if ("disabledOption" in item.props && typeof item.props.disabledOption === "function") {
1379
+ const disabledOption = item.props.disabledOption;
1380
+ item.props.disabledOption = (...args) => disabledOption(...args, scope);
1381
+ }
1382
+ }
1383
+ if (item.type === "EpButtons" && item.props) {
1384
+ item.props.list.forEach((btnItem) => {
1385
+ if (btnItem.prop) {
1386
+ btnItem.name = scope.row[btnItem.prop];
1387
+ }
1388
+ if (btnItem.onClick) {
1389
+ btnItem.onClick = btnItem.onClick.bind(null, scope);
1390
+ }
1391
+ });
1392
+ }
1393
+ for (const key in item) {
1394
+ if (key.startsWith("on") && typeof item[key] === "function") {
1395
+ const fn = item[key];
1396
+ item[key] = (...args) => fn(...args, scope);
1397
+ }
1398
+ }
1399
+ return {
1400
+ ...prepareProps(item),
1401
+ isShowLabel: false,
1402
+ required,
1403
+ hideRequiredAsterisk: "cellRequired" in item ? false : required,
1404
+ prop: `table.${scope.$index}.${item.prop}`,
1405
+ tableProp: item.prop,
1406
+ // table里的表单需要绑定的prop
1407
+ props: {
1408
+ ...item.props,
1409
+ disabled
1410
+ }
1411
+ };
1412
+ };
1413
+ return {
1414
+ formItemProps
1415
+ };
1416
+ };
1417
+
1418
+ var _sfc_main$2 = /* @__PURE__ */ vue.defineComponent({
1419
+ ...{
1420
+ name: "EpTable",
1421
+ inheritAttrs: false
1422
+ },
1423
+ __name: "table",
1424
+ props: tableProps,
1425
+ emits: tableEmits,
1426
+ setup(__props, {
1427
+ expose: __expose,
1428
+ emit: __emit
1429
+ }) {
1430
+ const bem = createNameSpace("table");
1431
+ const props = __props;
1432
+ const emit = __emit;
1433
+ const slots = vue.computed(() => {
1434
+ return Object.keys(vue.useSlots());
1435
+ });
1436
+ const customAttrs = vue.computed(() => {
1437
+ return {
1438
+ ...prepareProps(props, ["modelValue", ...expandTablePropsKeys]),
1439
+ size: "small",
1440
+ data: data.value,
1441
+ ...prepareEvents(emit, tableEmitsKeys)
1442
+ };
1443
+ });
1444
+ const {
1445
+ pagination,
1446
+ paginationProps,
1447
+ data,
1448
+ validate,
1449
+ resetFields,
1450
+ clearValidate,
1451
+ loading,
1452
+ search,
1453
+ elFormRef,
1454
+ elTableRef,
1455
+ formatActionButtons
1456
+ } = useTable$1(props);
1457
+ const {
1458
+ columnProps,
1459
+ columnList
1460
+ } = useTableColumn(props, data);
1461
+ const {
1462
+ formItemProps
1463
+ } = useTableFormItem(props);
1464
+ __expose({
1465
+ elFormRef,
1466
+ elTableRef,
1467
+ validate,
1468
+ resetFields,
1469
+ clearValidate,
1470
+ search
1471
+ });
1472
+ return (_ctx, _cache) => {
1473
+ const _component_el_table_column = vue.resolveComponent("el-table-column");
1474
+ const _component_EpButtons = vue.resolveComponent("EpButtons");
1475
+ const _component_el_table = vue.resolveComponent("el-table");
1476
+ const _component_el_form = vue.resolveComponent("el-form");
1477
+ const _component_el_pagination = vue.resolveComponent("el-pagination");
1478
+ const _directive_loading = vue.resolveDirective("loading");
1479
+ return vue.openBlock(), vue.createElementBlock(
1480
+ "div",
1481
+ {
1482
+ class: vue.normalizeClass(`${vue.unref(bem).b()} ${vue.unref(prepareClassNames)()}`),
1483
+ style: vue.normalizeStyle({
1484
+ ...vue.unref(prepareStyles)()
1485
+ })
1486
+ },
1487
+ [vue.createVNode(_component_el_form, {
1488
+ ref_key: "elFormRef",
1489
+ ref: elFormRef,
1490
+ model: {
1491
+ table: vue.unref(data)
1492
+ },
1493
+ size: "small",
1494
+ "hide-required-asterisk": "",
1495
+ "scroll-to-error": "",
1496
+ "scroll-into-view-options": {
1497
+ inline: "center"
1498
+ },
1499
+ class: "ep-form"
1500
+ }, {
1501
+ default: vue.withCtx(() => [vue.withDirectives((vue.openBlock(), vue.createBlock(
1502
+ _component_el_table,
1503
+ vue.mergeProps({
1504
+ ref_key: "elTableRef",
1505
+ ref: elTableRef
1506
+ }, customAttrs.value),
1507
+ vue.createSlots({
1508
+ default: vue.withCtx(() => [_ctx.showSelectionCol ? (vue.openBlock(), vue.createBlock(_component_el_table_column, {
1509
+ key: 0,
1510
+ type: "selection",
1511
+ width: "55",
1512
+ align: _ctx.align,
1513
+ selectable: _ctx.selectable,
1514
+ fixed: ""
1515
+ }, null, 8, ["align", "selectable"])) : vue.createCommentVNode("v-if", true), _ctx.showIndexCol ? (vue.openBlock(), vue.createBlock(_component_el_table_column, {
1516
+ key: 1,
1517
+ type: "index",
1518
+ width: "56",
1519
+ align: _ctx.align,
1520
+ label: "\u5E8F\u53F7",
1521
+ fixed: "",
1522
+ index: _ctx.indexFormatter
1523
+ }, null, 8, ["align", "index"])) : vue.createCommentVNode("v-if", true), _ctx.actionButtons.length ? (vue.openBlock(), vue.createBlock(_component_el_table_column, {
1524
+ key: 2,
1525
+ label: "\u64CD\u4F5C",
1526
+ align: _ctx.align,
1527
+ fixed: "",
1528
+ width: "200"
1529
+ }, {
1530
+ default: vue.withCtx((scope) => [vue.createElementVNode(
1531
+ "span",
1532
+ {
1533
+ class: vue.normalizeClass(vue.unref(bem).e("action-buttons"))
1534
+ },
1535
+ [vue.createVNode(_component_EpButtons, {
1536
+ list: vue.unref(formatActionButtons)(_ctx.actionButtons, scope),
1537
+ type: "text"
1538
+ }, null, 8, ["list"])],
1539
+ 2
1540
+ /* CLASS */
1541
+ )]),
1542
+ _: 1
1543
+ /* STABLE */
1544
+ }, 8, ["align"])) : vue.createCommentVNode("v-if", true), (vue.openBlock(true), vue.createElementBlock(
1545
+ vue.Fragment,
1546
+ null,
1547
+ vue.renderList(vue.unref(columnList), (item, index) => {
1548
+ return vue.openBlock(), vue.createBlock(
1549
+ _component_el_table_column,
1550
+ vue.mergeProps({
1551
+ key: index
1552
+ }, {
1553
+ ref_for: true
1554
+ }, vue.unref(columnProps)(item)),
1555
+ {
1556
+ default: vue.withCtx((scope) => [item.type ? (vue.openBlock(), vue.createBlock(vue.unref(EpFormItem), vue.mergeProps({
1557
+ key: 0,
1558
+ "form-data": scope.row
1559
+ }, {
1560
+ ref_for: true
1561
+ }, vue.unref(formItemProps)(scope, item)), null, 16, ["form-data"])) : (vue.openBlock(), vue.createElementBlock(
1562
+ vue.Fragment,
1563
+ {
1564
+ key: 1
1565
+ },
1566
+ [vue.createTextVNode(
1567
+ vue.toDisplayString(scope.row[item.prop]),
1568
+ 1
1569
+ /* TEXT */
1570
+ )],
1571
+ 64
1572
+ /* STABLE_FRAGMENT */
1573
+ ))]),
1574
+ _: 2
1575
+ /* DYNAMIC */
1576
+ },
1577
+ 1040
1578
+ /* FULL_PROPS, DYNAMIC_SLOTS */
1579
+ );
1580
+ }),
1581
+ 128
1582
+ /* KEYED_FRAGMENT */
1583
+ ))]),
1584
+ _: 2
1585
+ /* DYNAMIC */
1586
+ }, [vue.renderList(slots.value, (name) => {
1587
+ return {
1588
+ name,
1589
+ fn: vue.withCtx((scope) => [vue.renderSlot(_ctx.$slots, name, vue.normalizeProps(vue.guardReactiveProps(scope)))])
1590
+ };
1591
+ })]),
1592
+ 1040
1593
+ /* FULL_PROPS, DYNAMIC_SLOTS */
1594
+ )), [[_directive_loading, vue.unref(loading)]])]),
1595
+ _: 3
1596
+ /* FORWARDED */
1597
+ }, 8, ["model"]), _ctx.showPagination ? (vue.openBlock(), vue.createBlock(_component_el_pagination, vue.mergeProps({
1598
+ key: 0,
1599
+ "current-page": vue.unref(pagination).pageNo,
1600
+ "onUpdate:currentPage": ($event) => vue.unref(pagination).pageNo = $event,
1601
+ "page-size": vue.unref(pagination).pageSize,
1602
+ "onUpdate:pageSize": ($event) => vue.unref(pagination).pageSize = $event,
1603
+ total: vue.unref(pagination).total
1604
+ }, vue.unref(paginationProps)), null, 16, ["current-page", "onUpdate:currentPage", "page-size", "onUpdate:pageSize", "total"])) : vue.createCommentVNode("v-if", true)],
1605
+ 6
1606
+ /* CLASS, STYLE */
1607
+ );
1608
+ };
1609
+ }
1610
+ });
1611
+
1612
+ var Table = withInstall(_sfc_main$2);
1613
+
1614
+ console.log(formProps.formItemList);
1615
+ const searchListPageProps = {
1616
+ ...apiProps,
1617
+ customColumnModule: Number,
1618
+ // 自定义列模块
1619
+ showOperationColumn: Boolean,
1620
+ // 是否显示操作列
1621
+ // 表单列表
1622
+ formItemList: {
1623
+ ...formProps.formItemList
1624
+ },
1625
+ // 左侧按钮
1626
+ leftButtons: {
1627
+ ...buttonsProps.list
1628
+ },
1629
+ // 表格列
1630
+ columns: {
1631
+ ...tableProps.columns
1632
+ },
1633
+ // 操作列
1634
+ actionButtons: {
1635
+ ...tableProps.actionButtons
1636
+ },
1637
+ // 链接列
1638
+ linkProps: {
1639
+ ...tableProps.linkProps
1640
+ },
1641
+ showSelectionCol: Boolean,
1642
+ showIndexCol: {
1643
+ type: Boolean,
1644
+ default: true
1645
+ },
1646
+ add: Function,
1647
+ // 新增
1648
+ templateDownloadApi: String,
1649
+ // 模板下载
1650
+ importApi: String,
1651
+ // 导入
1652
+ exportApi: String,
1653
+ // 导出
1654
+ // 表格额外距离
1655
+ offsetTop: {
1656
+ type: Number,
1657
+ default: 0
1658
+ },
1659
+ formData: {
1660
+ type: Object,
1661
+ default: () => ({})
1662
+ },
1663
+ tableProps: Object,
1664
+ formProps: Object,
1665
+ buttonsProps: Object
1666
+ };
1667
+
1668
+ const useSearchListPage = (props) => {
1669
+ const { calcTableHeight, tableProps, tableRef } = useTable(props);
1670
+ const { formProps, validate, resetFields, formRef } = useForm(props, {
1671
+ calcTableHeight
1672
+ });
1673
+ const { buttonsProps, searchButtons, search, reset } = useButtons(props, {
1674
+ validate,
1675
+ resetFields,
1676
+ tableRef
1677
+ });
1678
+ return {
1679
+ formProps,
1680
+ tableProps,
1681
+ buttonsProps,
1682
+ searchButtons,
1683
+ search,
1684
+ reset,
1685
+ tableRef,
1686
+ formRef
1687
+ };
1688
+ };
1689
+ const useTable = (props) => {
1690
+ const instanceName = "tableRef";
1691
+ const tableRef = vue.useTemplateRef(instanceName);
1692
+ const tableHeight = vue.ref(window.innerHeight);
1693
+ const tableProps = vue.computed(() => {
1694
+ return {
1695
+ ref: instanceName,
1696
+ columns: props.columns,
1697
+ showPagination: true,
1698
+ height: tableHeight.value,
1699
+ showIndexCol: props.showIndexCol,
1700
+ showSelectionCol: props.showSelectionCol,
1701
+ actionButtons: props.actionButtons,
1702
+ linkProps: props.linkProps,
1703
+ api: props.api,
1704
+ reqData: props.formData,
1705
+ ...props.tableProps
1706
+ };
1707
+ });
1708
+ const calcTableHeight = () => {
1709
+ const topHeight = document.getElementById("top").offsetHeight;
1710
+ const middleHeight = document.getElementById("middle").offsetHeight;
1711
+ let paginationHeight = 0;
1712
+ if (tableProps.value.showPagination) {
1713
+ paginationHeight = document.querySelector(".el-pagination").offsetHeight + 12;
1714
+ }
1715
+ const frameDistance = 40;
1716
+ tableHeight.value = window.innerHeight - topHeight - middleHeight - paginationHeight - frameDistance - props.offsetTop;
1717
+ };
1718
+ vue.onMounted(calcTableHeight);
1719
+ return {
1720
+ tableRef,
1721
+ tableProps,
1722
+ calcTableHeight
1723
+ };
1724
+ };
1725
+ const useForm = (props, { calcTableHeight }) => {
1726
+ const instanceName = "formRef";
1727
+ const formRef = vue.useTemplateRef(instanceName);
1728
+ const formProps = vue.computed(() => {
1729
+ return {
1730
+ ref: instanceName,
1731
+ formItemList: props.formItemList,
1732
+ isShowFold: true,
1733
+ modelValue: props.formData,
1734
+ ...props.formProps,
1735
+ onToggleStatus: () => {
1736
+ setTimeout(() => {
1737
+ calcTableHeight();
1738
+ }, 0);
1739
+ }
1740
+ };
1741
+ });
1742
+ const validate = () => {
1743
+ return formRef.value.validate();
1744
+ };
1745
+ const resetFields = (props2) => {
1746
+ return formRef.value.resetFields(props2);
1747
+ };
1748
+ const clearValidate = (props2) => {
1749
+ return formRef.value.clearValidate(props2);
1750
+ };
1751
+ return {
1752
+ formProps,
1753
+ formRef,
1754
+ validate,
1755
+ resetFields,
1756
+ clearValidate
1757
+ };
1758
+ };
1759
+ const useButtons = (props, { validate, resetFields, tableRef }) => {
1760
+ const defaultButtons = [
1761
+ {
1762
+ name: "\u65B0\u589E",
1763
+ prop: "add",
1764
+ show: () => {
1765
+ return !!props.add;
1766
+ },
1767
+ onClick: () => {
1768
+ props.add?.();
1769
+ }
1770
+ },
1771
+ {
1772
+ name: "\u6A21\u7248\u4E0B\u8F7D",
1773
+ prop: "templateDownload",
1774
+ show: !!props.templateDownloadApi
1775
+ },
1776
+ {
1777
+ name: "\u5BFC\u5165",
1778
+ prop: "import",
1779
+ show: !!props.importApi
1780
+ },
1781
+ {
1782
+ name: "\u5BFC\u51FA",
1783
+ prop: "export",
1784
+ show: !!props.exportApi
1785
+ }
1786
+ ];
1787
+ props.leftButtons?.forEach((item) => {
1788
+ const defaultIndex = defaultButtons.findIndex(
1789
+ (item1) => item1.prop === item.prop
1790
+ );
1791
+ if (defaultIndex !== -1) {
1792
+ defaultButtons[defaultIndex] = {
1793
+ ...defaultButtons[defaultIndex],
1794
+ ...item
1795
+ };
1796
+ }
1797
+ });
1798
+ const list = defaultButtons.concat(props.leftButtons);
1799
+ list.forEach((item) => {
1800
+ if (item.onClick) {
1801
+ const clickFn = item.onClick;
1802
+ item.onClick = () => {
1803
+ const rows = tableRef.value.elTableRef.getSelectionRows();
1804
+ clickFn(rows);
1805
+ };
1806
+ }
1807
+ });
1808
+ const buttonsProps = vue.computed(() => {
1809
+ return {
1810
+ list,
1811
+ ...props.buttonsProps
1812
+ };
1813
+ });
1814
+ const search = async () => {
1815
+ await validate();
1816
+ tableRef.value.search(true);
1817
+ };
1818
+ const reset = async () => {
1819
+ resetFields();
1820
+ search();
1821
+ };
1822
+ const searchButtons = [
1823
+ {
1824
+ name: "\u641C\u7D22",
1825
+ type: "primary",
1826
+ onClick: search
1827
+ },
1828
+ {
1829
+ name: "\u6E05\u7A7A",
1830
+ onClick: reset
1831
+ }
1832
+ ];
1833
+ return {
1834
+ buttonsProps,
1835
+ searchButtons,
1836
+ search,
1837
+ reset
1838
+ };
1839
+ };
1840
+
1841
+ var _sfc_main$1 = /* @__PURE__ */ vue.defineComponent({
1842
+ ...{ name: "EpSearchListPage" },
1843
+ __name: "searchListPage",
1844
+ props: searchListPageProps,
1845
+ setup(__props, { expose: __expose }) {
1846
+ const bem = createNameSpace("search-list-page");
1847
+ const props = __props;
1848
+ const {
1849
+ formProps,
1850
+ buttonsProps,
1851
+ searchButtons,
1852
+ search,
1853
+ reset,
1854
+ tableRef,
1855
+ formRef,
1856
+ tableProps
1857
+ } = useSearchListPage(props);
1858
+ __expose({
1859
+ search,
1860
+ reset,
1861
+ tableRef,
1862
+ formRef
1863
+ });
1864
+ return (_ctx, _cache) => {
1865
+ const _component_EpButtons = vue.resolveComponent("EpButtons");
1866
+ return vue.openBlock(), vue.createElementBlock(
1867
+ "div",
1868
+ {
1869
+ class: vue.normalizeClass([vue.unref(bem).b(), vue.unref(prepareClassNames)()]),
1870
+ style: vue.normalizeStyle({
1871
+ ...vue.unref(prepareStyles)()
1872
+ })
1873
+ },
1874
+ [
1875
+ vue.createElementVNode("div", { id: "top" }, [
1876
+ vue.createVNode(
1877
+ vue.unref(Form),
1878
+ vue.normalizeProps(vue.guardReactiveProps(vue.unref(formProps))),
1879
+ null,
1880
+ 16
1881
+ /* FULL_PROPS */
1882
+ )
1883
+ ]),
1884
+ vue.createElementVNode("div", { id: "middle" }, [
1885
+ vue.createElementVNode(
1886
+ "div",
1887
+ {
1888
+ class: vue.normalizeClass(vue.unref(bem).e("middle-left"))
1889
+ },
1890
+ [
1891
+ vue.createVNode(
1892
+ _component_EpButtons,
1893
+ vue.normalizeProps(vue.guardReactiveProps(vue.unref(buttonsProps))),
1894
+ null,
1895
+ 16
1896
+ /* FULL_PROPS */
1897
+ )
1898
+ ],
1899
+ 2
1900
+ /* CLASS */
1901
+ ),
1902
+ vue.createElementVNode(
1903
+ "div",
1904
+ {
1905
+ class: vue.normalizeClass(vue.unref(bem).e("middle-right"))
1906
+ },
1907
+ [
1908
+ vue.createVNode(_component_EpButtons, { list: vue.unref(searchButtons) }, null, 8, ["list"])
1909
+ ],
1910
+ 2
1911
+ /* CLASS */
1912
+ )
1913
+ ]),
1914
+ vue.renderSlot(_ctx.$slots, "tableBefore"),
1915
+ vue.createVNode(
1916
+ vue.unref(Table),
1917
+ vue.normalizeProps(vue.guardReactiveProps(vue.unref(tableProps))),
1918
+ null,
1919
+ 16
1920
+ /* FULL_PROPS */
1921
+ )
1922
+ ],
1923
+ 6
1924
+ /* CLASS, STYLE */
1925
+ );
1926
+ };
1927
+ }
1928
+ });
1929
+
1930
+ var SearchListPage = withInstall(_sfc_main$1);
1931
+
1932
+ const inheritSelectProps = {
1933
+ ...elementPlus.selectProps,
1934
+ clearable: {
1935
+ ...elementPlus.selectProps.clearable,
1936
+ default: true
1937
+ }
1938
+ };
1939
+ const expandSelectProps = {
1940
+ ...apiProps,
1941
+ disabledOption: {
1942
+ type: Function,
1943
+ default: () => false
1944
+ },
1945
+ labelKey: {
1946
+ type: String,
1947
+ default: "label"
1948
+ },
1949
+ valueKey: {
1950
+ type: String,
1951
+ default: "value"
1952
+ },
1953
+ formatLabel: {
1954
+ type: Function
1955
+ },
1956
+ // api模式生效
1957
+ lazy: Boolean,
1958
+ // option是否同时展示code label, 默认值展示label, 传string展示指定字段
1959
+ codeInLabel: {
1960
+ type: [String, Boolean]
1961
+ }
1962
+ };
1963
+ const selectProps = {
1964
+ ...inheritSelectProps,
1965
+ ...expandSelectProps
1966
+ };
1967
+ const expandSelectPropsKeys = Object.keys(expandSelectProps);
1968
+ const selectEmits = {
1969
+ ...elementPlus.selectEmits,
1970
+ change: (value, item) => true
1971
+ };
1972
+ const selectEmitsKeys = Object.keys(selectEmits);
1973
+
1974
+ function useSelect(props, emit) {
1975
+ let hasLoaded = false;
1976
+ const { loading, requestFn } = useRequest({
1977
+ api: props.api,
1978
+ method: props.method,
1979
+ reqData: props.reqData,
1980
+ reqParams: props.reqParams,
1981
+ reqBefore: props.reqBefore,
1982
+ reqAfter: props.reqAfter,
1983
+ cancelToken: props.remote,
1984
+ hooks: {
1985
+ success(data) {
1986
+ if (Array.isArray(data)) {
1987
+ customOptions.value = data;
1988
+ } else if (data && typeof data === "object") {
1989
+ const rawData = data;
1990
+ customOptions.value = rawData?.list || rawData?.data || [];
1991
+ } else {
1992
+ customOptions.value = [];
1993
+ }
1994
+ hasLoaded = true;
1995
+ },
1996
+ fail(error) {
1997
+ console.error(error);
1998
+ }
1999
+ }
2000
+ });
2001
+ const customOptions = vue.ref([]);
2002
+ const loadOptions = (value, desc) => {
2003
+ if ((value || value === 0) && desc) {
2004
+ customOptions.value = [
2005
+ {
2006
+ [props.labelKey]: desc,
2007
+ [props.valueKey]: value
2008
+ }
2009
+ ];
2010
+ }
2011
+ if (props.api) {
2012
+ if (!props.lazy && !props.remote) {
2013
+ requestFn();
2014
+ }
2015
+ } else if (props.options?.length) {
2016
+ customOptions.value = props.options;
2017
+ }
2018
+ };
2019
+ const getSelectItem = (value) => {
2020
+ if (Array.isArray(value)) {
2021
+ if (!props.options) return [];
2022
+ return props.options.filter((item) => {
2023
+ return value.indexOf(item[props.valueKey]) > -1;
2024
+ });
2025
+ }
2026
+ if (!props.options) return {};
2027
+ return props.options.find((item) => {
2028
+ return item[props.valueKey] === value;
2029
+ }) || {};
2030
+ };
2031
+ const expandAttrs = {
2032
+ loading: props.loading || loading?.value,
2033
+ remoteMethod: (query) => {
2034
+ if (!query) return;
2035
+ requestFn({
2036
+ $searchValue: query
2037
+ });
2038
+ },
2039
+ onChange(value) {
2040
+ emit("change", value, getSelectItem(value));
2041
+ },
2042
+ onVisibleChange(visible) {
2043
+ if (props.api && props.lazy && visible && !hasLoaded && !props.remote) {
2044
+ requestFn();
2045
+ }
2046
+ emit("visible-change", visible);
2047
+ }
2048
+ };
2049
+ return {
2050
+ customOptions,
2051
+ loadOptions,
2052
+ expandAttrs
2053
+ };
2054
+ }
2055
+
2056
+ var _sfc_main = /* @__PURE__ */ vue.defineComponent({
2057
+ ...{
2058
+ name: "EpSelect",
2059
+ inheritAttrs: false
2060
+ },
2061
+ __name: "select",
2062
+ props: /* @__PURE__ */ vue.mergeModels(selectProps, {
2063
+ "modelValue": { type: null },
2064
+ "modelModifiers": {},
2065
+ "desc": { type: String },
2066
+ "descModifiers": {}
2067
+ }),
2068
+ emits: /* @__PURE__ */ vue.mergeModels(selectEmits, ["update:modelValue", "update:desc"]),
2069
+ setup(__props, { emit: __emit }) {
2070
+ const bem = createNameSpace("select");
2071
+ const props = __props;
2072
+ const emit = __emit;
2073
+ const slots = vue.computed(() => {
2074
+ return Object.keys(vue.useSlots());
2075
+ });
2076
+ const { customOptions, loadOptions, expandAttrs } = useSelect(props, emit);
2077
+ const value = vue.useModel(__props, "modelValue");
2078
+ const desc = vue.useModel(__props, "desc");
2079
+ const customAttrs = vue.computed(() => {
2080
+ return {
2081
+ ...prepareProps(props, ["modelValue", "desc", ...expandSelectPropsKeys]),
2082
+ ...prepareEvents(emit, selectEmitsKeys),
2083
+ ...expandAttrs
2084
+ };
2085
+ });
2086
+ loadOptions(value.value, desc.value);
2087
+ return (_ctx, _cache) => {
2088
+ const _component_el_option = vue.resolveComponent("el-option");
2089
+ const _component_el_select = vue.resolveComponent("el-select");
2090
+ return vue.openBlock(), vue.createBlock(_component_el_select, vue.mergeProps({
2091
+ modelValue: value.value,
2092
+ "onUpdate:modelValue": ($event) => value.value = $event,
2093
+ class: `${vue.unref(bem).b()} ${vue.unref(prepareClassNames)()}`
2094
+ }, customAttrs.value, {
2095
+ style: {
2096
+ ...vue.unref(prepareStyles)()
2097
+ }
2098
+ }), vue.createSlots({
2099
+ default: vue.withCtx(() => [
2100
+ (vue.openBlock(true), vue.createElementBlock(
2101
+ vue.Fragment,
2102
+ null,
2103
+ vue.renderList(vue.unref(customOptions), (item) => {
2104
+ return vue.openBlock(), vue.createBlock(_component_el_option, {
2105
+ key: item[_ctx.valueKey],
2106
+ class: vue.normalizeClass(vue.unref(bem).e("option")),
2107
+ label: item.formatLabel ? item.formatLabel(item) : _ctx.formatLabel ? _ctx.formatLabel(item) : item[_ctx.labelKey],
2108
+ value: item[_ctx.valueKey],
2109
+ disabled: _ctx.disabledOption(item)
2110
+ }, {
2111
+ default: vue.withCtx(() => [
2112
+ vue.renderSlot(_ctx.$slots, "option", { item }, () => [
2113
+ _ctx.codeInLabel || _ctx.codeInLabel === "" ? (vue.openBlock(), vue.createElementBlock(
2114
+ vue.Fragment,
2115
+ { key: 0 },
2116
+ [
2117
+ vue.createElementVNode(
2118
+ "span",
2119
+ { style: { "float": "left" } },
2120
+ vue.toDisplayString(item[_ctx.labelKey]),
2121
+ 1
2122
+ /* TEXT */
2123
+ ),
2124
+ vue.createElementVNode(
2125
+ "span",
2126
+ { style: { "float": "right", "color": "var(--el-text-color-secondary)", "font-size": "13px" } },
2127
+ vue.toDisplayString(item[typeof _ctx.codeInLabel === "string" && _ctx.codeInLabel ? _ctx.codeInLabel : _ctx.valueKey]),
2128
+ 1
2129
+ /* TEXT */
2130
+ )
2131
+ ],
2132
+ 64
2133
+ /* STABLE_FRAGMENT */
2134
+ )) : vue.createCommentVNode("v-if", true)
2135
+ ])
2136
+ ]),
2137
+ _: 2
2138
+ /* DYNAMIC */
2139
+ }, 1032, ["class", "label", "value", "disabled"]);
2140
+ }),
2141
+ 128
2142
+ /* KEYED_FRAGMENT */
2143
+ ))
2144
+ ]),
2145
+ _: 2
2146
+ /* DYNAMIC */
2147
+ }, [
2148
+ vue.renderList(slots.value, (name) => {
2149
+ return {
2150
+ name,
2151
+ fn: vue.withCtx((scope) => [
2152
+ vue.renderSlot(_ctx.$slots, name, vue.normalizeProps(vue.guardReactiveProps(scope)))
2153
+ ])
2154
+ };
2155
+ })
2156
+ ]), 1040, ["modelValue", "onUpdate:modelValue", "class", "style"]);
2157
+ };
2158
+ }
2159
+ });
2160
+
2161
+ var Select = withInstall(_sfc_main);
2162
+
2163
+ var components = [Buttons, Form, Input, SearchListPage, Select, Table];
2164
+
2165
+ var version = "0.0.1";
2166
+
2167
+ const install = (app, options) => {
2168
+ components.forEach((c) => app.use(c));
2169
+ };
2170
+ const plugin = {
2171
+ install,
2172
+ version
2173
+ };
2174
+
2175
+ exports.EpFormItem = EpFormItem;
2176
+ exports.buttonsProps = buttonsProps;
2177
+ exports.default = plugin;
2178
+ exports.expandFormItemPropsKeys = expandFormItemPropsKeys;
2179
+ exports.expandFormPropsKeys = expandFormPropsKeys;
2180
+ exports.expandSelectPropsKeys = expandSelectPropsKeys;
2181
+ exports.expandTablePropsKeys = expandTablePropsKeys;
2182
+ exports.formEmits = formEmits;
2183
+ exports.formEmitsKeys = formEmitsKeys;
2184
+ exports.formItemProps = formItemProps;
2185
+ exports.formProps = formProps;
2186
+ exports.inheritSelectProps = inheritSelectProps;
2187
+ exports.inputEmits = inputEmits;
2188
+ exports.inputEmitsKeys = inputEmitsKeys;
2189
+ exports.inputProps = inputProps;
2190
+ exports.install = install;
2191
+ exports.searchListPageProps = searchListPageProps;
2192
+ exports.selectEmits = selectEmits;
2193
+ exports.selectEmitsKeys = selectEmitsKeys;
2194
+ exports.selectProps = selectProps;
2195
+ exports.tableEmits = tableEmits;
2196
+ exports.tableEmitsKeys = tableEmitsKeys;
2197
+ exports.tableProps = tableProps;
2198
+ exports.useRequest = useRequest;
2199
+ exports.vPermission = vPermisson;
2200
+ exports.vRepeatClick = vRepeatClick;
2201
+
2202
+ Object.defineProperty(exports, '__esModule', { value: true });
2203
+
2204
+ }));