3.0.3(2022.03.02)更新:

1. 修复Pad/H5布局预览的样式显示问题;
2. 修复升级新版element-plus后事件代码编辑弹窗无法显示的问题;
3. 修复provide传递的formConfig属性不能获取最新值的问题,改用provide函数实现;
4. element-plus版本升级到2.0.4。
This commit is contained in:
vdpAdmin 2022-03-02 18:26:55 +08:00
parent 8766345ceb
commit 471c979abb
29 changed files with 155 additions and 154 deletions

View File

@ -14,7 +14,7 @@
"axios": "^0.24.0", "axios": "^0.24.0",
"clipboard": "^2.0.8", "clipboard": "^2.0.8",
"core-js": "^3.6.5", "core-js": "^3.6.5",
"element-plus": "^1.3.0-beta.9", "element-plus": "^2.0.4",
"file-saver": "^2.0.5", "file-saver": "^2.0.5",
"mitt": "^3.0.0", "mitt": "^3.0.0",
"sortablejs": "1.14.0", "sortablejs": "1.14.0",

View File

@ -1,4 +1,13 @@
export default { export default {
inject: ['getFormConfig'],
computed: {
formConfig() {
return this.getFormConfig()
},
},
methods: { methods: {
appendTableRow(widget) { appendTableRow(widget) {
this.designer.appendTableRow(widget) this.designer.appendTableRow(widget)

View File

@ -55,7 +55,6 @@
components: { components: {
FormItemWrapper, FormItemWrapper,
}, },
inject: ['refList', 'formConfig', 'globalOptionData', 'globalModel'],
data() { data() {
return { return {
oldFieldValue: null, //fieldchange oldFieldValue: null, //fieldchange

View File

@ -58,7 +58,6 @@
components: { components: {
FormItemWrapper, FormItemWrapper,
}, },
inject: ['refList', 'formConfig', 'globalOptionData', 'globalModel'],
data() { data() {
return { return {
oldFieldValue: null, //fieldchange oldFieldValue: null, //fieldchange

View File

@ -49,7 +49,6 @@
components: { components: {
FormItemWrapper, FormItemWrapper,
}, },
inject: ['refList', 'formConfig', 'globalOptionData', 'globalModel'],
data() { data() {
return { return {
oldFieldValue: null, //fieldchange oldFieldValue: null, //fieldchange

View File

@ -56,7 +56,6 @@
components: { components: {
FormItemWrapper, FormItemWrapper,
}, },
inject: ['refList', 'formConfig', 'globalOptionData', 'globalModel'],
data() { data() {
return { return {
oldFieldValue: null, //fieldchange oldFieldValue: null, //fieldchange

View File

@ -54,7 +54,6 @@
components: { components: {
FormItemWrapper, FormItemWrapper,
}, },
inject: ['refList', 'formConfig', 'globalOptionData', 'globalModel'],
data() { data() {
return { return {
oldFieldValue: null, //fieldchange oldFieldValue: null, //fieldchange

View File

@ -3,9 +3,13 @@ import FormValidators from '@/utils/validators'
import eventBus from "@/utils/event-bus" import eventBus from "@/utils/event-bus"
export default { export default {
inject: ['refList', 'formConfig', 'globalOptionData', 'globalModel', 'getOptionData'], inject: ['refList', 'getFormConfig', 'globalOptionData', 'globalModel', 'getOptionData'],
computed: { computed: {
formConfig() {
return this.getFormConfig()
},
widgetSize() { widgetSize() {
return this.field.options.size || 'default' return this.field.options.size || 'default'
}, },

View File

@ -77,7 +77,6 @@
SvgIcon, SvgIcon,
FormItemWrapper, FormItemWrapper,
}, },
inject: ['refList', 'formConfig', 'globalOptionData', 'globalModel'],
data() { data() {
return { return {
oldFieldValue: null, //fieldchange oldFieldValue: null, //fieldchange

View File

@ -93,8 +93,12 @@
rules: Array, rules: Array,
}, },
inject: ['formConfig'], inject: ['getFormConfig'],
computed: { computed: {
formConfig() {
return this.getFormConfig()
},
selected() { selected() {
return !!this.designer && this.field.id === this.designer.selectedId return !!this.designer && this.field.id === this.designer.selectedId
}, },

View File

@ -61,7 +61,6 @@
components: { components: {
FormItemWrapper, FormItemWrapper,
}, },
inject: ['refList', 'formConfig', 'globalOptionData', 'globalModel'],
data() { data() {
return { return {
oldFieldValue: null, //fieldchange oldFieldValue: null, //fieldchange

View File

@ -53,7 +53,6 @@
components: { components: {
FormItemWrapper, FormItemWrapper,
}, },
inject: ['refList', 'formConfig', 'globalOptionData', 'globalModel'],
data() { data() {
return { return {
oldFieldValue: null, //fieldchange oldFieldValue: null, //fieldchange

View File

@ -60,7 +60,6 @@
components: { components: {
FormItemWrapper, FormItemWrapper,
}, },
inject: ['refList', 'formConfig', 'globalOptionData', 'globalModel'],
data() { data() {
return { return {
oldFieldValue: null, //fieldchange oldFieldValue: null, //fieldchange
@ -180,8 +179,12 @@
handlePictureRemove(file, fileList) { handlePictureRemove(file, fileList) {
this.fileList = deepClone(fileList) //this.fileList = fileList this.fileList = deepClone(fileList) //this.fileList = fileList
this.updateUploadFieldModelAndEmitDataChange(fileList) this.updateUploadFieldModelAndEmitDataChange(fileList)
this.uploadBtnHidden = fileList.length >= this.field.options.limit this.uploadBtnHidden = fileList.length >= this.field.options.limit
if (!!this.field.options.onFileRemove) {
let customFn = new Function('file', 'fileList', this.field.options.onFileRemove)
customFn.call(this, file, fileList)
}
}, },
handelUploadError(err, file, fileList) { handelUploadError(err, file, fileList) {

View File

@ -58,7 +58,6 @@
components: { components: {
FormItemWrapper, FormItemWrapper,
}, },
inject: ['refList', 'formConfig', 'globalOptionData', 'globalModel'],
data() { data() {
return { return {
oldFieldValue: null, //fieldchange oldFieldValue: null, //fieldchange

View File

@ -52,7 +52,6 @@
components: { components: {
FormItemWrapper, FormItemWrapper,
}, },
inject: ['refList', 'formConfig', 'globalOptionData', 'globalModel'],
data() { data() {
return { return {
oldFieldValue: null, //fieldchange oldFieldValue: null, //fieldchange

View File

@ -71,7 +71,6 @@
// } // }
quillEditor, quillEditor,
}, },
inject: ['refList', 'formConfig', 'globalOptionData', 'globalModel'],
data() { data() {
return { return {
oldFieldValue: null, //fieldchange oldFieldValue: null, //fieldchange

View File

@ -61,7 +61,6 @@
components: { components: {
FormItemWrapper, FormItemWrapper,
}, },
inject: ['refList', 'formConfig', 'globalOptionData', 'globalModel'],
data() { data() {
return { return {
oldFieldValue: null, //fieldchange oldFieldValue: null, //fieldchange

View File

@ -50,7 +50,6 @@
components: { components: {
FormItemWrapper, FormItemWrapper,
}, },
inject: ['refList', 'formConfig', 'globalOptionData', 'globalModel'],
data() { data() {
return { return {
oldFieldValue: null, //fieldchange oldFieldValue: null, //fieldchange

View File

@ -51,7 +51,6 @@
components: { components: {
FormItemWrapper, FormItemWrapper,
}, },
inject: ['refList', 'formConfig', 'globalOptionData', 'globalModel'],
data() { data() {
return { return {
oldFieldValue: null, //fieldchange oldFieldValue: null, //fieldchange

View File

@ -53,7 +53,6 @@
components: { components: {
FormItemWrapper, FormItemWrapper,
}, },
inject: ['refList', 'formConfig', 'globalOptionData', 'globalModel'],
data() { data() {
return { return {
oldFieldValue: null, //fieldchange oldFieldValue: null, //fieldchange

View File

@ -57,7 +57,6 @@
components: { components: {
FormItemWrapper, FormItemWrapper,
}, },
inject: ['refList', 'formConfig', 'globalOptionData', 'globalModel'],
data() { data() {
return { return {
oldFieldValue: null, //fieldchange oldFieldValue: null, //fieldchange

View File

@ -54,7 +54,6 @@
components: { components: {
FormItemWrapper, FormItemWrapper,
}, },
inject: ['refList', 'formConfig', 'globalOptionData', 'globalModel'],
data() { data() {
return { return {
oldFieldValue: null, //fieldchange oldFieldValue: null, //fieldchange

View File

@ -53,7 +53,7 @@
provide() { provide() {
return { return {
refList: this.widgetRefList, refList: this.widgetRefList,
formConfig: this.formConfig, getFormConfig: () => this.formConfig, /* 解决provide传递formConfig属性的响应式更新问题 */
globalOptionData: this.optionData, globalOptionData: this.optionData,
getOptionData: () => this.optionData, getOptionData: () => this.optionData,
globalModel: { globalModel: {
@ -172,7 +172,6 @@
<style lang="scss" scoped> <style lang="scss" scoped>
.container-scroll-bar { .container-scroll-bar {
:deep(.el-scrollbar__wrap), :deep(.el-scrollbar__view) { :deep(.el-scrollbar__wrap), :deep(.el-scrollbar__view) {
overflow-x: hidden; overflow-x: hidden;
} }
@ -186,14 +185,6 @@
overflow-y: auto; overflow-y: auto;
.el-form.full-height-width { .el-form.full-height-width {
/*
margin: 0 auto;
width: 420px;
border-radius: 15px;
//border-width: 10px;
box-shadow: 0 0 1px 10px #495060;
*/
height: 100%; height: 100%;
padding: 3px; padding: 3px;
background: #ffffff; background: #ffffff;

View File

@ -180,14 +180,6 @@
}, },
created() { created() {
// eventBus.$on('editEventHandler', (eventName, eventParams) => {
// this.editEventHandler(eventName, eventParams)
// })
// eventBus.$on('editEventHandler', (eventParams) => {
// this.editEventHandler(eventParams[0], eventParams[1])
// })
this.on$('editEventHandler', (eventParams) => { this.on$('editEventHandler', (eventParams) => {
//debugger //debugger
this.editEventHandler(eventParams[0], eventParams[1]) this.editEventHandler(eventParams[0], eventParams[1])

View File

@ -7,7 +7,6 @@ export default {
methods: { methods: {
editEventHandler(eventName, eventParams) { editEventHandler(eventName, eventParams) {
this.dispatch('SettingPanel', 'editEventHandler', [eventName, [...eventParams]]) this.dispatch('SettingPanel', 'editEventHandler', [eventName, [...eventParams]])
// eventBus.$emit('editEventHandler', [eventName, [...eventParams]])
}, },
} }

View File

@ -44,9 +44,10 @@
<div v-if="showPreviewDialogFlag" class="" v-drag="['.drag-dialog.el-dialog', '.drag-dialog .el-dialog__header']"> <div v-if="showPreviewDialogFlag" class="" v-drag="['.drag-dialog.el-dialog', '.drag-dialog .el-dialog__header']">
<el-dialog :title="i18nt('designer.toolbar.preview')" v-model="showPreviewDialogFlag" <el-dialog :title="i18nt('designer.toolbar.preview')" v-model="showPreviewDialogFlag"
:show-close="true" :close-on-click-modal="false" :close-on-press-escape="false" center :show-close="true" :close-on-click-modal="false" :close-on-press-escape="false" center
:destroy-on-close="true" custom-class="drag-dialog small-padding-dialog" width="75%" :fullscreen="layoutType === 'H5'"> :destroy-on-close="true" custom-class="drag-dialog small-padding-dialog" width="75%"
:fullscreen="(layoutType === 'H5') || (layoutType === 'Pad')">
<div> <div>
<div class="form-render-wrapper" :class="[layoutType === 'H5' ? 'h5-layout' : '']"> <div class="form-render-wrapper" :class="[layoutType === 'H5' ? 'h5-layout' : (layoutType === 'Pad' ? 'pad-layout' : '')]">
<VFormRender ref="preForm" :form-json="formJson" :form-data="testFormData" :preview-state="true" <VFormRender ref="preForm" :form-json="formJson" :form-data="testFormData" :preview-state="true"
:option-data="testOptionData" :option-data="testOptionData"
@appendButtonClick="testOnAppendButtonClick" @buttonClick="testOnButtonClick" @appendButtonClick="testOnAppendButtonClick" @buttonClick="testOnButtonClick"
@ -705,7 +706,7 @@
.form-render-wrapper { .form-render-wrapper {
//height: calc(100vh - 142px); //height: calc(100vh - 142px);
all: revert !important; /* 防止表单继承el-dialog等外部样式未生效原因不明 */ //all: revert !important; /* el-dialog */
} }
.form-render-wrapper.h5-layout { .form-render-wrapper.h5-layout {
@ -714,7 +715,16 @@
border-radius: 15px; border-radius: 15px;
//border-width: 10px; //border-width: 10px;
box-shadow: 0 0 1px 10px #495060; box-shadow: 0 0 1px 10px #495060;
height: calc(100vh - 142px); height: calc(100vh - 175px);
}
.form-render-wrapper.pad-layout {
margin: 0 auto;
width: 960px;
border-radius: 15px;
//border-width: 10px;
box-shadow: 0 0 1px 10px #495060;
height: calc(100vh - 175px);
} }
.node-tree-drawer { .node-tree-drawer {

View File

@ -55,7 +55,7 @@
}, },
}, },
inject: ['refList', 'globalModel', 'formConfig', 'previewState'], inject: ['refList', 'globalModel', 'getFormConfig', 'previewState'],
data() { data() {
return { return {
layoutProps: { layoutProps: {
@ -70,6 +70,10 @@
} }
}, },
computed: { computed: {
formConfig() {
return this.getFormConfig()
},
customClass() { customClass() {
return this.widget.options.customClass || '' return this.widget.options.customClass || ''
}, },

View File

@ -73,7 +73,7 @@
return { return {
refList: this.widgetRefList, refList: this.widgetRefList,
sfRefList: this.subFormRefList, //SubForm sfRefList: this.subFormRefList, //SubForm
formConfig: this.formConfig, getFormConfig: () => this.formJsonObj.formConfig, /* 解决provide传递formConfig属性的响应式更新问题 */
globalOptionData: this.optionData, globalOptionData: this.optionData,
getOptionData: () => this.optionData, /* 该方法用于在异步更新option-data之后重新获取到最新值 */ getOptionData: () => this.optionData, /* 该方法用于在异步更新option-data之后重新获取到最新值 */
globalModel: { globalModel: {
@ -357,7 +357,6 @@
this.buildFormModel(newFormJsonObj.widgetList) this.buildFormModel(newFormJsonObj.widgetList)
this.formJsonObj['formConfig'] = newFormJsonObj.formConfig this.formJsonObj['formConfig'] = newFormJsonObj.formConfig
// this._provided.formConfig = newFormJsonObj.formConfig //provideformConfig
this.formJsonObj['widgetList'] = newFormJsonObj.widgetList this.formJsonObj['widgetList'] = newFormJsonObj.widgetList
this.$nextTick(() => { this.$nextTick(() => {

View File

@ -11,6 +11,7 @@ export function addDirective(app) {
mounted(el, binding) { mounted(el, binding) {
if (!binding.value) return false; if (!binding.value) return false;
binding.instance.$nextTick(() => {
const dragDom = document.querySelector(binding.value[0]) const dragDom = document.querySelector(binding.value[0])
const dragHeader = document.querySelector(binding.value[1]) const dragHeader = document.querySelector(binding.value[1])
@ -119,14 +120,15 @@ export function addDirective(app) {
document.ontouchend = null; document.ontouchend = null;
}; };
}; };
})
}, },
}) })
// v-dialogDragWidth: 弹窗宽度拖大 拖小 // v-dialogDragWidth: 弹窗宽度拖大 拖小
app.directive('dialogDragWidth', { app.directive('dialogDragWidth', {
mounted(el, binding) { mounted(el, binding) {
binding.instance.$nextTick(() => {
const dragDom = binding.value.$el.querySelector('.el-dialog') const dragDom = binding.value.$el.querySelector('.el-dialog')
el.onmousedown = (e) => { el.onmousedown = (e) => {
// 鼠标按下,计算当前元素距离可视区的距离 // 鼠标按下,计算当前元素距离可视区的距离
const disX = e.clientX - el.offsetLeft const disX = e.clientX - el.offsetLeft
@ -144,6 +146,7 @@ export function addDirective(app) {
document.onmouseup = null document.onmouseup = null
} }
} }
})
} }
}) })