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,15 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
methods: {
|
|
3
|
+
/**
|
|
4
|
+
* 超级提交完成后
|
|
5
|
+
* @name superSubmitOk
|
|
6
|
+
* @param formData 提交数据
|
|
7
|
+
* @param isSupper 是否超级提交
|
|
8
|
+
*/
|
|
9
|
+
submitOk(formData, isSupper) {
|
|
10
|
+
this.queryModuleData();
|
|
11
|
+
this.$emit('submitOk', formData, isSupper)
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
methods: {
|
|
3
|
+
// 数据校检 (对外暴露)
|
|
4
|
+
validate(moduleId) {
|
|
5
|
+
if (moduleId) {
|
|
6
|
+
return this.validateOneValue(moduleId)
|
|
7
|
+
} else {
|
|
8
|
+
return this.validateAllValue()
|
|
9
|
+
}
|
|
10
|
+
},
|
|
11
|
+
|
|
12
|
+
// 检测所有模块数据
|
|
13
|
+
validateAllValue() {
|
|
14
|
+
const PromiseAll = []
|
|
15
|
+
this.modules.map(module => PromiseAll.push(this.$refs[module.id][0].validate()))
|
|
16
|
+
return new Promise((resolve, reject) => {
|
|
17
|
+
Promise.all(PromiseAll).then(valid => {
|
|
18
|
+
resolve(true)
|
|
19
|
+
}).catch(err => {
|
|
20
|
+
resolve(err)
|
|
21
|
+
})
|
|
22
|
+
})
|
|
23
|
+
},
|
|
24
|
+
|
|
25
|
+
// 检测单个一级模块数据
|
|
26
|
+
validateOneValue(moduleId) {
|
|
27
|
+
return new Promise((resolve, reject) => {
|
|
28
|
+
const module = this.modules.find(i => i.id === moduleId);
|
|
29
|
+
if (module) {
|
|
30
|
+
this.$refs[module.id][0].validate().then((res) => {
|
|
31
|
+
resolve(true)
|
|
32
|
+
}).catch((err) => {
|
|
33
|
+
resolve(false)
|
|
34
|
+
})
|
|
35
|
+
} else {
|
|
36
|
+
reject('未查询到此模块')
|
|
37
|
+
}
|
|
38
|
+
})
|
|
39
|
+
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
@@ -0,0 +1,597 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div v-loading="initLoading">
|
|
3
|
+
<!-- form表单 -->
|
|
4
|
+
<el-form ref="EasyDataForm" :style="{height: height}" class="ed-form--box" v-bind="getBindValue()">
|
|
5
|
+
<slot name="formHeader" :model="formModel" :isSearchForm="isSearchForm" :controlInfos="controlInfos"></slot>
|
|
6
|
+
<template v-for="(control, index) in controlInfos">
|
|
7
|
+
<slot :control="control" :control-prop="getControlProp(control)" :isSearchForm="isSearchForm"
|
|
8
|
+
:model="formModel" :name="control.controlName+'Wrapper'">
|
|
9
|
+
<el-form-item v-if="showFormItem(control)" :prop="control.controlName">
|
|
10
|
+
<!-- 表单项标签文本的内容 -->
|
|
11
|
+
<template #label>
|
|
12
|
+
<span :class="{'el-form-item-required': control.isRequired && control.controlType ==='upload'}">
|
|
13
|
+
{{ control.label }}
|
|
14
|
+
<el-tooltip v-if="showTooltip(control)" :content="getControlProp(control).tips" effect="dark" placement="top">
|
|
15
|
+
<i class="el-icon-question"></i>
|
|
16
|
+
</el-tooltip>
|
|
17
|
+
</span>
|
|
18
|
+
</template>
|
|
19
|
+
|
|
20
|
+
<slot :control="control" :control-prop="getControlProp(control)"
|
|
21
|
+
:data="formModel[control.controlName]"
|
|
22
|
+
:isSearchForm="isSearchForm"
|
|
23
|
+
:model="formModel" :name="control.controlName">
|
|
24
|
+
<FormItem :key="control.id" :control="control" :control-prop="getControlProp(control)"
|
|
25
|
+
:form-model="formModel" :isSearchForm="isSearchForm" @change="triggerControl">
|
|
26
|
+
<!-- 计算公式 -->
|
|
27
|
+
<template v-slot:append="{prop}">
|
|
28
|
+
<span v-if="showAppendSlots(control, prop)">
|
|
29
|
+
<!-- 选择弹窗 -->
|
|
30
|
+
<el-button v-if="control.controlType === 'popup'" @click="chosePopup(control)">选择</el-button>
|
|
31
|
+
|
|
32
|
+
<!-- 计算公式 -->
|
|
33
|
+
<el-button v-if="control.controlType === 'expression'" @click="clickExpression(control, prop)">计算公式</el-button>
|
|
34
|
+
|
|
35
|
+
<!-- 搜索项 -->
|
|
36
|
+
<el-button v-if="control.controlType === 'input' && prop?.isCallback" id="search">搜索项</el-button>
|
|
37
|
+
</span>
|
|
38
|
+
</template>
|
|
39
|
+
</FormItem>
|
|
40
|
+
</slot>
|
|
41
|
+
</el-form-item>
|
|
42
|
+
</slot>
|
|
43
|
+
|
|
44
|
+
<slot :control="control"
|
|
45
|
+
:control-prop="getControlProp(control)"
|
|
46
|
+
:model="formModel"
|
|
47
|
+
:isSearchForm="isSearchForm"
|
|
48
|
+
:name="'formItem'+index"></slot>
|
|
49
|
+
</template>
|
|
50
|
+
<slot name="formFooter" :model="formModel" :isSearchForm="isSearchForm" :controlInfos="controlInfos"></slot>
|
|
51
|
+
</el-form>
|
|
52
|
+
|
|
53
|
+
<!-- 弹窗组件 -->
|
|
54
|
+
<ed-dialog ref="BasicDialog" :fullscreen="currentPopupComponent.controlProp?.isFullScreen" :visible="visible"
|
|
55
|
+
:width="currentPopupComponent.controlProp?.width" title="选择弹窗"
|
|
56
|
+
@close="handleClose"
|
|
57
|
+
@ok="handleOk">
|
|
58
|
+
<component v-bind:is="currentPopupComponent.component"
|
|
59
|
+
:ref="currentPopupComponent.ref" :controlProp="currentPopupComponent.controlProp"
|
|
60
|
+
:isSearchForm="isSearchForm">
|
|
61
|
+
</component>
|
|
62
|
+
</ed-dialog>
|
|
63
|
+
</div>
|
|
64
|
+
</template>
|
|
65
|
+
|
|
66
|
+
<script>
|
|
67
|
+
import EasyDataMixins from '../mixins/EasyDataMixins'
|
|
68
|
+
import Props, {FormProps} from './Props'
|
|
69
|
+
import useEmits from "./hooks/useEmits";
|
|
70
|
+
import useForm from "./hooks/useForm";
|
|
71
|
+
import useChosePopup from "./hooks/useChosePopup";
|
|
72
|
+
import {getControlProp, setDefaultFormData, setFormData} from "../../utils/useBusiness";
|
|
73
|
+
import FormItem from "./components/FormItem";
|
|
74
|
+
import {getVarType} from "../../utils/utils";
|
|
75
|
+
import {TempType} from "../../api/easyData";
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* EasyData表单组件
|
|
79
|
+
* - 示例
|
|
80
|
+
*
|
|
81
|
+
* ```vue
|
|
82
|
+
* <easy-data-form ref="EasyDataForm" :dataSourceName="dataSourceName" :formData="formData" :label-position="labelPosition">
|
|
83
|
+
* </easy-data-form>
|
|
84
|
+
* ```
|
|
85
|
+
* 详细用法参考下方链接
|
|
86
|
+
*
|
|
87
|
+
* [EasyDataForm组件使用示例](./web-comp/ExampleEasyDataFormCode.md)
|
|
88
|
+
*
|
|
89
|
+
* [](./EasyDataFormProps.md ':include')
|
|
90
|
+
*
|
|
91
|
+
* [](./ElFormItemProps.md ':include')
|
|
92
|
+
*
|
|
93
|
+
* [](./ElFormProps.md ':include')
|
|
94
|
+
*
|
|
95
|
+
*/
|
|
96
|
+
export default {
|
|
97
|
+
components: {FormItem},
|
|
98
|
+
name: "EasyDataForm",
|
|
99
|
+
props: Props,
|
|
100
|
+
mixins: [EasyDataMixins, useEmits, useForm, useChosePopup],
|
|
101
|
+
data() {
|
|
102
|
+
return {
|
|
103
|
+
// 转换this对象
|
|
104
|
+
self: this,
|
|
105
|
+
// 表单验证规则: object
|
|
106
|
+
formRules: {},
|
|
107
|
+
// 表单数据对象
|
|
108
|
+
formModel: {},
|
|
109
|
+
//popup弹窗 存储真实值
|
|
110
|
+
popupFormModel: {},
|
|
111
|
+
//文件列表 回显会用
|
|
112
|
+
fileList: [],
|
|
113
|
+
// 下拉树控件属性
|
|
114
|
+
selectTree: {
|
|
115
|
+
url: '/admin/base/tree/getData',
|
|
116
|
+
treeData: [],
|
|
117
|
+
},
|
|
118
|
+
currentPopupComponent: {},
|
|
119
|
+
// 选择弹窗緩存數據
|
|
120
|
+
popupCache: [],
|
|
121
|
+
// 显示弹窗
|
|
122
|
+
visible: false,
|
|
123
|
+
// loading
|
|
124
|
+
initLoading: false
|
|
125
|
+
}
|
|
126
|
+
},
|
|
127
|
+
watch: {
|
|
128
|
+
controlConfig: {
|
|
129
|
+
handler(newVal, oldVal) {
|
|
130
|
+
if (newVal && Object.keys(newVal).length > 0) {
|
|
131
|
+
const {controlInfos, controlProps, dataSource} = newVal
|
|
132
|
+
// 解除js对象指向同一内存地址 JSON.parse(JSON.stringify(Object | Array))
|
|
133
|
+
this.controlInfos = JSON.parse(JSON.stringify(controlInfos))
|
|
134
|
+
this.controlProps = JSON.parse(JSON.stringify(controlProps))
|
|
135
|
+
this.dataSource = JSON.parse(JSON.stringify(dataSource))
|
|
136
|
+
this.$nextTick(() => {
|
|
137
|
+
this.initFormControl()
|
|
138
|
+
})
|
|
139
|
+
}
|
|
140
|
+
},
|
|
141
|
+
deep: true,
|
|
142
|
+
immediate: true
|
|
143
|
+
},
|
|
144
|
+
// 有数据源名称且未传入controlConfig时,自动发起请求
|
|
145
|
+
dataSourceName: {
|
|
146
|
+
deep: true,
|
|
147
|
+
immediate: true,
|
|
148
|
+
handler(newVal, oldVal) {
|
|
149
|
+
if (newVal && newVal !== oldVal && (!this.controlConfig || Object.keys(this.controlConfig).length === 0)) {
|
|
150
|
+
this.initControls().then(config => {
|
|
151
|
+
this.initFormControl()
|
|
152
|
+
})
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
},
|
|
156
|
+
formData: {
|
|
157
|
+
deep: true,
|
|
158
|
+
immediate: true,
|
|
159
|
+
handler(newVal, oldVal) {
|
|
160
|
+
if (newVal && newVal !== oldVal && this.controlInfos && Object.keys(this.controlInfos).length > 0) {
|
|
161
|
+
this.watchFormData()
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
},
|
|
165
|
+
//没有传入formData 且传入查询参数时,自动查询数据
|
|
166
|
+
loadQuery: {
|
|
167
|
+
deep: true,
|
|
168
|
+
immediate: true,
|
|
169
|
+
handler(newVal, oldVal) {
|
|
170
|
+
if (newVal && newVal !== oldVal && newVal.param && (this.formData === undefined || this.formData == null)) {
|
|
171
|
+
this.initControls().then(config => {
|
|
172
|
+
this.initFormControl()
|
|
173
|
+
})
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
},
|
|
178
|
+
computed: {
|
|
179
|
+
showFormItem() {
|
|
180
|
+
return (control) => {
|
|
181
|
+
return Object.keys(this.formModel).length > 0 && control.isShow
|
|
182
|
+
}
|
|
183
|
+
},
|
|
184
|
+
showTooltip() {
|
|
185
|
+
return (control) => {
|
|
186
|
+
return !this.isSearchForm && this.getControlProp(control).tips
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
},
|
|
190
|
+
methods: {
|
|
191
|
+
/**
|
|
192
|
+
* @name initFormControl
|
|
193
|
+
* @description 初始化Form表单配置信息
|
|
194
|
+
*/
|
|
195
|
+
async initFormControl() {
|
|
196
|
+
await this.initRules()
|
|
197
|
+
await this.watchFormData()
|
|
198
|
+
this.initOk()
|
|
199
|
+
},
|
|
200
|
+
|
|
201
|
+
/**
|
|
202
|
+
* @name watchFormData
|
|
203
|
+
*/
|
|
204
|
+
watchFormData() {
|
|
205
|
+
return new Promise(async (resolve, reject) => {
|
|
206
|
+
// 默认值
|
|
207
|
+
const defaultFormData = setDefaultFormData({
|
|
208
|
+
controlInfos: this.controlInfos,
|
|
209
|
+
controlProps: this.controlProps,
|
|
210
|
+
dataSource: this.dataSource,
|
|
211
|
+
isSearchForm: this.isSearchForm
|
|
212
|
+
})
|
|
213
|
+
|
|
214
|
+
this.popupFormModel = []
|
|
215
|
+
// 传输值
|
|
216
|
+
const controlFormData = setFormData(this.formData, this.controlInfos, this)
|
|
217
|
+
|
|
218
|
+
//请求值
|
|
219
|
+
let qFormData = {}
|
|
220
|
+
if (this.hasObject(this.$props, 'loadQuery') && this.loadQuery && this.loadQuery.param) {
|
|
221
|
+
const temp = await this.queryFormData()
|
|
222
|
+
qFormData = setFormData(temp, this.controlInfos, this)
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
// 合并值
|
|
226
|
+
this.formModel = Object.assign({}, defaultFormData, qFormData, controlFormData);
|
|
227
|
+
|
|
228
|
+
let setTimeOut = setTimeout(() => {
|
|
229
|
+
this.clearValidate()
|
|
230
|
+
clearTimeout(setTimeOut)
|
|
231
|
+
}, 100);
|
|
232
|
+
|
|
233
|
+
this.initTriggerControl()
|
|
234
|
+
resolve(true)
|
|
235
|
+
})
|
|
236
|
+
},
|
|
237
|
+
|
|
238
|
+
/**
|
|
239
|
+
* initFormDataAndControl
|
|
240
|
+
*/
|
|
241
|
+
async initFormDataAndControl() {
|
|
242
|
+
await this.initRules()
|
|
243
|
+
await this.watchFormData()
|
|
244
|
+
this.initOk()
|
|
245
|
+
},
|
|
246
|
+
|
|
247
|
+
/**
|
|
248
|
+
* @private
|
|
249
|
+
* @name getControlProp
|
|
250
|
+
* @param control
|
|
251
|
+
* @return {*}
|
|
252
|
+
*/
|
|
253
|
+
getControlProp(control) {
|
|
254
|
+
return getControlProp(control, this.controlProps)
|
|
255
|
+
},
|
|
256
|
+
|
|
257
|
+
/**
|
|
258
|
+
* @private
|
|
259
|
+
* @name initTriggerControl
|
|
260
|
+
* @description
|
|
261
|
+
*/
|
|
262
|
+
initTriggerControl() {
|
|
263
|
+
Object.keys(this.formModel).map(f => {
|
|
264
|
+
f !== 'id' && this.formModel[f] && this.triggerControl(this.formModel[f], this.controlInfos.find(i => i.controlName === f))
|
|
265
|
+
})
|
|
266
|
+
},
|
|
267
|
+
|
|
268
|
+
/**
|
|
269
|
+
* @private
|
|
270
|
+
* @name showTriggerControl
|
|
271
|
+
* @param t
|
|
272
|
+
* @param isShow true: 显示控件 false: 隐藏控件
|
|
273
|
+
*/
|
|
274
|
+
showTriggerControl(t, isShow) {
|
|
275
|
+
this.controlInfos.map((control, index) => {
|
|
276
|
+
if (control.controlName === t) {
|
|
277
|
+
control.isShow = isShow
|
|
278
|
+
this.$set(this.controlInfos, index, control)
|
|
279
|
+
}
|
|
280
|
+
})
|
|
281
|
+
},
|
|
282
|
+
|
|
283
|
+
/**
|
|
284
|
+
* @private
|
|
285
|
+
* @name triggerControl
|
|
286
|
+
* @param value
|
|
287
|
+
* @param control
|
|
288
|
+
* @description
|
|
289
|
+
*/
|
|
290
|
+
triggerControl(value, control) {
|
|
291
|
+
if (control && this.triggerControls[control.controlName]) {
|
|
292
|
+
const {dataSource} = this.getControlProp(control);
|
|
293
|
+
if (dataSource && !this.isSearchForm) {
|
|
294
|
+
let t_1 = {}
|
|
295
|
+
dataSource.forEach((record) => {
|
|
296
|
+
let {value: v, triggerControl: trigger} = record
|
|
297
|
+
if (value.toString() === v.toString()) {
|
|
298
|
+
if (trigger) {
|
|
299
|
+
if (trigger.includes(',')) {
|
|
300
|
+
trigger.split(',').forEach((t) => {
|
|
301
|
+
this.showTriggerControl(t, true)
|
|
302
|
+
t_1[t] = []
|
|
303
|
+
t_1[t].push(t)
|
|
304
|
+
})
|
|
305
|
+
} else {
|
|
306
|
+
this.showTriggerControl(trigger, true)
|
|
307
|
+
t_1[trigger] = []
|
|
308
|
+
t_1[trigger].push(trigger)
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
} else {
|
|
312
|
+
trigger && trigger.includes(',') ? trigger.split(',').forEach((t) => this.showTriggerControl(t, !!t_1[t])) : this.showTriggerControl(trigger, !!t_1[trigger])
|
|
313
|
+
}
|
|
314
|
+
})
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
this.customizeChangeHandler(value, control)
|
|
318
|
+
},
|
|
319
|
+
|
|
320
|
+
/**
|
|
321
|
+
* @name getBindValue
|
|
322
|
+
* @returns {{}}
|
|
323
|
+
* @description 获取Form组件属性
|
|
324
|
+
*/
|
|
325
|
+
getBindValue() {
|
|
326
|
+
let props = {}
|
|
327
|
+
props = Object.assign({}, this.$attrs, this.$props)
|
|
328
|
+
for (const key in props) {
|
|
329
|
+
if (!this.hasObject(FormProps, key)) delete props[key]
|
|
330
|
+
}
|
|
331
|
+
props.model = this.formModel
|
|
332
|
+
props.rules = this.formRules
|
|
333
|
+
return Object.assign(props, this.$props.moduleProp)
|
|
334
|
+
},
|
|
335
|
+
|
|
336
|
+
/**
|
|
337
|
+
* @name getFormActionSlot
|
|
338
|
+
* @return {{form: {}}}
|
|
339
|
+
* @description 按钮区slot传参
|
|
340
|
+
*/
|
|
341
|
+
getFormActionSlot(data) {
|
|
342
|
+
return {
|
|
343
|
+
...data,
|
|
344
|
+
form: this.formModel,
|
|
345
|
+
self: this.self
|
|
346
|
+
}
|
|
347
|
+
},
|
|
348
|
+
|
|
349
|
+
/**
|
|
350
|
+
* 是否显示插槽
|
|
351
|
+
* @param control
|
|
352
|
+
* @param prop
|
|
353
|
+
* @return {boolean}
|
|
354
|
+
*/
|
|
355
|
+
showAppendSlots(control, prop) {
|
|
356
|
+
let arr = ['popup', 'upload', 'expression']
|
|
357
|
+
if (control.controlType === 'input' && prop?.isCallback) {
|
|
358
|
+
return true
|
|
359
|
+
}
|
|
360
|
+
return arr.includes(control.controlType)
|
|
361
|
+
},
|
|
362
|
+
/**
|
|
363
|
+
* 获取表单的数据
|
|
364
|
+
* @param form
|
|
365
|
+
* @returns {any}
|
|
366
|
+
*/
|
|
367
|
+
getFormModel(form) {
|
|
368
|
+
let data = Object.assign({}, form)
|
|
369
|
+
this.controlInfos.map(control => {
|
|
370
|
+
let controlProp = this.getControlProp(control)
|
|
371
|
+
if (controlProp && this.hasObject(controlProp, 'dataSource') && form[control.controlName]) {
|
|
372
|
+
|
|
373
|
+
if (Array.isArray(form[control.controlName])) {
|
|
374
|
+
data[control.controlName] = []
|
|
375
|
+
form[control.controlName].map(item => {
|
|
376
|
+
data[control.controlName].push(controlProp.dataSource.find(i => i.value === item))
|
|
377
|
+
})
|
|
378
|
+
} else {
|
|
379
|
+
data[control.controlName] = controlProp.dataSource.find(i => i.value === form[control.controlName])
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
})
|
|
383
|
+
|
|
384
|
+
return data
|
|
385
|
+
},
|
|
386
|
+
|
|
387
|
+
/**
|
|
388
|
+
* @param isValidate 是否验证后再返回数据
|
|
389
|
+
* @param labelValue 只返回value形式数据 (反:返回labelValue形式数据) 默认只返回值
|
|
390
|
+
* @param isOnlyControl
|
|
391
|
+
* @returns {Promise<unknown>}
|
|
392
|
+
* @description 获取当前表单数据
|
|
393
|
+
*/
|
|
394
|
+
getFormData(isValidate = false, labelValue = false, isOnlyControl = false) {
|
|
395
|
+
return new Promise(async (resolve, reject) => {
|
|
396
|
+
try {
|
|
397
|
+
isValidate ? await this.validateForm() : null;
|
|
398
|
+
//查询参数
|
|
399
|
+
let param = {}
|
|
400
|
+
if (this.formModel.id) {
|
|
401
|
+
param.id = this.formModel.id
|
|
402
|
+
}
|
|
403
|
+
param.keyInfo = null
|
|
404
|
+
param.dataInfo = null
|
|
405
|
+
let key = Object.assign(param.key ? param.key : {}, this.formModel, this.popupFormModel)
|
|
406
|
+
let controlName = {}
|
|
407
|
+
this.controlInfos.map(control => {
|
|
408
|
+
controlName[control.controlName] = control
|
|
409
|
+
})
|
|
410
|
+
for (const item in key) {
|
|
411
|
+
if (isOnlyControl) {
|
|
412
|
+
if (controlName[item] === undefined) {
|
|
413
|
+
delete key[item]
|
|
414
|
+
continue
|
|
415
|
+
}
|
|
416
|
+
}
|
|
417
|
+
//空数组 空对象则忽略
|
|
418
|
+
if (key[item] === false) {
|
|
419
|
+
// TO
|
|
420
|
+
} else if (key[item] === undefined || key[item] === null || key[item] === "") {
|
|
421
|
+
delete key[item]
|
|
422
|
+
} else if (getVarType(key[item]) === 'array' && key[item].length === 0) {
|
|
423
|
+
delete key[item]
|
|
424
|
+
} else if (getVarType(key[item]) === 'object' && Object.keys(key[item]).length === 0) {
|
|
425
|
+
delete key[item]
|
|
426
|
+
}
|
|
427
|
+
}
|
|
428
|
+
param.key = this._convertData(key, labelValue);
|
|
429
|
+
param.dataSourceName = this.dataSource.dataSourceName
|
|
430
|
+
resolve(param)
|
|
431
|
+
} catch (e) {
|
|
432
|
+
reject(e)
|
|
433
|
+
}
|
|
434
|
+
})
|
|
435
|
+
},
|
|
436
|
+
/** 数据转换
|
|
437
|
+
* labelValue 代码传入则肯定要转
|
|
438
|
+
*
|
|
439
|
+
*/
|
|
440
|
+
_convertData(form, labelValue) {
|
|
441
|
+
let data = Object.assign({}, form)
|
|
442
|
+
this.controlInfos.map(control => {
|
|
443
|
+
let currentValue = data[control.controlName]
|
|
444
|
+
let controlProp = this.getControlProp(control)
|
|
445
|
+
//只操作有值且有视图属性的字段
|
|
446
|
+
if (currentValue && controlProp && Object.keys(controlProp).length > 0) {
|
|
447
|
+
let isLabelValue = controlProp.isLabelValue ? controlProp.isLabelValue : false;
|
|
448
|
+
// 返回labelValue对象
|
|
449
|
+
if (!this.isSearchForm && (labelValue === true || isLabelValue === true)) {
|
|
450
|
+
if (control.controlType === 'cascader') {
|
|
451
|
+
if (controlProp.multiple) {
|
|
452
|
+
data[control.controlName] = currentValue.map(temp => this._addCascaderLabel(temp, controlProp.dataSource))
|
|
453
|
+
} else {
|
|
454
|
+
data[control.controlName] = this._addCascaderLabel(currentValue, controlProp.dataSource)
|
|
455
|
+
}
|
|
456
|
+
} else if (this.hasObject(controlProp, 'dataSource') && controlProp.dataSource.length > 0) {
|
|
457
|
+
if (Array.isArray(currentValue)) {
|
|
458
|
+
data[control.controlName] = currentValue.map(item => {
|
|
459
|
+
let {label, value} = controlProp.dataSource.find(i => i.value === item) || {}
|
|
460
|
+
return {label: label ? label : value, value}
|
|
461
|
+
})
|
|
462
|
+
} else {
|
|
463
|
+
let {label, value} = controlProp.dataSource.find(i => i.value === currentValue) || {}
|
|
464
|
+
data[control.controlName] = {label: label ? label : value, value}
|
|
465
|
+
}
|
|
466
|
+
}
|
|
467
|
+
} else {
|
|
468
|
+
//只存储值
|
|
469
|
+
if (['select', 'checkbox'].includes(control.controlType) && getVarType(currentValue) === 'array') {
|
|
470
|
+
data[control.controlName] = currentValue.join(",")
|
|
471
|
+
} else if (control.controlType === 'popup' && this.isSearchForm) {
|
|
472
|
+
if (currentValue instanceof Array) {
|
|
473
|
+
let arr = []
|
|
474
|
+
currentValue.forEach(item => {
|
|
475
|
+
arr.push(item.value)
|
|
476
|
+
})
|
|
477
|
+
data[control.controlName] = arr.join(",")
|
|
478
|
+
} else {
|
|
479
|
+
data[control.controlName] = currentValue.value
|
|
480
|
+
}
|
|
481
|
+
} else if (control.controlType === 'cascader') {
|
|
482
|
+
if (controlProp.multiple) {
|
|
483
|
+
data[control.controlName] = currentValue.map(i => {
|
|
484
|
+
if (getVarType(i) === 'array') {
|
|
485
|
+
return i.join("~")
|
|
486
|
+
}
|
|
487
|
+
}).join(",")
|
|
488
|
+
} else {
|
|
489
|
+
data[control.controlName] = currentValue.join("~")
|
|
490
|
+
}
|
|
491
|
+
}
|
|
492
|
+
}
|
|
493
|
+
}
|
|
494
|
+
})
|
|
495
|
+
return data
|
|
496
|
+
},
|
|
497
|
+
_addCascaderLabel(data, dataSource) {
|
|
498
|
+
if (data && dataSource) {
|
|
499
|
+
let result = {value: data}
|
|
500
|
+
let item = data.shift()
|
|
501
|
+
let {label, value, children} = dataSource.find(i => i.value === item) || {}
|
|
502
|
+
result.value = [item]
|
|
503
|
+
if (label && value) {
|
|
504
|
+
result.label = label
|
|
505
|
+
} else {
|
|
506
|
+
result.label = item
|
|
507
|
+
}
|
|
508
|
+
if (children) {
|
|
509
|
+
let childrenObj = this._addCascaderLabel(data, children)
|
|
510
|
+
result.label = result.label + "/" + childrenObj.label
|
|
511
|
+
result.value = result.value.concat(childrenObj.value)
|
|
512
|
+
}
|
|
513
|
+
return result;
|
|
514
|
+
}
|
|
515
|
+
},
|
|
516
|
+
/**
|
|
517
|
+
* @name getType
|
|
518
|
+
* @returns {string}
|
|
519
|
+
* @description 设置当前模版类型
|
|
520
|
+
*/
|
|
521
|
+
getType() {
|
|
522
|
+
return TempType.save
|
|
523
|
+
},
|
|
524
|
+
|
|
525
|
+
/**
|
|
526
|
+
* @name bindValuesChange
|
|
527
|
+
* @param value
|
|
528
|
+
* @param id
|
|
529
|
+
* @param key
|
|
530
|
+
* @returns {*}
|
|
531
|
+
* @description 动态修改this对象属性值
|
|
532
|
+
*/
|
|
533
|
+
bindValuesChange(value, id, key) {
|
|
534
|
+
this.$set(this[key], id, value)
|
|
535
|
+
return this[key]
|
|
536
|
+
},
|
|
537
|
+
|
|
538
|
+
/**
|
|
539
|
+
* @name getControlValue
|
|
540
|
+
* @param controlName
|
|
541
|
+
* @returns {*}
|
|
542
|
+
* @description 获取单项控件当前值
|
|
543
|
+
*/
|
|
544
|
+
getControlValue(controlName) {
|
|
545
|
+
return this.formModel[controlName]
|
|
546
|
+
},
|
|
547
|
+
|
|
548
|
+
/**
|
|
549
|
+
* @name getPassValue
|
|
550
|
+
* @param passDsName
|
|
551
|
+
* @param controlName
|
|
552
|
+
* @returns {*|string}
|
|
553
|
+
*/
|
|
554
|
+
getPassValue(passDsName, controlName) {
|
|
555
|
+
return this.passData[passDsName] ? this.passData[passDsName].keyInfoObject[controlName] : ''
|
|
556
|
+
},
|
|
557
|
+
|
|
558
|
+
// form-item项是否必填
|
|
559
|
+
getFormItemRequired(control) {
|
|
560
|
+
if (this.isSearchForm) {
|
|
561
|
+
return false;
|
|
562
|
+
}
|
|
563
|
+
return control.isRequired
|
|
564
|
+
},
|
|
565
|
+
|
|
566
|
+
//计算是否展示 form-item
|
|
567
|
+
isShowItem(control) {
|
|
568
|
+
const notQuery = ['link', 'upload', 'imgPreview', 'expression', 'label', 'radio', 'checkbox', 'textarea']
|
|
569
|
+
//搜索框且是查询项
|
|
570
|
+
if (this.isSearchForm && control.isQuery && !notQuery.includes(control.controlType)) {
|
|
571
|
+
return true;
|
|
572
|
+
}
|
|
573
|
+
//普通表单且是录入项
|
|
574
|
+
else if (!this.isSearchForm && control.isInput) {
|
|
575
|
+
return true;
|
|
576
|
+
}
|
|
577
|
+
return false;
|
|
578
|
+
},
|
|
579
|
+
|
|
580
|
+
/**清空数据及校验结果 */
|
|
581
|
+
resetFields() {
|
|
582
|
+
if (this.$refs.EasyDataForm)
|
|
583
|
+
this.$refs.EasyDataForm.resetFields()
|
|
584
|
+
},
|
|
585
|
+
|
|
586
|
+
/** 清除校验结果 */
|
|
587
|
+
clearValidate() {
|
|
588
|
+
if (this.$refs.EasyDataForm)
|
|
589
|
+
this.$refs.EasyDataForm.clearValidate()
|
|
590
|
+
},
|
|
591
|
+
clickFunc(e) {
|
|
592
|
+
this.$refs.FormAction.clickFunc(e)
|
|
593
|
+
},
|
|
594
|
+
},
|
|
595
|
+
}
|
|
596
|
+
</script>
|
|
597
|
+
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import EdFormProps from 'ed-base-vue/lib/package/EdForm/src/Props'
|
|
2
|
+
|
|
3
|
+
export const FormProps = EdFormProps
|
|
4
|
+
|
|
5
|
+
let form_props = Object.assign({}, FormProps)
|
|
6
|
+
delete form_props.formData
|
|
7
|
+
delete form_props.formDesc
|
|
8
|
+
|
|
9
|
+
export default {
|
|
10
|
+
...form_props,
|
|
11
|
+
|
|
12
|
+
// 表单类型 query | edit
|
|
13
|
+
formType: {type: String, default: "edit"},
|
|
14
|
+
// 是搜索表单、还是提交表单 默认提交表单
|
|
15
|
+
isSearchForm: {type: Boolean, default: false},
|
|
16
|
+
// 数据源配置属性
|
|
17
|
+
controlConfig: {type: Object, default: () => {}},
|
|
18
|
+
// 查询单条数据 url param
|
|
19
|
+
loadQuery: {type: Object},
|
|
20
|
+
// form 表单高度控制
|
|
21
|
+
height: {type: String, default: 'auto'},
|
|
22
|
+
}
|