Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

improvement: 标准插件Tag表单支持changeHook方法 #81 #82

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 13 additions & 4 deletions pipeline/blueflow/src/components/common/RenderForm/FormItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,16 @@
* specific language governing permissions and limitations under the License.
*/
<template>
<div :class="['rf-form-item', 'clearfix', {'rf-has-hook': showHook}]" v-show="showForm">
<div
:class="[
'rf-form-item',
'clearfix',
{
'rf-has-hook': showHook,
'show-label': option.showLabel
}
]"
v-show="showForm">
<div v-if="!hook && option.showGroup && scheme.attrs.name" class="rf-group-name">
<h3 class="name">{{scheme.attrs.name}}</h3>
<div v-if="scheme.attrs.desc" class="rf-group-desc">
Expand All @@ -22,11 +31,11 @@
:class="['rf-tag-label', {'required': isRequired()}]">
{{scheme.attrs.name}}
</label>
<div v-if="hook" class="rf-tag-form">
<div v-show="hook" class="rf-tag-form">
<el-input :disabled="true" :value="String(value)"></el-input>
</div>
<component
v-else
v-show="!hook"
class="rf-tag-form"
ref="tagComponent"
:is="tagComponent"
Expand Down Expand Up @@ -324,7 +333,7 @@ export default {
}
}
}
.rf-tag-label + .rf-tag-form {
&.show-label > .rf-tag-form {
margin-left: 120px;
}
.rf-tag-hook {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -223,8 +223,12 @@ export function getFormMixins (attrs = {}) {
this.$emit('onShow')
},
hide () {
this.changeHook(false)
this.$emit('onHide')
},
changeHook (val) {
this.$parent.onHookForm(val)
},
// 获取 form 项实例
get_form_instance () {
return this.$parent
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -957,6 +957,10 @@ export default {
} else { // cancel hook
variableKey = this.inputAtomData[key] // variable key
const variable = this.constants[variableKey]
if (!variable) {
return
}

const formKey = this.isSingleAtom ? tagCode : key // input arguments form item key
this.inputAtomHook[formKey] = val
this.inputAtomData[formKey] = tools.deepClone(this.constants[variableKey].value)
Expand Down