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,282 @@
1
+ <template>
2
+ <component class="es-box-card ed-table-editor-card" :is="tempName" :title="title" :shadow="shadow" :body-style="bodyStyle" :is-title="isTitle">
3
+ <template #operate>
4
+ <slot name="extra">
5
+ <el-button v-if="isAdd" icon="el-icon-plus" size="small" type="text" @click="handleAdd">新增</el-button>
6
+ </slot>
7
+ </template>
8
+
9
+ <el-form ref="ElForm" :model="form" :rules="rules">
10
+ <el-table ref="ElTable" :data="form.data" v-bind="_bindTableAttrs()" v-on="tableOn" v-loading="loading">
11
+ <!-- 是否显示拖拽-->
12
+ <el-table-column v-if="isDrag" align="center" class-name="ed-drag--cursor_move" width="40px">
13
+ <i class="el-icon-rank"></i>
14
+ </el-table-column>
15
+
16
+ <!-- element-ui table-column组件 -->
17
+ <template v-for="(col, index) in columns">
18
+ <el-table-column :key="index" v-bind="col">
19
+ <!-- table-column 作用域插槽; type 为 index / selection 时直接显示序号 -->
20
+ <template v-if="!col.type || !['selection', 'index'].includes(col.type)" v-slot:default="scope">
21
+ <!-- 对外暴露的作用域插槽 -->
22
+ <slot :data="form.data[scope.$index]" :name="col.prop" v-bind="scope">
23
+ <!-- 判断是否定义了children 属性 -->
24
+ <template v-if="col.children">
25
+ <!-- children 为字符串类型, 直接渲染 span 标签 -->
26
+ <span v-if="typeof col.children === 'string'">{{ col.children }}</span>
27
+
28
+ <!-- children 为其它类型, 则按照动态组件渲染 -->
29
+ <el-form-item :prop="`data.${scope.$index}.${col.prop}`" :rules="rules[col.prop]">
30
+ <!-- 组件 -->
31
+ <component :is="col.children.tags"
32
+ v-model="scope.row[col.children.valueKey || col.prop]"
33
+ :class="col.children.class"
34
+ :style="col.children.style"
35
+ v-bind="getAttrs(scope, col.children)"
36
+ @change="emitChange(col, $event, scope.row, scope.$index)"
37
+ @input="handleChange(col.children.valueKey || col.prop, scope.$index, $event)">
38
+ <template v-if="col.children.options">
39
+ <ed-option-slot
40
+ v-for="(option, index) of col.children.options"
41
+ :key="index"
42
+ :data="option"
43
+ :optionAttrs="option.attrs"
44
+ :tags="col.children.tags"
45
+ ></ed-option-slot>
46
+ </template>
47
+ </component>
48
+ </el-form-item>
49
+ </template>
50
+
51
+ <!-- 没有定义children则这显示对应的文本值 -->
52
+ <template v-else>{{ col.prop && getContentText(scope, col) }}</template>
53
+ </slot>
54
+ </template>
55
+ </el-table-column>
56
+
57
+ <!-- type 为 index / selection -->
58
+ <!-- <el-table-column v-if="col.type && ['selection', 'type'].includes(col.type)" :key="index"
59
+ v-bind="col"></el-table-column> -->
60
+ </template>
61
+ <!-- 操作 -->
62
+ <el-table-column v-if="isOperate" v-bind="operateProps">
63
+ <template v-slot:default="scope">
64
+ <slot name="operate" v-bind="{ self, scope, ...scope }">
65
+ <el-button type="text" @click="handleDelete(scope.$index)">删除</el-button>
66
+ </slot>
67
+ </template>
68
+ </el-table-column>
69
+ </el-table>
70
+ </el-form>
71
+ </component>
72
+ </template>
73
+
74
+ <script>
75
+ import props, {TableProps} from './Props'
76
+ import validate from "./hooks/validate";
77
+ import {getVarType} from "../../../tools/utils";
78
+ import Sortable from '../../../plugin/sortable';
79
+
80
+ export default {
81
+ name: "EdTableEditor",
82
+ props: props,
83
+ mixins: [validate],
84
+ data() {
85
+ return {
86
+ self: this,
87
+ // 表单数据对象
88
+ form: {
89
+ data: []
90
+ },
91
+ bodyStyle:{
92
+ padding: '5px'
93
+ },
94
+ }
95
+ },
96
+ model: {
97
+ prop: 'value',
98
+ event: 'change'
99
+ },
100
+ watch: {
101
+ value: {
102
+ handler(newVal, oldVal) {
103
+ if (newVal) {
104
+ this._setTableData(JSON.parse(JSON.stringify(newVal)))
105
+ }
106
+ },
107
+ deep: true,
108
+ immediate: true
109
+ }
110
+ },
111
+ computed:{
112
+ tempName(){
113
+ return this.isCard ? "ed-card" : "div"
114
+ },
115
+ isOperate(){
116
+ if(getVarType(this.operate) === 'boolean') {
117
+ return this.operate
118
+ }
119
+ else if(getVarType(this.operate) === 'object'){
120
+ return Object.keys(this.operate).length > 0
121
+ }
122
+ return false
123
+ },
124
+ operateProps(){
125
+ let defProp = {
126
+ align:"center",
127
+ fixed:"right",
128
+ headerAlign:"center",
129
+ label:"操作",
130
+ minWidth: '140px'
131
+ }
132
+ if(getVarType(this.operate) === 'object') {
133
+ return Object.assign(defProp, this.operate)
134
+ }
135
+ else {
136
+ return defProp
137
+ }
138
+ }
139
+ },
140
+ mounted() {
141
+ this._rowDrop()
142
+ },
143
+ methods: {
144
+ _bindTableAttrs() {
145
+ const props = Object.assign({}, this.$attrs, this.$props);
146
+ Object.keys(props).map(prop => {
147
+ if (!Object.prototype.hasOwnProperty.call(TableProps, prop)) {
148
+ delete props[prop]
149
+ }
150
+ })
151
+ return props
152
+ },
153
+
154
+ // 处理checkbox,radio的值
155
+ _setTableData(newVal) {
156
+ newVal.map((item, index) => {
157
+ this.columns.map((col, i) => {
158
+ if (col.children && col.children.tags === 'el-radio-group' && getVarType(item[col.prop]) === 'object') {
159
+ item[col.prop] = item[col.prop].value
160
+ } else if (col.children && col.children.tags === 'el-checkbox-group' && getVarType(item[col.prop]) === 'object') {
161
+ let data = []
162
+ item[col.prop].map(i => data.push(i.value))
163
+ item[col.prop] = data
164
+ }
165
+ })
166
+ })
167
+ this.$set(this.form, 'data', newVal)
168
+ },
169
+
170
+ // 行拖拽
171
+ _rowDrop() {
172
+ const tbody = this.$refs.ElTable.$el.querySelectorAll(".el-table__body-wrapper > table > tbody")[0];
173
+ let _this = this
174
+ Sortable.create(tbody, {
175
+ disabled: !this.isDrag, // 是否开启拖拽
176
+ ghostClass: 'sortable-ghost', //拖拽样式
177
+ group: {
178
+ name: 'words',
179
+ pull: true,
180
+ put: true
181
+ },
182
+ animation: 150, // ms, number 单位:ms,定义排序动画的时间
183
+ onEnd({newIndex, oldIndex}) { // 结束拖拽
184
+ let currRow = _this.form.data.splice(oldIndex, 1)[0]
185
+ _this.form.data.splice(newIndex, 0, currRow)
186
+ _this.emitChange()
187
+ }
188
+ })
189
+ },
190
+
191
+ // 获取数据
192
+ getData() {
193
+ return this.form.data
194
+ },
195
+
196
+ /**
197
+ * @name validate
198
+ * @return {Promise<unknown>}
199
+ * @description 数据校验
200
+ */
201
+ validate(callback) {
202
+ return this.$refs.ElForm.validate(callback)
203
+ },
204
+
205
+ /**
206
+ * 调用父组件的 change 函数
207
+ */
208
+ emitChange(col, val, row, index) {
209
+ if (col && col.change) {
210
+ col.change(col, val, row, index)
211
+ }
212
+ this.$emit('change', this.form.data)
213
+ this.$emit("valueChange", {col: col, val: val, row: row, index: index});
214
+ },
215
+
216
+ // 值变化
217
+ handleChange(prop, index, value) {
218
+ this.validateOneValue(prop, index, value)
219
+ },
220
+
221
+ // 新增
222
+ handleAdd() {
223
+ let data = {}
224
+ this.columns.filter(i=> !Object.prototype.hasOwnProperty.call(i, 'type')).map(col => {
225
+ if (col.children?.tags === 'el-checkbox-group') {
226
+ data[col.prop] = []
227
+ } else if (col.children?.tags === 'el-switch') {
228
+ data[col.prop] = false
229
+ } else {
230
+ data[col.prop] = ""
231
+ }
232
+ })
233
+ this.form.data.push(data)
234
+ this.emitChange()
235
+ },
236
+
237
+ // 删除
238
+ handleDelete(index) {
239
+ this.form.data.splice(index, 1)
240
+ this.$emit('change', this.form.data)
241
+ },
242
+
243
+ // 获取属性 (为了将disabled统一设置)
244
+ getAttrs(scope, item) {
245
+ const attrs = typeof item.attrs === 'function' ? item.attrs(scope, this.value) : item.attrs
246
+ return Object.assign({}, {disabled: this.disabled}, attrs)
247
+ },
248
+
249
+ // 获取文本内容
250
+ getContentText(scope, item) {
251
+ let text = scope.row[item.prop]
252
+ // 通过options获取枚举值
253
+ if (item.options && item.options[text]) {
254
+ text = item.options[text]
255
+ }
256
+ // 通过 formatter 获取格式化的值
257
+ if (item.formatter) {
258
+ text = item.formatter(scope.row, scope.column)
259
+ }
260
+ return text
261
+ }
262
+ }
263
+ }
264
+ </script>
265
+
266
+ <style lang="scss" scoped>
267
+ @import "../../../style/index";
268
+
269
+ ::v-deep {
270
+ .el-table .cell {
271
+ overflow: visible;
272
+ }
273
+
274
+ .el-form-item {
275
+ margin-bottom: 0;
276
+ }
277
+
278
+ .el-icon-s-operation {
279
+ font-size: 20px;
280
+ }
281
+ }
282
+ </style>
@@ -0,0 +1,107 @@
1
+ /**
2
+ * EdTable通用属性
3
+ */
4
+ export const TableProps = {
5
+ // table 数据数组
6
+ data: {type: Array, default: () => []},
7
+ // 列的宽度是否自撑开
8
+ fit: {type: Boolean, default: true},
9
+ // table 高度
10
+ height: {type: [String, Number]},
11
+ // 是否带有纵向边框
12
+ border: {type: Boolean, default: true},
13
+ // Table 的尺寸 medium / small / mini
14
+ size: {type: String},
15
+ // 是否要高亮当前行
16
+ highlightCurrentRow: {type: Boolean, default: true},
17
+ // 是否为斑马纹 table
18
+ stripe: {type: Boolean, default: false},
19
+ // Table 的最大高度。合法的值为数字或者单位为 px 的高度。
20
+ maxHeight: {type: [String, Number]},
21
+ // 是否显示表头
22
+ showHeader: {type: Boolean, default: true},
23
+ // 当前行的 key,只写属性
24
+ currentRowKey: {type: [String, Number]},
25
+ // 行的 className 的回调方法,也可以使用字符串为所有行设置一个固定的 className。
26
+ rowClassName: { type: Function },
27
+ // 行的 style 的回调方法,也可以使用一个固定的 Object 为所有行设置一样的 Style。
28
+ rowStyle: { type: [Function, Object] },
29
+ // 单元格的 className 的回调方法,也可以使用字符串为所有单元格设置一个固定的 className。
30
+ cellClassName: { type: [Function, String] },
31
+ // 单元格的 style 的回调方法,也可以使用一个固定的 Object 为所有单元格设置一样的 Style。
32
+ cellStyle: { type: [Function, Object] },
33
+ // 表头行的 className 的回调方法,也可以使用字符串为所有表头行设置一个固定的 className。
34
+ headerRowClassName: { type: [Function, String] },
35
+ // 表头行的 style 的回调方法,也可以使用一个固定的 Object 为所有表头行设置一样的 Style。
36
+ headerRowStyle: {type: [Function, Object]},
37
+ // 表头单元格的 className 的回调方法,也可以使用字符串为所有表头单元格设置一个固定的 className。
38
+ headerCellClassName: {type: [Function, String]},
39
+ // 表头单元格的 style 的回调方法,也可以使用一个固定的 Object 为所有表头单元格设置一样的 Style。
40
+ headerCellStyle: {type: [Function, Object]},
41
+ // 行数据的 Key,用来优化 Table 的渲染;在使用 reserve-selection 功能与显示树形数据时,该属性是必填的。
42
+ rowKey: {type: [Function, String]},
43
+ // 空数据时显示的文本内容,也可以通过 slot="empty" 设置
44
+ emptyText: {type: String},
45
+ // 是否默认展开所有行,当 Table 包含展开行存在或者为树形表格时有效
46
+ defaultExpandAll: {type: Boolean, default: false},
47
+ // 可以通过该属性设置 Table 目前的展开行,需要设置 row-key 属性才能使用,该属性为展开行的 keys 数组。
48
+ expandRowKeys: { type: Array },
49
+ // 默认的排序列的 prop 和顺序。它的prop属性指定默认的排序的列,order指定默认排序的顺序
50
+ defaultSort: { type: Object },
51
+ // tooltip effect 属性 | dark/light
52
+ tooltipEffect: { type: String },
53
+ // 是否在表尾显示合计行
54
+ showSummary: {type: Boolean, default: false},
55
+ // 合计行第一列的文本
56
+ sumText: {type: String},
57
+ // 自定义的合计计算方法
58
+ summaryMethod: { type: Function },
59
+ // 合并行或列的计算方法
60
+ spanMethod: { type: Function },
61
+ // 在多选表格中,当仅有部分行被选中时,点击表头的多选框时的行为。若为 true,则选中所有行;若为 false,则取消选择所有行
62
+ selectOnIndeterminate: {type: Boolean, default: true},
63
+ // 展示树形数据时,树节点的缩进
64
+ indent: {type: Number, default: 16},
65
+ // 是否懒加载子节点数据
66
+ lazy: {type: Boolean, default: true},
67
+ // 加载子节点数据的函数,lazy 为 true 时生效,函数第二个参数包含了节点的层级信息
68
+ load: { type: Function },
69
+ // 渲染嵌套数据的配置选项
70
+ treeProps: {type: Object}
71
+ }
72
+
73
+
74
+ /**
75
+ * EdTableEditor组件属性
76
+ */
77
+ export default {
78
+ // 表格的属性
79
+ ...TableProps,
80
+
81
+ // 名称
82
+ title: {type: String, default: ''},
83
+ // 是否显示名称
84
+ isTitle: {type: Boolean, default: true},
85
+ // 表格事件
86
+ tableOn: {type: Object},
87
+ // table 列
88
+ columns: {type: Array, default: () => []},
89
+ // 校检规则
90
+ rules: {type: Object, default: () => {return {}}},
91
+ // 表单数据
92
+ value: {type: Array, default: () => []},
93
+ // 禁用 (对所有form禁用))
94
+ disabled: {type: Boolean, default: false},
95
+ // 是否新增
96
+ isAdd: {type: Boolean, default: true},
97
+ // 是否拖拽排序
98
+ isDrag: {type: Boolean, default: false},
99
+ // 是否显示操作区域
100
+ operate: {type: [Boolean, Object], default: true},
101
+ // loading
102
+ loading: false,
103
+ //always / hover / never
104
+ shadow: {type: String, default: 'hover'},
105
+ // 是否启用卡片模式
106
+ isCard: {type: Boolean, default: true},
107
+ }
@@ -0,0 +1,90 @@
1
+ import Schema from 'async-validator'
2
+
3
+ export default {
4
+ data () {
5
+ return {
6
+ // 错误列表
7
+ errorList: {}
8
+ }
9
+ },
10
+ methods: {
11
+ // 数据校检 (对外暴露)
12
+ validate () {
13
+ // 没有数据 或者 没有校检, 则直接返回 resolve
14
+ if (!this.rules || !this.value.length) return Promise.resolve()
15
+
16
+ // 检测单个值, 用于界面提示
17
+ this.validateAllValue()
18
+
19
+ // 循环遍历每列数据, 进行校检
20
+ const validator = new Schema(this.rules)
21
+ const validators = this.value.map((item) => {
22
+ return new Promise((resolve, reject) => {
23
+ return validator.validate(item).then(resolve).catch(reject)
24
+ })
25
+ })
26
+ return Promise.all(validators)
27
+ },
28
+ // 检测每一个行的每个值的数据
29
+ validateAllValue () {
30
+ const ruleKeys = Object.keys(this.rules || {})
31
+ this.value.forEach((item, index) => {
32
+ ruleKeys.forEach(async (prop, i) => {
33
+ await this.validateOneValue(prop, index, item[prop])
34
+ })
35
+ })
36
+ },
37
+ // 检测单个数据
38
+ validateOneValue (prop, index, value) {
39
+ return new Promise(async (resolve) => {
40
+ try {
41
+ // 参数校检
42
+ await this.checkValue(prop, value)
43
+ this.handleCheckSuccess(prop, index)
44
+ resolve(true)
45
+ } catch (errors) {
46
+ // 处理错误
47
+ this.handleCheckError(prop, index, errors)
48
+ resolve(false)
49
+ }
50
+ })
51
+ },
52
+ // 数据校检
53
+ checkValue (prop, value) {
54
+ return new Promise((resolve, reject) => {
55
+ // 如果校检规则存在, 且当前字段的校检规则存在
56
+ if (this.rules && this.rules[prop]) {
57
+ const validator = new Schema({ [prop]: this.rules[prop] })
58
+ validator.validate({ [prop]: value }, (errors, fields) => {
59
+ if (errors) {
60
+ reject(errors, fields)
61
+ } else {
62
+ resolve()
63
+ }
64
+ })
65
+ } else {
66
+ resolve()
67
+ }
68
+ })
69
+ },
70
+ // 检查通过
71
+ // 重置 errorList 的值
72
+ handleCheckSuccess (prop, index) {
73
+ if (this.errorList[index] && this.errorList[index][prop]) {
74
+ this.errorList[index][prop] = null
75
+ }
76
+ },
77
+ // 处理错误, 将错误拼接字符串, 并保存在 errorList 中
78
+ handleCheckError (prop, index, errors) {
79
+ if (!this.errorList[index]) {
80
+ this.$set(this.errorList, index, {})
81
+ }
82
+ this.$set(this.errorList[index], prop, errors.map((item) => item.message).join(','))
83
+ },
84
+ // 判断是否出错
85
+ // 用于加 class 样式和 tooltip 的 disabled 属性
86
+ isError (index, valueKey, prop) {
87
+ return this.errorList && this.errorList[index] && this.errorList[index][prop]
88
+ }
89
+ }
90
+ }
@@ -0,0 +1,8 @@
1
+ import EdUpload from './src/index.vue'
2
+
3
+ /* istanbul ignore next */
4
+ EdUpload.install = function (Vue) {
5
+ Vue.component(EdUpload.name, EdUpload)
6
+ }
7
+
8
+ export default EdUpload
@@ -0,0 +1,90 @@
1
+ function noop() {
2
+ }
3
+
4
+ const ButtonAttrs = {
5
+ tags: "el-button",
6
+ text: "点击上传",
7
+ attrs:{
8
+ icon: "el-icon-upload",
9
+ size: "small",
10
+ type: "primary",
11
+ style:{
12
+ fontSize: "12px"
13
+ }
14
+ }
15
+ }
16
+
17
+ // 自定义属性
18
+ export const CustomProps = {
19
+ // 上传样式分类
20
+ model: {
21
+ type: [Object, String],
22
+ default: () => {
23
+ // return ButtonAttrs
24
+ return 'button'
25
+ }
26
+ },
27
+
28
+ // 提示说明文字
29
+ tipText:{
30
+ type: String,
31
+ default:""
32
+ }
33
+ }
34
+
35
+ // ElUpload 继承属性
36
+ export default {
37
+ ...CustomProps,
38
+ // 必选参数,上传的地址
39
+ action: {type: String, required: true},
40
+ // 设置上传的请求头部
41
+ headers: {type: Object, default() {return {};}},
42
+ // 是否支持多选文件
43
+ multiple: Boolean,
44
+ // 上传时附带的额外参数
45
+ data: Object,
46
+ // 上传的文件字段名
47
+ name: {type: String, default: 'file'},
48
+ // 是否启用拖拽上传
49
+ drag: Boolean,
50
+ // 支持发送 cookie 凭证信息
51
+ withCredentials: Boolean,
52
+ // 是否显示已上传文件列表
53
+ showFileList: {type: Boolean, default: true},
54
+ // 接受上传的文件类型(thumbnail-mode 模式下此参数无效)
55
+ accept: String,
56
+ // 上传文件之前的钩子,参数为上传的文件,若返回 false 或者返回 Promise 且被 reject,则停止上传。
57
+ beforeUpload: Function,
58
+ // 删除文件之前的钩子,参数为上传的文件和文件列表,若返回 false 或者返回 Promise 且被 reject,则停止删除。
59
+ beforeRemove: Function,
60
+ // 文件列表移除文件时的钩子
61
+ onRemove: {type: Function, default: noop},
62
+ // 文件状态改变时的钩子,添加文件、上传成功和上传失败时都会被调用
63
+ onChange: {type: Function, default: noop},
64
+ // 点击文件列表中已上传的文件时的钩子
65
+ onPreview: Function,
66
+ // 文件上传成功时的钩子
67
+ onSuccess: {type: Function, default: noop},
68
+ // 文件上传时的钩子
69
+ onProgress: {type: Function, default: noop},
70
+ // 文件上传失败时的钩子
71
+ onError: {type: Function, default: noop},
72
+ // 上传的文件列表, 例如: [{name: 'food.jpg', url: 'https://xxx.cdn.com/xxx.jpg'}]
73
+ fileList: {
74
+ type: Array, default() {
75
+ return []
76
+ }
77
+ },
78
+ // 是否在选取文件后立即进行上传
79
+ autoUpload: {type: Boolean, default: true},
80
+ // 文件列表的类型text,picture,picture-card
81
+ listType: {type: String},
82
+ // 覆盖默认的上传行为,可以自定义上传的实现
83
+ httpRequest: Function,
84
+ // 是否禁用
85
+ disabled: Boolean,
86
+ // 最大允许上传个数
87
+ limit: Number,
88
+ // 文件超出个数限制时的钩子
89
+ onExceed: {type: Function, default: noop}
90
+ }
@@ -0,0 +1,88 @@
1
+ <template>
2
+ <div v-loading="loading" class="ed-upload-warp">
3
+ <el-upload class="ed-upload" v-bind="uploadProps">
4
+ <!-- 上传组件--触发文件选择框的内容 -->
5
+ <template #trigger>
6
+ <slot name="trigger"></slot>
7
+ </template>
8
+
9
+ <slot name="upload">
10
+ <!-- 拖拽上传 -->
11
+ <div v-if="drag===true" class="ed-upload--content">
12
+ <i class="el-icon-upload"></i>
13
+ <div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div>
14
+ </div>
15
+
16
+ <!-- 上传组件样式 -->
17
+ <div v-else class="ed-upload--content">
18
+ <!-- 自定义组件 -->
19
+ <component :is="model.tags" v-if="modelType==='component'" v-bind="model.attrs">
20
+ {{ model.text }}
21
+ </component>
22
+
23
+ <!-- 按钮图标 -->
24
+ <el-button v-if="modelType==='button'" icon="el-icon-upload" size="small" type="primary"/>
25
+
26
+ <!-- 图片框: 仅listType==='picture-card' 时才能使用 -->
27
+ <i v-if="modelType==='image' && listType==='picture-card'" class="el-icon-plus"></i>
28
+ </div>
29
+ </slot>
30
+
31
+
32
+ <!-- 上传组件 -- 提示说明文字 -->
33
+ <template #tip>
34
+ <slot name="tip">
35
+ <div class="el-upload__tip">{{ tipText }}</div>
36
+ </slot>
37
+ </template>
38
+
39
+ <!-- 上传组件 -- 自定义文件列表展示样式 -->
40
+ <template v-slot:file="scope">
41
+ <slot name="file" v-bind="scope"></slot>
42
+ </template>
43
+ </el-upload>
44
+
45
+ <template v-if="!showFileList">
46
+ <slot name="fileList"></slot>
47
+ </template>
48
+ </div>
49
+ </template>
50
+
51
+ <script>
52
+ import Props, {CustomProps} from "./Props";
53
+ import {getVarType} from "../../../tools/utils";
54
+
55
+ export default {
56
+ name: "EdUpload",
57
+ props: Props,
58
+ data() {
59
+ return {
60
+ loading: false
61
+ }
62
+ },
63
+
64
+ computed: {
65
+ // 装载ElUpload属性
66
+ uploadProps() {
67
+ let props = Object.assign({}, this.$props);
68
+ for (const key in props) {
69
+ if (CustomProps[key]) delete props[key]
70
+ }
71
+ return props
72
+ },
73
+
74
+ // 上传组件样式
75
+ modelType() {
76
+ if (getVarType(this.model) === "object") {
77
+ return "component"
78
+ } else if (getVarType(this.model) === "string") {
79
+ return this.model
80
+ }
81
+ }
82
+ }
83
+ }
84
+ </script>
85
+
86
+ <style lang="scss" scoped>
87
+
88
+ </style>
@@ -0,0 +1,8 @@
1
+ import EdViewer from './src/EdViewer.vue';
2
+
3
+ /* istanbul ignore next */
4
+ EdViewer.install = function (Vue) {
5
+ Vue.component(EdViewer.name, EdViewer)
6
+ }
7
+
8
+ export default EdViewer;