mirror of
https://gitee.com/ulthon/ulthon_admin.git
synced 2026-07-01 15:32:48 +08:00
feat: 生成表单时在添加页面默认读取get参数预设值
This commit is contained in:
@@ -1266,6 +1266,9 @@ class BuildCurdServiceBase
|
||||
continue;
|
||||
}
|
||||
|
||||
$defaultFromRequestComponent = '{$Request.param.' . $field . '|default=\'' . $val['default'] . '\'}';
|
||||
$defaultFromRequestVar = '$Request.param.' . $field;
|
||||
|
||||
$templateFile = "view{$this->DS}module{$this->DS}input";
|
||||
$define = '';
|
||||
|
||||
@@ -1295,12 +1298,12 @@ class BuildCurdServiceBase
|
||||
} elseif ($val['formType'] == 'radio' || $val['formType'] == 'switch') {
|
||||
$templateFile = "view{$this->DS}module{$this->DS}radio";
|
||||
if (isset($val['define']) && !empty($val['define'])) {
|
||||
$define = $this->buildRadioView($field, '{in name="k" value="' . $val['default'] . '"}checked=""{/in}');
|
||||
$define = $this->buildRadioView($field, '{in name="k" value="' . $defaultFromRequestVar . '"}checked=""{/in}');
|
||||
}
|
||||
} elseif ($val['formType'] == 'checkbox') {
|
||||
$templateFile = "view{$this->DS}module{$this->DS}checkbox";
|
||||
if (isset($val['define']) && !empty($val['define'])) {
|
||||
$define = $this->buildCheckboxView($field, '{in name="k" value="' . $val['default'] . '"}checked=""{/in}');
|
||||
$define = $this->buildCheckboxView($field, '{in name="k" value="' . $defaultFromRequestVar . '"}checked=""{/in}');
|
||||
}
|
||||
} elseif ($val['formType'] == 'select') {
|
||||
$templateFile = "view{$this->DS}module{$this->DS}select";
|
||||
@@ -1308,7 +1311,7 @@ class BuildCurdServiceBase
|
||||
// TODO:这里的兼容关联不知道还有没有用,可能是技术债务,需要清理
|
||||
$define = $this->buildOptionView($val['bindRelation']);
|
||||
} elseif (isset($val['define']) && !empty($val['define'])) {
|
||||
$define = $this->buildOptionView($field);
|
||||
$define = $this->buildOptionView($field, '{in name="k" value="' . $defaultFromRequestVar . '"}selected=""{/in}');
|
||||
}
|
||||
} elseif (in_array($field, ['remark']) || $val['formType'] == 'textarea') {
|
||||
$templateFile = "view{$this->DS}module{$this->DS}textarea";
|
||||
@@ -1319,13 +1322,13 @@ class BuildCurdServiceBase
|
||||
|
||||
$templateFile = "view{$this->DS}module{$this->DS}table";
|
||||
|
||||
$define = $this->buildTableView($field, $val, $val['default']);
|
||||
$define = $this->buildTableView($field, $val, $defaultFromRequestComponent);
|
||||
} elseif ($val['formType'] == 'table') {
|
||||
$templateFile = "view{$this->DS}module{$this->DS}table";
|
||||
$define = $this->buildTableView($field, $val, $val['default']);
|
||||
$define = $this->buildTableView($field, $val, $defaultFromRequestComponent);
|
||||
} elseif ($val['formType'] == 'city') {
|
||||
$templateFile = "view{$this->DS}module{$this->DS}city";
|
||||
$define = $this->buildCityView($field, $val, $val['default']);
|
||||
$define = $this->buildCityView($field, $val, $defaultFromRequestComponent);
|
||||
} elseif ($val['formType'] == 'tag') {
|
||||
$templateFile = "view{$this->DS}module{$this->DS}tag";
|
||||
}
|
||||
@@ -1337,7 +1340,7 @@ class BuildCurdServiceBase
|
||||
'field' => $field,
|
||||
'required' => $this->buildRequiredHtml($val['required']),
|
||||
'required_text' => $val['required'] ? '1' : '',
|
||||
'value' => $val['default'],
|
||||
'value' => $defaultFromRequestComponent,
|
||||
'define' => $define,
|
||||
]
|
||||
);
|
||||
|
||||
@@ -2,7 +2,7 @@ var init = {
|
||||
tableElem: '#currentTable',
|
||||
tableRenderId: 'currentTableRenderId',
|
||||
indexUrl: '{{controllerUrl}}/index',
|
||||
addUrl: '{{controllerUrl}}/add',
|
||||
addUrl: '{{controllerUrl}}/add' + location.search,
|
||||
editUrl: '{{controllerUrl}}/edit',
|
||||
deleteUrl: '{{controllerUrl}}/delete',
|
||||
exportUrl: '{{controllerUrl}}/export',
|
||||
|
||||
Reference in New Issue
Block a user