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,228 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<!-- 表单内容渲染 -->
|
|
3
|
+
<div id="EasyDataFormContent">
|
|
4
|
+
<component :is="getComponent(control)" :ref="control.id"
|
|
5
|
+
v-model="formModel[control.controlName]"
|
|
6
|
+
v-bind="buildProps(control, controlProp)"
|
|
7
|
+
@change="(e) => handleChange(e, control)"
|
|
8
|
+
@visible-change="selectVisibleChange">
|
|
9
|
+
|
|
10
|
+
<!-- 下拉|单选|多选 子元素插槽 -->
|
|
11
|
+
<template v-if="showOptions(control.controlType)">
|
|
12
|
+
<ed-option-slot v-for="(ds, i) in controlProp.dataSource"
|
|
13
|
+
:key="i" :data="ds" :tags="getComponent(control)"></ed-option-slot>
|
|
14
|
+
</template>
|
|
15
|
+
|
|
16
|
+
<!-- 输入框后置内容插槽 -->
|
|
17
|
+
<template #append>
|
|
18
|
+
<slot :control="control" :prop="controlProp" name="append"></slot>
|
|
19
|
+
</template>
|
|
20
|
+
|
|
21
|
+
<!-- 上传组件样式插槽 -->
|
|
22
|
+
<template #upload>
|
|
23
|
+
<slot :control="control" :prop="controlProp" name="upload"></slot>
|
|
24
|
+
</template>
|
|
25
|
+
|
|
26
|
+
<!-- 文本框 -->
|
|
27
|
+
<template v-if="control.controlType === 'label'">
|
|
28
|
+
{{ formModel[control.controlName] }}
|
|
29
|
+
</template>
|
|
30
|
+
</component>
|
|
31
|
+
</div>
|
|
32
|
+
</template>
|
|
33
|
+
|
|
34
|
+
<script>
|
|
35
|
+
import {controlType} from "../../../utils/setting";
|
|
36
|
+
import {getVarType} from "../../../utils/utils";
|
|
37
|
+
import {initHeaders} from "../../../utils/useBusiness";
|
|
38
|
+
import {DefaultUrl} from "../../../api/easyData";
|
|
39
|
+
import useUpload from "../hooks/useUpload";
|
|
40
|
+
|
|
41
|
+
export default {
|
|
42
|
+
name: "FormItem",
|
|
43
|
+
mixins: [useUpload],
|
|
44
|
+
props: {
|
|
45
|
+
control: {type: Object, default: () => {}},
|
|
46
|
+
controlProp: {type: Object, default: () => {}},
|
|
47
|
+
isSearchForm: {type: Boolean, default: false},
|
|
48
|
+
formModel: {type: Object, default: () => {}}
|
|
49
|
+
},
|
|
50
|
+
methods: {
|
|
51
|
+
/**
|
|
52
|
+
* 获取组件配置信息
|
|
53
|
+
* @name getComponent
|
|
54
|
+
* @param control
|
|
55
|
+
* @returns {object}
|
|
56
|
+
*/
|
|
57
|
+
getComponent(control) {
|
|
58
|
+
const {attribute} = controlType.find(i => i.value === control.controlType)
|
|
59
|
+
|
|
60
|
+
// 搜索表单下,switch转为select
|
|
61
|
+
if (control.controlType === '_switch' && this.isSearchForm === true) {
|
|
62
|
+
return 'el-select'
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
// 读取渲染组件
|
|
66
|
+
if (getVarType(attribute) === 'string') {
|
|
67
|
+
return attribute
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* 设置单项组件配置信息
|
|
73
|
+
* @name buildProps
|
|
74
|
+
* @param control
|
|
75
|
+
* @param controlProps
|
|
76
|
+
* @returns {{}}
|
|
77
|
+
*/
|
|
78
|
+
buildProps(control, controlProps) {
|
|
79
|
+
let props = {}
|
|
80
|
+
if (controlProps) {
|
|
81
|
+
const controlProp = controlProps.form ? controlProps.form : controlProps
|
|
82
|
+
|
|
83
|
+
for (let prop in controlProp) {
|
|
84
|
+
if (controlProp[prop] || controlProp[prop] === false) props[prop] = controlProp[prop]
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
// upload 组件
|
|
88
|
+
if (control.controlType === 'upload') {
|
|
89
|
+
props = Object.assign({}, props, this.bindUploadProps(control, controlProps))
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
//多行输入框
|
|
93
|
+
if (control.controlType === 'textarea') {
|
|
94
|
+
props.type = 'textarea'
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
//级连选择框
|
|
98
|
+
if (control.controlType === 'cascader') {
|
|
99
|
+
props.options = controlProps.dataSource
|
|
100
|
+
props.props = props.props ? Object.assign(props.props, {multiple: controlProps.multiple}) : {multiple: controlProps.multiple}
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
//级连选择框
|
|
104
|
+
if (control.controlType === 'checkbox') {
|
|
105
|
+
delete props.dataSource
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
//单选框
|
|
109
|
+
if (control.controlType === 'select') {
|
|
110
|
+
if (props.isCreate === true) {
|
|
111
|
+
props.multiple = true
|
|
112
|
+
props.filterable = true
|
|
113
|
+
props.allowCreate = true
|
|
114
|
+
props.defaultFirstOption = true
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
//数字输入框
|
|
119
|
+
if (control.controlType === 'inputNumber') {
|
|
120
|
+
props.controlsPosition = 'right'
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
//搜索项开关
|
|
124
|
+
if (control.controlType === '_switch' && this.isSearchForm) {
|
|
125
|
+
props.clearable = true
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
//选择弹窗
|
|
129
|
+
if (control.controlType === 'popup') {
|
|
130
|
+
props.disabled = true
|
|
131
|
+
}
|
|
132
|
+
//富文本
|
|
133
|
+
if (control.controlType === 'editor') {
|
|
134
|
+
props = Object.assign({}, props, this.bindEditorProps(control, controlProps))
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
return props
|
|
139
|
+
},
|
|
140
|
+
|
|
141
|
+
/**
|
|
142
|
+
* @name bindUploadProps
|
|
143
|
+
* @param control
|
|
144
|
+
* @param controlProps
|
|
145
|
+
* @returns {{}}
|
|
146
|
+
* @description 设置upload组件props参数
|
|
147
|
+
*/
|
|
148
|
+
bindUploadProps(control, controlProps) {
|
|
149
|
+
let props = {}
|
|
150
|
+
props.headers = this.$EdFrame.BASE_HEADERS()
|
|
151
|
+
|
|
152
|
+
props.action = this.$EdFrame.BASE_API + '/admin-api' + DefaultUrl.uploadUrl
|
|
153
|
+
props.limit = controlProps.limit
|
|
154
|
+
props.subDir = controlProps.subDir
|
|
155
|
+
props.listType = controlProps.listType ? controlProps.listType : 'text'
|
|
156
|
+
props.beforeUpload = (file) => this.beforeUpload(file, control)
|
|
157
|
+
props.onPreview = (v) => this.uploadHandleDownload(v, control)
|
|
158
|
+
props.onSuccess = (res, file, fileList) => this.uploadHandleSuccess(res, file, fileList, control)
|
|
159
|
+
props.onExceed = (v) => this.uploadHandleExceed(v, controlProps)
|
|
160
|
+
props.onRemove = (file, fileList) => this.uploadHandleRemove(file, fileList, control.controlName)
|
|
161
|
+
props.fileList = this.initFileList(this.formModel[control.controlName])
|
|
162
|
+
props.data = controlProps
|
|
163
|
+
return props
|
|
164
|
+
},
|
|
165
|
+
|
|
166
|
+
bindEditorProps(control, controlProps) {
|
|
167
|
+
let props = {}
|
|
168
|
+
props.editorConfig = {
|
|
169
|
+
placeholder: "<p style='font-size: 14px'>请输入内容...</p>",
|
|
170
|
+
// 所有的菜单配置,都要在 MENU_CONF 属性下
|
|
171
|
+
MENU_CONF: {
|
|
172
|
+
uploadImage: {
|
|
173
|
+
server: this.$EdFrame.BASE_API + '/admin-api' + DefaultUrl.uploadUrl,
|
|
174
|
+
fieldName: 'file',
|
|
175
|
+
maxNumberOfFiles: 10,
|
|
176
|
+
allowedFileTypes: ['image/*'],
|
|
177
|
+
meta: {
|
|
178
|
+
subDir: 'tours'
|
|
179
|
+
},
|
|
180
|
+
metaWithUrl: false,
|
|
181
|
+
headers: this.$EdFrame.BASE_HEADERS(),
|
|
182
|
+
withCredentials: false,
|
|
183
|
+
timeout: 10 * 1000,
|
|
184
|
+
...props,
|
|
185
|
+
maxFileSize: props.maxFileSize * 1024 * 1024,
|
|
186
|
+
customInsert(res, insertFn) {
|
|
187
|
+
if(res.code == 0) {
|
|
188
|
+
console.log(`${res.data.name} 上传成功`, res)
|
|
189
|
+
insertFn(res.data.url, res.data.name, res.data.filePath);
|
|
190
|
+
}else {
|
|
191
|
+
this.$message.error("上传失败:" + res.msg)
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
},
|
|
195
|
+
onSuccess(file, res) {
|
|
196
|
+
console.log(`${file.name} 上传成功`, res);
|
|
197
|
+
},
|
|
198
|
+
onFailed(file, res) {
|
|
199
|
+
console.log(`${file.name} 上传失败`, res);
|
|
200
|
+
},
|
|
201
|
+
onError(file, err, res) {
|
|
202
|
+
console.log(`${file.name} 上传出错`, err, res);
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
return props;
|
|
208
|
+
},
|
|
209
|
+
|
|
210
|
+
/**
|
|
211
|
+
* @name handleChange
|
|
212
|
+
* @param e
|
|
213
|
+
* @param value
|
|
214
|
+
*/
|
|
215
|
+
handleChange(e, value) {
|
|
216
|
+
this.$emit('change', e, value)
|
|
217
|
+
},
|
|
218
|
+
|
|
219
|
+
selectVisibleChange(e) {
|
|
220
|
+
if (!e && this.isSearchForm) this.$refs[this.control.id].blur()
|
|
221
|
+
},
|
|
222
|
+
showOptions(type) {
|
|
223
|
+
return ['checkbox', 'select', 'radio', '_switch'].includes(type)
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
</script>
|
|
228
|
+
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import {getControlProp} from "../../../utils/useBusiness";
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
methods: {
|
|
5
|
+
/**
|
|
6
|
+
* @name chosePopup
|
|
7
|
+
* @param control
|
|
8
|
+
* @description 打开选择弹窗
|
|
9
|
+
*/
|
|
10
|
+
chosePopup(control) {
|
|
11
|
+
this.visible = true
|
|
12
|
+
this.$nextTick(() => {
|
|
13
|
+
if (this.controlProps[control.id]) {
|
|
14
|
+
let controlProp = getControlProp(control, this.controlProps)
|
|
15
|
+
let componentName = controlProp.compType === 'system' ? controlProp.popupMode + control.id : controlProp.component + control.id
|
|
16
|
+
this.currentPopupComponent = this.popupComponents[componentName]
|
|
17
|
+
this.popupCache = {
|
|
18
|
+
ref: componentName,
|
|
19
|
+
control: control
|
|
20
|
+
}
|
|
21
|
+
if (controlProp.params) {
|
|
22
|
+
let params = {}
|
|
23
|
+
if (controlProp.params.indexOf(",") > 0) {
|
|
24
|
+
let tr = controlProp.params.split(',')
|
|
25
|
+
tr.forEach(t => {
|
|
26
|
+
params[t] = this.popupFormModel[t] ? this.popupFormModel[t] : this.formModel[t]
|
|
27
|
+
})
|
|
28
|
+
} else {
|
|
29
|
+
params[controlProp.params] = this.popupFormModel[controlProp.params] ? this.popupFormModel[controlProp.params] : this.formModel[controlProp.params]
|
|
30
|
+
}
|
|
31
|
+
this.$nextTick(() => {
|
|
32
|
+
try {
|
|
33
|
+
let componentRef = this.$refs[componentName]
|
|
34
|
+
if (componentRef) {
|
|
35
|
+
componentRef.loadData(params)
|
|
36
|
+
}
|
|
37
|
+
} catch (e) {
|
|
38
|
+
throw "错误的加载方法:" + e
|
|
39
|
+
}
|
|
40
|
+
})
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
})
|
|
44
|
+
},
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* @name handleOk
|
|
48
|
+
* @description 选择弹窗关闭取值
|
|
49
|
+
*/
|
|
50
|
+
async handleOk() {
|
|
51
|
+
const {
|
|
52
|
+
ref,
|
|
53
|
+
control
|
|
54
|
+
} = this.popupCache
|
|
55
|
+
let controlProp = getControlProp(control, this.controlProps)
|
|
56
|
+
let componentName = controlProp.compType === 'system' ? controlProp.popupMode + control.id : controlProp.component + control.id
|
|
57
|
+
const data = await this.$refs[componentName].getData()
|
|
58
|
+
if (data) {
|
|
59
|
+
if(data instanceof Array){
|
|
60
|
+
let arr = []
|
|
61
|
+
data.forEach(item => {
|
|
62
|
+
arr.push(item.label)
|
|
63
|
+
})
|
|
64
|
+
this.$set(this.formModel, control.controlName, arr.join(','))
|
|
65
|
+
}else {
|
|
66
|
+
this.$set(this.formModel, control.controlName, data.label);
|
|
67
|
+
}
|
|
68
|
+
this.$set(this.popupFormModel, control.controlName, data);
|
|
69
|
+
this.$refs.EasyDataForm.clearValidate(control.controlName)
|
|
70
|
+
this.$emit("chosePopupOk", data, control)
|
|
71
|
+
this.customizeChangeHandler(data.value, control)
|
|
72
|
+
this.visible = false
|
|
73
|
+
} else {
|
|
74
|
+
this.$message.warn('未选中~')
|
|
75
|
+
}
|
|
76
|
+
},
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* @name handleClose
|
|
80
|
+
*/
|
|
81
|
+
handleClose() {
|
|
82
|
+
this.visible = false
|
|
83
|
+
},
|
|
84
|
+
}
|
|
85
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
methods: {
|
|
3
|
+
/**
|
|
4
|
+
* @name customizeChangeHandler
|
|
5
|
+
* @param value
|
|
6
|
+
* @param control
|
|
7
|
+
*/
|
|
8
|
+
customizeChangeHandler(value, control) {
|
|
9
|
+
this.$emit('customizeChange', this, value, control)
|
|
10
|
+
},
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* @name initOk
|
|
14
|
+
*/
|
|
15
|
+
initOk() {
|
|
16
|
+
this.$emit('ok', this)
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
import {getControlProp} from "../../../utils/useBusiness";
|
|
2
|
+
import * as popupComponentList from '../../../popup'
|
|
3
|
+
import {postAction} from '../../../api'
|
|
4
|
+
import {DefaultUrl} from "../../../api/easyData";
|
|
5
|
+
|
|
6
|
+
export default {
|
|
7
|
+
data() {
|
|
8
|
+
return {
|
|
9
|
+
triggerControls: {},
|
|
10
|
+
// 选择弹窗组件列表
|
|
11
|
+
popupComponents: [],
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
methods: {
|
|
15
|
+
/**
|
|
16
|
+
* @description 配置form表单校验规则
|
|
17
|
+
*/
|
|
18
|
+
initRules() {
|
|
19
|
+
return new Promise((resolve, reject) => {
|
|
20
|
+
this.formRules = {}
|
|
21
|
+
if (this.controlInfos) {
|
|
22
|
+
if (this.$refs.EasyDataForm) {
|
|
23
|
+
this.$refs.EasyDataForm.clearValidate()
|
|
24
|
+
}
|
|
25
|
+
this.controlInfos.forEach(async control => {
|
|
26
|
+
let controlProp = getControlProp(control, this.controlProps);
|
|
27
|
+
control['isShow'] = this.isShowItem(control)
|
|
28
|
+
|
|
29
|
+
// 添加验证
|
|
30
|
+
if (!this.formRules[control.controlName]) {
|
|
31
|
+
this.formRules[control.controlName] = []
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
//控件基础属性
|
|
35
|
+
this.formRules[control.controlName].push({
|
|
36
|
+
required: this.getFormItemRequired(control),
|
|
37
|
+
message: '请输入' + control.label
|
|
38
|
+
})
|
|
39
|
+
|
|
40
|
+
// 设置控件属性 - 最大长度
|
|
41
|
+
if (controlProp.maxLength) {
|
|
42
|
+
this.formRules[control.controlName].push({
|
|
43
|
+
max: controlProp.maxLength,
|
|
44
|
+
message: '最大长度' + controlProp.maxLength
|
|
45
|
+
})
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
// 设置控件属性 - 最小长度
|
|
49
|
+
if (controlProp.minLength) {
|
|
50
|
+
this.formRules[control.controlName].push({
|
|
51
|
+
min: controlProp.minLength,
|
|
52
|
+
message: '最小长度' + controlProp.minLength
|
|
53
|
+
})
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
// 设置验证表达式
|
|
57
|
+
if (controlProp.validateExpression) {
|
|
58
|
+
this.formRules[control.controlName].push({
|
|
59
|
+
pattern: eval(controlProp.validateExpression),
|
|
60
|
+
message: control.label + '格式不正确'
|
|
61
|
+
})
|
|
62
|
+
}
|
|
63
|
+
// }
|
|
64
|
+
// 设置控件默认组件
|
|
65
|
+
await this.initFormComp(control, controlProp)
|
|
66
|
+
})
|
|
67
|
+
resolve(true)
|
|
68
|
+
}
|
|
69
|
+
})
|
|
70
|
+
},
|
|
71
|
+
/**
|
|
72
|
+
* @param control
|
|
73
|
+
* @param controlProp
|
|
74
|
+
* @description 表单初始组件装填
|
|
75
|
+
*/
|
|
76
|
+
async initFormComp(control, controlProp) {
|
|
77
|
+
//为弹窗时,动态加载组件
|
|
78
|
+
if (control.controlType === 'popup') {
|
|
79
|
+
if (controlProp) {
|
|
80
|
+
let templateName = controlProp.compType === 'system' ? controlProp.popupMode : controlProp.component
|
|
81
|
+
if (templateName) {
|
|
82
|
+
let componentName = templateName + control.id
|
|
83
|
+
this.popupComponents[componentName] = {
|
|
84
|
+
component: popupComponentList[templateName] ? popupComponentList[templateName] : templateName,
|
|
85
|
+
ref: componentName,
|
|
86
|
+
control: control,
|
|
87
|
+
controlProp: controlProp
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
//写入触发控件
|
|
94
|
+
if (controlProp && controlProp.dataSource && controlProp.dataSource.length > 0) {
|
|
95
|
+
controlProp.dataSource.forEach(ds => {
|
|
96
|
+
if (ds.triggerControl) {
|
|
97
|
+
if (!this.triggerControls[control.controlName]) {
|
|
98
|
+
this.triggerControls[control.controlName] = []
|
|
99
|
+
}
|
|
100
|
+
this.triggerControls[control.controlName].push({
|
|
101
|
+
trigger: ds.triggerControl,
|
|
102
|
+
value: ds.value
|
|
103
|
+
})
|
|
104
|
+
}
|
|
105
|
+
})
|
|
106
|
+
}
|
|
107
|
+
},
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* @name validateForm
|
|
111
|
+
* @returns {Promise<unknown>}
|
|
112
|
+
* @description 验证form表单
|
|
113
|
+
*/
|
|
114
|
+
validateForm() {
|
|
115
|
+
return new Promise(async (resolve, reject) => {
|
|
116
|
+
try {
|
|
117
|
+
await this.$refs.EasyDataForm.validate();
|
|
118
|
+
|
|
119
|
+
//查询参数
|
|
120
|
+
this.controlInfos.forEach((control) => {
|
|
121
|
+
//获取数据
|
|
122
|
+
if (!control.isInput && control.defaultValue && control.isShow) {
|
|
123
|
+
this.formModel[control.controlName] = control.defaultValue === 'true' ? true : control.defaultValue === 'false' ? false : control.defaultValue
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
//判断文件是否为空
|
|
127
|
+
if (control.controlType === 'upload' && control.isRequired && control.isShow) {
|
|
128
|
+
if (!this.formModel[control.controlName] || this.formModel[control.controlName].length === 0) {
|
|
129
|
+
reject('请上传' + control.label);
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
})
|
|
133
|
+
resolve()
|
|
134
|
+
} catch (e) {
|
|
135
|
+
reject(e)
|
|
136
|
+
}
|
|
137
|
+
})
|
|
138
|
+
},
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* 计算联动公式
|
|
142
|
+
*/
|
|
143
|
+
clickExpression(controlInfo, controlProp) {
|
|
144
|
+
const {expression} = controlProp
|
|
145
|
+
if (!expression) {
|
|
146
|
+
this.$message.error('请配置联动公式')
|
|
147
|
+
return;
|
|
148
|
+
}
|
|
149
|
+
this.$set(this.formModel, controlInfo.controlName, eval(expression));
|
|
150
|
+
},
|
|
151
|
+
|
|
152
|
+
/**
|
|
153
|
+
* 查询表单数据
|
|
154
|
+
*/
|
|
155
|
+
async queryFormData() {
|
|
156
|
+
return new Promise((resolve, reject) => {
|
|
157
|
+
let url = this.loadQuery.url || DefaultUrl.selectData
|
|
158
|
+
let param = Object.assign({dataSourceName: this.dataSourceName}, this.loadQuery.param)
|
|
159
|
+
postAction(url, param).then(res => {
|
|
160
|
+
if (res.success && res.data) {
|
|
161
|
+
resolve(res.data)
|
|
162
|
+
}
|
|
163
|
+
}).catch(e => {
|
|
164
|
+
reject(e)
|
|
165
|
+
})
|
|
166
|
+
})
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
}
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
import {getControlProp} from "../../../utils/useBusiness";
|
|
2
|
+
import {DefaultUrl, getFileAccessHttpUrl} from "../../../api/easyData";
|
|
3
|
+
|
|
4
|
+
export default {
|
|
5
|
+
data() {
|
|
6
|
+
return {
|
|
7
|
+
downloadUrl: '/admin-api/infra/file/'
|
|
8
|
+
}
|
|
9
|
+
},
|
|
10
|
+
methods: {
|
|
11
|
+
/**
|
|
12
|
+
* @name beforeUpload
|
|
13
|
+
* @param file
|
|
14
|
+
* @param control
|
|
15
|
+
* @return {Promise<unknown>|*}
|
|
16
|
+
*/
|
|
17
|
+
beforeUpload(file, control) {
|
|
18
|
+
let controlProp = getControlProp(control, this.controlProps);
|
|
19
|
+
if (controlProp.isWatermark) {
|
|
20
|
+
return new Promise(async (resolve, reject) => {
|
|
21
|
+
let info = ''
|
|
22
|
+
if (controlProp.watermarkType === '1') {
|
|
23
|
+
let geolocation = MapLoader.initMap("map-container"); //定位
|
|
24
|
+
AMap.event.addListener(geolocation, "complete", result => {
|
|
25
|
+
info = result.formattedAddress + '||' + new Date().toLocaleString()
|
|
26
|
+
this.transformFile(file, info).then(res => {
|
|
27
|
+
resolve(res)
|
|
28
|
+
}).catch(error => {
|
|
29
|
+
reject(error)
|
|
30
|
+
})
|
|
31
|
+
});
|
|
32
|
+
} else {
|
|
33
|
+
info = controlProp.watermarkInfo
|
|
34
|
+
this.transformFile(file, info).then(res => {
|
|
35
|
+
resolve(res)
|
|
36
|
+
}).catch(error => {
|
|
37
|
+
reject(error)
|
|
38
|
+
})
|
|
39
|
+
}
|
|
40
|
+
})
|
|
41
|
+
} else {
|
|
42
|
+
return file
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* @name transformFile
|
|
48
|
+
* @param file
|
|
49
|
+
* @param info
|
|
50
|
+
* @return {Promise<unknown>}
|
|
51
|
+
*/
|
|
52
|
+
transformFile(file, info) {
|
|
53
|
+
return new Promise(resolve => {
|
|
54
|
+
const reader = new FileReader();
|
|
55
|
+
reader.readAsDataURL(file);
|
|
56
|
+
reader.onload = () => {
|
|
57
|
+
const canvas = document.createElement('canvas');
|
|
58
|
+
const img = document.createElement('img');
|
|
59
|
+
img.src = reader.result;
|
|
60
|
+
img.onload = () => {
|
|
61
|
+
const ctx = canvas.getContext('2d');
|
|
62
|
+
let width = img.width;
|
|
63
|
+
let height = img.height;
|
|
64
|
+
canvas.width = width;
|
|
65
|
+
canvas.height = height;
|
|
66
|
+
ctx.drawImage(img, 0, 0, width, height);
|
|
67
|
+
ctx.font = "800 30px Microsoft JhengHei";
|
|
68
|
+
ctx.fillStyle = "red";
|
|
69
|
+
ctx.textAlign = 'right';
|
|
70
|
+
ctx.textBaseline = 'Middle';
|
|
71
|
+
let text = info.split('||')
|
|
72
|
+
text.forEach((t, i) => {
|
|
73
|
+
ctx.fillText(t, width - 50, height - (50 + 30 * (text.length - (i + 1))))
|
|
74
|
+
})
|
|
75
|
+
let dataUrl = canvas.toDataURL("image/jpeg", 1)
|
|
76
|
+
resolve(this.dataURLtoFile(dataUrl, file.name))
|
|
77
|
+
};
|
|
78
|
+
};
|
|
79
|
+
});
|
|
80
|
+
},
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* @name uploadHandlePreview
|
|
85
|
+
* @param file
|
|
86
|
+
* @param control
|
|
87
|
+
* @description 文件预览
|
|
88
|
+
*/
|
|
89
|
+
uploadHandlePreview(file, control) {
|
|
90
|
+
if (file.url) {
|
|
91
|
+
let fileType = file.type
|
|
92
|
+
if (fileType.indexOf('image') > -1) {
|
|
93
|
+
this.previewImage = getFileAccessHttpUrl(file.url)
|
|
94
|
+
} else if (fileType.indexOf('pdf') > -1) {
|
|
95
|
+
this.$refs.PdfPreviewModal.previewFiles(getFileAccessHttpUrl(file.url))
|
|
96
|
+
} else {
|
|
97
|
+
this.uploadHandleDownload(file, control)
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
},
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* @name uploadHandleSuccess
|
|
104
|
+
* @param res
|
|
105
|
+
* @param file
|
|
106
|
+
* @param fileList
|
|
107
|
+
* @param control
|
|
108
|
+
*/
|
|
109
|
+
uploadHandleSuccess(res, file, fileList, control) {
|
|
110
|
+
const files = this.formModel[control.controlName] || []
|
|
111
|
+
if (res.code === 0) {
|
|
112
|
+
//参考如下代码即可
|
|
113
|
+
if (fileList.every(item => item.status === "success")) {
|
|
114
|
+
//由于fileList是所有的文件包含之前已上传过的,这里需要做区分(带response的即为新上传的)
|
|
115
|
+
fileList.map(item => {
|
|
116
|
+
item.response && files.push(item.response.data);
|
|
117
|
+
})
|
|
118
|
+
}
|
|
119
|
+
} else {
|
|
120
|
+
let index = fileList.findIndex(i => i.uid === file.uid)
|
|
121
|
+
if (index !== -1) {
|
|
122
|
+
fileList.splice(index, 1)
|
|
123
|
+
}
|
|
124
|
+
this.$message({message: res.msg || "上传失败!", type: 'error', duration: 1500})
|
|
125
|
+
}
|
|
126
|
+
},
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* @name 文件下载
|
|
130
|
+
* @param file
|
|
131
|
+
* @description 新窗口打开
|
|
132
|
+
*/
|
|
133
|
+
uploadHandleDownload(file) {
|
|
134
|
+
if (file.filePath) window.open(getFileAccessHttpUrl(DefaultUrl.downloadUrl + file.configId + "/get/" + file.filePath))
|
|
135
|
+
},
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* 超过设置文件上传上限时
|
|
139
|
+
* @param file
|
|
140
|
+
* @param controlProps
|
|
141
|
+
*/
|
|
142
|
+
uploadHandleExceed(file, controlProps) {
|
|
143
|
+
this.$message.error(`文件数量超过限制,最大允许上传 ${controlProps.limit} 个文件`)
|
|
144
|
+
},
|
|
145
|
+
|
|
146
|
+
/**
|
|
147
|
+
* @name uploadHandleRemove
|
|
148
|
+
* @param file
|
|
149
|
+
* @param controlName
|
|
150
|
+
*/
|
|
151
|
+
uploadHandleRemove(file, fileList, controlName) {
|
|
152
|
+
this.formModel[controlName] = fileList.filter(i => i.uid !== file.uid)
|
|
153
|
+
},
|
|
154
|
+
|
|
155
|
+
initFileList(fileList) {
|
|
156
|
+
let result = []
|
|
157
|
+
if (fileList && fileList instanceof Array) {
|
|
158
|
+
return fileList.map(file => {
|
|
159
|
+
if (!file.url.includes(this.$EdFrame.BASE_API)) {
|
|
160
|
+
file.url = getFileAccessHttpUrl(DefaultUrl.downloadUrl + file.configId + "/get/" + file.filePath)
|
|
161
|
+
}
|
|
162
|
+
return file
|
|
163
|
+
})
|
|
164
|
+
}
|
|
165
|
+
return result;
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
}
|