diff --git a/app/admin/model/Config.php b/app/admin/model/Config.php index 7a0aca5a..40e8c23e 100644 --- a/app/admin/model/Config.php +++ b/app/admin/model/Config.php @@ -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 []; } } \ No newline at end of file diff --git a/web/src/views/backend/routine/config/add.vue b/web/src/views/backend/routine/config/add.vue index c2025de4..3ab25d11 100644 --- a/web/src/views/backend/routine/config/add.vue +++ b/web/src/views/backend/routine/config/add.vue @@ -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" > @@ -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" />
${{ item.name }}