修复子表单禁用后操作按钮未同步禁用的问题。
parent
fac7e43faf
commit
965af7aae2
|
@ -38,7 +38,7 @@
|
||||||
<el-container class="center-layout-container">
|
<el-container class="center-layout-container">
|
||||||
<el-header class="toolbar-header">
|
<el-header class="toolbar-header">
|
||||||
<toolbar-panel :designer="designer" ref="toolbarRef">
|
<toolbar-panel :designer="designer" ref="toolbarRef">
|
||||||
<template #toolButton><slot name="customToolButtons"></slot></template>
|
<template #toolButtons><slot name="customToolButtons"></slot></template>
|
||||||
</toolbar-panel>
|
</toolbar-panel>
|
||||||
</el-header>
|
</el-header>
|
||||||
<el-main class="form-widget-main">
|
<el-main class="form-widget-main">
|
||||||
|
|
|
@ -36,7 +36,7 @@
|
||||||
{{i18nt('designer.toolbar.exportCode')}}</el-button>
|
{{i18nt('designer.toolbar.exportCode')}}</el-button>
|
||||||
<el-button v-if="showToolButton('generateSFCButton')" type="text" @click="generateSFC">
|
<el-button v-if="showToolButton('generateSFCButton')" type="text" @click="generateSFC">
|
||||||
<svg-icon icon-class="vue-sfc" />{{i18nt('designer.toolbar.generateSFC')}}</el-button>
|
<svg-icon icon-class="vue-sfc" />{{i18nt('designer.toolbar.generateSFC')}}</el-button>
|
||||||
<slot name="toolButton"></slot>
|
<slot name="toolButtons"></slot>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<el-dialog :title="i18nt('designer.toolbar.preview')" :visible.sync="showPreviewDialogFlag" v-if="showPreviewDialogFlag"
|
<el-dialog :title="i18nt('designer.toolbar.preview')" :visible.sync="showPreviewDialogFlag" v-if="showPreviewDialogFlag"
|
||||||
|
|
|
@ -38,7 +38,6 @@ export default {
|
||||||
this.activeTabName = tp.options.name
|
this.activeTabName = tp.options.name
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -92,6 +91,9 @@ export default {
|
||||||
this.disableSubFormRow(rIdx)
|
this.disableSubFormRow(rIdx)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//禁用3个操作按钮
|
||||||
|
this.actionDisabled = true
|
||||||
},
|
},
|
||||||
|
|
||||||
enableSubForm() {
|
enableSubForm() {
|
||||||
|
@ -100,6 +102,9 @@ export default {
|
||||||
this.enableSubFormRow(rIdx)
|
this.enableSubFormRow(rIdx)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//启用3个操作按钮
|
||||||
|
this.actionDisabled = false
|
||||||
},
|
},
|
||||||
|
|
||||||
resetSubForm() { //重置subForm数据为空
|
resetSubForm() { //重置subForm数据为空
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
<el-row class="header-row">
|
<el-row class="header-row">
|
||||||
<div class="action-header-column">
|
<div class="action-header-column">
|
||||||
<span class="action-label">{{i18nt('render.hint.subFormAction')}}</span>
|
<span class="action-label">{{i18nt('render.hint.subFormAction')}}</span>
|
||||||
<el-button round type="primary" size="mini" class="action-button" @click="addSubFormRow"
|
<el-button :disabled="actionDisabled" round type="primary" size="mini" class="action-button" @click="addSubFormRow"
|
||||||
:title="i18nt('render.hint.subFormAddActionHint')">
|
:title="i18nt('render.hint.subFormAddActionHint')">
|
||||||
{{i18nt('render.hint.subFormAddAction')}}<i class="el-icon-plus el-icon-right"></i></el-button>
|
{{i18nt('render.hint.subFormAddAction')}}<i class="el-icon-plus el-icon-right"></i></el-button>
|
||||||
</div>
|
</div>
|
||||||
|
@ -38,9 +38,9 @@
|
||||||
<el-row v-for="(subFormRowId, sfrIdx) in rowIdData" class="sub-form-row" :key="subFormRowId">
|
<el-row v-for="(subFormRowId, sfrIdx) in rowIdData" class="sub-form-row" :key="subFormRowId">
|
||||||
<div class="sub-form-action-column hide-label">
|
<div class="sub-form-action-column hide-label">
|
||||||
<div class="action-button-column">
|
<div class="action-button-column">
|
||||||
<el-button circle type="" icon="el-icon-circle-plus-outline" @click="insertSubFormRow(sfrIdx)"
|
<el-button :disabled="actionDisabled" circle type="" icon="el-icon-circle-plus-outline" @click="insertSubFormRow(sfrIdx)"
|
||||||
:title="i18nt('render.hint.insertSubFormRow')"></el-button>
|
:title="i18nt('render.hint.insertSubFormRow')"></el-button>
|
||||||
<el-button circle type="" icon="el-icon-delete" @click="deleteSubFormRow(sfrIdx)"
|
<el-button :disabled="actionDisabled" circle type="" icon="el-icon-delete" @click="deleteSubFormRow(sfrIdx)"
|
||||||
:title="i18nt('render.hint.deleteSubFormRow')"></el-button>
|
:title="i18nt('render.hint.deleteSubFormRow')"></el-button>
|
||||||
<span v-if="widget.options.showRowNumber" class="row-number-span">#{{sfrIdx+1}}</span>
|
<span v-if="widget.options.showRowNumber" class="row-number-span">#{{sfrIdx+1}}</span>
|
||||||
</div>
|
</div>
|
||||||
|
@ -88,6 +88,7 @@
|
||||||
return {
|
return {
|
||||||
rowIdData: [],
|
rowIdData: [],
|
||||||
fieldSchemaData: [],
|
fieldSchemaData: [],
|
||||||
|
actionDisabled: false,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
|
|
|
@ -255,7 +255,7 @@
|
||||||
addFieldChangeEventHandler() {
|
addFieldChangeEventHandler() {
|
||||||
this.$off('fieldChange') //移除原有事件监听
|
this.$off('fieldChange') //移除原有事件监听
|
||||||
|
|
||||||
this.$on('fieldChange', function (fieldName, newValue, oldValue, subFormName, subFormRowIndex) {
|
this.$on('fieldChange', (fieldName, newValue, oldValue, subFormName, subFormRowIndex) => {
|
||||||
this.handleFieldDataChange(fieldName, newValue, oldValue, subFormName, subFormRowIndex)
|
this.handleFieldDataChange(fieldName, newValue, oldValue, subFormName, subFormRowIndex)
|
||||||
this.$emit('formChange', fieldName, newValue, oldValue, this.formDataModel, subFormName, subFormRowIndex)
|
this.$emit('formChange', fieldName, newValue, oldValue, this.formDataModel, subFormName, subFormRowIndex)
|
||||||
})
|
})
|
||||||
|
@ -374,8 +374,6 @@
|
||||||
* @param widgetNames 指定重新加载的组件名称或组件名数组,不传则重新加载所有选项字段
|
* @param widgetNames 指定重新加载的组件名称或组件名数组,不传则重新加载所有选项字段
|
||||||
*/
|
*/
|
||||||
reloadOptionData(widgetNames) {
|
reloadOptionData(widgetNames) {
|
||||||
//this._provided.globalOptionData = this.optionData
|
|
||||||
|
|
||||||
let eventParams = []
|
let eventParams = []
|
||||||
if (!!widgetNames && (typeof widgetNames === 'string')) {
|
if (!!widgetNames && (typeof widgetNames === 'string')) {
|
||||||
eventParams = [widgetNames]
|
eventParams = [widgetNames]
|
||||||
|
@ -409,24 +407,16 @@
|
||||||
},
|
},
|
||||||
|
|
||||||
setFormData(formData) { //设置表单数据
|
setFormData(formData) { //设置表单数据
|
||||||
//this.formDataModel = formData //inject注入的formModel不是响应式的,直接赋值在其他组件拿不到最新值!!
|
|
||||||
|
|
||||||
Object.keys(this.formDataModel).forEach(propName => {
|
Object.keys(this.formDataModel).forEach(propName => {
|
||||||
if (!!formData && formData.hasOwnProperty(propName)) {
|
if (!!formData && formData.hasOwnProperty(propName)) {
|
||||||
this.formDataModel[propName] = deepClone( formData[propName] )
|
this.formDataModel[propName] = deepClone( formData[propName] )
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
//this.formDataModel = formData
|
|
||||||
//this._provided.globalModel.formModel = formData /* 这种写法可使inject的属性保持响应式更新!! */
|
|
||||||
//
|
|
||||||
|
|
||||||
// 通知SubForm组件:表单数据更新事件!!
|
// 通知SubForm组件:表单数据更新事件!!
|
||||||
//this.broadcast('ContainerItem', 'setFormData', formData)
|
|
||||||
this.broadcast('ContainerItem', 'setFormData', this.formDataModel)
|
this.broadcast('ContainerItem', 'setFormData', this.formDataModel)
|
||||||
|
|
||||||
// 通知FieldWidget组件:表单数据更新事件!!
|
// 通知FieldWidget组件:表单数据更新事件!!
|
||||||
//this.broadcast('FieldWidget', 'setFormData', formData)
|
|
||||||
this.broadcast('FieldWidget', 'setFormData', this.formDataModel)
|
this.broadcast('FieldWidget', 'setFormData', this.formDataModel)
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -457,11 +447,11 @@
|
||||||
wNameList.forEach(wName => {
|
wNameList.forEach(wName => {
|
||||||
let foundW = this.getWidgetRef(wName)
|
let foundW = this.getWidgetRef(wName)
|
||||||
if (!!foundW) {
|
if (!!foundW) {
|
||||||
// if (!!foundW.setDisabled) {
|
if (!!foundW.widget && (foundW.widget.type === 'sub-form')) {
|
||||||
// foundW.setDisabled(true)
|
foundW.disableSubForm()
|
||||||
// }
|
} else {
|
||||||
|
!!foundW.setDisabled && foundW.setDisabled(true)
|
||||||
!!foundW.setDisabled && foundW.setDisabled(true)
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
@ -471,11 +461,11 @@
|
||||||
wNameList.forEach(wName => {
|
wNameList.forEach(wName => {
|
||||||
let foundW = this.getWidgetRef(wName)
|
let foundW = this.getWidgetRef(wName)
|
||||||
if (!!foundW) {
|
if (!!foundW) {
|
||||||
// if (!!foundW.setDisabled) {
|
if (!!foundW.widget && (foundW.widget.type === 'sub-form')) {
|
||||||
// foundW.setDisabled(false)
|
foundW.enableSubForm()
|
||||||
// }
|
} else {
|
||||||
|
!!foundW.setDisabled && foundW.setDisabled(false)
|
||||||
!!foundW.setDisabled && foundW.setDisabled(false)
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue