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,48 @@
1
+ /**
2
+ * EdInputPop组件悬浮属性
3
+ */
4
+ export const PopverProps = {
5
+ // 触发方式 click/focus/hover/manual
6
+ trigger: {type: String, default: "manual"},
7
+ // 标题
8
+ title: {type: String, default: ""},
9
+ // 显示的内容,也可以通过 slot 传入 DOM
10
+ content: {type: String, default: ""},
11
+ // 宽度
12
+ width: {type: Number, default: 300},
13
+ // 出现位置 top/top-start/top-end/bottom/bottom-start/bottom-end/left/left-start/left-end/right/right-start/right-end
14
+ placement: {type: String, default: "left-start"},
15
+ // Popover 是否可用
16
+ disabled: {type: Boolean, default: false},
17
+ // 出现位置的偏移量
18
+ offset: {type: Number, default: 0},
19
+ // 定义渐变动画
20
+ transition: {type: String, default: 'fade-in-linear'},
21
+ // 是否显示 Tooltip 箭头,更多参数可见Vue-popper
22
+ visibleArrow: {type: Boolean, default: true},
23
+ // popper.js 的参数
24
+ popperOptions: {type: Object, default: () => {}},
25
+ // 为 popper 添加类名
26
+ popperClass: {type: String, default: ''},
27
+ // 触发方式为 hover 时的显示延迟,单位为毫秒
28
+ openDelay: {type: Number},
29
+ // 触发方式为 hover 时的隐藏延迟,单位为毫秒
30
+ closeDelay: {type: Number, default: 200},
31
+ // Popover 组件的 tabindex
32
+ tabindex: {type: Number, default: 0}
33
+ }
34
+
35
+
36
+ /**
37
+ * EdInputPop组件属性
38
+ */
39
+ export default {
40
+ // 值
41
+ value: {type: String, default: ""},
42
+ height: {type: Number, default: 200,},
43
+ placeholder: {type: String, default: ""},
44
+ // 尺寸 medium / small / mini
45
+ size: {type: String},
46
+
47
+ ...PopverProps
48
+ }
@@ -0,0 +1,8 @@
1
+ import EdInputTable from './src/EdInputTable.vue';
2
+
3
+ /* istanbul ignore next */
4
+ EdInputTable.install = function (Vue) {
5
+ Vue.component(EdInputTable.name, EdInputTable)
6
+ }
7
+
8
+ export default EdInputTable;
@@ -0,0 +1,368 @@
1
+ <template>
2
+ <div>
3
+ <el-input v-model="dataValue" :disabled="disabled" placeholder="请输入内容" readonly @focus="handlerFocus"/>
4
+ <ed-dialog ref="elsDialog" :height="height" :title="title" :visible="visible" :width="width" @close="handlerClose"
5
+ @ok="handlerOk">
6
+ <!-- 查询表单 -->
7
+ <ed-form ref="elsForm" v-model="model" :form-desc="formDesc">
8
+ <template v-for="item in formSlots" #[item]="data">
9
+ <slot :name="item" v-bind="data || {}"></slot>
10
+ </template>
11
+ <template v-slot:form-btn>
12
+ <el-button icon="el-icon-search" type="primary" @click="handlerSearch">搜索</el-button>
13
+ <el-button icon="el-icon-delete" @click="handlerClear">清空</el-button>
14
+ </template>
15
+ </ed-form>
16
+
17
+ <!-- 数据表格 -->
18
+ <ed-table ref="elsTable" :column-type="columnType" :columns="columns" :data="tables" :height="tableHeight"
19
+ :loading.sync="loading" :pagination.sync="paging ? pagination : undefined"
20
+ @change="initRequest" @row-click="handlerRowClick" @selection-change="handleSelectionChange">
21
+ <template v-for="item in tableSlots" #[item]="data">
22
+ <slot :name="item" v-bind="data || {}"></slot>
23
+ </template>
24
+ </ed-table>
25
+
26
+ </ed-dialog>
27
+ </div>
28
+ </template>
29
+
30
+ <script>
31
+ import Fetch from "./Fetch"
32
+ import {getVarType} from "../../../tools/utils";
33
+
34
+ /**
35
+ * 弹窗表格组件
36
+ * - 示例
37
+ *
38
+ * ```vue
39
+ * <ed-input-table v-model="value" :columns="columns" :data="data">
40
+ * </ed-input-table>
41
+ * ```
42
+ *
43
+ * [](./EdInputTableProps.md ':include')
44
+ */
45
+ export default {
46
+ name: "EdInputTable",
47
+ props: {
48
+ // 是否多选
49
+ multiple: {type: Boolean, default: false},
50
+ // 是否禁用
51
+ disabled: {type: Boolean, default: false},
52
+ // 值
53
+ value: {type: [String, Object, Array], default: () => []},
54
+ // 标题
55
+ title: {type: String, default: "表格选择器"},
56
+ // 表格列的配置描述
57
+ columns: {type: [Array, String]},
58
+ // table 数据数组
59
+ data: {type: Array, default: () => []},
60
+ // 输入框显示字段分隔符
61
+ split: {type: String, default: "-"},
62
+ // 弹窗宽度
63
+ width: {type: [String, Number]},
64
+ // 弹窗高度
65
+ height: {type: [String, Number]},
66
+ // 表格高度
67
+ tbHeight: {type: [String, Number]},
68
+ // 覆盖默认的上传行为,可以自定义上传的实现:仅支持Promise
69
+ httpRequest: {type: Function, default: Fetch},
70
+ // 是否分页查询
71
+ paging: {type: Boolean, default: false},
72
+ // 上传的地址
73
+ action: {type: String, default: ""},
74
+ // 设置查询的请求头部
75
+ headers: {type: [Object, String]},
76
+ // 查询时附带的额外参数
77
+ params: {type: [Object, String]},
78
+ // 查询成功时的钩子
79
+ onSuccess: {
80
+ type: Function,
81
+ default: function () {
82
+ }
83
+ },
84
+ // 查询失败时的钩子
85
+ onError: {
86
+ type: Function,
87
+ default: function () {
88
+ }
89
+ },
90
+ // 请求的类型;GET 或 POST
91
+ method: {type: String, default: "POST"},
92
+ },
93
+ data() {
94
+ return {
95
+ loading: true,
96
+ visible: false,
97
+ dataValue: "", // input值
98
+ currentRow: {},
99
+ formDesc: [],
100
+ model: {},
101
+ tables: this.data,
102
+ radioVal: "",
103
+ defHeaders: {
104
+ 'Content-Type': 'application/json;charset=utf-8'
105
+ },
106
+ // 输入框显示字段
107
+ rowKey: [],
108
+ pagination: {
109
+ current: 1,
110
+ pageSize: 10,
111
+ total: 0,
112
+ pageSizes: [10, 20, 30]
113
+ },
114
+ cardHeight: "300px"
115
+ }
116
+ },
117
+ computed: {
118
+ columnType() {
119
+ return this.multiple ? 'selection' : "radio"
120
+ },
121
+ isAjax() {
122
+ return this.action !== ""
123
+ },
124
+ tableSlots() {
125
+ let slots = []
126
+ this.columns.map(col => slots.push(col.prop + 'Column'))
127
+ return slots
128
+ },
129
+ formSlots() {
130
+ let slots = []
131
+ this.formDesc.map(col => slots.push(col.prop))
132
+ return slots
133
+ },
134
+ tableHeight() {
135
+ if (!this.tbHeight) {
136
+ return this.paging ? 315 - 32 : 315
137
+ } else {
138
+ return this.tbHeight
139
+ }
140
+ }
141
+ },
142
+ watch: {
143
+ columns: {
144
+ handler(nVal, oVal) {
145
+ if (nVal) {
146
+ let column = this.columns.filter(i => i.rowKey)
147
+ if (column.length > 0) this.rowKey = column.map(col => col.prop)
148
+
149
+ this.initTableColumns()
150
+ this.initFormDesc()
151
+ this.initDataValue()
152
+ }
153
+ },
154
+ deep: true,
155
+ immediate: true
156
+ },
157
+ value: {
158
+ handler(nVal, oVal) {
159
+ if (nVal && this.columns.length > 0) {
160
+ this.initDataValue()
161
+ }
162
+ },
163
+ deep: true
164
+ },
165
+ action: {
166
+ deep: true,
167
+ immediate: true,
168
+ handler(newVal, oldVal) {
169
+ if (newVal && this.data.length === 0) {
170
+ this.initRequest()
171
+ }
172
+ }
173
+ }
174
+ },
175
+ methods: {
176
+ // 初始化Columns,formDesc
177
+ initRequest() {
178
+ const options = {
179
+ method: this.method,
180
+ headers: Object.assign({}, this.defHeaders, this.headers),
181
+ action: this.action,
182
+ data: this.getAjaxData(),
183
+ }
184
+
185
+ this.httpRequest(options).then(res => {
186
+ if (getVarType(res.data) === 'array') {
187
+ this.tables = res.data
188
+ } else {
189
+ this.tables = res.data.records
190
+ if (Object.keys(res.data).includes("total")) this.pagination.total = res.data.total
191
+ }
192
+
193
+ this.onSuccess(res);
194
+ }).catch(error => {
195
+ this.onError(error)
196
+ })
197
+ },
198
+
199
+ // 初始化TableColumns
200
+ initTableColumns() {
201
+ this.columns.map(column => {
202
+ if (column.formatter && getVarType(column.formatter) === 'string') {
203
+ column.formatter = new Function('return ' + column.formatter)();
204
+ }
205
+ })
206
+ },
207
+
208
+ // 初始化FormDesc
209
+ initFormDesc() {
210
+ this.formDesc = []
211
+ this.columns.map(i => {
212
+ if (i.query) {
213
+ this.formDesc.push({
214
+ label: i.label,
215
+ prop: i.map ? i.map : i.prop,
216
+ precise: i.precise ? i.precise : false,
217
+ children: {
218
+ tags: "el-input",
219
+ attrs: {
220
+ placeholder: `请输入${i.label}`
221
+ }
222
+ }
223
+ })
224
+ this.model[i.map ? i.map : i.prop] = ""
225
+ }
226
+ })
227
+ },
228
+
229
+ // 初始化input值
230
+ initDataValue() {
231
+ if (getVarType(this.value) === 'object') {
232
+ this.dataValue = this.rowKey.map(prop => this.value[prop]).join(this.split)
233
+ } else if (getVarType(this.value) === 'array') {
234
+ let value = this.value.map(val => this.rowKey.map(prop => val[prop]).join(this.split))
235
+ this.dataValue = value.join(",")
236
+ }
237
+ },
238
+
239
+ // 获取焦点时,打开弹窗
240
+ handlerFocus() {
241
+ this.visible = true
242
+ this.$nextTick(() => {
243
+ this.multiple ? this.toggleRowSelection() : this.setCurrentRow()
244
+ })
245
+ },
246
+
247
+ // 初始化table选中项 - 单选
248
+ setCurrentRow() {
249
+ if (getVarType(this.value === 'object')) {
250
+ let index = this.isEqualIndex(this.tables, this.value)
251
+ this.$refs.elsTable.setCurrentRow(this.tables[index])
252
+ } else if (getVarType(this.value) === 'array') {
253
+ let index = this.isEqualIndex(this.tables, this.value[0])
254
+ this.$refs.elsTable.setCurrentRow(this.tables[index])
255
+ console.warn("请注意:取值数组第一项,单选模式下传入了Array,应为Object")
256
+ }
257
+ },
258
+
259
+ // 初始化table选中项 - 多选
260
+ toggleRowSelection() {
261
+ if (getVarType(this.value) === 'array') {
262
+ this.value.map((row) => {
263
+ let index = this.isEqualIndex(this.tables, row)
264
+ this.$refs.elsTable.toggleRowSelection(this.tables[index])
265
+ })
266
+ } else if (getVarType(this.value) === 'object') {
267
+ let index = this.isEqualIndex(this.tables, this.value)
268
+ this.$refs.elsTable.toggleRowSelection(this.tables[index])
269
+ console.warn("请注意:多选模式下传入了Object,应为Array")
270
+ }
271
+ },
272
+
273
+ // 弹窗确认
274
+ handlerOk() {
275
+ this.$emit('input', this.currentRow)
276
+ this.handlerClose()
277
+ },
278
+
279
+ // 关闭弹窗
280
+ handlerClose() {
281
+ this.visible = false
282
+ },
283
+
284
+ // table单选
285
+ handlerRowClick(row, column, event) {
286
+ if (!this.multiple) {
287
+ this.currentRow = row
288
+ }
289
+ },
290
+
291
+ // table多选
292
+ handleSelectionChange(val) {
293
+ if (this.multiple) {
294
+ this.currentRow = val
295
+ }
296
+ },
297
+
298
+ // 搜索
299
+ handlerSearch() {
300
+ if (this.isAjax) {
301
+ this.initRequest()
302
+ } else {
303
+ let tableData = []
304
+ Object.keys(this.model).map(key => {
305
+ let data = this.tables.filter(i => i[key].includes(this.model[key]))
306
+ if (this.model[key] && data.length > 0) {
307
+ tableData = [...tableData, ...data]
308
+ } else {
309
+ tableData = this.data
310
+ }
311
+ })
312
+ this.tables = tableData
313
+ }
314
+ },
315
+
316
+ // 清空
317
+ handlerClear() {
318
+ this.$refs.elsForm.resetFields()
319
+
320
+ if (this.isAjax) {
321
+ this.init()
322
+ } else {
323
+ this.tables = this.data
324
+ }
325
+ },
326
+
327
+ // 检测table数组中是否包含传输值,返回其索引值
328
+ isEqualIndex(arr, obj) {
329
+ return arr.findIndex(i => this.rowKey.find(prop => i[prop] === obj[prop]))
330
+ },
331
+
332
+ // 组装请求数据
333
+ getAjaxData() {
334
+ let data = Object.assign({}, this.params)
335
+ let page = {current: this.pagination.current, size: this.pagination.pageSize}
336
+
337
+ if (this.paging && this.method.toUpperCase() !== "GET") {
338
+ data.page = page
339
+ data.wheres = this.getWheresData()
340
+ } else {
341
+ data = this.paging ? Object.assign(data, page, this.model) : Object.assign(data, this.model)
342
+ }
343
+ return data
344
+ },
345
+
346
+ // 组装分页请求数据
347
+ getWheresData() {
348
+ return this.formDesc.map(item => {
349
+ return {label: item.prop, value: this.model[item.prop], precise: item.precise}
350
+ })
351
+ },
352
+ }
353
+ }
354
+ </script>
355
+
356
+ <style lang="scss" scoped>
357
+ @import "../../../style/index";
358
+
359
+ .ed-input-table--card {
360
+ border: none;
361
+ }
362
+
363
+ ::v-deep {
364
+ .ed-input-table--card .el-card__body {
365
+ height: 100%;
366
+ }
367
+ }
368
+ </style>
@@ -0,0 +1,40 @@
1
+ export default async function request(options) {
2
+ let action = options.action;
3
+ if (options.method.toUpperCase() === 'GET') {
4
+ let dataStr = ''; //数据拼接字符串
5
+ Object.keys(options.data).forEach(key => {
6
+ dataStr += key + '=' + options.data[key] + '&';
7
+ })
8
+ if (dataStr !== '') {
9
+ dataStr = dataStr.slice(0, dataStr.lastIndexOf('&'));
10
+ action = action + '?' + dataStr;
11
+ }
12
+ }
13
+
14
+ let requestConfig = {
15
+ credentials: 'same-origin',
16
+ method: options.method.toUpperCase(),
17
+ headers: options.headers,
18
+ mode: "cors", // 用来决定是否允许跨域请求 值有 三个 same-origin,no-cors(默认)以及 cores;
19
+ cache: "force-cache" // 是否缓存请求资源 可选值有 default 、 no-store 、 reload 、 no-cache 、 force-cache 或者 only-if-cached 。
20
+ }
21
+
22
+ if (options.method.toUpperCase() === 'POST') {
23
+ Object.defineProperty(requestConfig, 'body', {
24
+ value: JSON.stringify(options.data)
25
+ })
26
+ }
27
+
28
+ try {
29
+ const response = await fetch(action, requestConfig);
30
+ const responseJson = await response.json()
31
+
32
+ if(responseJson.data.list){
33
+ responseJson.data.records = responseJson.data.list
34
+ delete responseJson.data.list
35
+ }
36
+ return responseJson
37
+ } catch (error) {
38
+ return error
39
+ }
40
+ }
@@ -0,0 +1,13 @@
1
+ /**
2
+ * JSON编辑器
3
+ * 依赖:jsoneditor { https://jsoneditoronline.org/}
4
+ */
5
+
6
+ import EdJsonEditor from './src/EdJsonEditor.vue'
7
+
8
+ /* istanbul ignore next */
9
+ EdJsonEditor.install = function (Vue) {
10
+ Vue.component(EdJsonEditor.name, EdJsonEditor)
11
+ }
12
+
13
+ export default EdJsonEditor
@@ -0,0 +1,198 @@
1
+ <template>
2
+ <div :class="{'max-box':max, 'min-box':!max, ...customClass}" :style="{height: height, ...customStyle}"
3
+ class="jsonEditor-container">
4
+ <div ref="jsonEditor" class="jsonEditor-box"></div>
5
+ <button v-if="mode === 'code'" class="max-btn" type="button" @click="max = !max"></button>
6
+ </div>
7
+ </template>
8
+
9
+ <script>
10
+ // 引入组件
11
+ import JSONEditor from "jsoneditor/dist/jsoneditor.min"
12
+ import './assets/jsoneditor.css'
13
+ import {OPTIONS} from './hooks'
14
+
15
+ /**
16
+ * JSON编辑器
17
+ * - 示例
18
+ *
19
+ * ```vue
20
+ * <ed-json-editor v-model="value"></ed-json-editor>
21
+ * ```
22
+ *
23
+ * [](./EdJsonEditorProps.md ':include')
24
+ */
25
+ export default {
26
+ name: "EdJsonEditor",
27
+ data() {
28
+ return {
29
+ editor: null,
30
+ expandedModes: ["tree", "view", "form"],
31
+ max: false,
32
+ internalChange: false,
33
+ }
34
+ },
35
+ props: {
36
+ // 显示模式
37
+ mode: {type: String, default: 'code'},
38
+ // 值
39
+ value: [Array, Object, String],
40
+ // 高度
41
+ height: {type: [String, Number], default: '500px'},
42
+ // 属性
43
+ options: {type: Object, default: () => {return OPTIONS}},
44
+ // 自定义class 类名
45
+ customClass: {type: Object, default: () => ({})},
46
+ // 自定义样式
47
+ customStyle: {type: Object, default: () => ({})},
48
+ // 是否启动时展开所有
49
+ expandedOnStart: {type: Boolean, default: true}
50
+ },
51
+ model: {
52
+ prop: "value",
53
+ event: "change"
54
+ },
55
+ methods: {
56
+ /**
57
+ * @private
58
+ */
59
+ onChange() {
60
+ let error = null
61
+ let json = {}
62
+ try {
63
+ json = this.editor.get()
64
+ } catch (err) {
65
+ error = err
66
+ }
67
+ if (error) {
68
+ this.$emit("error", error)
69
+ } else {
70
+ if (this.editor) {
71
+ this.internalChange = true
72
+ this.$emit("change", json)
73
+ this.$nextTick(() => {
74
+ this.internalChange = false
75
+ })
76
+ }
77
+ }
78
+ },
79
+ // 初始化
80
+ initView() {
81
+ if (!this.editor) {
82
+ const container = this.$refs.jsonEditor;
83
+ this.editor = new JSONEditor(container, {
84
+ mode: this.mode, // 默认模式
85
+ ...this.options,
86
+ onChange: this.onChange,
87
+ onModeChange: this.expandAll
88
+ })
89
+ }
90
+ this.editor.set(this.value !== undefined ? this.value : {})
91
+ },
92
+
93
+ // 启动时展开所有
94
+ expandAll() {
95
+ if (this.expandedOnStart && this.expandedModes.includes(this.editor.getMode())) {
96
+ this.editor.expandAll();
97
+ }
98
+ },
99
+
100
+ // 销毁
101
+ destroyView() {
102
+ if (this.editor) {
103
+ this.editor.destroy()
104
+ this.editor = null
105
+ }
106
+ }
107
+ },
108
+ watch: {
109
+ value: {
110
+ handler(value) {
111
+ if (this.editor && value !== undefined && !this.internalChange) {
112
+ this.editor.set(value)
113
+ }
114
+ },
115
+ deep: true
116
+ },
117
+ max(value) {
118
+ this.$nextTick(() => {
119
+ this.initView()
120
+ })
121
+ },
122
+ options: {
123
+ handler(value) {
124
+ if (this.options && this.options.mode && this.editor) {
125
+ this.editor.setMode(this.options.mode)
126
+ }
127
+ },
128
+ deep: true
129
+ }
130
+ },
131
+ mounted() {
132
+ this.initView()
133
+ },
134
+ beforeDestroy() {
135
+ this.destroyView()
136
+ },
137
+ computed: {
138
+ getHeight() {
139
+ if (this.height && !this.max) {
140
+ return {
141
+ height: this.height
142
+ }
143
+ }
144
+ return {}
145
+ }
146
+ }
147
+ }
148
+ </script>
149
+
150
+ <style lang="scss" scoped>
151
+ ::v-deep {
152
+ .jsoneditor-poweredBy, .jsoneditor-jmespath-label, #wizard {
153
+ display: none !important;
154
+ }
155
+ }
156
+
157
+ .jsonEditor-container.max-box {
158
+ position: fixed;
159
+ top: 0;
160
+ left: 0;
161
+ width: 100vw;
162
+ height: 100vh !important;
163
+ z-index: 10000;
164
+ }
165
+
166
+ .jsonEditor-container.min-box {
167
+ position: relative;
168
+ min-width: 300px;
169
+ width: 100%;
170
+ }
171
+
172
+ .jsonEditor-box {
173
+ height: 100%;
174
+ }
175
+
176
+ .jsonEditor-container:hover .max-btn {
177
+ display: block;
178
+ }
179
+
180
+ .max-btn {
181
+ display: none;
182
+ position: absolute;
183
+ top: 7px;
184
+ right: 10px;
185
+ color: #fff;
186
+ width: 24px;
187
+ height: 24px;
188
+ background: rgba(0, 0, 0, 0) url(./assets/plus.svg) no-repeat 3px;
189
+ border: 1px solid rgba(0, 0, 0, 0);
190
+ border-radius: 3px;
191
+ }
192
+
193
+ .max-btn:hover {
194
+ border: 1px solid #d7e6fe;
195
+ }
196
+
197
+
198
+ </style>