mirror of https://gitee.com/karson/fastadmin.git
CRUD生成改进
parent
3fa885c4cd
commit
4457fcfbb5
|
|
@ -696,6 +696,7 @@ class Crud extends Command
|
|||
|
||||
//表注释
|
||||
$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;
|
||||
|
||||
$appNamespace = Config::get('app_namespace');
|
||||
|
|
@ -724,6 +725,7 @@ class Crud extends Command
|
|||
'modelTableTypeName' => $modelTableTypeName,
|
||||
'validateName' => $validateName,
|
||||
'tableComment' => $tableComment,
|
||||
'tableCNName' => $tableCNName,
|
||||
'iconName' => $iconName,
|
||||
'pk' => $priKey,
|
||||
'order' => $order,
|
||||
|
|
@ -1166,11 +1168,11 @@ EOD;
|
|||
return <<<EOD
|
||||
<div class="input-group">
|
||||
{$content}
|
||||
<span class="msg-box n-top" for="c-{$field}"></span>
|
||||
<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="fachoose-{$field}" class="btn btn-primary fachoose" data-input-id="c-{$field}"{$selectfilter}{$multiple}><i class="fa fa-list"></i> {:__('Choose')}</button></span>
|
||||
</div>
|
||||
<span class="msg-box n-right" for="c-{$field}"></span>
|
||||
</div>
|
||||
{$previewcontainer}
|
||||
EOD;
|
||||
|
|
@ -1207,7 +1209,7 @@ EOD;
|
|||
$html = str_repeat(" ", 24) . "{field: '{$field}{$extend}', title: __('{$lang}')";
|
||||
//$formatter = $extend ? '' : $formatter;
|
||||
if ($extend) {
|
||||
$html .= ", operate:false";
|
||||
$html .= ", operate: false";
|
||||
if ($datatype == 'set') {
|
||||
$formatter = 'label';
|
||||
}
|
||||
|
|
@ -1218,21 +1220,21 @@ EOD;
|
|||
}
|
||||
unset($v);
|
||||
$searchList = json_encode($itemArr, JSON_FORCE_OBJECT);
|
||||
$searchList = str_replace(['":"', '"}', ')","'], ['":', '}', '),"'], $searchList);
|
||||
$searchList = str_replace(['":"', '"}', ')","'], ['": ', '}', '), "'], $searchList);
|
||||
if ($itemArr && !$extend) {
|
||||
$html .= ", searchList: " . $searchList;
|
||||
}
|
||||
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'])) {
|
||||
$html .= ", operate:'BETWEEN'";
|
||||
$html .= ", operate: 'BETWEEN'";
|
||||
}
|
||||
if ($formatter)
|
||||
$html .= ", formatter: Table.api.formatter." . $formatter . "}";
|
||||
else
|
||||
$html .= "}";
|
||||
if ($extend) {
|
||||
$origin = str_repeat(" ", 24) . "{field: '{$field}', title: __('{$lang}'), visible:false";
|
||||
$origin = str_repeat(" ", 24) . "{field: '{$field}', title: __('{$lang}'), visible: false";
|
||||
if ($searchList) {
|
||||
$origin .= ", searchList: " . $searchList;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,6 +18,13 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
|
|||
var table = $("#table");
|
||||
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({
|
||||
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 : "");
|
||||
url = Fast.api.fixurl(url);
|
||||
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({
|
||||
type: 2,
|
||||
title: title,
|
||||
|
|
|
|||
Loading…
Reference in New Issue