simple-frame-unit 1.0.2

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 (260) hide show
  1. package/.env.dev +14 -0
  2. package/CHANGELOG.md +9 -0
  3. package/README.md +24 -0
  4. package/dist/ed-frame-vue.common.1.js +11046 -0
  5. package/dist/ed-frame-vue.common.1.js.map +1 -0
  6. package/dist/ed-frame-vue.common.2.js +1715 -0
  7. package/dist/ed-frame-vue.common.2.js.map +1 -0
  8. package/dist/ed-frame-vue.common.js +53427 -0
  9. package/dist/ed-frame-vue.common.js.map +1 -0
  10. package/dist/ed-frame-vue.umd.1.js +11046 -0
  11. package/dist/ed-frame-vue.umd.1.js.map +1 -0
  12. package/dist/ed-frame-vue.umd.2.js +1715 -0
  13. package/dist/ed-frame-vue.umd.2.js.map +1 -0
  14. package/dist/ed-frame-vue.umd.js +53437 -0
  15. package/dist/ed-frame-vue.umd.js.map +1 -0
  16. package/dist/ed-frame-vue.umd.min.1.js +17 -0
  17. package/dist/ed-frame-vue.umd.min.1.js.map +1 -0
  18. package/dist/ed-frame-vue.umd.min.2.js +4 -0
  19. package/dist/ed-frame-vue.umd.min.2.js.map +1 -0
  20. package/dist/ed-frame-vue.umd.min.js +470 -0
  21. package/dist/ed-frame-vue.umd.min.js.map +1 -0
  22. package/import.easydata.js +46 -0
  23. package/lib/CHANGELOG.md +18 -0
  24. package/lib/README.md +27 -0
  25. package/lib/api/ds/index.js +124 -0
  26. package/lib/api/easyData.js +90 -0
  27. package/lib/api/easyform/easyForm.js +32 -0
  28. package/lib/api/index.js +61 -0
  29. package/lib/api/interface/index.js +32 -0
  30. package/lib/api/system.js +20 -0
  31. package/lib/index.js +80 -0
  32. package/lib/packages/BasicTemplate/EasyDataTemplate.vue +189 -0
  33. package/lib/packages/BasicTemplate/Props.js +64 -0
  34. package/lib/packages/BasicTemplate/components/TemplateComp.vue +263 -0
  35. package/lib/packages/BasicTemplate/components/TemplateViews.vue +292 -0
  36. package/lib/packages/BasicTemplate/hooks/business.js +74 -0
  37. package/lib/packages/BasicTemplate/hooks/getFormData.js +89 -0
  38. package/lib/packages/BasicTemplate/hooks/queryFormData.js +194 -0
  39. package/lib/packages/BasicTemplate/hooks/submitForm.js +53 -0
  40. package/lib/packages/BasicTemplate/hooks/useEmits.js +15 -0
  41. package/lib/packages/BasicTemplate/hooks/validate.js +42 -0
  42. package/lib/packages/EasyDataForm/EasyDataForm.vue +597 -0
  43. package/lib/packages/EasyDataForm/Props.js +22 -0
  44. package/lib/packages/EasyDataForm/components/FormItem.vue +228 -0
  45. package/lib/packages/EasyDataForm/hooks/useChosePopup.js +85 -0
  46. package/lib/packages/EasyDataForm/hooks/useEmits.js +19 -0
  47. package/lib/packages/EasyDataForm/hooks/useForm.js +169 -0
  48. package/lib/packages/EasyDataForm/hooks/useUpload.js +168 -0
  49. package/lib/packages/EasyDataList/EasyDataList.vue +348 -0
  50. package/lib/packages/EasyDataList/Props.js +116 -0
  51. package/lib/packages/EasyDataList/components/BasicModal.vue +150 -0
  52. package/lib/packages/EasyDataList/components/FormAction.vue +63 -0
  53. package/lib/packages/EasyDataList/hooks/useEmits.js +30 -0
  54. package/lib/packages/EasyDataList/hooks/useForm.js +62 -0
  55. package/lib/packages/EasyDataList/hooks/useTable.js +314 -0
  56. package/lib/packages/EasyDataTable/EasyDataTable.vue +233 -0
  57. package/lib/packages/EasyDataView/EasyDataView.vue +105 -0
  58. package/lib/packages/EdRichPreview/index.js +32 -0
  59. package/lib/packages/EdRichText/index.vue +167 -0
  60. package/lib/packages/EdRichText/replaceUrl.js +49 -0
  61. package/lib/packages/components/FileView.vue +97 -0
  62. package/lib/packages/index.js +11 -0
  63. package/lib/packages/mixins/EasyDataMixins.js +133 -0
  64. package/lib/packages/mixins/useTable.jsx +130 -0
  65. package/lib/pages/DataSource/index.js +8 -0
  66. package/lib/pages/DataSource/src/components/ControlViews/BaseProps.js +103 -0
  67. package/lib/pages/DataSource/src/components/ControlViews/control.js +1089 -0
  68. package/lib/pages/DataSource/src/components/ControlViews/index.vue +301 -0
  69. package/lib/pages/DataSource/src/components/TableOperationModal.vue +225 -0
  70. package/lib/pages/DataSource/src/components/TablePropsModal.vue +367 -0
  71. package/lib/pages/DataSource/src/components/ViewPropsModal.vue +737 -0
  72. package/lib/pages/DataSource/src/components/modal/ChooseDict.vue +119 -0
  73. package/lib/pages/DataSource/src/hooks/useTable.js +138 -0
  74. package/lib/pages/DataSource/src/index.vue +431 -0
  75. package/lib/pages/Interface/index.js +8 -0
  76. package/lib/pages/Interface/src/components/InterfaceCall.vue +73 -0
  77. package/lib/pages/Interface/src/components/InterfaceDepend.vue +299 -0
  78. package/lib/pages/Interface/src/components/InterfaceFee.vue +131 -0
  79. package/lib/pages/Interface/src/components/InterfaceMessage.vue +878 -0
  80. package/lib/pages/Interface/src/components/InterfaceMock.vue +203 -0
  81. package/lib/pages/Interface/src/components/InterfaceParam.vue +308 -0
  82. package/lib/pages/Interface/src/components/InterfaceRepeat.vue +281 -0
  83. package/lib/pages/Interface/src/components/InterfaceVariable.vue +31 -0
  84. package/lib/pages/Interface/src/index.vue +216 -0
  85. package/lib/pages/Template/index.js +8 -0
  86. package/lib/pages/Template/src/components/DefineModal.vue +524 -0
  87. package/lib/pages/Template/src/components/TemplatePreview.vue +109 -0
  88. package/lib/pages/Template/src/components/model/AddDialog.vue +60 -0
  89. package/lib/pages/Template/src/components/model/TemplatePreview2.vue +101 -0
  90. package/lib/pages/Template/src/hooks/index.js +3 -0
  91. package/lib/pages/Template/src/hooks/useEmits.js +64 -0
  92. package/lib/pages/Template/src/index.vue +124 -0
  93. package/lib/popup/index.js +8 -0
  94. package/lib/popup/src/DataSourceChoose.vue +44 -0
  95. package/lib/popup/src/DataSourceViewIdChoose.vue +67 -0
  96. package/lib/popup/src/DictChoose.vue +104 -0
  97. package/lib/popup/src/InterfaceChoose.vue +46 -0
  98. package/lib/popup/src/OrgChoose.vue +121 -0
  99. package/lib/popup/src/RoleChoose.vue +101 -0
  100. package/lib/popup/src/TemplateChoose.vue +43 -0
  101. package/lib/popup/src/UserChoose.vue +161 -0
  102. package/lib/popup//347/273/204/344/273/266/345/274/200/345/217/221/350/247/204/350/214/203.md +25 -0
  103. package/lib/style/custom.scss +126 -0
  104. package/lib/style/deep.scss +109 -0
  105. package/lib/style/index.scss +4 -0
  106. package/lib/utils/MapLoader.js +48 -0
  107. package/lib/utils/dateUtils.js +58 -0
  108. package/lib/utils/index.js +8 -0
  109. package/lib/utils/setting.js +25 -0
  110. package/lib/utils/sortable/index.js +3784 -0
  111. package/lib/utils/useBusiness.js +212 -0
  112. package/lib/utils/utils.js +588 -0
  113. package/package.json +77 -0
  114. package/src/App.vue +12 -0
  115. package/src/assets/Vue.png +0 -0
  116. package/src/assets/avatar.png +0 -0
  117. package/src/assets/images/bg.png +0 -0
  118. package/src/assets/images/logo-bills.png +0 -0
  119. package/src/assets/images/pic.png +0 -0
  120. package/src/assets/images/weplus-logo.png +0 -0
  121. package/src/assets/marker.png +0 -0
  122. package/src/assets/styles/common.scss +359 -0
  123. package/src/assets/styles/ele-docs.css +3278 -0
  124. package/src/assets/styles/fonts/icomoon.eot +0 -0
  125. package/src/assets/styles/fonts/icomoon.svg +14 -0
  126. package/src/assets/styles/fonts/icomoon.ttf +0 -0
  127. package/src/assets/styles/fonts/icomoon.woff +0 -0
  128. package/src/assets/styles/fonts/style.css +39 -0
  129. package/src/assets/styles/higtlightEle.css +84 -0
  130. package/src/assets/svg/code.svg +7 -0
  131. package/src/assets/svg/password.svg +1 -0
  132. package/src/components/Popups/DiyCompDictChoose.vue +112 -0
  133. package/src/components/Popups/index.js +28 -0
  134. package/src/components/ed-base-vue/global/variable.js +8 -0
  135. package/src/components/ed-base-vue/index.js +81 -0
  136. package/src/components/ed-base-vue/package/EdCard/index.js +7 -0
  137. package/src/components/ed-base-vue/package/EdCard/src/index.vue +87 -0
  138. package/src/components/ed-base-vue/package/EdCodeEditor/index.js +8 -0
  139. package/src/components/ed-base-vue/package/EdCodeEditor/src/AceEditor/AceConfig.js +71 -0
  140. package/src/components/ed-base-vue/package/EdCodeEditor/src/AceEditor/Editor.vue +137 -0
  141. package/src/components/ed-base-vue/package/EdCodeEditor/src/AceEditor/Toolbar.vue +68 -0
  142. package/src/components/ed-base-vue/package/EdCodeEditor/src/AceEditor/index.vue +119 -0
  143. package/src/components/ed-base-vue/package/EdCodeEditor/src/AceEditor/webpack-resolver.js +51 -0
  144. package/src/components/ed-base-vue/package/EdCodeEditor/src/Codemirror/Toolbar.vue +57 -0
  145. package/src/components/ed-base-vue/package/EdCodeEditor/src/Codemirror/config.js +64 -0
  146. package/src/components/ed-base-vue/package/EdCodeEditor/src/Codemirror/index.vue +309 -0
  147. package/src/components/ed-base-vue/package/EdCodeEditor/src/EdCodeEditor.vue +238 -0
  148. package/src/components/ed-base-vue/package/EdDate/index.js +8 -0
  149. package/src/components/ed-base-vue/package/EdDate/src/index.js +50 -0
  150. package/src/components/ed-base-vue/package/EdDescriptions/index.js +8 -0
  151. package/src/components/ed-base-vue/package/EdDescriptions/src/EdDescriptions.vue +46 -0
  152. package/src/components/ed-base-vue/package/EdDescriptions/src/EdDescriptionsItem.js +20 -0
  153. package/src/components/ed-base-vue/package/EdDescriptions/src/Props.js +20 -0
  154. package/src/components/ed-base-vue/package/EdDialog/index.js +8 -0
  155. package/src/components/ed-base-vue/package/EdDialog/src/EdDialog.vue +138 -0
  156. package/src/components/ed-base-vue/package/EdDialog/src/Props.js +91 -0
  157. package/src/components/ed-base-vue/package/EdDialog/src/components/DialogFooter.vue +42 -0
  158. package/src/components/ed-base-vue/package/EdDialog/src/components/DialogWrapper.vue +53 -0
  159. package/src/components/ed-base-vue/package/EdDrawer/index.js +8 -0
  160. package/src/components/ed-base-vue/package/EdDrawer/src/DrawerFooter.vue +41 -0
  161. package/src/components/ed-base-vue/package/EdDrawer/src/EdDrawer.vue +150 -0
  162. package/src/components/ed-base-vue/package/EdDrawer/src/props.js +71 -0
  163. package/src/components/ed-base-vue/package/EdFlow/index.js +8 -0
  164. package/src/components/ed-base-vue/package/EdFlow/src/EdFlowItem.vue +733 -0
  165. package/src/components/ed-base-vue/package/EdFlow/src/index.vue +148 -0
  166. package/src/components/ed-base-vue/package/EdForm/index.js +8 -0
  167. package/src/components/ed-base-vue/package/EdForm/src/EdForm.vue +172 -0
  168. package/src/components/ed-base-vue/package/EdForm/src/Props.js +33 -0
  169. package/src/components/ed-base-vue/package/EdForm/src/components/EdFormItem.vue +34 -0
  170. package/src/components/ed-base-vue/package/EdIcons/index.js +8 -0
  171. package/src/components/ed-base-vue/package/EdIcons/src/hooks/Icons.js +406 -0
  172. package/src/components/ed-base-vue/package/EdIcons/src/hooks/Icons1.js +830 -0
  173. package/src/components/ed-base-vue/package/EdIcons/src/index.vue +13 -0
  174. package/src/components/ed-base-vue/package/EdImage/index.js +8 -0
  175. package/src/components/ed-base-vue/package/EdImage/src/index.vue +28 -0
  176. package/src/components/ed-base-vue/package/EdInputArray/index.js +8 -0
  177. package/src/components/ed-base-vue/package/EdInputArray/src/Props.js +26 -0
  178. package/src/components/ed-base-vue/package/EdInputArray/src/index.vue +97 -0
  179. package/src/components/ed-base-vue/package/EdInputColor/index.js +8 -0
  180. package/src/components/ed-base-vue/package/EdInputColor/src/InputColor.vue +81 -0
  181. package/src/components/ed-base-vue/package/EdInputMap/index.js +9 -0
  182. package/src/components/ed-base-vue/package/EdInputMap/src/EdInputMap.vue +246 -0
  183. package/src/components/ed-base-vue/package/EdInputMap/src/EdInputMapProps.js +6 -0
  184. package/src/components/ed-base-vue/package/EdInputPop/index.js +13 -0
  185. package/src/components/ed-base-vue/package/EdInputPop/src/EdInputPop.vue +144 -0
  186. package/src/components/ed-base-vue/package/EdInputPop/src/Props.js +48 -0
  187. package/src/components/ed-base-vue/package/EdInputTable/index.js +8 -0
  188. package/src/components/ed-base-vue/package/EdInputTable/src/EdInputTable.vue +368 -0
  189. package/src/components/ed-base-vue/package/EdInputTable/src/Fetch.js +40 -0
  190. package/src/components/ed-base-vue/package/EdJsonEditor/index.js +13 -0
  191. package/src/components/ed-base-vue/package/EdJsonEditor/src/EdJsonEditor.vue +198 -0
  192. package/src/components/ed-base-vue/package/EdJsonEditor/src/assets/img/jsoneditor-icons.svg +749 -0
  193. package/src/components/ed-base-vue/package/EdJsonEditor/src/assets/jsoneditor.css +2031 -0
  194. package/src/components/ed-base-vue/package/EdJsonEditor/src/assets/plus.svg +1 -0
  195. package/src/components/ed-base-vue/package/EdJsonEditor/src/hooks.js +63 -0
  196. package/src/components/ed-base-vue/package/EdJsonViewer/index.js +8 -0
  197. package/src/components/ed-base-vue/package/EdJsonViewer/src/EdJsonViewer.vue +44 -0
  198. package/src/components/ed-base-vue/package/EdLable/index.js +8 -0
  199. package/src/components/ed-base-vue/package/EdLable/src/index.vue +34 -0
  200. package/src/components/ed-base-vue/package/EdLink/index.js +8 -0
  201. package/src/components/ed-base-vue/package/EdLink/src/index.vue +43 -0
  202. package/src/components/ed-base-vue/package/EdMarkEditor/index.js +15 -0
  203. package/src/components/ed-base-vue/package/EdMarkEditor/src/EdMarkEditor.vue +368 -0
  204. package/src/components/ed-base-vue/package/EdMarkEditor/src/extra-function.js +538 -0
  205. package/src/components/ed-base-vue/package/EdMarkEditor/src/highlight.js +95 -0
  206. package/src/components/ed-base-vue/package/EdTable/index.js +8 -0
  207. package/src/components/ed-base-vue/package/EdTable/src/EdTable.vue +240 -0
  208. package/src/components/ed-base-vue/package/EdTable/src/Props.js +97 -0
  209. package/src/components/ed-base-vue/package/EdTable/src/components/TableColumnItem.js +24 -0
  210. package/src/components/ed-base-vue/package/EdTable/src/components/TablePagination.vue +73 -0
  211. package/src/components/ed-base-vue/package/EdTableEditor/index.js +8 -0
  212. package/src/components/ed-base-vue/package/EdTableEditor/src/EdTableEditor.vue +282 -0
  213. package/src/components/ed-base-vue/package/EdTableEditor/src/Props.js +107 -0
  214. package/src/components/ed-base-vue/package/EdTableEditor/src/hooks/validate.js +90 -0
  215. package/src/components/ed-base-vue/package/EdUpload/index.js +8 -0
  216. package/src/components/ed-base-vue/package/EdUpload/src/Props.js +90 -0
  217. package/src/components/ed-base-vue/package/EdUpload/src/index.vue +88 -0
  218. package/src/components/ed-base-vue/package/EdViewer/index.js +8 -0
  219. package/src/components/ed-base-vue/package/EdViewer/src/EdViewer.vue +310 -0
  220. package/src/components/ed-base-vue/package/EdWangEditor/index.js +14 -0
  221. package/src/components/ed-base-vue/package/EdWangEditor/src/EdWangEditor.vue +127 -0
  222. package/src/components/ed-base-vue/package/ExtendSlot.js +12 -0
  223. package/src/components/ed-base-vue/package/OptionSlot.js +65 -0
  224. package/src/components/ed-base-vue/plugin/Message/index.js +2 -0
  225. package/src/components/ed-base-vue/plugin/Message/src/main.js +91 -0
  226. package/src/components/ed-base-vue/plugin/Message/src/main.vue +253 -0
  227. package/src/components/ed-base-vue/plugin/print/index.js +156 -0
  228. package/src/components/ed-base-vue/plugin/sortable/index.js +3784 -0
  229. package/src/components/ed-base-vue/style/custom.scss +107 -0
  230. package/src/components/ed-base-vue/style/deep.scss +100 -0
  231. package/src/components/ed-base-vue/style/index.scss +4 -0
  232. package/src/components/ed-base-vue/tools/date-format.js +315 -0
  233. package/src/components/ed-base-vue/tools/utils.js +124 -0
  234. package/src/layouts/components/AppMain.vue +17 -0
  235. package/src/layouts/components/Header.vue +256 -0
  236. package/src/layouts/components/Logo.vue +56 -0
  237. package/src/layouts/components/Navbar.vue +169 -0
  238. package/src/layouts/components/SideBar.vue +107 -0
  239. package/src/layouts/components/index.js +5 -0
  240. package/src/layouts/index.vue +57 -0
  241. package/src/main.js +42 -0
  242. package/src/request/config.js +6 -0
  243. package/src/request/index.js +85 -0
  244. package/src/request/request.js +147 -0
  245. package/src/router/index.js +65 -0
  246. package/src/router/modules/baseRouter.js +43 -0
  247. package/src/router/modules/easydata.js +49 -0
  248. package/src/views/base/BaseRichPreview.vue +23 -0
  249. package/src/views/base/BaseRichText.vue +28 -0
  250. package/src/views/base/EdFormView.vue +54 -0
  251. package/src/views/base/EdTable.vue +98 -0
  252. package/src/views/base/inputTable.vue +103 -0
  253. package/src/views/easydata/Interface.vue +3 -0
  254. package/src/views/easydata/dataSource.vue +13 -0
  255. package/src/views/easydata/dataSourceView.vue +71 -0
  256. package/src/views/easydata/templateDemo.vue +89 -0
  257. package/src/views/easydata/templateInfo.vue +13 -0
  258. package/src/views/index.vue +17 -0
  259. package/src/views/login.vue +208 -0
  260. package/src/views/redirect.vue +15 -0
@@ -0,0 +1,30 @@
1
+ export default {
2
+ methods: {
3
+ loadDataOk(result) {
4
+ this.$emit('loadDataOk', result)
5
+ },
6
+
7
+ /**
8
+ * @name getControlInfo
9
+ * @param controlInfos
10
+ * @returns {*}
11
+ * @description 获取表单控件属性
12
+ */
13
+ getControlInfo(controlInfos) {
14
+ this.$emit('editControlInfos', controlInfos)
15
+ return controlInfos
16
+ },
17
+
18
+ /**
19
+ * @name rowSelectionSelect
20
+ * @param record
21
+ * @param selectedRowKeys
22
+ * @param selectedRows
23
+ * @description
24
+ */
25
+ rowSelectionSelect(record, selectedRowKeys, selectedRows) {
26
+ this.selectedRowKeys = selectedRowKeys
27
+ this.$emit('rowSelectionSelect', record, selectedRowKeys, selectedRows)
28
+ },
29
+ }
30
+ }
@@ -0,0 +1,62 @@
1
+ export default {
2
+ data() {
3
+ return {
4
+ // 查询条件参数
5
+ formKeyInfo: {},
6
+ // form 表单高度
7
+ formHeight: "auto"
8
+ }
9
+ },
10
+ methods: {
11
+ /**
12
+ * @name bindFormProps
13
+ * @return {Object}
14
+ * @description 设置form组件参数
15
+ */
16
+ bindFormProps() {
17
+ let baseProps= {
18
+ inline: true,
19
+ isSearchForm: true,
20
+ height: this.formHeight,
21
+ formData: this.formData,
22
+ controlConfig: this.controlConfig,
23
+ }
24
+
25
+ return Object.assign({}, baseProps, this.formProps)
26
+ },
27
+
28
+ /**
29
+ * @name renderModalSlot
30
+ * @description 组装form按钮区插槽
31
+ */
32
+ renderFormSlot() {
33
+ const slots = ['resetBefore', 'queryBefore', 'exportBefore', 'addBefore', 'extra']
34
+ const scopedSlots = []
35
+ Object.keys(this.$scopedSlots).map(slot => {
36
+ if (slots.includes(slot)) {
37
+ scopedSlots.push(slot)
38
+ }
39
+ })
40
+ return scopedSlots
41
+ },
42
+
43
+ /**
44
+ * @name searchQuery
45
+ * @description 搜索方法
46
+ */
47
+ async searchQuery() {
48
+ let form = await this.$refs.EasyDataForm.getFormData(true)
49
+ this.formKeyInfo = form.key
50
+ await this.loadTableData();
51
+ },
52
+
53
+ /**
54
+ * @name searchReset
55
+ * @description 重写查询重置方法,默认显示值
56
+ */
57
+ async searchReset() {
58
+ await this.$refs.EasyDataForm.watchFormData();
59
+ await this.searchQuery();
60
+ },
61
+ }
62
+ }
@@ -0,0 +1,314 @@
1
+ import {DefaultUrl, pageQueryList} from "../../../api/easyData";
2
+ import {getVarType, sign, underlineToHumpJson} from "../../../utils/utils";
3
+ import {postAction} from "../../../api";
4
+ import {getControlProp, setFormData} from "../../../utils/useBusiness";
5
+
6
+ export default {
7
+ data() {
8
+ return {
9
+ // table 数据数组
10
+ tableData: [],
11
+ // 表格loading动画
12
+ tableLoading: false,
13
+ // 表格列的配置描述
14
+ columns: this.diyColums,
15
+ cacheColumns: [],
16
+ // 分页
17
+ pagination: {
18
+ current: 1,
19
+ pageSize: 10,
20
+ total: 0,
21
+ pageSizes: [10, 20, 30]
22
+ },
23
+ }
24
+ },
25
+ methods: {
26
+ /**
27
+ * @private
28
+ */
29
+ bindTableProps() {
30
+ return {
31
+ ...this.tableProps,
32
+ columnType: this.columnType,
33
+ pagination: this.pagination,
34
+ data: this.tableData,
35
+ columns: this.columns,
36
+ loading: this.initLoading
37
+ }
38
+ },
39
+ /**
40
+ * @name handleTableChange
41
+ * @description 分页、排序、筛选变化时触发
42
+ */
43
+ handleTableChange({pagination}) {
44
+ this.loadTableData(pagination.current)
45
+ },
46
+ /**
47
+ * @name loadTableData
48
+ * @param arg
49
+ * @returns {Promise<void>}
50
+ * @description 加载列表数据
51
+ */
52
+ async loadTableData(arg = 1) {
53
+ this.rowSelectionSelect(null, [], [])
54
+ if (arg === 1) this.pagination.current = 1
55
+ this.tableLoading = true
56
+ try {
57
+ let res = null
58
+ if (this.httpUrl.pageUrl === DefaultUrl.page) {
59
+ res = await pageQueryList(sign(this.getQueryParams()))
60
+ } else {
61
+ res = await postAction(this.httpUrl.pageUrl, this.getQueryParams())
62
+ }
63
+
64
+ this.tableLoading = false
65
+ if (res.success) {
66
+ let result = res.data
67
+ if (Number(result.total) > 0) {
68
+ this.pagination.total = Number(result.total)
69
+ this.tableData = setFormData(result.records, this.controlInfos, this)
70
+ } else {
71
+ this.pagination.total = 0
72
+ this.tableData = []
73
+ }
74
+ } else {
75
+ this.$message.warning(res.message)
76
+ }
77
+ this.loadDataOk(res)
78
+ } catch (e) {
79
+ console.log(e)
80
+ this.tableLoading = false
81
+ }
82
+ },
83
+
84
+ /**
85
+ * @private
86
+ * @name getQueryParams
87
+ * @returns {*}
88
+ * @description 组装表格查询参数
89
+ */
90
+ getQueryParams() {
91
+ const {dataSource, controlProps, controlInfos} = this.controlConfig
92
+ //查询参数
93
+ let param = this.initQueryParams(dataSource);
94
+ // console.info("param", param, this.formKeyInfo)
95
+ //where
96
+ let whereList = [];
97
+ if (controlInfos) {
98
+ controlInfos.map(control => {
99
+ //查询参数
100
+ let controlValue = this.formKeyInfo[control.controlName]
101
+ const controlProp = getControlProp(control, controlProps);
102
+ if (control.isQuery && getVarType(controlValue) !== 'undefined') {
103
+ let where = {}
104
+ if (['cascader', 'select'].includes(control.controlType)) {
105
+ let isMultiple = getVarType(controlProp.multiple) === 'boolean' && controlProp.multiple
106
+ where = this.addWhereCascader(control, isMultiple, controlValue)
107
+ } else if (control.controlType === 'datePicker') {
108
+ where = this.addWhereDatePicker(control, controlValue)
109
+ } else {
110
+ where = this.addWhereOther(control, controlProp, controlValue)
111
+ }
112
+
113
+ if (where) whereList.push(where)
114
+
115
+ }
116
+ //传递参数
117
+ if (getVarType(this.queryParams) === 'object') {
118
+ if (this.queryParams && this.hasObject(this.queryParams, control.controlName)) {
119
+ whereList.push({
120
+ fieldName: control.controlName,
121
+ fieldValue: this.queryParams[control.controlName],
122
+ operator: 'like',
123
+ })
124
+ control.hidden = true
125
+ }
126
+ }
127
+ })
128
+ if (getVarType(this.queryParams) === 'array') {
129
+ whereList = whereList.concat(this.queryParams)
130
+ }
131
+ param.wheres = whereList
132
+ param.orders = this.orderBy
133
+ }
134
+
135
+ //加签
136
+ return sign(param);
137
+ },
138
+ /**
139
+ * @private
140
+ * 查询条件创建默认参数
141
+ * @param {} dataSource
142
+ * @returns
143
+ */
144
+ initQueryParams(dataSource) {
145
+ let param = {}
146
+ for (let i in this.formKeyInfo) {
147
+ if (getVarType(this.formKeyInfo[i]) === 'string') {
148
+ this.formKeyInfo[i] = this.formKeyInfo[i].trimEnd().trimStart()
149
+ }
150
+ }
151
+ param = Object.assign({}, underlineToHumpJson(this.formKeyInfo))
152
+ param.key = Object.assign({}, this.formKeyInfo)
153
+ /**
154
+ * 判断key里面的属性在是否在查询项,不在查询项属性一律不要
155
+ */
156
+ let keys = param.key;
157
+ for (let i in keys) {
158
+ let control = this.controlInfos.find(control => control.controlName === i)
159
+ const isQuery = control ? control.isQuery : false;
160
+ if (!isQuery) {
161
+ delete keys[i]
162
+ }
163
+ }
164
+ param.key = keys
165
+ param.dataSourceName = dataSource.dataSourceName
166
+ param.page = {
167
+ current: this.pagination.current,
168
+ size: this.pagination.pageSize
169
+ }
170
+ param.viewId = this.viewId
171
+ param.easyFormId = this.easyFormId
172
+ param.sqlId = this.sqlId
173
+ param.sqlIdAddWhere = this.sqlIdAddWhere
174
+ //转换数据库存id的字段为{label:'',value:''}格式
175
+ param.convertToTag = true
176
+ return param
177
+ },
178
+ /**
179
+ * 添加级连参数的查询条件
180
+ * @private
181
+ * @param {*} control
182
+ * @param isMultiple
183
+ * @param {*} controlValue
184
+ * @returns 查询参数是级连下拉、下拉列表
185
+ */
186
+ addWhereCascader(control, isMultiple, controlValue) {
187
+ let where = {
188
+ fieldName: control.controlName
189
+ }
190
+ let isCascader = control.controlType === 'cascader'
191
+ if (isMultiple && getVarType(controlValue) === 'array' && controlValue.length > 1) {
192
+ this.$message.warning(`[${control.label}]只支持勾选一个作为查询条件,当前查询忽略该条件`);
193
+ return false
194
+ } else if (isMultiple && getVarType(controlValue) === 'array' && controlValue.length === 0) {
195
+ return false
196
+ }
197
+
198
+
199
+ let operator = isMultiple ? 'like' : '='
200
+ let fieldValue = isMultiple && controlValue.length === 1 ? controlValue[0] : controlValue
201
+ where.fieldValue = isCascader ? fieldValue.join("~") : fieldValue
202
+ where.operator = operator
203
+ return where
204
+ },
205
+ /**
206
+ * 日期查询条件
207
+ * @private
208
+ * @param control
209
+ * @param controlValue
210
+ * @returns {{sql: string}|{fieldName: ([]|*), fieldValue, operator: string}|boolean}
211
+ */
212
+ addWhereDatePicker(control, controlValue) {
213
+ if (getVarType(controlValue) == 'string') {
214
+ return {
215
+ fieldName: control.controlName,
216
+ fieldValue: controlValue,
217
+ operator: 'like'
218
+ }
219
+ } else if (getVarType(controlValue) == 'array' && controlValue.length == 2) {
220
+ return {
221
+ sql: control.controlName + ' between "' + controlValue[0] + '" and "' + controlValue[1] + '"'
222
+ }
223
+ }
224
+ return false;
225
+ },
226
+ /**
227
+ * @private
228
+ * 其他查询条件
229
+ * @param control
230
+ * @param controlProp
231
+ * @param controlValue
232
+ * @returns {{fieldName: ([]|*)}}
233
+ */
234
+ addWhereOther(control, controlProp, controlValue) {
235
+ let where = {
236
+ fieldName: control.controlName,
237
+ }
238
+ if (typeof controlValue == 'object' && Array.isArray(controlValue)) {
239
+ //当参数是数组时
240
+ let formKey = []
241
+ controlValue.forEach(key => {
242
+ if (typeof key == 'object') {
243
+ formKey.push(key.key ? key.key : key.value)
244
+ } else {
245
+ formKey.push(key)
246
+ }
247
+ })
248
+ if (formKey.length > 0) {
249
+ where.fieldValue = formKey
250
+ where.operator = 'in'
251
+ }
252
+ } else {
253
+ where.fieldValue = controlValue
254
+ where.operator = control.isAccurateQuery ? '=' : 'like'
255
+ }
256
+
257
+ return where
258
+ },
259
+ /**
260
+ * 编辑数据
261
+ * @param {*} row 一行数据
262
+ * @param {*} index 行索引
263
+ * @param {*} viewId 自定义viewId
264
+ */
265
+ handlerEdit(row, index, viewId) {
266
+ let fd = row
267
+ if (this.formData && Object.keys(this.formData).length > 0) {
268
+ fd = JSON.parse(JSON.stringify(row))
269
+ let {keyInfo, keyInfoObject} = fd
270
+ Object.assign(keyInfo, this.formData.key ? this.formData.key : this.formData)
271
+ Object.assign(keyInfoObject, this.formData.key ? this.formData.key : this.formData)
272
+ }
273
+ this.$refs.BasicModal.showModal({
274
+ formData: fd,
275
+ isDescribe: false,
276
+ submitUrl: this.httpUrl.updateUrl,
277
+ title: '更新-' + this.dataSource.remark,
278
+ useControlConfig: !viewId,
279
+ viewId: viewId
280
+ })
281
+ },
282
+ /**
283
+ * 查看数据
284
+ * @param {*} row 一行数据
285
+ * @param {*} index 行索引
286
+ */
287
+ handlerDetail(row, index) {
288
+ this.$refs.BasicModal.showModal({
289
+ formData: row,
290
+ isDescribe: true,
291
+ title: '查看-' + this.dataSource.remark,
292
+ })
293
+ },
294
+ /**
295
+ * 删除数据
296
+ * @param {*} id 行ID
297
+ */
298
+ async handlerDelete(id) {
299
+ if (id) {
300
+ const params = {
301
+ id,
302
+ dataSourceName: this.dataSource.dataSourceName
303
+ }
304
+ const res = await postAction(this.httpUrl.deleteUrl, params);
305
+ if (res.success) {
306
+ this.$message.success(res.msg)
307
+ await this.loadTableData(this.pagination.current)
308
+ } else {
309
+ this.$message.error(res.msg)
310
+ }
311
+ }
312
+ },
313
+ }
314
+ }
@@ -0,0 +1,233 @@
1
+ <template>
2
+ <div>
3
+ <slot name="header">
4
+ <el-button v-if="moduleProp?.showAddBtn" class="btn" plain type="primary" @click="handlerAdd">新增</el-button>
5
+ </slot>
6
+
7
+ <ed-table :columns="columns" :data="tableData" :loading="initLoading" :pagination="false" v-bind="tableProps">
8
+ <!-- 表格列插槽 -->
9
+ <template v-for="name in slotNames" v-slot:[name]="scope">
10
+ <slot :name="name" v-bind="scope"></slot>
11
+ </template>
12
+
13
+
14
+ <template v-if="moduleProp?.showAction" v-slot:operate="{row, $index}">
15
+ <slot name="operate" v-bind="{row, $index}">
16
+ <el-button size="mini" type="text" @click="handlerEdit(row, $index)">编辑</el-button>
17
+ <el-divider direction='vertical'></el-divider>
18
+ <el-popconfirm title="确定删除数据吗?" @confirm="handlerDelete(row, $index)">
19
+ <el-button slot="reference" size="mini" style="color: red" type="text">删除</el-button>
20
+ </el-popconfirm>
21
+ </slot>
22
+ </template>
23
+ </ed-table>
24
+
25
+ <!-- 编辑 -->
26
+ <ed-drawer ref="elsDrawer" :title="drawerTit" :visible="visible" @close="handlerClose" @ok="handlerOk">
27
+ <easy-data-form ref="easyDataForm" :control-config="edFormConfig" :form-data="edFormData"></easy-data-form>
28
+ </ed-drawer>
29
+ </div>
30
+ </template>
31
+
32
+ <script>
33
+ import EasyDataMixins from '../mixins/EasyDataMixins'
34
+ import {getPath, getVarType} from "../../utils/utils";
35
+ import {setFormData, setTableData} from "../../utils/useBusiness";
36
+ import {TempType} from "../../api/easyData";
37
+
38
+ /**
39
+ * EasyDataTable组件
40
+ * - 示例
41
+ *
42
+ * ```vue
43
+ * <easy-data-table ref="EasyDataTable" :columnType="columnType" :dataSourceName="dataSourceName" :viewId="viewId">
44
+ * </easy-data-table>
45
+ * ```
46
+ * 详细用法参考下方链接
47
+ *
48
+ * [EasyDataTable组件使用示例](./web-comp/ExampleEasyDataTableCode.md)
49
+ *
50
+ * 混入属性参考
51
+ *
52
+ * [EasyDataMixins](./EasyDataMixins.md)
53
+ */
54
+ export default {
55
+ name: "EasyDataTable",
56
+ mixins: [EasyDataMixins],
57
+ data() {
58
+ return {
59
+ tableData: [],
60
+ columns: [],
61
+ visible: false,
62
+ drawerTit: '',
63
+ cacheIndex: null,
64
+ edFormData: {},
65
+ edFormConfig: {},
66
+ // 插槽名
67
+ slotNames: []
68
+ }
69
+ },
70
+ props: {
71
+ /**
72
+ * Table 表格props(参考[EdTable](web-comp/new/Table.md?id=dtable-props)组件)
73
+ * @default {}
74
+ */
75
+ tableProps: {
76
+ type: Object,
77
+ default: () => {
78
+ }
79
+ },
80
+
81
+ // 数据源配置信息
82
+ controlConfig: {
83
+ type: Object,
84
+ default: () => {
85
+ }
86
+ }
87
+ },
88
+ watch: {
89
+ controlConfig: {
90
+ handler(newVal, oldVal) {
91
+ if (newVal && Object.keys(newVal).length > 0) {
92
+ this.initColumns(newVal)
93
+ }
94
+ },
95
+ deep: true,
96
+ immediate: true
97
+ },
98
+ dataSourceName: {
99
+ handler(nVal, oVal) {
100
+ if (nVal && nVal !== oVal && (!this.controlConfig || Object.keys(this.controlConfig).length === 0)) {
101
+ this.initControls().then(config => {
102
+ this.initColumns(config)
103
+ })
104
+ }
105
+ },
106
+ deep: true,
107
+ immediate: true
108
+ },
109
+
110
+ formData: {
111
+ deep: true,
112
+ immediate: true,
113
+ handler(newVal, oldVal) {
114
+ if (newVal && this.controlInfos) {
115
+ let data = []
116
+ if (!this.hasObject(newVal, 'data') && getVarType(newVal) === 'array' && newVal.length > 0) {
117
+ newVal.map(i => {
118
+ data.push({
119
+ id: i.keyInfoView.id,
120
+ keyInfo: i.keyInfo,
121
+ keyInfoView: i.keyInfoView,
122
+ keyInfoObject: i.keyInfoObject
123
+ })
124
+ })
125
+ }
126
+ if (this.hasObject(newVal, 'data') && getVarType(newVal.data) === 'array') {
127
+ newVal.data.map(i => {
128
+ data.push({
129
+ id: i.keyInfo.id,
130
+ keyInfo: i.keyInfo,
131
+ keyInfoView: i.keyInfo,
132
+ keyInfoObject: i.keyInfo
133
+ })
134
+ })
135
+ }
136
+ this.tableData = setFormData(data, this.controlInfos, this)
137
+ }
138
+ }
139
+ }
140
+ },
141
+ methods: {
142
+ // 初始化
143
+ initColumns(config) {
144
+ const {controlInfos, controlProps, dataSource} = config
145
+ // 解除js对象指向同一内存地址 JSON.parse(JSON.stringify(Object | Array))
146
+ this.controlInfos = JSON.parse(JSON.stringify(controlInfos))
147
+ this.controlProps = JSON.parse(JSON.stringify(controlProps))
148
+ this.dataSource = JSON.parse(JSON.stringify(dataSource))
149
+ this.edFormConfig = JSON.parse(JSON.stringify(config))
150
+ this.columns = this.columns.length === 0 ? this.getColumns(controlInfos, controlProps) : this.columns
151
+ this.getSlotNames(this.columns)
152
+ },
153
+
154
+ // 插槽项
155
+ getSlotNames(columns) {
156
+ columns.map(column => {
157
+ this.slotNames.push(getPath(column.prop) + 'Column')
158
+ })
159
+ },
160
+
161
+ // 编辑
162
+ handlerEdit(row, index) {
163
+ this.visible = true
164
+ this.drawerTit = '编辑'
165
+ this.cacheIndex = index
166
+ this.edFormData = row
167
+ },
168
+
169
+ // 删除
170
+ handlerDelete(row, index) {
171
+ this.tableData.splice(index, 1)
172
+ },
173
+
174
+ // 新增
175
+ handlerAdd() {
176
+ this.visible = true
177
+ this.drawerTit = '新增'
178
+ this.cacheIndex = null
179
+ this.edFormData = {}
180
+ setTimeout(() => {
181
+ this.$refs.easyDataForm.resetFields()
182
+ }, 100)
183
+ },
184
+
185
+ // 确认弹窗
186
+ async handlerOk() {
187
+ const data = await this.$refs.easyDataForm.getFormData(true, true)
188
+ if (data) {
189
+ data.keyInfoView = Object.assign(data.key, this.bizParams)
190
+ if (this.cacheIndex != null) {
191
+ this.tableData.splice(this.cacheIndex, 1, data)
192
+ } else {
193
+ this.tableData.push(data)
194
+ }
195
+ this.tableData = setFormData(this.tableData, this.controlInfos, this)
196
+ this.handlerClose()
197
+ }
198
+ },
199
+
200
+ // 关闭弹窗
201
+ handlerClose() {
202
+ this.visible = false
203
+ },
204
+ /**
205
+ * 获取表单数据
206
+ * @param isValidate
207
+ * @returns {Promise<unknown>}
208
+ */
209
+ getFormData() {
210
+ return new Promise((resolve) => {
211
+ resolve(Object.assign({}, {
212
+ dataSourceName: this.dataSourceName,
213
+ data: setTableData(this.tableData)
214
+ }))
215
+ })
216
+ },
217
+ /**
218
+ * @name getType
219
+ * @returns {string}
220
+ * @description 设置当前模版类型
221
+ */
222
+ getType() {
223
+ return this.moduleProp?.showAddBtn || this.moduleProp?.showAction ? TempType.save : TempType.view
224
+ },
225
+ }
226
+ }
227
+ </script>
228
+
229
+ <style scoped>
230
+ .btn {
231
+ margin-bottom: 10px;
232
+ }
233
+ </style>