CRUD生成改进

pull/71/head
PPPSCN 2018-04-08 14:27:27 +08:00
parent 3fa885c4cd
commit 4457fcfbb5
3 changed files with 16 additions and 7 deletions

View File

@ -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;

View File

@ -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,

View File

@ -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,