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