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.
- package/.env.dev +14 -0
- package/CHANGELOG.md +9 -0
- package/README.md +24 -0
- package/dist/ed-frame-vue.common.1.js +11046 -0
- package/dist/ed-frame-vue.common.1.js.map +1 -0
- package/dist/ed-frame-vue.common.2.js +1715 -0
- package/dist/ed-frame-vue.common.2.js.map +1 -0
- package/dist/ed-frame-vue.common.js +53427 -0
- package/dist/ed-frame-vue.common.js.map +1 -0
- package/dist/ed-frame-vue.umd.1.js +11046 -0
- package/dist/ed-frame-vue.umd.1.js.map +1 -0
- package/dist/ed-frame-vue.umd.2.js +1715 -0
- package/dist/ed-frame-vue.umd.2.js.map +1 -0
- package/dist/ed-frame-vue.umd.js +53437 -0
- package/dist/ed-frame-vue.umd.js.map +1 -0
- package/dist/ed-frame-vue.umd.min.1.js +17 -0
- package/dist/ed-frame-vue.umd.min.1.js.map +1 -0
- package/dist/ed-frame-vue.umd.min.2.js +4 -0
- package/dist/ed-frame-vue.umd.min.2.js.map +1 -0
- package/dist/ed-frame-vue.umd.min.js +470 -0
- package/dist/ed-frame-vue.umd.min.js.map +1 -0
- package/import.easydata.js +46 -0
- package/lib/CHANGELOG.md +18 -0
- package/lib/README.md +27 -0
- package/lib/api/ds/index.js +124 -0
- package/lib/api/easyData.js +90 -0
- package/lib/api/easyform/easyForm.js +32 -0
- package/lib/api/index.js +61 -0
- package/lib/api/interface/index.js +32 -0
- package/lib/api/system.js +20 -0
- package/lib/index.js +80 -0
- package/lib/packages/BasicTemplate/EasyDataTemplate.vue +189 -0
- package/lib/packages/BasicTemplate/Props.js +64 -0
- package/lib/packages/BasicTemplate/components/TemplateComp.vue +263 -0
- package/lib/packages/BasicTemplate/components/TemplateViews.vue +292 -0
- package/lib/packages/BasicTemplate/hooks/business.js +74 -0
- package/lib/packages/BasicTemplate/hooks/getFormData.js +89 -0
- package/lib/packages/BasicTemplate/hooks/queryFormData.js +194 -0
- package/lib/packages/BasicTemplate/hooks/submitForm.js +53 -0
- package/lib/packages/BasicTemplate/hooks/useEmits.js +15 -0
- package/lib/packages/BasicTemplate/hooks/validate.js +42 -0
- package/lib/packages/EasyDataForm/EasyDataForm.vue +597 -0
- package/lib/packages/EasyDataForm/Props.js +22 -0
- package/lib/packages/EasyDataForm/components/FormItem.vue +228 -0
- package/lib/packages/EasyDataForm/hooks/useChosePopup.js +85 -0
- package/lib/packages/EasyDataForm/hooks/useEmits.js +19 -0
- package/lib/packages/EasyDataForm/hooks/useForm.js +169 -0
- package/lib/packages/EasyDataForm/hooks/useUpload.js +168 -0
- package/lib/packages/EasyDataList/EasyDataList.vue +348 -0
- package/lib/packages/EasyDataList/Props.js +116 -0
- package/lib/packages/EasyDataList/components/BasicModal.vue +150 -0
- package/lib/packages/EasyDataList/components/FormAction.vue +63 -0
- package/lib/packages/EasyDataList/hooks/useEmits.js +30 -0
- package/lib/packages/EasyDataList/hooks/useForm.js +62 -0
- package/lib/packages/EasyDataList/hooks/useTable.js +314 -0
- package/lib/packages/EasyDataTable/EasyDataTable.vue +233 -0
- package/lib/packages/EasyDataView/EasyDataView.vue +105 -0
- package/lib/packages/EdRichPreview/index.js +32 -0
- package/lib/packages/EdRichText/index.vue +167 -0
- package/lib/packages/EdRichText/replaceUrl.js +49 -0
- package/lib/packages/components/FileView.vue +97 -0
- package/lib/packages/index.js +11 -0
- package/lib/packages/mixins/EasyDataMixins.js +133 -0
- package/lib/packages/mixins/useTable.jsx +130 -0
- package/lib/pages/DataSource/index.js +8 -0
- package/lib/pages/DataSource/src/components/ControlViews/BaseProps.js +103 -0
- package/lib/pages/DataSource/src/components/ControlViews/control.js +1089 -0
- package/lib/pages/DataSource/src/components/ControlViews/index.vue +301 -0
- package/lib/pages/DataSource/src/components/TableOperationModal.vue +225 -0
- package/lib/pages/DataSource/src/components/TablePropsModal.vue +367 -0
- package/lib/pages/DataSource/src/components/ViewPropsModal.vue +737 -0
- package/lib/pages/DataSource/src/components/modal/ChooseDict.vue +119 -0
- package/lib/pages/DataSource/src/hooks/useTable.js +138 -0
- package/lib/pages/DataSource/src/index.vue +431 -0
- package/lib/pages/Interface/index.js +8 -0
- package/lib/pages/Interface/src/components/InterfaceCall.vue +73 -0
- package/lib/pages/Interface/src/components/InterfaceDepend.vue +299 -0
- package/lib/pages/Interface/src/components/InterfaceFee.vue +131 -0
- package/lib/pages/Interface/src/components/InterfaceMessage.vue +878 -0
- package/lib/pages/Interface/src/components/InterfaceMock.vue +203 -0
- package/lib/pages/Interface/src/components/InterfaceParam.vue +308 -0
- package/lib/pages/Interface/src/components/InterfaceRepeat.vue +281 -0
- package/lib/pages/Interface/src/components/InterfaceVariable.vue +31 -0
- package/lib/pages/Interface/src/index.vue +216 -0
- package/lib/pages/Template/index.js +8 -0
- package/lib/pages/Template/src/components/DefineModal.vue +524 -0
- package/lib/pages/Template/src/components/TemplatePreview.vue +109 -0
- package/lib/pages/Template/src/components/model/AddDialog.vue +60 -0
- package/lib/pages/Template/src/components/model/TemplatePreview2.vue +101 -0
- package/lib/pages/Template/src/hooks/index.js +3 -0
- package/lib/pages/Template/src/hooks/useEmits.js +64 -0
- package/lib/pages/Template/src/index.vue +124 -0
- package/lib/popup/index.js +8 -0
- package/lib/popup/src/DataSourceChoose.vue +44 -0
- package/lib/popup/src/DataSourceViewIdChoose.vue +67 -0
- package/lib/popup/src/DictChoose.vue +104 -0
- package/lib/popup/src/InterfaceChoose.vue +46 -0
- package/lib/popup/src/OrgChoose.vue +121 -0
- package/lib/popup/src/RoleChoose.vue +101 -0
- package/lib/popup/src/TemplateChoose.vue +43 -0
- package/lib/popup/src/UserChoose.vue +161 -0
- package/lib/popup//347/273/204/344/273/266/345/274/200/345/217/221/350/247/204/350/214/203.md +25 -0
- package/lib/style/custom.scss +126 -0
- package/lib/style/deep.scss +109 -0
- package/lib/style/index.scss +4 -0
- package/lib/utils/MapLoader.js +48 -0
- package/lib/utils/dateUtils.js +58 -0
- package/lib/utils/index.js +8 -0
- package/lib/utils/setting.js +25 -0
- package/lib/utils/sortable/index.js +3784 -0
- package/lib/utils/useBusiness.js +212 -0
- package/lib/utils/utils.js +588 -0
- package/package.json +77 -0
- package/src/App.vue +12 -0
- package/src/assets/Vue.png +0 -0
- package/src/assets/avatar.png +0 -0
- package/src/assets/images/bg.png +0 -0
- package/src/assets/images/logo-bills.png +0 -0
- package/src/assets/images/pic.png +0 -0
- package/src/assets/images/weplus-logo.png +0 -0
- package/src/assets/marker.png +0 -0
- package/src/assets/styles/common.scss +359 -0
- package/src/assets/styles/ele-docs.css +3278 -0
- package/src/assets/styles/fonts/icomoon.eot +0 -0
- package/src/assets/styles/fonts/icomoon.svg +14 -0
- package/src/assets/styles/fonts/icomoon.ttf +0 -0
- package/src/assets/styles/fonts/icomoon.woff +0 -0
- package/src/assets/styles/fonts/style.css +39 -0
- package/src/assets/styles/higtlightEle.css +84 -0
- package/src/assets/svg/code.svg +7 -0
- package/src/assets/svg/password.svg +1 -0
- package/src/components/Popups/DiyCompDictChoose.vue +112 -0
- package/src/components/Popups/index.js +28 -0
- package/src/components/ed-base-vue/global/variable.js +8 -0
- package/src/components/ed-base-vue/index.js +81 -0
- package/src/components/ed-base-vue/package/EdCard/index.js +7 -0
- package/src/components/ed-base-vue/package/EdCard/src/index.vue +87 -0
- package/src/components/ed-base-vue/package/EdCodeEditor/index.js +8 -0
- package/src/components/ed-base-vue/package/EdCodeEditor/src/AceEditor/AceConfig.js +71 -0
- package/src/components/ed-base-vue/package/EdCodeEditor/src/AceEditor/Editor.vue +137 -0
- package/src/components/ed-base-vue/package/EdCodeEditor/src/AceEditor/Toolbar.vue +68 -0
- package/src/components/ed-base-vue/package/EdCodeEditor/src/AceEditor/index.vue +119 -0
- package/src/components/ed-base-vue/package/EdCodeEditor/src/AceEditor/webpack-resolver.js +51 -0
- package/src/components/ed-base-vue/package/EdCodeEditor/src/Codemirror/Toolbar.vue +57 -0
- package/src/components/ed-base-vue/package/EdCodeEditor/src/Codemirror/config.js +64 -0
- package/src/components/ed-base-vue/package/EdCodeEditor/src/Codemirror/index.vue +309 -0
- package/src/components/ed-base-vue/package/EdCodeEditor/src/EdCodeEditor.vue +238 -0
- package/src/components/ed-base-vue/package/EdDate/index.js +8 -0
- package/src/components/ed-base-vue/package/EdDate/src/index.js +50 -0
- package/src/components/ed-base-vue/package/EdDescriptions/index.js +8 -0
- package/src/components/ed-base-vue/package/EdDescriptions/src/EdDescriptions.vue +46 -0
- package/src/components/ed-base-vue/package/EdDescriptions/src/EdDescriptionsItem.js +20 -0
- package/src/components/ed-base-vue/package/EdDescriptions/src/Props.js +20 -0
- package/src/components/ed-base-vue/package/EdDialog/index.js +8 -0
- package/src/components/ed-base-vue/package/EdDialog/src/EdDialog.vue +138 -0
- package/src/components/ed-base-vue/package/EdDialog/src/Props.js +91 -0
- package/src/components/ed-base-vue/package/EdDialog/src/components/DialogFooter.vue +42 -0
- package/src/components/ed-base-vue/package/EdDialog/src/components/DialogWrapper.vue +53 -0
- package/src/components/ed-base-vue/package/EdDrawer/index.js +8 -0
- package/src/components/ed-base-vue/package/EdDrawer/src/DrawerFooter.vue +41 -0
- package/src/components/ed-base-vue/package/EdDrawer/src/EdDrawer.vue +150 -0
- package/src/components/ed-base-vue/package/EdDrawer/src/props.js +71 -0
- package/src/components/ed-base-vue/package/EdFlow/index.js +8 -0
- package/src/components/ed-base-vue/package/EdFlow/src/EdFlowItem.vue +733 -0
- package/src/components/ed-base-vue/package/EdFlow/src/index.vue +148 -0
- package/src/components/ed-base-vue/package/EdForm/index.js +8 -0
- package/src/components/ed-base-vue/package/EdForm/src/EdForm.vue +172 -0
- package/src/components/ed-base-vue/package/EdForm/src/Props.js +33 -0
- package/src/components/ed-base-vue/package/EdForm/src/components/EdFormItem.vue +34 -0
- package/src/components/ed-base-vue/package/EdIcons/index.js +8 -0
- package/src/components/ed-base-vue/package/EdIcons/src/hooks/Icons.js +406 -0
- package/src/components/ed-base-vue/package/EdIcons/src/hooks/Icons1.js +830 -0
- package/src/components/ed-base-vue/package/EdIcons/src/index.vue +13 -0
- package/src/components/ed-base-vue/package/EdImage/index.js +8 -0
- package/src/components/ed-base-vue/package/EdImage/src/index.vue +28 -0
- package/src/components/ed-base-vue/package/EdInputArray/index.js +8 -0
- package/src/components/ed-base-vue/package/EdInputArray/src/Props.js +26 -0
- package/src/components/ed-base-vue/package/EdInputArray/src/index.vue +97 -0
- package/src/components/ed-base-vue/package/EdInputColor/index.js +8 -0
- package/src/components/ed-base-vue/package/EdInputColor/src/InputColor.vue +81 -0
- package/src/components/ed-base-vue/package/EdInputMap/index.js +9 -0
- package/src/components/ed-base-vue/package/EdInputMap/src/EdInputMap.vue +246 -0
- package/src/components/ed-base-vue/package/EdInputMap/src/EdInputMapProps.js +6 -0
- package/src/components/ed-base-vue/package/EdInputPop/index.js +13 -0
- package/src/components/ed-base-vue/package/EdInputPop/src/EdInputPop.vue +144 -0
- package/src/components/ed-base-vue/package/EdInputPop/src/Props.js +48 -0
- package/src/components/ed-base-vue/package/EdInputTable/index.js +8 -0
- package/src/components/ed-base-vue/package/EdInputTable/src/EdInputTable.vue +368 -0
- package/src/components/ed-base-vue/package/EdInputTable/src/Fetch.js +40 -0
- package/src/components/ed-base-vue/package/EdJsonEditor/index.js +13 -0
- package/src/components/ed-base-vue/package/EdJsonEditor/src/EdJsonEditor.vue +198 -0
- package/src/components/ed-base-vue/package/EdJsonEditor/src/assets/img/jsoneditor-icons.svg +749 -0
- package/src/components/ed-base-vue/package/EdJsonEditor/src/assets/jsoneditor.css +2031 -0
- package/src/components/ed-base-vue/package/EdJsonEditor/src/assets/plus.svg +1 -0
- package/src/components/ed-base-vue/package/EdJsonEditor/src/hooks.js +63 -0
- package/src/components/ed-base-vue/package/EdJsonViewer/index.js +8 -0
- package/src/components/ed-base-vue/package/EdJsonViewer/src/EdJsonViewer.vue +44 -0
- package/src/components/ed-base-vue/package/EdLable/index.js +8 -0
- package/src/components/ed-base-vue/package/EdLable/src/index.vue +34 -0
- package/src/components/ed-base-vue/package/EdLink/index.js +8 -0
- package/src/components/ed-base-vue/package/EdLink/src/index.vue +43 -0
- package/src/components/ed-base-vue/package/EdMarkEditor/index.js +15 -0
- package/src/components/ed-base-vue/package/EdMarkEditor/src/EdMarkEditor.vue +368 -0
- package/src/components/ed-base-vue/package/EdMarkEditor/src/extra-function.js +538 -0
- package/src/components/ed-base-vue/package/EdMarkEditor/src/highlight.js +95 -0
- package/src/components/ed-base-vue/package/EdTable/index.js +8 -0
- package/src/components/ed-base-vue/package/EdTable/src/EdTable.vue +240 -0
- package/src/components/ed-base-vue/package/EdTable/src/Props.js +97 -0
- package/src/components/ed-base-vue/package/EdTable/src/components/TableColumnItem.js +24 -0
- package/src/components/ed-base-vue/package/EdTable/src/components/TablePagination.vue +73 -0
- package/src/components/ed-base-vue/package/EdTableEditor/index.js +8 -0
- package/src/components/ed-base-vue/package/EdTableEditor/src/EdTableEditor.vue +282 -0
- package/src/components/ed-base-vue/package/EdTableEditor/src/Props.js +107 -0
- package/src/components/ed-base-vue/package/EdTableEditor/src/hooks/validate.js +90 -0
- package/src/components/ed-base-vue/package/EdUpload/index.js +8 -0
- package/src/components/ed-base-vue/package/EdUpload/src/Props.js +90 -0
- package/src/components/ed-base-vue/package/EdUpload/src/index.vue +88 -0
- package/src/components/ed-base-vue/package/EdViewer/index.js +8 -0
- package/src/components/ed-base-vue/package/EdViewer/src/EdViewer.vue +310 -0
- package/src/components/ed-base-vue/package/EdWangEditor/index.js +14 -0
- package/src/components/ed-base-vue/package/EdWangEditor/src/EdWangEditor.vue +127 -0
- package/src/components/ed-base-vue/package/ExtendSlot.js +12 -0
- package/src/components/ed-base-vue/package/OptionSlot.js +65 -0
- package/src/components/ed-base-vue/plugin/Message/index.js +2 -0
- package/src/components/ed-base-vue/plugin/Message/src/main.js +91 -0
- package/src/components/ed-base-vue/plugin/Message/src/main.vue +253 -0
- package/src/components/ed-base-vue/plugin/print/index.js +156 -0
- package/src/components/ed-base-vue/plugin/sortable/index.js +3784 -0
- package/src/components/ed-base-vue/style/custom.scss +107 -0
- package/src/components/ed-base-vue/style/deep.scss +100 -0
- package/src/components/ed-base-vue/style/index.scss +4 -0
- package/src/components/ed-base-vue/tools/date-format.js +315 -0
- package/src/components/ed-base-vue/tools/utils.js +124 -0
- package/src/layouts/components/AppMain.vue +17 -0
- package/src/layouts/components/Header.vue +256 -0
- package/src/layouts/components/Logo.vue +56 -0
- package/src/layouts/components/Navbar.vue +169 -0
- package/src/layouts/components/SideBar.vue +107 -0
- package/src/layouts/components/index.js +5 -0
- package/src/layouts/index.vue +57 -0
- package/src/main.js +42 -0
- package/src/request/config.js +6 -0
- package/src/request/index.js +85 -0
- package/src/request/request.js +147 -0
- package/src/router/index.js +65 -0
- package/src/router/modules/baseRouter.js +43 -0
- package/src/router/modules/easydata.js +49 -0
- package/src/views/base/BaseRichPreview.vue +23 -0
- package/src/views/base/BaseRichText.vue +28 -0
- package/src/views/base/EdFormView.vue +54 -0
- package/src/views/base/EdTable.vue +98 -0
- package/src/views/base/inputTable.vue +103 -0
- package/src/views/easydata/Interface.vue +3 -0
- package/src/views/easydata/dataSource.vue +13 -0
- package/src/views/easydata/dataSourceView.vue +71 -0
- package/src/views/easydata/templateDemo.vue +89 -0
- package/src/views/easydata/templateInfo.vue +13 -0
- package/src/views/index.vue +17 -0
- package/src/views/login.vue +208 -0
- package/src/views/redirect.vue +15 -0
|
@@ -0,0 +1,309 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="common-editor" style="font-size: 14px">
|
|
3
|
+
<Toolbar v-model="form"></Toolbar>
|
|
4
|
+
<textarea v-if="CodeEditor" ref="textarea" v-model="value" :placeholder="placeholder"></textarea>
|
|
5
|
+
</div>
|
|
6
|
+
</template>
|
|
7
|
+
|
|
8
|
+
<script>
|
|
9
|
+
import 'codemirror/lib/codemirror.css'
|
|
10
|
+
|
|
11
|
+
// 主题
|
|
12
|
+
import 'codemirror/theme/abcdef.css'
|
|
13
|
+
import 'codemirror/theme/base16-dark.css'
|
|
14
|
+
import 'codemirror/theme/blackboard.css'
|
|
15
|
+
import 'codemirror/theme/cobalt.css'
|
|
16
|
+
import 'codemirror/theme/colorforth.css'
|
|
17
|
+
import 'codemirror/theme/darcula.css'
|
|
18
|
+
import 'codemirror/theme/dracula.css'
|
|
19
|
+
import 'codemirror/theme/duotone-dark.css'
|
|
20
|
+
import 'codemirror/theme/eclipse.css'
|
|
21
|
+
import 'codemirror/theme/hopscotch.css'
|
|
22
|
+
import 'codemirror/theme/icecoder.css'
|
|
23
|
+
import 'codemirror/theme/idea.css'
|
|
24
|
+
import 'codemirror/theme/isotope.css'
|
|
25
|
+
import 'codemirror/theme/liquibyte.css'
|
|
26
|
+
import 'codemirror/theme/lucario.css'
|
|
27
|
+
import 'codemirror/theme/material.css'
|
|
28
|
+
import 'codemirror/theme/mbo.css'
|
|
29
|
+
import 'codemirror/theme/mdn-like.css'
|
|
30
|
+
import 'codemirror/theme/night.css'
|
|
31
|
+
import 'codemirror/theme/panda-syntax.css'
|
|
32
|
+
import 'codemirror/theme/pastel-on-dark.css'
|
|
33
|
+
import 'codemirror/theme/rubyblue.css'
|
|
34
|
+
import 'codemirror/theme/seti.css'
|
|
35
|
+
import 'codemirror/theme/shadowfox.css'
|
|
36
|
+
import 'codemirror/theme/yonce.css'
|
|
37
|
+
|
|
38
|
+
// 插件
|
|
39
|
+
import 'codemirror/addon/hint/show-hint.css'
|
|
40
|
+
import 'codemirror/addon/hint/show-hint.js'
|
|
41
|
+
import 'codemirror/addon/hint/show-hint'
|
|
42
|
+
import 'codemirror/addon/hint/javascript-hint'
|
|
43
|
+
import 'codemirror/addon/hint/sql-hint'
|
|
44
|
+
import 'codemirror/addon/display/placeholder.js'
|
|
45
|
+
|
|
46
|
+
// 语言
|
|
47
|
+
import 'codemirror/mode/clike/clike'
|
|
48
|
+
import 'codemirror/mode/css/css'
|
|
49
|
+
import 'codemirror/mode/htmlmixed/htmlmixed'
|
|
50
|
+
import 'codemirror/mode/htmlembedded/htmlembedded'
|
|
51
|
+
import 'codemirror/mode/http/http'
|
|
52
|
+
import 'codemirror/mode/javascript/javascript'
|
|
53
|
+
import 'codemirror/mode/jsx/jsx'
|
|
54
|
+
import 'codemirror/mode/markdown/markdown'
|
|
55
|
+
import 'codemirror/mode/nginx/nginx'
|
|
56
|
+
import 'codemirror/mode/php/php'
|
|
57
|
+
import 'codemirror/mode/python/python'
|
|
58
|
+
import 'codemirror/mode/sass/sass'
|
|
59
|
+
import 'codemirror/mode/shell/shell'
|
|
60
|
+
import 'codemirror/mode/sql/sql'
|
|
61
|
+
import 'codemirror/mode/vue/vue'
|
|
62
|
+
import 'codemirror/mode/powershell/powershell'
|
|
63
|
+
import 'codemirror/mode/xml/xml'
|
|
64
|
+
|
|
65
|
+
// 显示自动刷新
|
|
66
|
+
import 'codemirror/addon/display/autorefresh.js'
|
|
67
|
+
|
|
68
|
+
// #region 搜索功能
|
|
69
|
+
// find:Ctrl-F (PC), Cmd-F (Mac)
|
|
70
|
+
// findNext:Ctrl-G (PC), Cmd-G (Mac)
|
|
71
|
+
// findPrev:Shift-Ctrl-G (PC), Shift-Cmd-G (Mac)
|
|
72
|
+
// replace:Shift-Ctrl-F (PC), Cmd-Alt-F (Mac)
|
|
73
|
+
// replaceAll:Shift-Ctrl-R (PC), Shift-Cmd-Alt-F (Mac)
|
|
74
|
+
import 'codemirror/addon/dialog/dialog.css'
|
|
75
|
+
import 'codemirror/addon/dialog/dialog'
|
|
76
|
+
import 'codemirror/addon/search/searchcursor'
|
|
77
|
+
import 'codemirror/addon/search/search'
|
|
78
|
+
import 'codemirror/addon/search/jump-to-line'
|
|
79
|
+
import 'codemirror/addon/search/matchesonscrollbar'
|
|
80
|
+
import 'codemirror/addon/search/match-highlighter'
|
|
81
|
+
// #endregion
|
|
82
|
+
import CodeMirror from 'codemirror/lib/codemirror'
|
|
83
|
+
|
|
84
|
+
import Toolbar from "./Toolbar";
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* 一个代码编辑器,支持多种语言
|
|
88
|
+
* 该组件已经全局注册,可以直接使用
|
|
89
|
+
* - 示例
|
|
90
|
+
*
|
|
91
|
+
* ```vue
|
|
92
|
+
* <ed-code-editor v-model="value"></ed-code-editor>
|
|
93
|
+
* ```
|
|
94
|
+
*/
|
|
95
|
+
|
|
96
|
+
export default {
|
|
97
|
+
name: 'EdCodeEditor',
|
|
98
|
+
components: {Toolbar},
|
|
99
|
+
props: {
|
|
100
|
+
// 编辑器的值, 可以通过 v-model 双向绑定
|
|
101
|
+
value: {
|
|
102
|
+
type: String,
|
|
103
|
+
default: ''
|
|
104
|
+
},
|
|
105
|
+
// 编辑器的占位符
|
|
106
|
+
placeholder: {
|
|
107
|
+
type: String,
|
|
108
|
+
default: 'Please enter the code.'
|
|
109
|
+
},
|
|
110
|
+
// 编辑器的语言
|
|
111
|
+
language: {
|
|
112
|
+
type: String,
|
|
113
|
+
default: 'javascript'
|
|
114
|
+
}
|
|
115
|
+
},
|
|
116
|
+
data() {
|
|
117
|
+
return {
|
|
118
|
+
CodeEditor: true,
|
|
119
|
+
flag: false,
|
|
120
|
+
code: '',
|
|
121
|
+
coder: null,
|
|
122
|
+
form: {
|
|
123
|
+
mode: 'text/javascript',
|
|
124
|
+
theme: 'eclipse',
|
|
125
|
+
},
|
|
126
|
+
modes: [
|
|
127
|
+
{value: 'text/x-vue', label: 'Vue'},
|
|
128
|
+
{value: 'text/javascript', label: 'Javascript'},
|
|
129
|
+
{value: 'text/css', label: 'Css'},
|
|
130
|
+
{value: 'x-java', label: 'Java'},
|
|
131
|
+
{value: 'x-python', label: 'Python'},
|
|
132
|
+
{value: 'x-sql', label: 'SQL'},
|
|
133
|
+
{value: 'x-shell', label: 'Shell'},
|
|
134
|
+
{value: 'x-powershell', label: 'PowerShell'},
|
|
135
|
+
{value: 'x-php', label: 'PHP'}
|
|
136
|
+
]
|
|
137
|
+
}
|
|
138
|
+
},
|
|
139
|
+
watch: {
|
|
140
|
+
"form.mode": {
|
|
141
|
+
deep: true,
|
|
142
|
+
handler(newVal, oldVal) {
|
|
143
|
+
if (newVal) {
|
|
144
|
+
console.log("--------", newVal)
|
|
145
|
+
this.getCoder().then(() => {
|
|
146
|
+
this.coder.setOption('mode', `${newVal}`)
|
|
147
|
+
})
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
},
|
|
151
|
+
"form.theme": {
|
|
152
|
+
deep: true,
|
|
153
|
+
handler(newVal, oldVal) {
|
|
154
|
+
if (newVal) {
|
|
155
|
+
this.getCoder().then(() => {
|
|
156
|
+
this.coder.setOption('theme', `${newVal}`)
|
|
157
|
+
})
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
},
|
|
162
|
+
computed: {
|
|
163
|
+
coderOptions() {
|
|
164
|
+
return {
|
|
165
|
+
autoRefresh: true,
|
|
166
|
+
line: true,
|
|
167
|
+
mode: this.form.mode, // json数据高亮
|
|
168
|
+
theme: this.form.theme, //设置主题 记得引入对应主题才有显示 import 'codemirror/theme/blackboard.css'
|
|
169
|
+
tabSize: 2,
|
|
170
|
+
lineNumbers: true, // 显示行号
|
|
171
|
+
cursorHeight: 0.8, //光标高度,默认是1
|
|
172
|
+
autoCloseBrackets: true,
|
|
173
|
+
matchBrackets: true, // 括号匹配
|
|
174
|
+
lineWrapping: 'wrap', // 文字过长时,是换行(wrap)还是滚动(scroll),默认是滚动
|
|
175
|
+
showCursorWhenSelecting: true, // 文本选中时显示光标
|
|
176
|
+
smartIndent: true, // 智能缩进
|
|
177
|
+
completeSingle: false // 当匹配只有一项的时候是否自动补全
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
},
|
|
181
|
+
mounted() {
|
|
182
|
+
// 初始化
|
|
183
|
+
this.initialize()
|
|
184
|
+
},
|
|
185
|
+
methods: {
|
|
186
|
+
test() {
|
|
187
|
+
this.CodeEditor = false
|
|
188
|
+
this.$nextTick(() => {
|
|
189
|
+
this.CodeEditor = true
|
|
190
|
+
})
|
|
191
|
+
},
|
|
192
|
+
/**
|
|
193
|
+
* @public
|
|
194
|
+
* 刷新编辑器
|
|
195
|
+
*/
|
|
196
|
+
refresh() {
|
|
197
|
+
this.coder.refresh()
|
|
198
|
+
},
|
|
199
|
+
// 初始化
|
|
200
|
+
initialize() {
|
|
201
|
+
// 初始化编辑器实例,传入需要被实例化的文本域对象和默认配置
|
|
202
|
+
this.coder = CodeMirror.fromTextArea(this.$refs.textarea, this.coderOptions)
|
|
203
|
+
this.coder.refresh()
|
|
204
|
+
this.coder.on('inputRead', () => {
|
|
205
|
+
this.coder.showHint()
|
|
206
|
+
})
|
|
207
|
+
|
|
208
|
+
// 编辑器赋值
|
|
209
|
+
if (this.value || this.code) {
|
|
210
|
+
this.setCodeContent(this.value || this.code)
|
|
211
|
+
} else {
|
|
212
|
+
this.coder.setValue('')
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
// 支持双向绑定
|
|
216
|
+
this.coder.on('change', (coder) => {
|
|
217
|
+
this.code = coder.getValue()
|
|
218
|
+
if (this.$emit) {
|
|
219
|
+
this.$emit('input', this.code)
|
|
220
|
+
this.$emit('change', this.code)
|
|
221
|
+
}
|
|
222
|
+
})
|
|
223
|
+
},
|
|
224
|
+
/**
|
|
225
|
+
* @private
|
|
226
|
+
* @param val
|
|
227
|
+
* 设置编辑器内容
|
|
228
|
+
*/
|
|
229
|
+
setCodeContent(val) {
|
|
230
|
+
setTimeout(() => {
|
|
231
|
+
if (!val) {
|
|
232
|
+
this.coder.setValue('')
|
|
233
|
+
} else {
|
|
234
|
+
this.coder.setValue(val)
|
|
235
|
+
}
|
|
236
|
+
}, 300)
|
|
237
|
+
},
|
|
238
|
+
/**
|
|
239
|
+
* @private
|
|
240
|
+
* @returns {Promise<unknown>}
|
|
241
|
+
* 获取编辑器实例
|
|
242
|
+
*/
|
|
243
|
+
getCoder() {
|
|
244
|
+
const that = this
|
|
245
|
+
return new Promise((resolve) => {
|
|
246
|
+
(function get() {
|
|
247
|
+
if (that.coder) {
|
|
248
|
+
resolve(that.coder)
|
|
249
|
+
} else {
|
|
250
|
+
setTimeout(get, 10)
|
|
251
|
+
}
|
|
252
|
+
})()
|
|
253
|
+
})
|
|
254
|
+
},
|
|
255
|
+
/**
|
|
256
|
+
* @private
|
|
257
|
+
* @param language
|
|
258
|
+
* @returns {{label: string, value: string} | {label: string, value: string} | {label: string, value: string} | {label: string, value: string} | {label: string, value: string}}
|
|
259
|
+
* 获取语法类型
|
|
260
|
+
*/
|
|
261
|
+
getLanguage(language) {
|
|
262
|
+
// 在支持的语法类型列表中寻找传入的语法类型
|
|
263
|
+
return this.modes.find((mode) => {
|
|
264
|
+
// 所有的值都忽略大小写,方便比较
|
|
265
|
+
const currentLanguage = language.toLowerCase()
|
|
266
|
+
const currentLabel = mode.label.toLowerCase()
|
|
267
|
+
const currentValue = mode.value.toLowerCase()
|
|
268
|
+
|
|
269
|
+
// 由于真实值可能不规范,例如 java 的真实值是 x-java ,所以讲 value 和 label 同时和传入语法进行比较
|
|
270
|
+
return (
|
|
271
|
+
currentLabel === currentLanguage || currentValue === currentLanguage
|
|
272
|
+
)
|
|
273
|
+
})
|
|
274
|
+
},
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
</script>
|
|
278
|
+
<style lang="scss" scoped>
|
|
279
|
+
.common-editor {
|
|
280
|
+
width: 100%;
|
|
281
|
+
height: 100%;
|
|
282
|
+
|
|
283
|
+
.CodeMirror {
|
|
284
|
+
// color: #ccc;
|
|
285
|
+
direction: ltr;
|
|
286
|
+
line-height: 20px;
|
|
287
|
+
width: 100%;
|
|
288
|
+
height: 100%;
|
|
289
|
+
// background-color: #000;
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
.CodeMirror-hints {
|
|
293
|
+
z-index: 9999 !important;
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
.custom-class .CodeMirror {
|
|
297
|
+
width: 100%;
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
.CodeMirror-hints {
|
|
302
|
+
z-index: 1000;
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
.CodeMirror pre.CodeMirror-placeholder {
|
|
306
|
+
color: #999;
|
|
307
|
+
font-size: 0.5rem;
|
|
308
|
+
}
|
|
309
|
+
</style>
|
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="common-editor">
|
|
3
|
+
<textarea ref="textarea" v-model="value" :placeholder="placeholder"></textarea>
|
|
4
|
+
</div>
|
|
5
|
+
</template>
|
|
6
|
+
|
|
7
|
+
<script>
|
|
8
|
+
import 'codemirror/lib/codemirror.css'
|
|
9
|
+
import 'codemirror/theme/base16-dark.css'
|
|
10
|
+
import 'codemirror/theme/blackboard.css'
|
|
11
|
+
import 'codemirror/addon/hint/show-hint.css'
|
|
12
|
+
import 'codemirror/addon/hint/show-hint.js'
|
|
13
|
+
import 'codemirror/addon/hint/show-hint'
|
|
14
|
+
import 'codemirror/addon/hint/javascript-hint'
|
|
15
|
+
import 'codemirror/addon/hint/sql-hint'
|
|
16
|
+
import 'codemirror/mode/javascript/javascript'
|
|
17
|
+
import 'codemirror/mode/vue/vue'
|
|
18
|
+
import 'codemirror/mode/markdown/markdown'
|
|
19
|
+
import 'codemirror/mode/sql/sql'
|
|
20
|
+
import 'codemirror/mode/php/php'
|
|
21
|
+
import 'codemirror/mode/python/python'
|
|
22
|
+
import 'codemirror/mode/shell/shell'
|
|
23
|
+
import 'codemirror/mode/powershell/powershell'
|
|
24
|
+
import 'codemirror/addon/display/placeholder.js'
|
|
25
|
+
|
|
26
|
+
import CodeMirror from 'codemirror/lib/codemirror'
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* 一个代码编辑器,支持多种语言
|
|
30
|
+
* 该组件已经全局注册,可以直接使用
|
|
31
|
+
* - 示例
|
|
32
|
+
*
|
|
33
|
+
* ```vue
|
|
34
|
+
* <ed-code-editor v-model="value"></ed-code-editor>
|
|
35
|
+
* ```
|
|
36
|
+
*/
|
|
37
|
+
|
|
38
|
+
export default {
|
|
39
|
+
name: 'EdCodeEditor',
|
|
40
|
+
props: {
|
|
41
|
+
// 编辑器的值, 可以通过 v-model 双向绑定
|
|
42
|
+
value: {
|
|
43
|
+
type: String,
|
|
44
|
+
default: ''
|
|
45
|
+
},
|
|
46
|
+
// 编辑器的占位符
|
|
47
|
+
placeholder: {
|
|
48
|
+
type: String,
|
|
49
|
+
default: ''
|
|
50
|
+
},
|
|
51
|
+
// 编辑器的语言
|
|
52
|
+
language: {
|
|
53
|
+
type: String,
|
|
54
|
+
default: 'javascript'
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
data() {
|
|
58
|
+
return {
|
|
59
|
+
CodeEditor: false,
|
|
60
|
+
code: '',
|
|
61
|
+
coder: null,
|
|
62
|
+
mode: 'javascript',
|
|
63
|
+
theme: 'default',
|
|
64
|
+
modes: [
|
|
65
|
+
{value: 'text/x-vue', label: 'Vue'},
|
|
66
|
+
{value: 'text/javascript', label: 'Javascript'},
|
|
67
|
+
{value: 'text/css', label: 'Css'},
|
|
68
|
+
{value: 'x-java', label: 'Java'},
|
|
69
|
+
{value: 'x-python', label: 'Python'},
|
|
70
|
+
{value: 'x-sql', label: 'SQL'},
|
|
71
|
+
{value: 'x-shell', label: 'Shell'},
|
|
72
|
+
{value: 'x-powershell', label: 'PowerShell'},
|
|
73
|
+
{value: 'x-php', label: 'PHP'}
|
|
74
|
+
]
|
|
75
|
+
}
|
|
76
|
+
},
|
|
77
|
+
watch: {
|
|
78
|
+
language: {
|
|
79
|
+
handler(language) {
|
|
80
|
+
this.getCoder().then(() => {
|
|
81
|
+
// 尝试从父容器获取语法类型
|
|
82
|
+
if (language) {
|
|
83
|
+
// 获取具体的语法类型对象
|
|
84
|
+
const modeObj = this.getLanguage(language)
|
|
85
|
+
// 判断父容器传入的语法是否被支持
|
|
86
|
+
if (modeObj) {
|
|
87
|
+
this.mode = modeObj.label
|
|
88
|
+
this.coder.setOption('mode', `text/${modeObj.value}`)
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
})
|
|
92
|
+
},
|
|
93
|
+
immediate: true
|
|
94
|
+
}
|
|
95
|
+
},
|
|
96
|
+
computed: {
|
|
97
|
+
coderOptions() {
|
|
98
|
+
return {
|
|
99
|
+
autoRefresh: true,
|
|
100
|
+
line: true,
|
|
101
|
+
mode: 'application/json', // json数据高亮
|
|
102
|
+
theme: 'blackboard', //设置主题 记得引入对应主题才有显示 import 'codemirror/theme/blackboard.css'
|
|
103
|
+
tabSize: 1,
|
|
104
|
+
lineNumbers: true, // 显示行号
|
|
105
|
+
cursorHeight: 0.8, //光标高度,默认是1
|
|
106
|
+
autoCloseBrackets: true,
|
|
107
|
+
matchBrackets: true, // 括号匹配
|
|
108
|
+
lineWrapping: 'wrap', // 文字过长时,是换行(wrap)还是滚动(scroll),默认是滚动
|
|
109
|
+
showCursorWhenSelecting: true, // 文本选中时显示光标
|
|
110
|
+
smartIndent: true, // 智能缩进
|
|
111
|
+
completeSingle: false // 当匹配只有一项的时候是否自动补全
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
},
|
|
115
|
+
mounted() {
|
|
116
|
+
// 初始化
|
|
117
|
+
this.initialize()
|
|
118
|
+
},
|
|
119
|
+
methods: {
|
|
120
|
+
/**
|
|
121
|
+
* @public
|
|
122
|
+
* 刷新编辑器
|
|
123
|
+
*/
|
|
124
|
+
refresh() {
|
|
125
|
+
this.coder.refresh()
|
|
126
|
+
},
|
|
127
|
+
// 初始化
|
|
128
|
+
initialize() {
|
|
129
|
+
// 初始化编辑器实例,传入需要被实例化的文本域对象和默认配置
|
|
130
|
+
this.coder = CodeMirror.fromTextArea(
|
|
131
|
+
this.$refs.textarea,
|
|
132
|
+
this.coderOptions
|
|
133
|
+
)
|
|
134
|
+
this.coder.refresh()
|
|
135
|
+
this.coder.on('inputRead', () => {
|
|
136
|
+
this.coder.showHint()
|
|
137
|
+
})
|
|
138
|
+
// 编辑器赋值
|
|
139
|
+
if (this.value || this.code) {
|
|
140
|
+
this.setCodeContent(this.value || this.code)
|
|
141
|
+
} else {
|
|
142
|
+
this.coder.setValue('')
|
|
143
|
+
}
|
|
144
|
+
// 支持双向绑定
|
|
145
|
+
this.coder.on('change', (coder) => {
|
|
146
|
+
this.code = coder.getValue()
|
|
147
|
+
if (this.$emit) {
|
|
148
|
+
this.$emit('input', this.code)
|
|
149
|
+
this.$emit('change', this.code)
|
|
150
|
+
}
|
|
151
|
+
})
|
|
152
|
+
},
|
|
153
|
+
/**
|
|
154
|
+
* @private
|
|
155
|
+
* @param val
|
|
156
|
+
* 设置编辑器内容
|
|
157
|
+
*/
|
|
158
|
+
setCodeContent(val) {
|
|
159
|
+
setTimeout(() => {
|
|
160
|
+
if (!val) {
|
|
161
|
+
this.coder.setValue('')
|
|
162
|
+
} else {
|
|
163
|
+
this.coder.setValue(val)
|
|
164
|
+
}
|
|
165
|
+
}, 300)
|
|
166
|
+
},
|
|
167
|
+
/**
|
|
168
|
+
* @private
|
|
169
|
+
* @returns {Promise<unknown>}
|
|
170
|
+
* 获取编辑器实例
|
|
171
|
+
*/
|
|
172
|
+
getCoder() {
|
|
173
|
+
const that = this
|
|
174
|
+
return new Promise((resolve) => {
|
|
175
|
+
(function get() {
|
|
176
|
+
if (that.coder) {
|
|
177
|
+
resolve(that.coder)
|
|
178
|
+
} else {
|
|
179
|
+
setTimeout(get, 10)
|
|
180
|
+
}
|
|
181
|
+
})()
|
|
182
|
+
})
|
|
183
|
+
},
|
|
184
|
+
/**
|
|
185
|
+
* @private
|
|
186
|
+
* @param language
|
|
187
|
+
* @returns {{label: string, value: string} | {label: string, value: string} | {label: string, value: string} | {label: string, value: string} | {label: string, value: string}}
|
|
188
|
+
* 获取语法类型
|
|
189
|
+
*/
|
|
190
|
+
getLanguage(language) {
|
|
191
|
+
// 在支持的语法类型列表中寻找传入的语法类型
|
|
192
|
+
return this.modes.find((mode) => {
|
|
193
|
+
// 所有的值都忽略大小写,方便比较
|
|
194
|
+
const currentLanguage = language.toLowerCase()
|
|
195
|
+
const currentLabel = mode.label.toLowerCase()
|
|
196
|
+
const currentValue = mode.value.toLowerCase()
|
|
197
|
+
|
|
198
|
+
// 由于真实值可能不规范,例如 java 的真实值是 x-java ,所以讲 value 和 label 同时和传入语法进行比较
|
|
199
|
+
return (
|
|
200
|
+
currentLabel === currentLanguage || currentValue === currentLanguage
|
|
201
|
+
)
|
|
202
|
+
})
|
|
203
|
+
},
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
</script>
|
|
207
|
+
<style lang="scss" scoped>
|
|
208
|
+
.common-editor {
|
|
209
|
+
width: 100%;
|
|
210
|
+
height: 100%;
|
|
211
|
+
|
|
212
|
+
.CodeMirror {
|
|
213
|
+
// color: #ccc;
|
|
214
|
+
direction: ltr;
|
|
215
|
+
line-height: 20px;
|
|
216
|
+
width: 100%;
|
|
217
|
+
height: 100%;
|
|
218
|
+
// background-color: #000;
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
.CodeMirror-hints {
|
|
222
|
+
z-index: 9999 !important;
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
.custom-class .CodeMirror {
|
|
226
|
+
width: 100%;
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
.CodeMirror-hints {
|
|
231
|
+
z-index: 1000;
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
.CodeMirror pre.CodeMirror-placeholder {
|
|
235
|
+
color: #999;
|
|
236
|
+
font-size: 0.5rem;
|
|
237
|
+
}
|
|
238
|
+
</style>
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import {friendlyDate} from '../../../tools/date-format'
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
name: "EdDate",
|
|
5
|
+
functional: true,
|
|
6
|
+
props: {
|
|
7
|
+
// date 日期对象/日期字符串/时间戳
|
|
8
|
+
date: {
|
|
9
|
+
type: [Object, String, Number],
|
|
10
|
+
},
|
|
11
|
+
// 格式化使用的语言
|
|
12
|
+
locale: {
|
|
13
|
+
type: String,
|
|
14
|
+
default: 'zh',
|
|
15
|
+
},
|
|
16
|
+
// 应用不同类型格式化的阈值
|
|
17
|
+
threshold: {
|
|
18
|
+
type: Array,
|
|
19
|
+
default() {
|
|
20
|
+
return [0, 0]
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
// 输出日期字符串时的格式
|
|
24
|
+
format: {
|
|
25
|
+
type: String,
|
|
26
|
+
default: 'yyyy/MM/dd hh:mm:ss'
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
render: (h, ctx) => {
|
|
30
|
+
let dataShow = "-"
|
|
31
|
+
if (ctx.props.date) {
|
|
32
|
+
dataShow = ctx.props.date
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
if (ctx.children) {
|
|
36
|
+
dataShow = ctx.children[0].text
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
let date = friendlyDate(dataShow, {
|
|
40
|
+
locale: ctx.props.locale,
|
|
41
|
+
threshold: ctx.props.threshold,
|
|
42
|
+
format: ctx.props.format
|
|
43
|
+
})
|
|
44
|
+
return h('span', {
|
|
45
|
+
domProps: {
|
|
46
|
+
innerHTML: date // 这里是要渲染的数据
|
|
47
|
+
}
|
|
48
|
+
})
|
|
49
|
+
}
|
|
50
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<el-descriptions v-bind="_buildProps()">
|
|
3
|
+
<template v-for="(column, index) in columns">
|
|
4
|
+
<el-descriptions-item v-if="showNullValue(column)" :key="index" :label="column.label">
|
|
5
|
+
<slot :cellValue="cellValue(column)" :column="column" :index="index" :name="slotName(column)" :row="data">
|
|
6
|
+
<ed-descriptions-item :column="column" :data="data" :index="index"></ed-descriptions-item>
|
|
7
|
+
</slot>
|
|
8
|
+
</el-descriptions-item>
|
|
9
|
+
</template>
|
|
10
|
+
</el-descriptions>
|
|
11
|
+
</template>
|
|
12
|
+
|
|
13
|
+
<script lang="jsx">
|
|
14
|
+
import EdDescriptionsItem from "./EdDescriptionsItem";
|
|
15
|
+
import lodashGet from 'lodash/get'
|
|
16
|
+
import Props from './Props'
|
|
17
|
+
|
|
18
|
+
export default {
|
|
19
|
+
name: "EdDescriptions",
|
|
20
|
+
components: {EdDescriptionsItem},
|
|
21
|
+
props: Props,
|
|
22
|
+
methods: {
|
|
23
|
+
// 设置组件属性
|
|
24
|
+
_buildProps() {
|
|
25
|
+
return Object.assign({}, this.$attrs, this.$props)
|
|
26
|
+
},
|
|
27
|
+
// 获取字段名
|
|
28
|
+
slotName(column) {
|
|
29
|
+
return column.prop.includes('.') ? column.prop.split('.').pop() : column.prop
|
|
30
|
+
},
|
|
31
|
+
// 获取字段值
|
|
32
|
+
cellValue(column) {
|
|
33
|
+
return lodashGet(this.data, column.prop) || ''
|
|
34
|
+
},
|
|
35
|
+
// 是否显示空值
|
|
36
|
+
showNullValue(column) {
|
|
37
|
+
let cellValue = lodashGet(this.data, column.prop)
|
|
38
|
+
return !this.showNull ? (cellValue !== undefined && cellValue !== null) : true
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
</script>
|
|
43
|
+
|
|
44
|
+
<style lang="scss" scoped>
|
|
45
|
+
@import "../../../style/index";
|
|
46
|
+
</style>
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import lodashGet from 'lodash/get'
|
|
2
|
+
import {isVNode} from "../../../tools/utils";
|
|
3
|
+
|
|
4
|
+
export default {
|
|
5
|
+
name: "EdDescriptionsItem",
|
|
6
|
+
props: {
|
|
7
|
+
column: {},
|
|
8
|
+
data: {},
|
|
9
|
+
index: Number,
|
|
10
|
+
},
|
|
11
|
+
render(h) {
|
|
12
|
+
let {prop, formatter} = this.column
|
|
13
|
+
let value = lodashGet(this.data, prop) || ''
|
|
14
|
+
if (formatter) {
|
|
15
|
+
let VNode = formatter(this.data, this.column, value, this.index)
|
|
16
|
+
return isVNode(this, VNode) ? VNode : h('span', VNode)
|
|
17
|
+
}
|
|
18
|
+
return h('span', value)
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
border: {type: Boolean, default: false},
|
|
3
|
+
column: {type: Number, default: 2},
|
|
4
|
+
direction: {type: String, default: 'horizontal'},
|
|
5
|
+
size: {type: String},
|
|
6
|
+
title: {type: String, default: ''},
|
|
7
|
+
extra: {type: String, default: ''},
|
|
8
|
+
labelStyle: {type: Object},
|
|
9
|
+
contentStyle: {type: Object},
|
|
10
|
+
labelClassName: {type: String, default: ''},
|
|
11
|
+
contentClassName: {type: String, default: ''},
|
|
12
|
+
colon: {type: Boolean, default: true},
|
|
13
|
+
|
|
14
|
+
// 描述
|
|
15
|
+
columns: {type: Array},
|
|
16
|
+
// 值
|
|
17
|
+
data: {type: Object},
|
|
18
|
+
// 是否显示空值
|
|
19
|
+
showNull: {type: Boolean, default: true}
|
|
20
|
+
}
|