three-trees-ui 1.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 (384) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +32 -0
  3. package/lib/demo.html +10 -0
  4. package/lib/three-trees-ui.common.js +49136 -0
  5. package/lib/three-trees-ui.css +1 -0
  6. package/lib/three-trees-ui.umd.js +49146 -0
  7. package/lib/three-trees-ui.umd.min.js +1 -0
  8. package/package.json +137 -0
  9. package/packages/AddQueryStrategy/index.js +7 -0
  10. package/packages/AddQueryStrategy/src/main.vue +236 -0
  11. package/packages/Autocomplete/index.js +7 -0
  12. package/packages/Autocomplete/src/main.vue +201 -0
  13. package/packages/Avatar/index.js +7 -0
  14. package/packages/Avatar/src/AvatarImage.vue +218 -0
  15. package/packages/Button/index.js +7 -0
  16. package/packages/Button/src/main.vue +90 -0
  17. package/packages/Cascader/index.js +7 -0
  18. package/packages/Cascader/src/main.vue +210 -0
  19. package/packages/Chart/index.js +7 -0
  20. package/packages/Chart/src/Chart.vue +856 -0
  21. package/packages/Checkbox/index.js +7 -0
  22. package/packages/Checkbox/src/main.vue +205 -0
  23. package/packages/Collapse/index.js +7 -0
  24. package/packages/Collapse/src/HtCollapse.vue +85 -0
  25. package/packages/Collapse/src/HtCollapseItem.vue +21 -0
  26. package/packages/CollapseItem/index.js +7 -0
  27. package/packages/CustomComponent/index.js +6 -0
  28. package/packages/CustomComponent/src/main.vue +87 -0
  29. package/packages/CustomDialog/index.js +7 -0
  30. package/packages/CustomDialog/src/customDialog.js +126 -0
  31. package/packages/CustomDialog/src/customDialog.vue +1864 -0
  32. package/packages/CustomDialog/src/customMobileDialog.vue +1619 -0
  33. package/packages/CustomDialog/src/main.vue +485 -0
  34. package/packages/DataView/index.js +7 -0
  35. package/packages/DataView/src/DataView.vue +45 -0
  36. package/packages/Date/index.js +7 -0
  37. package/packages/Date/src/main.vue +182 -0
  38. package/packages/DatePicker/index.js +7 -0
  39. package/packages/DatePicker/src/main.vue +155 -0
  40. package/packages/Demension/index.js +7 -0
  41. package/packages/Demension/src/main.vue +382 -0
  42. package/packages/Dialog/index.js +7 -0
  43. package/packages/Dialog/src/main.vue +169 -0
  44. package/packages/Dictionary/index.js +7 -0
  45. package/packages/Dictionary/src/main.vue +211 -0
  46. package/packages/DimensionSelector/index.js +7 -0
  47. package/packages/DimensionSelector/src/main.vue +526 -0
  48. package/packages/DimensionSelectorInput/index.js +7 -0
  49. package/packages/DimensionSelectorInput/src/main.vue +161 -0
  50. package/packages/Divider/index.js +7 -0
  51. package/packages/Divider/src/main.vue +38 -0
  52. package/packages/Duration/index.js +7 -0
  53. package/packages/Duration/src/main.vue +180 -0
  54. package/packages/Editor/index.js +7 -0
  55. package/packages/Editor/src/main.vue +320 -0
  56. package/packages/Explain/index.js +7 -0
  57. package/packages/Explain/src/main.vue +126 -0
  58. package/packages/FieldTail/index.js +7 -0
  59. package/packages/FieldTail/src/main.vue +188 -0
  60. package/packages/File/index.js +7 -0
  61. package/packages/File/src/FileCard.vue +169 -0
  62. package/packages/File/src/FileList.vue +180 -0
  63. package/packages/File/src/FileTable.vue +223 -0
  64. package/packages/File/src/main.vue +499 -0
  65. package/packages/FileUpload/index.js +7 -0
  66. package/packages/FileUpload/src/main.vue +242 -0
  67. package/packages/FlowChart/index.js +7 -0
  68. package/packages/FlowChart/src/main.vue +386 -0
  69. package/packages/FormItem/index.js +7 -0
  70. package/packages/FormItem/src/main.vue +175 -0
  71. package/packages/Global/index.js +12 -0
  72. package/packages/Global/src/GlobalQuery.vue +225 -0
  73. package/packages/Global/src/GlobalValidate.vue +132 -0
  74. package/packages/HistoricalApproval/index.js +7 -0
  75. package/packages/HistoricalApproval/src/main.vue +427 -0
  76. package/packages/Icon/index.js +7 -0
  77. package/packages/Icon/src/icons/ad.js +14 -0
  78. package/packages/Icon/src/icons/address-book.js +14 -0
  79. package/packages/Icon/src/icons/arrow.js +14 -0
  80. package/packages/Icon/src/icons/attachment.js +18 -0
  81. package/packages/Icon/src/icons/balance.js +14 -0
  82. package/packages/Icon/src/icons/ban.js +14 -0
  83. package/packages/Icon/src/icons/bell.js +14 -0
  84. package/packages/Icon/src/icons/block.js +26 -0
  85. package/packages/Icon/src/icons/book.js +14 -0
  86. package/packages/Icon/src/icons/bookmark.js +14 -0
  87. package/packages/Icon/src/icons/bug.js +22 -0
  88. package/packages/Icon/src/icons/bullhorn.js +14 -0
  89. package/packages/Icon/src/icons/calc.js +14 -0
  90. package/packages/Icon/src/icons/checkbox.js +14 -0
  91. package/packages/Icon/src/icons/circle.js +14 -0
  92. package/packages/Icon/src/icons/close.js +14 -0
  93. package/packages/Icon/src/icons/cloud-sun.js +14 -0
  94. package/packages/Icon/src/icons/coffee.js +14 -0
  95. package/packages/Icon/src/icons/component.js +14 -0
  96. package/packages/Icon/src/icons/compress.js +14 -0
  97. package/packages/Icon/src/icons/copyright.js +14 -0
  98. package/packages/Icon/src/icons/demension.js +18 -0
  99. package/packages/Icon/src/icons/dialog.js +14 -0
  100. package/packages/Icon/src/icons/down-unfold.js +18 -0
  101. package/packages/Icon/src/icons/download.js +14 -0
  102. package/packages/Icon/src/icons/duration.js +14 -0
  103. package/packages/Icon/src/icons/excel.js +18 -0
  104. package/packages/Icon/src/icons/expand.js +14 -0
  105. package/packages/Icon/src/icons/export.js +21 -0
  106. package/packages/Icon/src/icons/eye-slash.js +14 -0
  107. package/packages/Icon/src/icons/eye.js +14 -0
  108. package/packages/Icon/src/icons/file.js +18 -0
  109. package/packages/Icon/src/icons/form.js +14 -0
  110. package/packages/Icon/src/icons/ganged.js +14 -0
  111. package/packages/Icon/src/icons/gaode.js +27 -0
  112. package/packages/Icon/src/icons/gift.js +14 -0
  113. package/packages/Icon/src/icons/home.js +14 -0
  114. package/packages/Icon/src/icons/hotent.js +26 -0
  115. package/packages/Icon/src/icons/image.js +14 -0
  116. package/packages/Icon/src/icons/import.js +18 -0
  117. package/packages/Icon/src/icons/index.js +75 -0
  118. package/packages/Icon/src/icons/info.js +21 -0
  119. package/packages/Icon/src/icons/job.js +18 -0
  120. package/packages/Icon/src/icons/laptop.js +14 -0
  121. package/packages/Icon/src/icons/line.js +34 -0
  122. package/packages/Icon/src/icons/lock.js +14 -0
  123. package/packages/Icon/src/icons/map.js +18 -0
  124. package/packages/Icon/src/icons/more.js +19 -0
  125. package/packages/Icon/src/icons/move.js +14 -0
  126. package/packages/Icon/src/icons/org-tree.js +33 -0
  127. package/packages/Icon/src/icons/org-tree2.js +42 -0
  128. package/packages/Icon/src/icons/org.js +18 -0
  129. package/packages/Icon/src/icons/palette.js +14 -0
  130. package/packages/Icon/src/icons/plan.js +17 -0
  131. package/packages/Icon/src/icons/post.js +23 -0
  132. package/packages/Icon/src/icons/ppt.js +18 -0
  133. package/packages/Icon/src/icons/question.js +18 -0
  134. package/packages/Icon/src/icons/radio.js +14 -0
  135. package/packages/Icon/src/icons/refresh.js +14 -0
  136. package/packages/Icon/src/icons/role.js +38 -0
  137. package/packages/Icon/src/icons/search.js +14 -0
  138. package/packages/Icon/src/icons/select.js +14 -0
  139. package/packages/Icon/src/icons/setting.js +18 -0
  140. package/packages/Icon/src/icons/simple-collapse.js +18 -0
  141. package/packages/Icon/src/icons/simple-expand.js +14 -0
  142. package/packages/Icon/src/icons/sort.js +22 -0
  143. package/packages/Icon/src/icons/table.js +14 -0
  144. package/packages/Icon/src/icons/time.js +14 -0
  145. package/packages/Icon/src/icons/tree.js +14 -0
  146. package/packages/Icon/src/icons/typography.js +18 -0
  147. package/packages/Icon/src/icons/up-fold.js +18 -0
  148. package/packages/Icon/src/icons/upload.js +18 -0
  149. package/packages/Icon/src/icons/user.js +14 -0
  150. package/packages/Icon/src/icons/users.js +30 -0
  151. package/packages/Icon/src/icons/video.js +14 -0
  152. package/packages/Icon/src/icons/word.js +19 -0
  153. package/packages/Icon/src/main.vue +432 -0
  154. package/packages/Iframe/index.js +6 -0
  155. package/packages/Iframe/src/main.vue +208 -0
  156. package/packages/Image/index.js +7 -0
  157. package/packages/Image/src/main.vue +70 -0
  158. package/packages/Input/index.js +7 -0
  159. package/packages/Input/src/main.vue +659 -0
  160. package/packages/JobDialog/index.js +7 -0
  161. package/packages/JobDialog/src/main.vue +197 -0
  162. package/packages/JobSelector/index.js +7 -0
  163. package/packages/JobSelector/src/JobSelectorDialog.vue +305 -0
  164. package/packages/JobSelector/src/JobSelectorMobileDialog.vue +293 -0
  165. package/packages/JobSelector/src/main.vue +346 -0
  166. package/packages/JobSelectorInput/index.js +7 -0
  167. package/packages/JobSelectorInput/src/main.vue +166 -0
  168. package/packages/ListSelector/index.js +7 -0
  169. package/packages/ListSelector/src/ListSelector.vue +499 -0
  170. package/packages/Map/index.js +7 -0
  171. package/packages/Map/src/Map.vue +434 -0
  172. package/packages/Milepost/index.js +7 -0
  173. package/packages/Milepost/src/main.vue +45 -0
  174. package/packages/OnlineForm/index.js +7 -0
  175. package/packages/OnlineForm/src/Form.vue +659 -0
  176. package/packages/OrgPostDialog/index.js +7 -0
  177. package/packages/OrgPostDialog/src/main.vue +331 -0
  178. package/packages/OrgSelector/index.js +7 -0
  179. package/packages/OrgSelector/src/OrgSelectorDialog.vue +334 -0
  180. package/packages/OrgSelector/src/OrgSelectorMobileDialog.vue +307 -0
  181. package/packages/OrgSelector/src/Organization.vue +131 -0
  182. package/packages/OrgSelector/src/PolicyUser.vue +141 -0
  183. package/packages/OrgSelector/src/main.vue +409 -0
  184. package/packages/OrgSelectorInput/index.js +7 -0
  185. package/packages/OrgSelectorInput/src/OrgSelectorInput.vue +324 -0
  186. package/packages/PostDialog/index.js +7 -0
  187. package/packages/PostDialog/src/main.vue +309 -0
  188. package/packages/PostSelector/index.js +7 -0
  189. package/packages/PostSelector/src/Organization.vue +131 -0
  190. package/packages/PostSelector/src/PolicyUser.vue +141 -0
  191. package/packages/PostSelector/src/PostSelectorDialog.vue +342 -0
  192. package/packages/PostSelector/src/PostSelectorMobileDialog.vue +307 -0
  193. package/packages/PostSelector/src/main.vue +374 -0
  194. package/packages/PostSelectorInput/index.js +7 -0
  195. package/packages/PostSelectorInput/src/PostSelectorInput.vue +317 -0
  196. package/packages/Preview/index.js +7 -0
  197. package/packages/Preview/src/FillPage.vue +311 -0
  198. package/packages/Preview/src/FrameViewer.vue +157 -0
  199. package/packages/Preview/src/Loading.vue +126 -0
  200. package/packages/Preview/src/PdfViewer.vue +125 -0
  201. package/packages/Preview/src/TextViewer.vue +99 -0
  202. package/packages/Preview/src/main.vue +242 -0
  203. package/packages/Preview/src/watermark.js +124 -0
  204. package/packages/ProcessRecord/index.js +7 -0
  205. package/packages/ProcessRecord/src/main.vue +396 -0
  206. package/packages/Qrcode/index.js +7 -0
  207. package/packages/Qrcode/src/Qrcode.vue +110 -0
  208. package/packages/QuerySqlPreview/index.js +7 -0
  209. package/packages/QuerySqlPreview/src/QuerySqlPreview.vue +163 -0
  210. package/packages/Radio/index.js +7 -0
  211. package/packages/Radio/src/main.vue +174 -0
  212. package/packages/Rate/index.js +7 -0
  213. package/packages/Rate/src/main.vue +141 -0
  214. package/packages/ReadonlyInput/index.js +7 -0
  215. package/packages/ReadonlyInput/src/main.vue +92 -0
  216. package/packages/RelevantFlow/index.js +7 -0
  217. package/packages/RelevantFlow/src/main.vue +579 -0
  218. package/packages/RelevantFlow/src/relevantFlow.js +35 -0
  219. package/packages/RoleDialog/index.js +7 -0
  220. package/packages/RoleDialog/src/main.vue +198 -0
  221. package/packages/RoleSelector/index.js +7 -0
  222. package/packages/RoleSelector/src/RoleSelectorDialog.vue +307 -0
  223. package/packages/RoleSelector/src/RoleSelectorMobileDialog.vue +293 -0
  224. package/packages/RoleSelector/src/main.vue +367 -0
  225. package/packages/RoleSelectorInput/index.js +7 -0
  226. package/packages/RoleSelectorInput/src/main.vue +166 -0
  227. package/packages/SaveButton/index.js +7 -0
  228. package/packages/SaveButton/src/main.vue +73 -0
  229. package/packages/Select/index.js +7 -0
  230. package/packages/Select/src/main.vue +376 -0
  231. package/packages/SelectTree/index.js +7 -0
  232. package/packages/SelectTree/src/SelectTree.vue +360 -0
  233. package/packages/Selector/index.js +7 -0
  234. package/packages/Selector/src/main.vue +623 -0
  235. package/packages/SidebarDialog/index.js +7 -0
  236. package/packages/SidebarDialog/src/main.vue +156 -0
  237. package/packages/Slider/index.js +7 -0
  238. package/packages/Slider/src/main.vue +141 -0
  239. package/packages/Step/index.js +7 -0
  240. package/packages/StepLayout/index.js +7 -0
  241. package/packages/Steps/index.js +7 -0
  242. package/packages/Steps/src/Step.vue +139 -0
  243. package/packages/Steps/src/StepLayout.vue +35 -0
  244. package/packages/Steps/src/Steps.vue +65 -0
  245. package/packages/Subtable/index.js +33 -0
  246. package/packages/Subtable/src/SubDialog.vue +2145 -0
  247. package/packages/Subtable/src/SubExportDialog.vue +115 -0
  248. package/packages/Subtable/src/SubImportDialog.vue +340 -0
  249. package/packages/Subtable/src/SubPagination.vue +128 -0
  250. package/packages/Subtable/src/SubtableBackfill.vue +150 -0
  251. package/packages/Subtable/src/dialog.js +42 -0
  252. package/packages/Switch/index.js +7 -0
  253. package/packages/Switch/src/main.vue +92 -0
  254. package/packages/Table/index.js +7 -0
  255. package/packages/Table/src/CustomColumn.vue +353 -0
  256. package/packages/Table/src/Table.vue +1031 -0
  257. package/packages/TableColumn/index.js +7 -0
  258. package/packages/TableColumn/src/main.vue +189 -0
  259. package/packages/TableSearchField/index.js +7 -0
  260. package/packages/TableSearchField/src/main.vue +334 -0
  261. package/packages/TableSearchPanel/index.js +7 -0
  262. package/packages/TableSearchPanel/src/main.vue +182 -0
  263. package/packages/Tabs/index.js +7 -0
  264. package/packages/Tabs/src/Tabs.vue +140 -0
  265. package/packages/Tag/index.js +7 -0
  266. package/packages/Tag/src/main.vue +266 -0
  267. package/packages/TemplateBatchUpdate/index.js +7 -0
  268. package/packages/TemplateBatchUpdate/src/TemplateBatchUpdateDialog.vue +175 -0
  269. package/packages/TemplateForm/index.js +7 -0
  270. package/packages/TemplateForm/src/main.vue +661 -0
  271. package/packages/TemplateFormDialog/index.js +7 -0
  272. package/packages/TemplateFormDialog/src/main.vue +97 -0
  273. package/packages/TemplateIframeDialog/index.js +7 -0
  274. package/packages/TemplateIframeDialog/src/main.vue +72 -0
  275. package/packages/TemplateImportResult/index.js +7 -0
  276. package/packages/TemplateImportResult/src/main.vue +206 -0
  277. package/packages/TemplatePreview/index.js +19 -0
  278. package/packages/TemplatePreview/src/TemplatePreview.vue +239 -0
  279. package/packages/TemplatePreview/src/TemplatePreviewFile.vue +179 -0
  280. package/packages/TemplatePreview/src/TemplatePreviewImage.vue +83 -0
  281. package/packages/TemplateTaskCirculate/index.js +7 -0
  282. package/packages/TemplateTaskCirculate/src/main.vue +258 -0
  283. package/packages/Text/index.js +7 -0
  284. package/packages/Text/src/main.vue +58 -0
  285. package/packages/TimePicker/index.js +7 -0
  286. package/packages/TimePicker/src/main.vue +149 -0
  287. package/packages/TimeSelect/index.js +7 -0
  288. package/packages/TimeSelect/src/main.vue +106 -0
  289. package/packages/Tree/index.js +7 -0
  290. package/packages/Tree/src/main.vue +443 -0
  291. package/packages/TreeDialog/index.js +7 -0
  292. package/packages/TreeDialog/src/main.vue +322 -0
  293. package/packages/TreeListDialog/index.js +7 -0
  294. package/packages/TreeListDialog/src/main.vue +219 -0
  295. package/packages/Typography/index.js +8 -0
  296. package/packages/Typography/src/create-header.js +72 -0
  297. package/packages/UserDialog/index.js +7 -0
  298. package/packages/UserDialog/src/main.vue +393 -0
  299. package/packages/UserSelector/index.js +7 -0
  300. package/packages/UserSelector/src/Organization.vue +131 -0
  301. package/packages/UserSelector/src/PolicyUser.vue +141 -0
  302. package/packages/UserSelector/src/RoleUser.vue +139 -0
  303. package/packages/UserSelector/src/TopContactUser.vue +109 -0
  304. package/packages/UserSelector/src/UserSelectorDialog.vue +370 -0
  305. package/packages/UserSelector/src/UserSelectorMobileDialog.vue +332 -0
  306. package/packages/UserSelector/src/main.vue +519 -0
  307. package/packages/UserSelectorInput/index.js +7 -0
  308. package/packages/UserSelectorInput/src/main.vue +374 -0
  309. package/packages/picture/index.js +7 -0
  310. package/packages/picture/src/main.vue +736 -0
  311. package/packages/plugins/Echarts.js +30 -0
  312. package/packages/plugins/Map.js +29 -0
  313. package/packages/plugins/Preview.js +49 -0
  314. package/packages/plugins/Qrcode.js +7 -0
  315. package/packages/plugins/XLSX.js +7 -0
  316. package/packages/plugins/wangeditor.js +19 -0
  317. package/src/assets/icon_found_img.png +0 -0
  318. package/src/assets/no-data.png +0 -0
  319. package/src/assets/table-no-data.png +0 -0
  320. package/src/directive/badge.js +53 -0
  321. package/src/directive/copy.js +47 -0
  322. package/src/directive/ellipsis.js +6 -0
  323. package/src/directive/expandClick.js +23 -0
  324. package/src/directive/express.js +86 -0
  325. package/src/directive/form.js +122 -0
  326. package/src/directive/format.js +24 -0
  327. package/src/directive/formulas.js +710 -0
  328. package/src/directive/index.js +42 -0
  329. package/src/directive/permissionLine.js +59 -0
  330. package/src/directive/permissionLineLable.js +56 -0
  331. package/src/directive/permit.js +23 -0
  332. package/src/directive/popconfirm.js +86 -0
  333. package/src/directive/relatedQuery.js +61 -0
  334. package/src/directive/resize.js +18 -0
  335. package/src/directive/subSort.js +18 -0
  336. package/src/directive/tableDrag.js +25 -0
  337. package/src/directive/tooltip.js +37 -0
  338. package/src/filter/computerSize.js +23 -0
  339. package/src/filter/dateFormat.js +10 -0
  340. package/src/filter/index.js +10 -0
  341. package/src/index.js +295 -0
  342. package/src/locale/format.js +44 -0
  343. package/src/locale/index.js +48 -0
  344. package/src/locale/lang/en.js +59 -0
  345. package/src/locale/lang/zh-CN.js +59 -0
  346. package/src/locale/lang/zh-TW.js +57 -0
  347. package/src/locale/validate/dict.js +278 -0
  348. package/src/math.js +270 -0
  349. package/src/mixins/dialog.js +16 -0
  350. package/src/mixins/emitter.js +33 -0
  351. package/src/mixins/form.js +33 -0
  352. package/src/mixins/formDataUpdate.js +32 -0
  353. package/src/mixins/ganged.js +131 -0
  354. package/src/mixins/inputName.js +30 -0
  355. package/src/mixins/linkage.js +414 -0
  356. package/src/mixins/locale.js +9 -0
  357. package/src/mixins/mobileMode.js +27 -0
  358. package/src/mixins/onlineHottable.js +128 -0
  359. package/src/mixins/onlineSubtable.js +538 -0
  360. package/src/mixins/permission.js +94 -0
  361. package/src/mixins/querySqlPreview.js +852 -0
  362. package/src/mixins/regionValidator.js +70 -0
  363. package/src/mixins/script.js +37 -0
  364. package/src/mixins/templatePreview.js +4527 -0
  365. package/src/plugins/loading/index.js +37 -0
  366. package/src/plugins/loading/index.vue +18 -0
  367. package/src/service.js +336 -0
  368. package/src/services/CustomQuery.js +197 -0
  369. package/src/services/SubPagination.js +132 -0
  370. package/src/services/commonScripts.js +45 -0
  371. package/src/styles/index.scss +7 -0
  372. package/src/styles/selector.css +140 -0
  373. package/src/styles/selector.min.css +1 -0
  374. package/src/styles/selector.scss +130 -0
  375. package/src/styles/variables.css +67 -0
  376. package/src/styles/variables.min.css +1 -0
  377. package/src/styles/variables.scss +109 -0
  378. package/src/util/base64.js +46 -0
  379. package/src/util/brower.js +15 -0
  380. package/src/util/clone.js +61 -0
  381. package/src/util/path.js +4 -0
  382. package/src/util/request.js +14 -0
  383. package/src/utils.js +1242 -0
  384. package/src/validate.js +256 -0
@@ -0,0 +1,1031 @@
1
+ <template>
2
+ <el-main ref="tablePanel" class="ht-table-panel">
3
+ <div
4
+ v-if="!noHeader && !justShowSearch"
5
+ ref="toolbarPanel"
6
+ class="toolbar-panel"
7
+ >
8
+ <div
9
+ v-if="!justShowSearch"
10
+ class="toolbar-panel__search"
11
+ :class="{ 'ht-quick__search': !hideTableSearch }"
12
+ >
13
+ <ht-input
14
+ v-if="quickSearchConfig && quickSearchConfig.length > 0"
15
+ ref="quickSearch"
16
+ v-model.lazy="quickSearchWord"
17
+ class="quick-search"
18
+ :style="quickSearchWidthStyle"
19
+ :placeholder="quickSearchPlaceholder"
20
+ :autofocus="true"
21
+ :disabled="loading || showAdvancedSearch"
22
+ :debounce="2000"
23
+ suffix-icon="el-icon-search"
24
+ style="margin-right: 20px"
25
+ @keydown.enter.native="doQuickSearch"
26
+ @click.native="clickQuickSearch"
27
+ ></ht-input>
28
+ <div class="common-tools">
29
+ <el-button
30
+ v-if="hasSearchPanel && !justShowSearch"
31
+ class="advance-search__button"
32
+ @click="showAdvancedSearch = !showAdvancedSearch"
33
+ >
34
+ {{ showAdvancedSearch ? '基础搜索' : '高级搜索' }}
35
+ <i
36
+ :class="
37
+ showAdvancedSearch ? 'el-icon-arrow-up' : 'el-icon-arrow-down'
38
+ "
39
+ ></i>
40
+ </el-button>
41
+ <el-tooltip v-if="showExport" content="导出数据" placement="top">
42
+ <el-button @click="$emit('export')">
43
+ <ht-icon name="arrow" />
44
+ </el-button>
45
+ </el-tooltip>
46
+ <el-tooltip content="刷新数据" placement="top">
47
+ <el-button
48
+ icon="el-icon-refresh"
49
+ class="refresh-btn-icon"
50
+ @click="load(true)"
51
+ ></el-button>
52
+ </el-tooltip>
53
+ <el-tooltip
54
+ v-if="showCustomColumn && !isCardView"
55
+ content="自定义列"
56
+ placement="top"
57
+ >
58
+ <el-button @click="customColumnDialogVisible = true">
59
+ <ht-icon name="setting" />
60
+ </el-button>
61
+ </el-tooltip>
62
+ <el-button-group v-if="multiViewSwitch" class="multiview-switcher">
63
+ <el-tooltip content="卡片视图" placement="top">
64
+ <el-button
65
+ :type="isCardView ? 'primary' : 'default'"
66
+ @click="isCardView = true"
67
+ >
68
+ <ht-icon name="block" />
69
+ </el-button>
70
+ </el-tooltip>
71
+ <el-tooltip content="表格视图" placement="top">
72
+ <el-button
73
+ :type="isCardView ? 'default' : 'primary'"
74
+ @click="isCardView = false"
75
+ >
76
+ <ht-icon name="line" />
77
+ </el-button>
78
+ </el-tooltip>
79
+ </el-button-group>
80
+ </div>
81
+ </div>
82
+ </div>
83
+ <el-collapse-transition>
84
+ <div
85
+ v-show="showAdvancedSearch || justShowSearch"
86
+ ref="searchPanel"
87
+ class="search-panel"
88
+ >
89
+ <slot name="search"></slot>
90
+ </div>
91
+ </el-collapse-transition>
92
+ <div v-if="hasToolBar" ref="toolbarContainer" class="toolbar-container">
93
+ <slot name="toolbar"></slot>
94
+ </div>
95
+ <el-table
96
+ v-if="!isCardView"
97
+ ref="htTable"
98
+ v-loading="loading && !noLoading"
99
+ :stripe="stripe"
100
+ border
101
+ class="ht-table"
102
+ :class="{ 'no-data-table': data.length < 1 }"
103
+ :data="data"
104
+ :size="size"
105
+ :empty-text="emptyText"
106
+ :show-header="showHeader"
107
+ :max-height="tableMaxHeight ? tableMaxHeight : 400"
108
+ :tooltip-effect="tooltipEffect"
109
+ :default-querys="defaultQuerys"
110
+ :header-row-class-name="headerRowClassName"
111
+ :header-cell-class-name="headerCellClassName"
112
+ :highlight-current-row="highlightCurrentRow"
113
+ :row-class-name="rowClassName"
114
+ :cell-class-name="cellClassName"
115
+ :style="{ height: `${tableMaxHeight ? tableMaxHeight : 400}` + 'px' }"
116
+ :row-key="rowKey"
117
+ @row-click="handleRowClick"
118
+ @select="handleTableSelect"
119
+ @select-all="handleTableSelect"
120
+ @sort-change="handleSortChange"
121
+ @filter-change="handleFilterChange"
122
+ @selection-change="(selection) => $emit('selection-change', selection)"
123
+ >
124
+ <el-table-column
125
+ v-if="selectable"
126
+ type="selection"
127
+ align="center"
128
+ :reserve-selection="reserveSelection"
129
+ width="45"
130
+ />
131
+ <slot></slot>
132
+ <template slot="empty">
133
+ <el-image :src="tableNoDataImg"></el-image>
134
+ <p class="no-data-text">{{ emptyText || t('el.table.emptyText') }}</p>
135
+ </template>
136
+ </el-table>
137
+ <div
138
+ v-else
139
+ v-loading="loading && !noLoading"
140
+ class="ht-card"
141
+ :style="{ height: `${tableMaxHeight}` + 'px' }"
142
+ >
143
+ <template v-if="loading || (data && data.length > 0)">
144
+ <div v-if="cardItemMode" class="ht-card__container">
145
+ <el-card
146
+ v-for="(item, index) in data"
147
+ :key="index"
148
+ shadow="hover"
149
+ @click.native="$emit('card-click', item)"
150
+ >
151
+ <slot name="card" :item="item"></slot>
152
+ </el-card>
153
+ </div>
154
+ <div v-else>
155
+ <slot name="card" :data="data"></slot>
156
+ </div>
157
+ </template>
158
+ <div v-else class="el-table__empty-block">
159
+ <template v-if="data.length < 1 && !emptyText">
160
+ <slot name="empty-card"></slot>
161
+ </template>
162
+ <span v-else-if="emptyText" class="el-table__empty-text">
163
+ {{ emptyText || t('el.table.emptyText') }}
164
+ </span>
165
+ </div>
166
+ </div>
167
+ <div v-if="!nopagination" ref="paginationPanel" class="pagination-panel">
168
+ <el-row type="flex" :justify="tablePaginationJustify">
169
+ <el-pagination
170
+ :small="small"
171
+ :class="{ 'page-sizes__hidden': hidePageSizes }"
172
+ :disabled="loading"
173
+ :current-page="pagination.page"
174
+ :page-sizes="pageSizes"
175
+ :page-size="pagination.pageSize"
176
+ :pager-count="pagerCount"
177
+ :background="$paginationBackground"
178
+ :layout="layout"
179
+ :total="pagination.total"
180
+ @size-change="handleSizeChange"
181
+ @current-change="handleCurrentChange"
182
+ ></el-pagination>
183
+ </el-row>
184
+ </div>
185
+ <custom-column
186
+ :custom-columns="customColumns"
187
+ :visible.sync="customColumnDialogVisible"
188
+ @apply-custom-column="handleApplyCustomColumn"
189
+ ></custom-column>
190
+ </el-main>
191
+ </template>
192
+ <script>
193
+ import Locale from '@/mixins/locale'
194
+ import Emitter from '@/mixins/emitter'
195
+ import utils from '@/utils.js'
196
+ import CustomColumn from './CustomColumn.vue'
197
+ import elementResizeDetectorMaker from 'element-resize-detector'
198
+ export default {
199
+ name: 'HtTable',
200
+ components: { CustomColumn },
201
+ mixins: [Locale, Emitter],
202
+ props: {
203
+ //是否使用小型分页样式
204
+ small: {
205
+ type: Boolean,
206
+ default: false,
207
+ },
208
+ size: {
209
+ type: String,
210
+ default: 'mini',
211
+ },
212
+ tooltipEffect: {
213
+ type: String,
214
+ default: 'dark',
215
+ },
216
+ justShowSearch: {
217
+ //为true时只显示高级搜索中的查询条件
218
+ type: Boolean,
219
+ default: false,
220
+ },
221
+ paginationJustify: {
222
+ type: String,
223
+ default: 'start',
224
+ validator: function(value) {
225
+ return ['start', 'end', 'center'].indexOf(value) !== -1
226
+ },
227
+ },
228
+ data: Array,
229
+ showHeader: {
230
+ type: Boolean,
231
+ default: true,
232
+ },
233
+ pageResult: {
234
+ type: Object,
235
+ default: () => {
236
+ return { page: 1, pageSize: 50, total: 0 }
237
+ },
238
+ },
239
+ pageSizes: {
240
+ type: Array,
241
+ default: () => {
242
+ return [10, 20, 50, 100, 200, 300]
243
+ },
244
+ },
245
+ pagerCount: {
246
+ type: Number,
247
+ default: 7,
248
+ },
249
+ nopagination: {
250
+ type: Boolean,
251
+ default: false,
252
+ },
253
+ highlightCurrentRow: {
254
+ type: Boolean,
255
+ default: false,
256
+ },
257
+ selectable: {
258
+ type: Boolean,
259
+ default: true,
260
+ },
261
+ quickSearchProps: [String, Array],
262
+ headerRowClassName: [String, Function],
263
+ headerCellClassName: [String, Function],
264
+ rowClassName: [String, Function],
265
+ cellClassName: [String, Function],
266
+ showExport: {
267
+ type: Boolean,
268
+ default: false,
269
+ },
270
+ showCustomColumn: {
271
+ type: Boolean,
272
+ default: true,
273
+ },
274
+ defaultQuerys: {
275
+ type: Array,
276
+ default() {
277
+ return []
278
+ },
279
+ },
280
+ defaultSorter: {
281
+ type: Array,
282
+ default() {
283
+ return []
284
+ },
285
+ },
286
+ isLoadTable: {
287
+ //是否默认在mounted函数中请求table数据
288
+ type: Boolean,
289
+ default: true,
290
+ },
291
+ quickSearchWidth: {
292
+ type: Number,
293
+ default: 400,
294
+ },
295
+ customTableHeight: {
296
+ type: [String, Number], //自定义传入固定高度
297
+ validator: (val) => {
298
+ if (typeof val == 'number') {
299
+ return val > 0
300
+ } else if (typeof val == 'string') {
301
+ const numVal = Number(val)
302
+ return !isNaN(numVal) && numVal > 0
303
+ } else {
304
+ return false
305
+ }
306
+ },
307
+ },
308
+ multiViewSwitch: {
309
+ // 是否支持多视图切换
310
+ type: Boolean,
311
+ default: false,
312
+ },
313
+ cardView: {
314
+ // 是否卡片视图
315
+ type: Boolean,
316
+ default: false,
317
+ },
318
+ cardItemMode: {
319
+ // 是否单个卡片模式
320
+ type: Boolean,
321
+ default: true,
322
+ },
323
+ noHeader: {
324
+ // 不显示整个工具栏
325
+ type: Boolean,
326
+ default: false,
327
+ },
328
+ emptyText: String,
329
+ rowClickSelect: {
330
+ // 单击行时是否选中该行数据
331
+ type: Boolean,
332
+ default: true,
333
+ },
334
+ autoFix: {
335
+ //是否在表头高度改变时,触发doLayout操作
336
+ type: Boolean,
337
+ default: false,
338
+ },
339
+ hidePageSizes: {
340
+ type: Boolean,
341
+ default: false,
342
+ },
343
+ tableNoDataImg: {
344
+ type: String,
345
+ default: require('@/assets/table-no-data.png'),
346
+ },
347
+ noLoading: {
348
+ type: Boolean,
349
+ default: false,
350
+ },
351
+ rowKey: {
352
+ type: [Function, String],
353
+ },
354
+ reserveSelection: {
355
+ type: Boolean,
356
+ default: false,
357
+ },
358
+ stripe: {
359
+ type: Boolean,
360
+ default: false,
361
+ },
362
+ layout: {
363
+ type: String,
364
+ default: 'total, sizes, prev, pager, next, jumper',
365
+ },
366
+ },
367
+ data() {
368
+ return {
369
+ querys: [],
370
+ sorter: null,
371
+ quickSearchWord: null,
372
+ quickSearchPlaceholder: '请输入搜索内容',
373
+ quickSearchConfig: null,
374
+ hasSearchPanel: false,
375
+ filters: {},
376
+ pagination: { ...this.pageResult },
377
+ tableMaxHeight: 400,
378
+ showAdvancedSearch: false,
379
+ loading: false,
380
+ columns: [],
381
+ customColumns: [],
382
+ customColumnDialogVisible: false,
383
+ selection: [],
384
+ tablePanelHeight: 0,
385
+ isCardView: this.cardView,
386
+ }
387
+ },
388
+ computed: {
389
+ calDefaultQuerys: function() {
390
+ let calQuerys = []
391
+ let query = {
392
+ group: 'defaultQueryGroup',
393
+ operation: 'EQUAL',
394
+ relation: 'AND',
395
+ }
396
+ this.defaultQuerys.forEach((c) => {
397
+ calQuerys.push({ ...query, ...c })
398
+ })
399
+ return calQuerys
400
+ },
401
+ hasToolBar() {
402
+ return this.$slots.toolbar && this.$slots.toolbar.length > 0
403
+ },
404
+ hideTableSearch() {
405
+ const hasQuickSearch =
406
+ this.quickSearchConfig && this.quickSearchConfig.length > 0
407
+ return !this.showAdvancedSearch && !this.hasToolBar && !hasQuickSearch
408
+ },
409
+ customTableHeightNum() {
410
+ return typeof this.customTableHeight == 'number'
411
+ ? this.customTableHeight
412
+ : Number(this.customTableHeight)
413
+ },
414
+ quickSearchWidthStyle() {
415
+ return { width: `${this.quickSearchWidth}` + 'px' }
416
+ },
417
+ tablePaginationJustify() {
418
+ return this.$allPaginationJustify || this.paginationJustify
419
+ },
420
+ },
421
+ watch: {
422
+ justShowSearch: {
423
+ handler(val) {
424
+ if (val) {
425
+ this.showAdvancedSearch = true
426
+ }
427
+ },
428
+ immediate: true,
429
+ },
430
+ isCardView: function(newVal, oldVal) {
431
+ if (newVal !== oldVal) {
432
+ this.selection = []
433
+ this.$emit('view-change', newVal)
434
+ }
435
+ },
436
+ customTableHeight() {
437
+ this.calcTableHeight()
438
+ },
439
+ },
440
+ created() {
441
+ this.initCustomColumns()
442
+ this.$on('advance-search', (data, isSearchBtn) =>
443
+ this.advanceSearch(data, isSearchBtn)
444
+ )
445
+ setTimeout(() => {
446
+ this.quickSearchProps && this.generateQuickSearchConfig()
447
+ }, 100)
448
+ },
449
+ activated() {
450
+ this.doLayout()
451
+ },
452
+ mounted() {
453
+ // 判断是否有高级搜索面板
454
+ this.hasSearchPanel = !!this.$scopedSlots.search
455
+ if (this.isLoadTable) {
456
+ this.load()
457
+ }
458
+ this.calcTableHeight()
459
+ this.$watch('showAdvancedSearch', (n, o) => {
460
+ if (n !== o) {
461
+ if (n) {
462
+ this.quickSearchWord = null
463
+ }
464
+ // 显示或收起搜索面板时,重新计算表格高度
465
+ this.calcTableHeight(300)
466
+ this.$emit('advanced-show', n)
467
+ }
468
+ })
469
+ this.$watch('pageResult', (n, o) => {
470
+ if (n !== o) {
471
+ this.pagination = { ...n }
472
+ }
473
+ })
474
+ this.$root.$on('resize', () => {
475
+ this.tablePanelHeight = 0
476
+ this.calcTableHeight(300)
477
+ })
478
+ if (this.autoFix) {
479
+ this.addResizeListener()
480
+ }
481
+ },
482
+ methods: {
483
+ setColumns(n) {
484
+ if (n && n.componentOptions) {
485
+ this.columns.push(n.componentOptions.propsData)
486
+ }
487
+ if (n && n.componentOptions && n.componentOptions.children) {
488
+ n.componentOptions.children.forEach((i) => {
489
+ this.setColumns(i)
490
+ })
491
+ }
492
+ },
493
+ initCustomColumns() {
494
+ const me = this
495
+ const ary = []
496
+ setTimeout(() => {
497
+ if (
498
+ !me.$slots ||
499
+ !me.$slots.default ||
500
+ me.$slots.default.length == 0
501
+ ) {
502
+ return
503
+ }
504
+ const count = me.$slots.default.length
505
+ // 从插槽中获取到当前表格的所有列
506
+ me.$slots.default &&
507
+ me.$slots.default.forEach((n, index) => {
508
+ // 将当前表格的列放入一个数组 多表头时需递归改造
509
+ me.setColumns(n)
510
+ if (n && n.componentOptions) {
511
+ const pd = n.componentOptions.propsData
512
+ // 将当前有有prop和label的列放入自定义列表项的数组中
513
+ if (pd.label) {
514
+ const hasChildren =
515
+ n.componentOptions.children &&
516
+ n.componentOptions.children.length > 0
517
+ ary.push({
518
+ key: pd.prop || pd.label,
519
+ value: pd.label,
520
+ checked:
521
+ !(pd.hidden === true || pd.hidden === '') ||
522
+ pd.required === true ||
523
+ pd.required === '' ||
524
+ index == count - 1 ||
525
+ hasChildren,
526
+ required:
527
+ pd.required === true ||
528
+ pd.required === '' ||
529
+ index == count - 1 ||
530
+ hasChildren,
531
+ width: pd.width || 'auto',
532
+ })
533
+ }
534
+ }
535
+ })
536
+ me.customColumns = ary
537
+ }, 0)
538
+ },
539
+ handleApplyCustomColumn(columns) {
540
+ this.broadcast('HtTableColumn', 'customColumn', columns)
541
+ this.$nextTick(() => {
542
+ setTimeout(() => this.doLayout(), 200)
543
+ })
544
+ },
545
+ doQuickSearch() {
546
+ // 先删除快速查询的查询条件
547
+ this.clearQueryByGroupName('quick')
548
+ this.clearQueryByGroupName('advance')
549
+ this.quickSearchWord &&
550
+ this.quickSearchConfig.forEach((c) => {
551
+ let query = {
552
+ property: c.prop,
553
+ value: this.quickSearchWord.trim(),
554
+ group: 'quick',
555
+ relation: 'OR',
556
+ operation: 'LIKE',
557
+ }
558
+ this.querys.push(query)
559
+ })
560
+ this.load()
561
+ },
562
+ clickQuickSearch($event) {
563
+ if (
564
+ !(this.loading || this.showAdvancedSearch) &&
565
+ $event &&
566
+ $event.target &&
567
+ $event.target.tagName == 'I'
568
+ ) {
569
+ this.$nextTick(() => {
570
+ this.doQuickSearch()
571
+ })
572
+ }
573
+ },
574
+ advanceSearch(data, isSearchBtn) {
575
+ if (this.loading || !this.showAdvancedSearch) {
576
+ return
577
+ }
578
+ this.clearQueryByGroupName('quick')
579
+ this.clearQueryByGroupName('advance')
580
+ data &&
581
+ data.forEach((d) => {
582
+ const shouldPush =
583
+ d.value != null && d.value != undefined && d.value != ''
584
+ // 高级搜索中支持一个搜索框中关联多个属性进行搜索
585
+ if (d.prop.indexOf(',') > 0) {
586
+ const propAry = utils.stringSplit(d.prop, ',')
587
+ if (propAry && propAry.length > 0) {
588
+ const groupName = `group_${propAry[0]}`
589
+ this.clearQueryByGroupName(groupName)
590
+ shouldPush &&
591
+ propAry.forEach((p) => {
592
+ this.querys.push({
593
+ property: p,
594
+ value: d.value,
595
+ group: groupName,
596
+ relation: 'OR',
597
+ operation: d.operation,
598
+ })
599
+ })
600
+ }
601
+ } else {
602
+ shouldPush &&
603
+ this.querys.push({
604
+ property: d.prop,
605
+ value: d.value,
606
+ group: 'advance',
607
+ relation: d.relation,
608
+ operation: d.operation,
609
+ })
610
+ }
611
+ })
612
+ this.load('', isSearchBtn)
613
+ },
614
+ // 加载数据
615
+ load(doNotResetPage, isSearchBtn) {
616
+ this.loading = true
617
+ // 默认重置页码为第一页
618
+ if (!doNotResetPage) {
619
+ this.pagination.page = 1
620
+ }
621
+ let param = {
622
+ pageBean: this.pagination,
623
+ sorter: [],
624
+ }
625
+
626
+ if (this.sorter && this.sorter.length > 0) {
627
+ param.sorter = this.sorter
628
+ }
629
+ // 处理默认排序字段。只有当用户没有选择排序字段才使用默认排序
630
+ if (this.defaultSorter.length > 0 && param.sorter.length == 0) {
631
+ param.sorter = [...this.defaultSorter]
632
+ }
633
+ // 处理过滤条件
634
+ this.handleFilters()
635
+
636
+ if (this.querys && this.querys.length > 0) {
637
+ param.querys = this.querys
638
+ }
639
+
640
+ // 处理查询条件
641
+ if (this.calDefaultQuerys.length > 0) {
642
+ if (!param.querys) {
643
+ param.querys = []
644
+ }
645
+ this.calDefaultQuerys.forEach((item) => {
646
+ param.querys.remove(item)
647
+ })
648
+ param.querys = param.querys.concat(this.calDefaultQuerys)
649
+ }
650
+
651
+ const me = this
652
+ // 防止外部没有回调,设置10秒后自动取消加载中的状态
653
+ let waitTime = 10000
654
+ if (!this._events || !this._events.load || !this._events.load.length) {
655
+ // 如果没有绑定在当前组件里的load事件,即组件仅仅作展示数据用 直接取消loading
656
+ waitTime = 0
657
+ }
658
+ const finalTickCB = setTimeout(function() {
659
+ me.loading = false
660
+ this.selection = []
661
+ }, waitTime)
662
+
663
+ if (this.nopagination) {
664
+ param.pageBean = {}
665
+ }
666
+ const loadedHandler = () => {
667
+ // 外部已经回调的情况下,取消倒计时
668
+ clearTimeout(finalTickCB)
669
+ me.loading = false
670
+ this.selection = []
671
+ setTimeout(() => {
672
+ me.$refs.quickSearch &&
673
+ me.$refs.quickSearch.$children[0].$el.children[0].focus()
674
+ })
675
+ }
676
+
677
+ this.$emit('load', { ...param }, loadedHandler, isSearchBtn)
678
+ this.$emit('loading', { ...param }, loadedHandler, isSearchBtn)
679
+ },
680
+ // 通过列属性获取列标签
681
+ getColumnLabelByProp(prop) {
682
+ let label = null
683
+ if (!prop) {
684
+ return label
685
+ }
686
+ this.columns.forEach((c) => {
687
+ if (c.prop && c.prop === prop) {
688
+ label = c.label
689
+ }
690
+ })
691
+ return label
692
+ },
693
+ // 构建快速搜索配置项
694
+ generateQuickSearchConfig() {
695
+ let labelAry = []
696
+ if (typeof this.quickSearchProps == 'string') {
697
+ const props = utils.stringSplit(this.quickSearchProps, ',')
698
+ this.quickSearchConfig = []
699
+ props.forEach((prop) => {
700
+ const label = this.getColumnLabelByProp(prop)
701
+ if (label) {
702
+ labelAry.push(label)
703
+ this.quickSearchConfig.push({ prop, label })
704
+ }
705
+ })
706
+ }
707
+ if (typeof this.quickSearchProps == 'object') {
708
+ this.quickSearchProps.forEach((prop) => {
709
+ if (prop && prop.label) {
710
+ labelAry.push(prop.label)
711
+ }
712
+ })
713
+ this.quickSearchConfig = [...this.quickSearchProps]
714
+ }
715
+ this.quickSearchPlaceholder = `${this.t(
716
+ 'ht.common.enter'
717
+ )}${labelAry.join(',')}${this.t('ht.common.toSearch')}`
718
+ },
719
+ // 通过分组名称清除对应查询条件
720
+ clearQueryByGroupName(groupName) {
721
+ // 待删除的查询条件
722
+ let toDelete = []
723
+ this.querys &&
724
+ this.querys.forEach((query) => {
725
+ if (query.group == groupName) {
726
+ toDelete.push(query)
727
+ }
728
+ })
729
+ toDelete.forEach((d) => {
730
+ this.querys.remove(d)
731
+ })
732
+ },
733
+ handleFilters() {
734
+ this.clearQueryByGroupName('filter')
735
+ // 将过滤条件添加查询参数数组中
736
+ if (this.filters && Object.keys(this.filters).length > 0) {
737
+ Object.keys(this.filters).forEach((k) => {
738
+ const filter = this.filters[k]
739
+ let query = {
740
+ property: k,
741
+ value: filter[0],
742
+ group: 'filter',
743
+ relation: 'AND',
744
+ }
745
+ if (filter.length == 1) {
746
+ query.operation = 'EQUAL'
747
+ this.querys.push(query)
748
+ } else if (filter.length > 1) {
749
+ query.operation = 'IN'
750
+ query.value = filter
751
+ this.querys.push(query)
752
+ }
753
+ })
754
+ }
755
+ },
756
+ handleSizeChange(pageSize) {
757
+ this.pagination = { ...this.pagination, pageSize }
758
+ this.$emit('size-change', pageSize)
759
+ this.load()
760
+ },
761
+ handleCurrentChange(page) {
762
+ this.pagination = { ...this.pagination, page }
763
+ // 翻页时不重置页码
764
+ this.$emit('current-change', page)
765
+ this.load(true)
766
+ },
767
+ handleRowClick(row, column, event) {
768
+ if (this.rowClickSelect) {
769
+ if (this.selection.some((s) => s === row)) {
770
+ this.selection.remove(row)
771
+ } else {
772
+ this.selection.push(row)
773
+ }
774
+ this.$refs.htTable.toggleRowSelection(row)
775
+ }
776
+ this.$emit('row-click', row, column, event)
777
+ },
778
+ handleTableSelect(selection, row) {
779
+ this.selection = selection
780
+ if (row) {
781
+ this.$emit('select', selection, row)
782
+ } else {
783
+ this.$emit('select-all', selection)
784
+ }
785
+ },
786
+ handleSortChange(column) {
787
+ if (!column.order) {
788
+ this.sorter = null
789
+ } else {
790
+ this.sorter = [
791
+ {
792
+ property: column.prop,
793
+ direction: column.order == 'ascending' ? 'ASC' : 'DESC',
794
+ },
795
+ ]
796
+ }
797
+ this.load(true)
798
+ this.$emit('sort-change', column)
799
+ },
800
+ handleFilterChange(m) {
801
+ this.filters = { ...this.filters, ...m }
802
+ Object.keys(this.filters).forEach((k) => {
803
+ if (!this.filters[k] || this.filters[k].length == 0) {
804
+ delete this.filters[k]
805
+ }
806
+ })
807
+ this.load()
808
+ this.$emit('filter-change', m)
809
+ },
810
+ doLayout() {
811
+ this.$nextTick(() => {
812
+ this.$refs.htTable && this.$refs.htTable.doLayout()
813
+ })
814
+ },
815
+ initTablePanelHeight() {
816
+ this.tablePanelHeight = this.$refs.tablePanel.$el.clientHeight
817
+ },
818
+ calcTableHeight(delay) {
819
+ // 动态计算表格的高度,自适应当前容器
820
+ setTimeout(() => {
821
+ const toolbarPanelHeight =
822
+ (this.$refs.toolbarPanel && this.$refs.toolbarPanel.clientHeight) ||
823
+ 0
824
+
825
+ const searchPanelHeight =
826
+ (this.$refs.searchPanel && this.$refs.searchPanel.clientHeight) || 0
827
+
828
+ const toolbarContainerHeight =
829
+ (this.$refs.toolbarContainer &&
830
+ this.$refs.toolbarContainer.clientHeight) ||
831
+ 0
832
+
833
+ const paginationPanelHeight =
834
+ (this.$refs.paginationPanel &&
835
+ this.$refs.paginationPanel.clientHeight) ||
836
+ 0
837
+ // 下外边距
838
+ const searchPanelBottom = searchPanelHeight > 0 ? 18 : 0
839
+ const toolbarPanelBottom = toolbarPanelHeight > 0 ? 18 : 0
840
+ const toolbarContainerBottom = toolbarContainerHeight > 0 ? 18 : 0
841
+
842
+ // 表格之外的高度
843
+ const tableOuterHeight =
844
+ toolbarPanelHeight +
845
+ toolbarPanelBottom +
846
+ searchPanelHeight +
847
+ searchPanelBottom +
848
+ toolbarContainerHeight +
849
+ toolbarContainerBottom +
850
+ paginationPanelHeight
851
+ if (this.customTableHeightNum) {
852
+ this.tableMaxHeight = this.customTableHeightNum - tableOuterHeight
853
+ } else {
854
+ if (!this.$refs.tablePanel) {
855
+ return
856
+ }
857
+ if (this.tablePanelHeight == 0) {
858
+ this.initTablePanelHeight()
859
+ }
860
+ const tableHeight = this.tablePanelHeight - tableOuterHeight
861
+ this.tableMaxHeight = tableHeight
862
+ }
863
+ }, delay || 0)
864
+ },
865
+ addResizeListener() {
866
+ //监听表头高度变化,如果
867
+ this.$nextTick(() => {
868
+ let erd = elementResizeDetectorMaker()
869
+ erd.listenTo(
870
+ this.$refs.htTable.$refs.headerWrapper.getElementsByTagName(
871
+ 'tr'
872
+ )[0],
873
+ this.doLayout
874
+ )
875
+ })
876
+ },
877
+ },
878
+ }
879
+ </script>
880
+ <style lang="scss" scoped>
881
+ .ht-table-panel {
882
+ padding: 0px;
883
+ height: 100%;
884
+ overflow: hidden;
885
+
886
+ .toolbar-panel,
887
+ .toolbar-container {
888
+ margin-bottom: 16px;
889
+ box-sizing: border-box;
890
+ }
891
+
892
+ .search-panel {
893
+ background-color: #f9f9f9;
894
+ padding: 16px 16px 10px 16px;
895
+ margin-bottom: 16px;
896
+ box-sizing: border-box;
897
+ }
898
+ }
899
+
900
+ .ht-table {
901
+ width: 100%;
902
+ //min-height: 500px;
903
+ }
904
+ .no-data-table {
905
+ ::v-deep .el-table__body-wrapper {
906
+ height: 100%;
907
+ .el-table__empty-text {
908
+ line-height: unset;
909
+ }
910
+ .no-data-text {
911
+ margin: 8px 0;
912
+ line-height: 20px;
913
+ font-size: 14px;
914
+ }
915
+ }
916
+ }
917
+ .ht-card {
918
+ .el-table__empty-block {
919
+ height: 100%;
920
+ }
921
+ }
922
+ .toolbar-panel__search {
923
+ display: flex;
924
+ justify-content: space-between;
925
+ }
926
+
927
+ .search-container__col {
928
+ display: -webkit-box;
929
+ display: -ms-flexbox;
930
+ display: flex;
931
+ -webkit-box-align: center;
932
+ -ms-flex-align: center;
933
+ flex-direction: row;
934
+ align-items: center;
935
+ }
936
+
937
+ .ht-quick__search {
938
+ margin-bottom: 15px;
939
+ max-height: 32px;
940
+ }
941
+
942
+ .quick-search {
943
+ margin-right: 20px;
944
+ }
945
+
946
+ .quick-search + .el-divider {
947
+ margin-right: 20px;
948
+ }
949
+
950
+ ::v-deep .el-input__inner,
951
+ ::v-deep .el-input-group__append {
952
+ border-radius: 0;
953
+ }
954
+
955
+ .common-tools {
956
+ display: flex;
957
+ justify-content: flex-end;
958
+
959
+ .el-button-group {
960
+ margin: 0 0 0 16px;
961
+ }
962
+
963
+ .el-button {
964
+ padding: 6px;
965
+ border-radius: 0;
966
+ }
967
+ ::v-deep.el-button.refresh-btn-icon {
968
+ i {
969
+ font-size: 16px;
970
+ }
971
+ }
972
+ .advance-search__button {
973
+ padding: 6px 12px;
974
+ }
975
+ }
976
+
977
+ ::v-deep .ht-table .sort-caret.descending {
978
+ bottom: 0px;
979
+ }
980
+
981
+ ::v-deep .ht-table .sort-caret.ascending {
982
+ top: -2px;
983
+ }
984
+
985
+ ::v-deep .ht-table .caret-wrapper {
986
+ height: 20px;
987
+ }
988
+
989
+ ::v-deep .ht-table .el-table__column-filter-trigger {
990
+ line-height: 20px;
991
+ }
992
+
993
+ .pagination-panel {
994
+ padding: 10px 0;
995
+ }
996
+
997
+ .multiview-switcher {
998
+ width: 59px;
999
+ height: 32px;
1000
+ overflow: hidden;
1001
+ }
1002
+
1003
+ .ht-card {
1004
+ @include base-scrollbar;
1005
+ overflow: auto;
1006
+
1007
+ .ht-card__container {
1008
+ &::after {
1009
+ content: '';
1010
+ display: block;
1011
+ clear: both;
1012
+ }
1013
+
1014
+ .el-card {
1015
+ cursor: pointer;
1016
+ float: left;
1017
+ margin: 8px;
1018
+
1019
+ ::v-deep .el-card__body {
1020
+ padding: 16px;
1021
+ }
1022
+ }
1023
+ }
1024
+ }
1025
+
1026
+ .page-sizes__hidden {
1027
+ ::v-deep .el-pagination__sizes {
1028
+ display: none;
1029
+ }
1030
+ }
1031
+ </style>