mirror of
https://gitee.com/wonderful-code/buildadmin
synced 2024-11-22 07:04:24 +00:00
perf:优化系统配置
This commit is contained in:
parent
d2aed871c0
commit
8defddfaf3
@ -12,6 +12,7 @@ class Config extends Model
|
||||
'value',
|
||||
'content',
|
||||
'extend',
|
||||
'input_extend',
|
||||
];
|
||||
|
||||
protected $jsonDecodeType = ['checkbox', 'array', 'selects'];
|
||||
@ -27,8 +28,11 @@ class Config extends Model
|
||||
if (is_array($model->rule)) {
|
||||
$model->rule = implode(',', $model->rule);
|
||||
}
|
||||
if ($model->getData('extend')) {
|
||||
$model->extend = json_encode($model->handleTextAreaData($model->getData('extend')));
|
||||
if ($model->getData('extend') || $model->getData('inputExtend')) {
|
||||
$extend = $model->handleTextAreaData($model->getData('extend'));
|
||||
$inputExtend = $model->handleTextAreaData($model->getData('inputExtend'));
|
||||
if ($inputExtend) $extend['baInputExtend'] = $inputExtend;
|
||||
if ($extend) $model->extend = json_encode($extend);
|
||||
}
|
||||
$model->allow_del = 1;
|
||||
}
|
||||
@ -104,9 +108,22 @@ class Config extends Model
|
||||
{
|
||||
if ($value) {
|
||||
$arr = json_decode($value, true);
|
||||
return $arr ?: [];
|
||||
if ($arr) {
|
||||
unset($arr['baInputExtend']);
|
||||
return $arr;
|
||||
}
|
||||
}
|
||||
return [];
|
||||
}
|
||||
|
||||
public function getInputExtendAttr($value, $row)
|
||||
{
|
||||
if ($row['extend']) {
|
||||
$arr = json_decode($row['extend'], true);
|
||||
if ($arr && isset($arr['baInputExtend'])) {
|
||||
return $arr['baInputExtend'];
|
||||
}
|
||||
}
|
||||
return [];
|
||||
}
|
||||
}
|
@ -12,8 +12,8 @@
|
||||
@keyup.enter="onAddSubmit(formRef)"
|
||||
:rules="rules"
|
||||
:model="{ ...state.addConfig, ...state.formItemData }"
|
||||
:label-position="'left'"
|
||||
:label-width="120"
|
||||
label-position="right"
|
||||
:label-width="160"
|
||||
>
|
||||
<FormItem
|
||||
:label="t('routine.config.Variable grouping')"
|
||||
@ -79,7 +79,7 @@ const state: {
|
||||
formItemData: anyObj
|
||||
} = reactive({
|
||||
inputTypes: {},
|
||||
labelWidth: 160,
|
||||
labelWidth: 180,
|
||||
submitLoading: false,
|
||||
addConfig: {
|
||||
group: '',
|
||||
|
@ -20,9 +20,9 @@
|
||||
:label="item.title"
|
||||
:type="item.type"
|
||||
v-model.number="state.form[item.name]"
|
||||
:input-attr="{ placeholder: item.tip }"
|
||||
:attr="{ prop: item.name, ...item.extend }"
|
||||
:input-attr="{ placeholder: item.tip, ...item.input_extend }"
|
||||
:data="{ tip: item.tip }"
|
||||
:attr="Object.assign({ prop: item.name }, item.extend)"
|
||||
:key="'number-' + item.id"
|
||||
/>
|
||||
<!-- 富文本在dialog内全屏编辑器时必须拥有很高的z-index,此处选择单独为editor设定较小的z-index -->
|
||||
@ -33,14 +33,15 @@
|
||||
@keyup.enter.stop=""
|
||||
@keyup.ctrl.enter="onSubmit(formRef)"
|
||||
v-model="state.form[item.name]"
|
||||
:attr="{ prop: item.name, ...item.extend }"
|
||||
:input-attr="{
|
||||
placeholder: item.tip,
|
||||
style: {
|
||||
zIndex: 99,
|
||||
},
|
||||
...item.input_extend,
|
||||
}"
|
||||
:data="{ tip: item.tip }"
|
||||
:attr="Object.assign({ prop: item.name }, item.extend)"
|
||||
:key="'editor-' + item.id"
|
||||
/>
|
||||
<FormItem
|
||||
@ -50,9 +51,9 @@
|
||||
@keyup.enter.stop=""
|
||||
@keyup.ctrl.enter="onSubmit(formRef)"
|
||||
v-model="state.form[item.name]"
|
||||
:input-attr="{ placeholder: item.tip, rows: 3 }"
|
||||
:attr="{ prop: item.name, ...item.extend }"
|
||||
:input-attr="{ placeholder: item.tip, rows: 3, ...item.input_extend }"
|
||||
:data="{ tip: item.tip }"
|
||||
:attr="Object.assign({ prop: item.name }, item.extend)"
|
||||
:key="'textarea-' + item.id"
|
||||
/>
|
||||
<FormItem
|
||||
@ -60,9 +61,9 @@
|
||||
:label="item.title"
|
||||
:type="item.type"
|
||||
v-model="state.form[item.name]"
|
||||
:input-attr="{ placeholder: item.tip }"
|
||||
:attr="{ prop: item.name, ...item.extend }"
|
||||
:input-attr="{ placeholder: item.tip, ...item.input_extend }"
|
||||
:data="{ tip: item.tip, content: item.content ? item.content : {} }"
|
||||
:attr="Object.assign({ prop: item.name }, item.extend)"
|
||||
:key="'other-' + item.id"
|
||||
/>
|
||||
<div class="config-form-item-name">${{ item.name }}</div>
|
||||
|
Loading…
Reference in New Issue
Block a user