mirror of
https://github.com/jumpserver/lina.git
synced 2026-01-15 14:24:39 +00:00
perf: 修改 auto form check box
This commit is contained in:
@@ -173,7 +173,13 @@ export class FormFieldGenerator {
|
||||
|
||||
let helpTextAsPlaceholder = field.helpTextAsPlaceholder
|
||||
const helpTextWordLength = helpText.split(' ').length
|
||||
if ((helpTextWordLength <= 5 || helpText.length <= 10) && helpTextAsPlaceholder === undefined) {
|
||||
const placeholderType = ['input', 'select', 'm2m_related_field']
|
||||
const placeholderComponent = [ObjectSelect2]
|
||||
if (helpTextAsPlaceholder !== undefined) {
|
||||
helpTextAsPlaceholder = !!helpTextAsPlaceholder
|
||||
} else if (placeholderType.indexOf(field.type) === -1 && placeholderComponent.indexOf(field.component) === -1) {
|
||||
helpTextAsPlaceholder = false
|
||||
} else if (helpTextWordLength <= 5 || helpText.length <= 10) {
|
||||
helpTextAsPlaceholder = true
|
||||
}
|
||||
|
||||
@@ -193,6 +199,16 @@ export class FormFieldGenerator {
|
||||
if (field.placeholder) {
|
||||
field.el.placeholder = field.placeholder
|
||||
}
|
||||
|
||||
// 设置 checkbox 的 tips
|
||||
if (field.tips && ['checkbox-group', 'radio-group'].indexOf(field.type) !== -1) {
|
||||
field.options.map(option => {
|
||||
if (!option.tip && field.tips[option.value]) {
|
||||
option.tip = field.tips[option.value]
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
return field
|
||||
}
|
||||
|
||||
|
||||
@@ -61,6 +61,9 @@
|
||||
v-bind="opt"
|
||||
>
|
||||
{{ opt.label }}
|
||||
<el-tooltip v-if="opt.tip" :content="opt.tip" :open-delay="500" placement="top">
|
||||
<i class="fa fa-question-circle-o" />
|
||||
</el-tooltip>
|
||||
</el-checkbox>
|
||||
<!-- WARNING: radio 用 label 属性来表示 value 的含义 -->
|
||||
<!-- FYI: radio 的 value 属性可以在没有 radio-group 时用来关联到同一个 v-model -->
|
||||
@@ -69,7 +72,11 @@
|
||||
:key="opt.label"
|
||||
:label="'value' in opt ? opt.value : opt.label"
|
||||
v-bind="opt"
|
||||
>{{ opt.label }}
|
||||
>
|
||||
{{ opt.label }}
|
||||
<el-tooltip v-if="opt.tip" :content="opt.tip" :open-delay="500" placement="top">
|
||||
<i class="fa fa-question-circle-o" />
|
||||
</el-tooltip>
|
||||
</el-radio>
|
||||
</template>
|
||||
</custom-component>
|
||||
|
||||
@@ -82,6 +82,10 @@ export default {
|
||||
}
|
||||
}
|
||||
|
||||
>>> .el-table td, .el-table th {
|
||||
padding: 5px 0;
|
||||
}
|
||||
|
||||
>>> .el-table th, .el-table tr {
|
||||
background-color: #F5F6F7!important;
|
||||
|
||||
|
||||
@@ -46,7 +46,10 @@ export default {
|
||||
}
|
||||
},
|
||||
mfa_level: {
|
||||
disabled: false
|
||||
disabled: false,
|
||||
tips: {
|
||||
2: this.$t('If force enable, user can not disable by themselves')
|
||||
}
|
||||
},
|
||||
email: {
|
||||
rules: [
|
||||
|
||||
Reference in New Issue
Block a user