mirror of https://gitee.com/karson/fastadmin.git
CRUD生成改进
parent
3fa885c4cd
commit
4457fcfbb5
|
|
@ -696,6 +696,7 @@ class Crud extends Command
|
||||||
|
|
||||||
//表注释
|
//表注释
|
||||||
$tableComment = $modelTableInfo['Comment'];
|
$tableComment = $modelTableInfo['Comment'];
|
||||||
|
$tableCNName = mb_substr($tableComment, -1) == '表' ? mb_substr($tableComment, 0, -1) : $tableComment;
|
||||||
$tableComment = mb_substr($tableComment, -1) == '表' ? mb_substr($tableComment, 0, -1) . '管理' : $tableComment;
|
$tableComment = mb_substr($tableComment, -1) == '表' ? mb_substr($tableComment, 0, -1) . '管理' : $tableComment;
|
||||||
|
|
||||||
$appNamespace = Config::get('app_namespace');
|
$appNamespace = Config::get('app_namespace');
|
||||||
|
|
@ -724,6 +725,7 @@ class Crud extends Command
|
||||||
'modelTableTypeName' => $modelTableTypeName,
|
'modelTableTypeName' => $modelTableTypeName,
|
||||||
'validateName' => $validateName,
|
'validateName' => $validateName,
|
||||||
'tableComment' => $tableComment,
|
'tableComment' => $tableComment,
|
||||||
|
'tableCNName' => $tableCNName,
|
||||||
'iconName' => $iconName,
|
'iconName' => $iconName,
|
||||||
'pk' => $priKey,
|
'pk' => $priKey,
|
||||||
'order' => $order,
|
'order' => $order,
|
||||||
|
|
@ -1166,11 +1168,11 @@ EOD;
|
||||||
return <<<EOD
|
return <<<EOD
|
||||||
<div class="input-group">
|
<div class="input-group">
|
||||||
{$content}
|
{$content}
|
||||||
|
<span class="msg-box n-top" for="c-{$field}"></span>
|
||||||
<div class="input-group-addon no-border no-padding">
|
<div class="input-group-addon no-border no-padding">
|
||||||
<span><button type="button" id="plupload-{$field}" class="btn btn-danger plupload" data-input-id="c-{$field}"{$uploadfilter}{$multiple}{$preview}><i class="fa fa-upload"></i> {:__('Upload')}</button></span>
|
<span><button type="button" id="plupload-{$field}" class="btn btn-danger plupload" data-input-id="c-{$field}"{$uploadfilter}{$multiple}{$preview}><i class="fa fa-upload"></i> {:__('Upload')}</button></span>
|
||||||
<span><button type="button" id="fachoose-{$field}" class="btn btn-primary fachoose" data-input-id="c-{$field}"{$selectfilter}{$multiple}><i class="fa fa-list"></i> {:__('Choose')}</button></span>
|
<span><button type="button" id="fachoose-{$field}" class="btn btn-primary fachoose" data-input-id="c-{$field}"{$selectfilter}{$multiple}><i class="fa fa-list"></i> {:__('Choose')}</button></span>
|
||||||
</div>
|
</div>
|
||||||
<span class="msg-box n-right" for="c-{$field}"></span>
|
|
||||||
</div>
|
</div>
|
||||||
{$previewcontainer}
|
{$previewcontainer}
|
||||||
EOD;
|
EOD;
|
||||||
|
|
@ -1207,7 +1209,7 @@ EOD;
|
||||||
$html = str_repeat(" ", 24) . "{field: '{$field}{$extend}', title: __('{$lang}')";
|
$html = str_repeat(" ", 24) . "{field: '{$field}{$extend}', title: __('{$lang}')";
|
||||||
//$formatter = $extend ? '' : $formatter;
|
//$formatter = $extend ? '' : $formatter;
|
||||||
if ($extend) {
|
if ($extend) {
|
||||||
$html .= ", operate:false";
|
$html .= ", operate: false";
|
||||||
if ($datatype == 'set') {
|
if ($datatype == 'set') {
|
||||||
$formatter = 'label';
|
$formatter = 'label';
|
||||||
}
|
}
|
||||||
|
|
@ -1218,21 +1220,21 @@ EOD;
|
||||||
}
|
}
|
||||||
unset($v);
|
unset($v);
|
||||||
$searchList = json_encode($itemArr, JSON_FORCE_OBJECT);
|
$searchList = json_encode($itemArr, JSON_FORCE_OBJECT);
|
||||||
$searchList = str_replace(['":"', '"}', ')","'], ['":', '}', '),"'], $searchList);
|
$searchList = str_replace(['":"', '"}', ')","'], ['": ', '}', '), "'], $searchList);
|
||||||
if ($itemArr && !$extend) {
|
if ($itemArr && !$extend) {
|
||||||
$html .= ", searchList: " . $searchList;
|
$html .= ", searchList: " . $searchList;
|
||||||
}
|
}
|
||||||
if (in_array($datatype, ['date', 'datetime']) || $formatter === 'datetime') {
|
if (in_array($datatype, ['date', 'datetime']) || $formatter === 'datetime') {
|
||||||
$html .= ", operate:'RANGE', addclass:'datetimerange'";
|
$html .= ", operate: 'RANGE', addclass: 'datetimerange'";
|
||||||
} else if (in_array($datatype, ['float', 'double', 'decimal'])) {
|
} else if (in_array($datatype, ['float', 'double', 'decimal'])) {
|
||||||
$html .= ", operate:'BETWEEN'";
|
$html .= ", operate: 'BETWEEN'";
|
||||||
}
|
}
|
||||||
if ($formatter)
|
if ($formatter)
|
||||||
$html .= ", formatter: Table.api.formatter." . $formatter . "}";
|
$html .= ", formatter: Table.api.formatter." . $formatter . "}";
|
||||||
else
|
else
|
||||||
$html .= "}";
|
$html .= "}";
|
||||||
if ($extend) {
|
if ($extend) {
|
||||||
$origin = str_repeat(" ", 24) . "{field: '{$field}', title: __('{$lang}'), visible:false";
|
$origin = str_repeat(" ", 24) . "{field: '{$field}', title: __('{$lang}'), visible: false";
|
||||||
if ($searchList) {
|
if ($searchList) {
|
||||||
$origin .= ", searchList: " . $searchList;
|
$origin .= ", searchList: " . $searchList;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,13 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
|
||||||
var table = $("#table");
|
var table = $("#table");
|
||||||
var date = new Date();
|
var date = new Date();
|
||||||
|
|
||||||
|
//在表格内容渲染完成后回调的事件
|
||||||
|
table.on('post-body.bs.table', function (e, settings, json, xhr) {
|
||||||
|
$(".btn-add").data("area", ["1000px", "95%"]).data("title", '添加{%tableCNName%}');
|
||||||
|
$(".btn-editone").data("area", ["1000px", "95%"]).data("title", '编辑{%tableCNName%}');
|
||||||
|
$(".btn-edit").data("area", ["1000px", "95%"]).data("title", '编辑{%tableCNName%}');
|
||||||
|
});
|
||||||
|
|
||||||
// 初始化表格
|
// 初始化表格
|
||||||
table.bootstrapTable({
|
table.bootstrapTable({
|
||||||
url: $.fn.bootstrapTable.defaults.extend.index_url,
|
url: $.fn.bootstrapTable.defaults.extend.index_url,
|
||||||
|
|
|
||||||
|
|
@ -117,7 +117,7 @@ define(['jquery', 'bootstrap', 'toastr', 'layer', 'lang'], function ($, undefine
|
||||||
title = options.title ? options.title : (title ? title : "");
|
title = options.title ? options.title : (title ? title : "");
|
||||||
url = Fast.api.fixurl(url);
|
url = Fast.api.fixurl(url);
|
||||||
url = url + (url.indexOf("?") > -1 ? "&" : "?") + "dialog=1";
|
url = url + (url.indexOf("?") > -1 ? "&" : "?") + "dialog=1";
|
||||||
var area = [$(window).width() > 1000 ? '1000px' : '95%', $(window).height() > 750 ? '750px' : '95%'];
|
var area = [$(window).width() > 800 ? '800px' : '95%', $(window).height() > 600 ? '600px' : '95%'];
|
||||||
options = $.extend({
|
options = $.extend({
|
||||||
type: 2,
|
type: 2,
|
||||||
title: title,
|
title: title,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue