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,348 @@
1
+ <template>
2
+ <el-skeleton :animated="true" :loading="initLoading" :rows="20" :style="showTableForm ? 'padding: 20px;' : 'padding: 0px 20px 20px 0px;'"
3
+ :throttle="500">
4
+ <!-- 查询表单区域 -->
5
+ <slot name="queryForm">
6
+ <easy-data-form v-if="showTableForm" ref="EasyDataForm" v-bind="bindFormProps()"
7
+ @keyup.enter.native="searchQuery">
8
+ <!-- 字段插槽 - 头部添加 -->
9
+ <template v-slot:formHeader="data">
10
+ <slot name="easyFormHeader" v-bind="data"></slot>
11
+ </template>
12
+
13
+ <!-- 字段插槽 - 重置 -->
14
+ <template v-for="name in FormSlotNames" v-slot:[name]="data">
15
+ <slot :name="name" v-bind="data"></slot>
16
+ </template>
17
+
18
+ <!-- 字段插槽 - 尾部添加 -->
19
+ <template v-slot:formFooter="data">
20
+ <slot name="easyFormFooter" v-bind="data"></slot>
21
+ </template>
22
+ </easy-data-form>
23
+ </slot>
24
+
25
+ <!-- 操作按钮区域 -->
26
+ <slot name="operate">
27
+ <ed-form-action v-if="showAction" v-model="actionStatus" :is-operate="isOperate" v-bind="actionProps"
28
+ @add="showEasyDataModal" @export="exportData" @query="searchQuery"
29
+ @reset="searchReset">
30
+ <!-- 按钮区域插槽 - 插入 -->
31
+ <template v-for="item in renderFormSlot()" #[item]="data">
32
+ <slot :name="item" v-bind="getFormActionSlot(data)"></slot>
33
+ </template>
34
+ </ed-form-action>
35
+ </slot>
36
+
37
+ <!-- table区域 -->
38
+ <ed-table ref="BasicTable" v-loading="tableLoading" :pagination.sync="showPagination ? pagination : undefined"
39
+ class="basicTable" v-bind="bindTableProps()"
40
+ @change="handleTableChange" @handleCurrentChange="handleCurrentChange" @selection-change="handleSelectionChange">
41
+ <!-- 索引列插槽 -->
42
+ <template v-slot:indexColumn>
43
+ <slot name="indexColumn"></slot>
44
+ </template>
45
+
46
+ <!-- 索引列内部插槽 -->
47
+ <template v-slot:customRow="scope">
48
+ <slot name="diyExpand" v-bind="{ self, scope, ...scope }">
49
+ <ed-json-viewer v-if="columnType==='expand'" :value="scope.row" copyable expanded></ed-json-viewer>
50
+ </slot>
51
+ </template>
52
+
53
+ <!-- 展示列插槽 -->
54
+ <template v-for="name in ColumnSlotNames" v-slot:[name]="scope">
55
+ <slot :name="name" v-bind="scope"></slot>
56
+ </template>
57
+
58
+ <!-- 操作列插槽 -->
59
+ <template v-slot:operate="scope">
60
+ <slot name="tableSlot" v-bind="{ self, scope, ...scope }">
61
+ <el-button size="mini" type="text" @click="handlerDetail(scope.row, scope.$index)">查看</el-button>
62
+ <el-divider direction='vertical'></el-divider>
63
+ <el-button size="mini" type="text" @click="handlerEdit(scope.row, scope.$index)">编辑</el-button>
64
+ <el-divider direction='vertical'></el-divider>
65
+ <el-popconfirm title="确定删除数据吗?" @confirm="handlerDelete(scope.row.id)">
66
+ <el-button slot="reference" size="mini" style="color: red" type="text">删除</el-button>
67
+ </el-popconfirm>
68
+ </slot>
69
+ </template>
70
+ </ed-table>
71
+ <BasicModal ref="BasicModal" :controlConfig="controlConfig" :dataSourceName="dataSourceName" :descColumns="columns"
72
+ :loading="modalLoading"
73
+ @ok="submitModalForm"></BasicModal>
74
+ </el-skeleton>
75
+ </template>
76
+
77
+ <script>
78
+ import useTable from './hooks/useTable'
79
+ import useForm from './hooks/useForm'
80
+ import useEmits from './hooks/useEmits'
81
+ import EasyDataMixins from '../mixins/EasyDataMixins'
82
+ import Props from './Props'
83
+ import BasicModal from './components/BasicModal'
84
+ import EdFormAction from './components/FormAction'
85
+ import {getVarType} from '../../utils/utils'
86
+ import {setFormData} from "../../utils/useBusiness";
87
+ import {formatDate} from "../../utils/dateUtils";
88
+ import {DefaultUrl} from "../../api/easyData";
89
+
90
+ /**
91
+ * EasyDataList组件
92
+ * - 示例
93
+ *
94
+ * ```vue
95
+ * <easy-data-list ref="EasyDataList" :columnType="columnType" :dataSourceName="dataSourceName" :diy-colums="diyColums"
96
+ * :form-props="formProps" model="list" @editColumns="editColumns">
97
+ * </easy-data-list>
98
+ * ```
99
+ * 详细用法参考下方链接
100
+ *
101
+ * [EasyDataList组件使用示例](./web-comp/ExampleEasyDataListCode.md)
102
+ *
103
+ * [](./EasyDataListProps.md ':include')
104
+ *
105
+ * ## Props
106
+ *
107
+ * | Name | Type | Description |
108
+ * | ------------------ | ----------------------- | --------------------- |
109
+ * | `data-source-name` | `String` | 数据源名称 |
110
+ * | `view-id` | `String` | 视图ID,用于显示不同视图 |
111
+ * | `biz-params` | `Object` | 业务请求参数,仅模板使用 |
112
+ * | `form-data` | `Array` &#124; `Object` | 表单数据默认值,新增接口提交数据会自动带上 |
113
+ * | `extra-params` | `Object` | 额外请求参数,仅模板使用 |
114
+ * | `pass-module-ids` | `Array` | 数据源传递 |
115
+ * | `module-prop` | `Object` | 模块属性 模块使用自定义属性 |
116
+ *
117
+ * ## Slots(插槽)
118
+ *
119
+ * | Name | Description |
120
+ * |------------------|---------------|
121
+ * | `tableSlot` | 列表右侧操作栏插槽 |
122
+ * | `extra` | 在列表上方按钮区域追加按钮 |
123
+ * | `resetBefore` | 重置按钮之前追加 |
124
+ * | `queryBefore` | 查询按钮之前追加 |
125
+ * | `exportBefore` | 导出按钮之前追加 |
126
+ * | `addBefore` | 新增按钮之前追加 |
127
+ * | `easyFormFooter` | 查询表单区域插槽 |
128
+ *
129
+ * [](./useTable.md ':include')
130
+ *
131
+ */
132
+ export default {
133
+ name: "EasyDataList",
134
+ components: {BasicModal, EdFormAction},
135
+ mixins: [useTable, useForm, useEmits, EasyDataMixins],
136
+ props: Props,
137
+ data() {
138
+ return {
139
+ self: this,
140
+ // 数据源配置属性
141
+ controlConfig: {},
142
+ // 表单属性对象
143
+ controlProp: {},
144
+ // 初始化loading
145
+ modalLoading: false,
146
+ // form插槽
147
+ FormSlotNames: [],
148
+ // 是否显示展开收起按钮
149
+ isOperate: false,
150
+ // 展开收起状态
151
+ actionStatus: "",
152
+ // table 插槽
153
+ ColumnSlotNames: [],
154
+ defaultHttpUrl: {
155
+ insertUrl: DefaultUrl.insertData, // 表单更新地址
156
+ updateUrl: DefaultUrl.updateData, // table 数据请求地址
157
+ pageUrl: DefaultUrl.page, //分页查询地址
158
+ deleteUrl: DefaultUrl.deleteData,
159
+ exportDataList: DefaultUrl.exportDataList
160
+ }
161
+ }
162
+ },
163
+ watch: {
164
+ dataSourceName: {
165
+ immediate: true,
166
+ async handler(newVal, oldVal) {
167
+ if (newVal && newVal !== oldVal) {
168
+ this.initLoading = true
169
+ this.initLoading = true
170
+ const {dataSource, controlProps, controlInfos} = await this.initControls()
171
+ this.initLoading = false
172
+ this.$set(this.controlConfig, 'dataSource', dataSource)
173
+ this.$set(this.controlConfig, 'controlProps', controlProps)
174
+ this.$set(this.controlConfig, 'controlInfos', controlInfos)
175
+
176
+ // 组装列数据
177
+ this.columns = this.columns.length === 0 ? this.getColumns(controlInfos, controlProps) : this.columns
178
+ this.initSlotNames()
179
+
180
+ //等待查询表单加载完成,并初始化默认数据后。
181
+ if (this.autoQuery) await this.searchQuery()
182
+
183
+ // 初始化按钮组状态
184
+ this.setFormActionProps()
185
+ }
186
+ }
187
+ },
188
+ actionStatus(newVal, oldVal) {
189
+ if (newVal) {
190
+ let formDom = this.$refs.EasyDataForm.$refs.EasyDataForm.$el
191
+ let height = formDom[0]?.offsetHeight + 18
192
+ this.formHeight = newVal === 'retract' && formDom[0] ? `${height}px` : 'auto';
193
+ }
194
+ },
195
+ formParams: {
196
+ deep: true,
197
+ immediate: true,
198
+ handler(newVal, oldVal) {
199
+ if (newVal) {
200
+ for (let key in newVal) {
201
+ this.formKeyInfo[key] = newVal[key]
202
+ }
203
+ }
204
+ }
205
+ },
206
+ formData: {
207
+ deep: true,
208
+ immediate: true,
209
+ handler(newVal, oldVal) {
210
+ if (newVal && getVarType(newVal) === 'array' && newVal.length > 0 && this.controlConfig) {
211
+ const {controlInfos} = this.controlConfig
212
+ this.tableData = setFormData(newVal, controlInfos, this)
213
+ }
214
+ }
215
+ },
216
+ httpUrl: {
217
+ deep: true,
218
+ immediate: true,
219
+ handler(newVal, oldVal) {
220
+ if (newVal && Object.keys(newVal).length < 5) {
221
+ this.$emit('update:httpUrl', Object.assign({}, this.defaultHttpUrl, newVal))
222
+ }
223
+ }
224
+ }
225
+ },
226
+ computed: {
227
+ // 是否显示表达操作按钮区域
228
+ showAction() {
229
+ return getVarType(this.actionProps) === 'boolean' ? this.actionProps : true;
230
+ }
231
+ },
232
+
233
+ methods: {
234
+ // 初始化插槽列表
235
+ initSlotNames() {
236
+ // form表单插槽项
237
+ this.controlInfos.map(control => {
238
+ this.FormSlotNames.push(control.controlName)
239
+ })
240
+
241
+ // table列插槽项
242
+ this.columns.map(column => {
243
+ let name = column.prop.includes('keyInfo') ? column.prop.split('.')[1] : column.prop
244
+ this.ColumnSlotNames.push(name + 'Column')
245
+ })
246
+ },
247
+
248
+ // 设置按钮组属性
249
+ setFormActionProps() {
250
+ let height = this.$refs.EasyDataForm.$refs.EasyDataForm.$el.offsetHeight
251
+ this.isOperate = this.bindFormProps().inline && height > 55
252
+ if (this.isOperate) {
253
+ this.actionStatus = height > 55 ? 'retract' : 'expand'
254
+ }
255
+ },
256
+
257
+ /**
258
+ * @private
259
+ * @param val
260
+ */
261
+ handleCurrentChange(val) {
262
+ /**
263
+ * @private
264
+ * @event handleCurrentChange
265
+ */
266
+ this.$emit('handleCurrentChange', val)
267
+ },
268
+
269
+ /**
270
+ * @private
271
+ * @param val
272
+ */
273
+ handleSelectionChange(val) {
274
+ this.$emit('selection-change', val)
275
+ },
276
+
277
+ /**
278
+ * @name submitModalForm
279
+ * @param params
280
+ * @param submitUrl
281
+ * @return {Promise<void>}
282
+ */
283
+ async submitModalForm(params, submitUrl) {
284
+ this.modalLoading = true
285
+ const res = await this.$EdFrame.postAction(submitUrl, params).finally(() => {
286
+ this.modalLoading = false
287
+ });
288
+ this.modalLoading = false
289
+ if (res.success) {
290
+ await this.loadTableData()
291
+ this.$refs.BasicModal.close()
292
+ this.$message.success(res.msg)
293
+ } else {
294
+ this.$message.error(res.msg)
295
+ }
296
+ },
297
+
298
+ /**
299
+ * @name showEasyDataModal
300
+ */
301
+ showEasyDataModal(viewId) {
302
+ this.$refs.BasicModal.showModal({
303
+ formData: this.formData,
304
+ isDescribe: false,
305
+ submitUrl: this.httpUrl.insertUrl,
306
+ title: '新增-' + this.dataSource.remark,
307
+ useControlConfig: !viewId,
308
+ viewId: viewId
309
+ })
310
+ },
311
+ /**
312
+ * 导出数据
313
+ */
314
+ exportData() {
315
+ this.$EdFrame.downFilePost(this.httpUrl.exportDataList, this.getQueryParams()).then((res) => {
316
+ const date = formatDate(new Date(), 'yyyy-MM-dd hh:mm:ss')
317
+ const fileName = this.dataSource.remark + date + '.xlsx'
318
+ let url = window.URL.createObjectURL(new Blob([res]));
319
+ let link = document.createElement('a');
320
+ link.style.display = 'none';
321
+ link.href = url;
322
+ link.setAttribute('download', fileName);
323
+ document.body.appendChild(link);
324
+ link.click();
325
+ //释放内存
326
+ window.URL.revokeObjectURL(link.href)
327
+ })
328
+ },
329
+ /**
330
+ * @name getFormActionSlot
331
+ * @return {{form: {}}}
332
+ * @description 按钮区slot传参
333
+ */
334
+ getFormActionSlot(data) {
335
+ return {
336
+ ...data,
337
+ form: this.$refs.EasyDataForm.formModel,
338
+ self: this.$refs.EasyDataForm.self
339
+ }
340
+ },
341
+ }
342
+ }
343
+
344
+ </script>
345
+
346
+ <style lang="scss" scoped>
347
+ @import "../../style/index.scss";
348
+ </style>
@@ -0,0 +1,116 @@
1
+ import {DefaultUrl} from "../../api/easyData";
2
+
3
+ /**
4
+ * EastDataList组件属性
5
+ */
6
+ export default {
7
+ /**
8
+ * 是否显示分页
9
+ */
10
+ showPagination: {type: Boolean, default: true},
11
+ showTableForm: {type: Boolean, default: true},
12
+ /**
13
+ * @private
14
+ * Form表单props数据(属性参考[EasyDataForm](web-comp/EasyDataForm.md?id=formactionprops)组件
15
+ */
16
+ formProps: {type: Object, default: () => {return {}}},
17
+ /**Table 表格props((属性参考[EasyDataForm](web-comp/EdTable.md)组件)
18
+ * - 示例 1
19
+ * :tableProps="{operateFixed: 'right'}" 配置table操作拦固定在右侧
20
+ */
21
+ tableProps: {type: Object},
22
+ // action 操作区域按钮属性(属性参考[EasyDataForm](web-comp/EasyDataForm.md?id=formactionprops)组件
23
+ actionProps: {type: [Object, Boolean], default: () => {}},
24
+ /**
25
+ * 数据查询条件组装对象,持对象和数据
26
+ * - 示例 1
27
+ * `queryParams:{id:'123'}`
28
+ * - 示例 2
29
+ * `queryParams:[{fieldName: 'id',fieldValue: '123',operator: 'like'}]`
30
+ * 示例 2 写法更强大,可以自定义逻辑.
31
+ * 示例 1 中的key必须时数据源中存在的字段,示例 2 可以是不存在的字段,sqlId可能用到, 这里需要开发者自己保证字段的正确性
32
+ */
33
+ queryParams: {type: [Array, Object],},
34
+ /**
35
+ * 新增数据时默认传递数据
36
+ * - 示例 1
37
+ * formData: {ms:'测试'}
38
+ * - 示例2
39
+ * formData: {key: {ms:'测试'}}
40
+ * @default {}
41
+ */
42
+ formData: {
43
+ type: [Array, Object], default: () => {
44
+ }
45
+ },
46
+
47
+ /**
48
+ * sqlId
49
+ * - 示例
50
+ * `SELECT a.* from demo a WHERE a.id ='${id}'`
51
+ * @default null
52
+ */
53
+
54
+ sqlId: {type: String, default: null},
55
+
56
+ /**
57
+ * 动态表单id
58
+ * @default ''
59
+ */
60
+ easyFormId: {type: String, default: ''},
61
+
62
+ /**
63
+ * 列表数据类型,expand则为可以展开表格
64
+ * @default ''
65
+ */
66
+ columnType: {type: String, default: ''},
67
+ /**
68
+ * 列表自定义传入列数据,前提是keyInfo里面存在的key
69
+ * - 示例
70
+ * `diyColums: [{ label: 'id',prop: 'id',}, {label: '名称',prop: 'name', }]`
71
+ * @default []
72
+ */
73
+ diyColums: {type: Array, default: () => []},
74
+
75
+ /**
76
+ * 是否自动查询
77
+ * @default true
78
+ */
79
+ autoQuery: {type: Boolean, default: true},
80
+ /**
81
+ * 排序规则
82
+ * - 示例
83
+ * `[{fieldName: 'create_time,id', order: 'DESC'},{fieldName: 'template_name', order: 'ASC' }]`
84
+ * @default [{ fieldName: 'create_time', order: 'DESC' }]
85
+ */
86
+ orderBy: {
87
+ type: Array, default: () => {
88
+ return [{
89
+ fieldName: 'create_time', order: 'DESC'
90
+ }]
91
+ }
92
+ },
93
+ /**
94
+ * sqlId情况下是否把查询条件拼接到sqlId中,默认开启
95
+ * @default true
96
+ */
97
+ sqlIdAddWhere: {
98
+ type: Boolean, default: true
99
+ },
100
+ /**
101
+ * 覆盖默认请求后端接口地址
102
+ * @default {insertUrl: '/api/easyData/insertData',updateUrl: '/api/easyData/updateData',pageUrl: '/api/easyData/page',deleteUrl: '/api/easyData/deleteData',exportDataList: '/api/easyData/exportDataList'}
103
+ */
104
+ httpUrl: {
105
+ type: Object, default: () => {
106
+ return {
107
+ // 表单保存地址
108
+ insertUrl: DefaultUrl.insertData, // 表单更新地址
109
+ updateUrl: DefaultUrl.updateData, // table 数据请求地址
110
+ pageUrl: DefaultUrl.page, //分页查询地址
111
+ deleteUrl: DefaultUrl.deleteData,
112
+ exportDataList: DefaultUrl.exportDataList
113
+ }
114
+ }
115
+ },
116
+ }
@@ -0,0 +1,150 @@
1
+ <template>
2
+ <component :is="componentName" ref="BasicModal" v-bind="bindModalProps()" @close="handleClose" @ok="handleOk">
3
+
4
+ <easy-data-view v-if="isDescribe" ref="BasicDescribe" :controlConfig="controlConfig" :formData="formData"></easy-data-view>
5
+ <easy-data-form v-else ref="EasyDataForm"
6
+ :controlConfig="useControlConfig ? controlConfig : {}"
7
+ :data-source-name="dataSourceName"
8
+ :formData="formData"
9
+ :isSearchForm="isSearchForm"
10
+ :view-id="viewId"
11
+ labelPosition="right"
12
+ labelWidth="140px"></easy-data-form>
13
+ </component>
14
+ </template>
15
+
16
+ <script>
17
+
18
+ export default {
19
+ name: "BasicModal",
20
+ props: {
21
+ // 弹窗类型 drawer
22
+ model: {
23
+ type: String,
24
+ default: 'drawer'
25
+ },
26
+
27
+ // loading
28
+ loading: {
29
+ type: Boolean,
30
+ default: false
31
+ },
32
+
33
+ // 数据源配置属性
34
+ controlConfig: {
35
+ type: Object,
36
+ default: () => {
37
+ }
38
+ },
39
+ //数据源
40
+ dataSourceName: {type: String, default: ""},
41
+
42
+ // 数据源配置属性
43
+ descColumns: {
44
+ type: Array,
45
+ default: () => {
46
+ }
47
+ },
48
+
49
+ // Drawer组件属性
50
+ drawerProps: {
51
+ type: Object,
52
+ default: () => {
53
+ }
54
+ },
55
+
56
+ // Dialog组件属性
57
+ dialogProps: {
58
+ type: Object,
59
+ default: () => {
60
+ }
61
+ },
62
+ },
63
+ components: {},
64
+ data() {
65
+ return {
66
+ title: '',
67
+ visible: false,
68
+ // 是否为展示弹窗
69
+ isDescribe: false,
70
+ //使用外部传入的ControlConfig
71
+ useControlConfig: true,
72
+ viewId: undefined,
73
+ formData: {},
74
+ isSearchForm: false,
75
+ }
76
+ },
77
+ computed: {
78
+ componentName() {
79
+ return this.model === 'drawer' ? 'ed-drawer' : 'ed-dialog'
80
+ },
81
+ },
82
+ watch: {
83
+ controlConfig: {
84
+ handler(nVal, oVal) {
85
+ },
86
+ deep: true,
87
+ immediate: true
88
+ },
89
+ },
90
+ mounted() {
91
+ // console.log(this.descColumns)
92
+ },
93
+ methods: {
94
+ /**
95
+ * @name showModal
96
+ * @description 显示弹窗
97
+ */
98
+ showModal(options) {
99
+ for (const Key in options) {
100
+ this[Key] = options[Key]
101
+ this.$set(this, Key, options[Key])
102
+ }
103
+
104
+ if (!options.title) {
105
+ this.title = this.controlConfig.dataSource?.remark
106
+ }
107
+
108
+ this.$nextTick(() => {
109
+ this.visible = true
110
+ })
111
+ },
112
+
113
+ async handleOk() {
114
+ if (this.loading) {
115
+ this.$message.warning("当前提交未完成,请等待")
116
+ return false
117
+ }
118
+ try {
119
+ const param = await this.$refs.EasyDataForm.getFormData(true);
120
+ this.$emit('ok', param, this.submitUrl)
121
+ } catch (e) {
122
+ console.log(e);
123
+ }
124
+ },
125
+
126
+ handleClose() {
127
+ this.$emit('close')
128
+ this.visible = false
129
+ },
130
+
131
+ close() {
132
+ this.visible = false
133
+ },
134
+
135
+ /**
136
+ * @name bindModalProps
137
+ * @returns {Object}
138
+ * @description 设置弹窗组件属性
139
+ */
140
+ bindModalProps() {
141
+ return {
142
+ title: this.title,
143
+ visible: this.visible,
144
+ loading: this.loading,
145
+ showOkBtn: !this.isDescribe
146
+ }
147
+ }
148
+ },
149
+ }
150
+ </script>
@@ -0,0 +1,63 @@
1
+ <template>
2
+ <div class="es-form--action">
3
+ <slot name="queryBefore"></slot>
4
+ <el-button v-if="showQueryBtn" icon="el-icon-search" v-bind="btnAttrs" @click="clickFunc('query')">查询</el-button>
5
+ <slot name="resetBefore"></slot>
6
+ <el-button v-if="showResetBtn" icon="el-icon-refresh" type="primary" v-bind="btnAttrs" @click="clickFunc('reset')">
7
+ 重置
8
+ </el-button>
9
+ <slot name="exportBefore"></slot>
10
+ <el-button v-if="showExportBtn" icon="el-icon-download" type="primary" v-bind="btnAttrs"
11
+ @click="clickFunc('export')">导出
12
+ </el-button>
13
+ <slot name="addBefore"></slot>
14
+ <el-button v-if="showAddBtn" icon="el-icon-plus" plain type="primary" v-bind="btnAttrs" @click="clickFunc('add')">
15
+ 新增
16
+ </el-button>
17
+ <slot name="extra"></slot>
18
+ <el-button v-show="isOperate" :size="btnAttrs.size" type="text" @click="toggleAdvanced">
19
+ {{ status === 'retract' ? "展开" : "收起" }}
20
+ <i :class="status ==='retract' ? 'el-icon-arrow-down ': 'el-icon-arrow-up'"></i>
21
+ </el-button>
22
+ </div>
23
+ </template>
24
+
25
+ <script>
26
+ export default {
27
+ name: "FormAction",
28
+ props: {
29
+ isOperate: {type: Boolean, default: false},
30
+ // 展开or收起 状态 expand | retract
31
+ status: {type: String},
32
+ // 按钮属性
33
+ btnAttrs: {
34
+ type: Object,
35
+ default: () => {
36
+ return {
37
+ size: "mini",
38
+ type: "primary"
39
+ }
40
+ }
41
+ },
42
+ showExportBtn: {type: Boolean, default: true},
43
+ showAddBtn: {type: Boolean, default: true},
44
+ showQueryBtn: {type: Boolean, default: true},
45
+ showResetBtn: {type: Boolean, default: true},
46
+ },
47
+ model: {
48
+ prop: 'status',
49
+ event: "input"
50
+ },
51
+ methods: {
52
+ clickFunc(e) {
53
+ setTimeout(() => {
54
+ const fun = Object.keys(this.$listeners).find(i => i === e);
55
+ this.$emit(fun)
56
+ }, 100)
57
+ },
58
+ toggleAdvanced() {
59
+ this.$emit('input', this.status === 'retract' ? 'expand' : 'retract')
60
+ }
61
+ }
62
+ }
63
+ </script>