Skip to content

Commit

Permalink
improvement: 标准插件Tag表单支持changeHook方法 TencentBlueKing#81 (TencentBlueK…
Browse files Browse the repository at this point in the history
…ing#82)

* feature: 标准插件Tag表单支持changeHook方法

* minor:Tag表单项label margin 样式
  • Loading branch information
luofann authored and pagezz-canway committed Apr 12, 2019
1 parent e67c001 commit bfc9ffb
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 4 deletions.
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">
<span class="name">{{scheme.attrs.name}}</span>
<span v-if="scheme.attrs.desc" class="rf-group-desc">
Expand All @@ -29,11 +38,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 @@ -332,7 +341,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 @@ -224,8 +224,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 @@ -972,6 +972,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

0 comments on commit bfc9ffb

Please sign in to comment.