Pre Merge pull request !101 from PPPSCN/master

pull/101/MERGE
PPPSCN 2019-03-03 19:19:38 +08:00
commit 4e9adacc32
24 changed files with 724 additions and 75 deletions

View File

@ -359,11 +359,12 @@ class Crud extends Command
//验证器 //验证器
list($validateNamespace, $validateName, $validateFile, $validateArr) = $this->getValidateData($validateModuleName, $validate, $table); list($validateNamespace, $validateName, $validateFile, $validateArr) = $this->getValidateData($validateModuleName, $validate, $table);
$controllerUrl = strtolower(implode('/', $controllerArr)); //如果控制器名为双驼峰形式,链接则需转为下划线与一键生成菜单保持一致
$controllerUrl = strtolower(preg_replace('/(?<=[a-z])([A-Z])/', '_$1', implode('/', $controllerArr)));
$controllerBaseName = strtolower(implode(DS, $controllerArr)); $controllerBaseName = strtolower(implode(DS, $controllerArr));
//视图文件 //视图文件 -- 如果控制器名为双驼峰形式,视图目录名则需转为下划线
$viewDir = $adminPath . 'view' . DS . $controllerBaseName . DS; $viewDir = $adminPath . 'view' . DS . strtolower(preg_replace('/(?<=[a-z])([A-Z])/', '_$1', implode(DS, $controllerArr))) . DS;
//最终将生成的文件路径 //最终将生成的文件路径
$javascriptFile = ROOT_PATH . 'public' . DS . 'assets' . DS . 'js' . DS . 'backend' . DS . $controllerBaseName . '.js'; $javascriptFile = ROOT_PATH . 'public' . DS . 'assets' . DS . 'js' . DS . 'backend' . DS . $controllerBaseName . '.js';
@ -523,6 +524,7 @@ class Crud extends Command
//循环所有字段,开始构造视图的HTML和JS信息 //循环所有字段,开始构造视图的HTML和JS信息
foreach ($columnList as $k => $v) { foreach ($columnList as $k => $v) {
$field = $v['COLUMN_NAME']; $field = $v['COLUMN_NAME'];
$langField = mb_ucfirst($field);
$itemArr = []; $itemArr = [];
// 这里构建Enum和Set类型的列表数据 // 这里构建Enum和Set类型的列表数据
if (in_array($v['DATA_TYPE'], ['enum', 'set', 'tinyint'])) { if (in_array($v['DATA_TYPE'], ['enum', 'set', 'tinyint'])) {
@ -580,6 +582,7 @@ class Crud extends Command
$formEditElement = $this->getReplacedStub('html/select', ['field' => $field, 'fieldName' => $fieldName, 'fieldList' => $this->getFieldListName($field), 'attrStr' => Form::attributes($attrArr), 'selectedValue' => "\$row.{$field}"]); $formEditElement = $this->getReplacedStub('html/select', ['field' => $field, 'fieldName' => $fieldName, 'fieldList' => $this->getFieldListName($field), 'attrStr' => Form::attributes($attrArr), 'selectedValue' => "\$row.{$field}"]);
} elseif ($inputType == 'datetime') { } elseif ($inputType == 'datetime') {
$cssClassArr[] = 'datetimepicker'; $cssClassArr[] = 'datetimepicker';
$attrArr['placeholder'] = "{:__('Please select')}{:__('{$langField}')}";
$attrArr['class'] = implode(' ', $cssClassArr); $attrArr['class'] = implode(' ', $cssClassArr);
$format = "YYYY-MM-DD HH:mm:ss"; $format = "YYYY-MM-DD HH:mm:ss";
$phpFormat = "Y-m-d H:i:s"; $phpFormat = "Y-m-d H:i:s";
@ -636,6 +639,7 @@ class Crud extends Command
$formEditElement = $this->getReplacedStub('html/' . $inputType, ['field' => $field, 'fieldName' => $fieldName, 'fieldList' => $this->getFieldListName($field), 'attrStr' => Form::attributes($attrArr), 'selectedValue' => "\$row.{$field}"]); $formEditElement = $this->getReplacedStub('html/' . $inputType, ['field' => $field, 'fieldName' => $fieldName, 'fieldList' => $this->getFieldListName($field), 'attrStr' => Form::attributes($attrArr), 'selectedValue' => "\$row.{$field}"]);
} elseif ($inputType == 'textarea') { } elseif ($inputType == 'textarea') {
$cssClassArr[] = $this->isMatchSuffix($field, $this->editorSuffix) ? $this->editorClass : ''; $cssClassArr[] = $this->isMatchSuffix($field, $this->editorSuffix) ? $this->editorClass : '';
$attrArr['placeholder'] = "{:__('Please input')}{:__('{$langField}')}";
$attrArr['class'] = implode(' ', $cssClassArr); $attrArr['class'] = implode(' ', $cssClassArr);
$attrArr['rows'] = 5; $attrArr['rows'] = 5;
$formAddElement = Form::textarea($fieldName, $defaultValue, $attrArr); $formAddElement = Form::textarea($fieldName, $defaultValue, $attrArr);
@ -656,17 +660,20 @@ class Crud extends Command
$formAddElement = $this->getReplacedStub('html/' . $inputType, ['field' => $field, 'fieldName' => $fieldName, 'fieldYes' => $yes, 'fieldNo' => $no, 'attrStr' => Form::attributes($attrArr), 'fieldValue' => $defaultValue, 'fieldSwitchClass' => $defaultValue == $no ? $stateNoClass : '']); $formAddElement = $this->getReplacedStub('html/' . $inputType, ['field' => $field, 'fieldName' => $fieldName, 'fieldYes' => $yes, 'fieldNo' => $no, 'attrStr' => Form::attributes($attrArr), 'fieldValue' => $defaultValue, 'fieldSwitchClass' => $defaultValue == $no ? $stateNoClass : '']);
$formEditElement = $this->getReplacedStub('html/' . $inputType, ['field' => $field, 'fieldName' => $fieldName, 'fieldYes' => $yes, 'fieldNo' => $no, 'attrStr' => Form::attributes($attrArr), 'fieldValue' => "{\$row.{$field}}", 'fieldSwitchClass' => "{eq name=\"\$row.{$field}\" value=\"{$no}\"}fa-flip-horizontal text-gray{/eq}"]); $formEditElement = $this->getReplacedStub('html/' . $inputType, ['field' => $field, 'fieldName' => $fieldName, 'fieldYes' => $yes, 'fieldNo' => $no, 'attrStr' => Form::attributes($attrArr), 'fieldValue' => "{\$row.{$field}}", 'fieldSwitchClass' => "{eq name=\"\$row.{$field}\" value=\"{$no}\"}fa-flip-horizontal text-gray{/eq}"]);
} elseif ($inputType == 'citypicker') { } elseif ($inputType == 'citypicker') {
$attrArr['placeholder'] = "{:__('Please select')}{:__('{$langField}')}";
$attrArr['class'] = implode(' ', $cssClassArr); $attrArr['class'] = implode(' ', $cssClassArr);
$attrArr['data-toggle'] = "city-picker"; $attrArr['data-toggle'] = "city-picker";
$formAddElement = sprintf("<div class='control-relative'>%s</div>", Form::input('text', $fieldName, $defaultValue, $attrArr)); $formAddElement = sprintf("<div class='control-relative'>%s</div>", Form::input('text', $fieldName, $defaultValue, $attrArr));
$formEditElement = sprintf("<div class='control-relative'>%s</div>", Form::input('text', $fieldName, $editValue, $attrArr)); $formEditElement = sprintf("<div class='control-relative'>%s</div>", Form::input('text', $fieldName, $editValue, $attrArr));
} else { } else {
$attrArr['placeholder'] = "{:__('Please input')}{:__('{$langField}')}";
$search = $replace = ''; $search = $replace = '';
//特殊字段为关联搜索 //特殊字段为关联搜索
if ($this->isMatchSuffix($field, $this->selectpageSuffix)) { if ($this->isMatchSuffix($field, $this->selectpageSuffix)) {
$inputType = 'text'; $inputType = 'text';
$defaultValue = ''; $defaultValue = '';
$attrArr['data-rule'] = 'required'; $attrArr['data-rule'] = 'required';
$attrArr['placeholder'] = "{:__('Please select')}{:__('{$langField}')}";
$cssClassArr[] = 'selectpage'; $cssClassArr[] = 'selectpage';
$selectpageController = str_replace('_', '/', substr($field, 0, strripos($field, '_'))); $selectpageController = str_replace('_', '/', substr($field, 0, strripos($field, '_')));
$attrArr['data-source'] = $selectpageController . "/index"; $attrArr['data-source'] = $selectpageController . "/index";
@ -1311,8 +1318,8 @@ EOD;
$langField = mb_ucfirst($field); $langField = mb_ucfirst($field);
return <<<EOD return <<<EOD
<div class="form-group"> <div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('{$langField}')}:</label> <label for="c-{$field}" class="control-label">{:__('{$langField}')}:</label>
<div class="col-xs-12 col-sm-8"> <div class="pp_container">
{$content} {$content}
</div> </div>
</div> </div>
@ -1338,11 +1345,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

@ -1,9 +1,7 @@
<form id="add-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action=""> <form id="add-form" role="form" data-toggle="validator" method="POST" action="">
{%addList%} {%addList%}
<div class="form-group layer-footer"> <div class="form-group layer-footer">
<label class="control-label col-xs-12 col-sm-2"></label> <div class="pp_container text-center">
<div class="col-xs-12 col-sm-8">
<button type="submit" class="btn btn-success btn-embossed disabled">{:__('OK')}</button> <button type="submit" class="btn btn-success btn-embossed disabled">{:__('OK')}</button>
<button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button> <button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button>
</div> </div>

View File

@ -1,9 +1,7 @@
<form id="edit-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action=""> <form id="edit-form" role="form" data-toggle="validator" method="POST" action="">
{%editList%} {%editList%}
<div class="form-group layer-footer"> <div class="form-group layer-footer">
<label class="control-label col-xs-12 col-sm-2"></label> <div class="pp_container text-center">
<div class="col-xs-12 col-sm-8">
<button type="submit" class="btn btn-success btn-embossed disabled">{:__('OK')}</button> <button type="submit" class="btn btn-success btn-embossed disabled">{:__('OK')}</button>
<button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button> <button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button>
</div> </div>

View File

@ -1,5 +1,4 @@
<div class="radio" id="c-{%field%}">
<div class="radio">
{foreach name="{%fieldList%}" item="vo"} {foreach name="{%fieldList%}" item="vo"}
<label for="{%fieldName%}-{$key}"><input id="{%fieldName%}-{$key}" name="{%fieldName%}" type="radio" value="{$key}" {in name="key" value="{%selectedValue%}"}checked{/in} /> {$vo}</label> <label for="{%fieldName%}-{$key}"><input id="{%fieldName%}-{$key}" name="{%fieldName%}" type="radio" value="{$key}" {in name="key" value="{%selectedValue%}"}checked{/in} /> {$vo}</label>
{/foreach} {/foreach}

View File

@ -1,4 +1,3 @@
<select {%attrStr%}> <select {%attrStr%}>
{foreach name="{%fieldList%}" item="vo"} {foreach name="{%fieldList%}" item="vo"}
<option value="{$key}" {in name="key" value="{%selectedValue%}"}selected{/in}>{$vo}</option> <option value="{$key}" {in name="key" value="{%selectedValue%}"}selected{/in}>{$vo}</option>

View File

@ -25,7 +25,15 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
[ [
{%javascriptList%} {%javascriptList%}
] ]
] ],
//禁用默认搜索
search: false,
//启用普通表单搜索
commonSearch: true,
//可以控制是否默认显示搜索表单,false则隐藏,默认为false
searchFormVisible: false,
showColumns: false,
showToggle: false,
}); });
// 为表格绑定事件 // 为表格绑定事件

View File

@ -201,6 +201,13 @@ class Menu extends Command
if (in_array('trashed', get_class_methods($model))) { if (in_array('trashed', get_class_methods($model))) {
$withSofeDelete = true; $withSofeDelete = true;
} }
} else {
preg_match_all("/\\\$this\->model\s*=\s*new\s+([a-zA-Z\\\]+);/", $classContent, $matches);
\think\Request::instance()->module('admin');
$model = new $matches[1][0];
if (in_array('trashed', get_class_methods($model))) {
$withSofeDelete = true;
}
} }
//忽略的类 //忽略的类
if (stripos($classComment, "@internal") !== false) { if (stripos($classComment, "@internal") !== false) {

View File

@ -130,21 +130,21 @@ if (!function_exists('build_toolbar')) {
$template = str_replace('/', '_', $controller); $template = str_replace('/', '_', $controller);
$download = ''; $download = '';
if (file_exists("./template/{$template}.xlsx")) { if (file_exists("./template/{$template}.xlsx")) {
$download .= "<li><a href=\"/template/{$template}.xlsx\" target=\"_blank\">XLSX模版</a></li>"; $download .= "\n <li><a href=\"/template/{$template}.xlsx\" target=\"_blank\">__('%s template', 'XLSX')</a></li>";
} }
if (file_exists("./template/{$template}.xls")) { if (file_exists("./template/{$template}.xls")) {
$download .= "<li><a href=\"/template/{$template}.xls\" target=\"_blank\">XLS模版</a></li>"; $download .= "\n <li><a href=\"/template/{$template}.xls\" target=\"_blank\">__('%s template', 'XLSX')</a></li>";
} }
if (file_exists("./template/{$template}.csv")) { if (file_exists("./template/{$template}.csv")) {
$download .= empty($download) ? '' : "<li class=\"divider\"></li>"; $download .= empty($download) ? '' : "\n <li class=\"divider\"></li>";
$download .= "<li><a href=\"/template/{$template}.csv\" target=\"_blank\">CSV模版</a></li>"; $download .= "\n <li><a href=\"/template/{$template}.csv\" target=\"_blank\">__('%s template', 'CSV')</a></li>";
} }
$download .= empty($download) ? '' : "\n "; $download .= empty($download) ? '' : "\n ";
if (!empty($download)) { if (!empty($download)) {
$html[] = <<<EOT $html[] = <<<EOT
<div class="btn-group"> <div class="btn-group">
<button type="button" href="{$href}" class="btn btn-info btn-import" title="{$title}" id="btn-import-file" data-url="ajax/upload" data-mimetype="csv,xls,xlsx" data-multiple="false"><i class="{$icon}"></i> {$text}</button> <button type="button" href="{$href}" class="btn btn-info btn-import" title="{$title}" id="btn-import-file" data-url="ajax/upload" data-mimetype="csv,xls,xlsx" data-multiple="false"><i class="{$icon}"></i> {$text}</button>
<button type="button" class="btn btn-info dropdown-toggle" data-toggle="dropdown" title="下载批量导入模版"> <button type="button" class="btn btn-info dropdown-toggle" data-toggle="dropdown" title="__('Download bulk import template')">
<span class="caret"></span> <span class="caret"></span>
<span class="sr-only">Toggle Dropdown</span> <span class="sr-only">Toggle Dropdown</span>
</button> </button>

View File

@ -17,6 +17,8 @@ return [
'Del' => '删除', 'Del' => '删除',
'Delete' => '删除', 'Delete' => '删除',
'Import' => '导入', 'Import' => '导入',
'Download bulk import template' => '下载批量导入模版',
'%s template' => '%s模版',
'Export' => '导出', 'Export' => '导出',
'All' => '全部', 'All' => '全部',
'Detail' => '详情', 'Detail' => '详情',

View File

@ -18,5 +18,8 @@ return [
'Storage' => '存储引擎', 'Storage' => '存储引擎',
'Upload to third' => '上传到第三方', 'Upload to third' => '上传到第三方',
'Upload to local' => '上传到本地', 'Upload to local' => '上传到本地',
'Upload from editor' => '从编辑器上传' 'Upload from editor' => '从编辑器上传',
'No file upload or server upload limit exceeded' => '未上传文件或超出服务器上传限制',
'Uploaded file format is limited' => '上传文件格式受限制',
'Upload successful' => '上传成功',
]; ];

View File

@ -12,6 +12,15 @@ use think\Exception;
trait Backend trait Backend
{ {
/**
* 空操作
* @internal
*/
public function _empty()
{
$this->error(__('An unexpected error occurred'));
}
/** /**
* 排除前台提交过来的字段 * 排除前台提交过来的字段
* @param $params * @param $params

View File

@ -3,6 +3,9 @@
<head> <head>
<!-- 加载样式及META信息 --> <!-- 加载样式及META信息 -->
{include file="common/meta" /} {include file="common/meta" /}
<script type="text/javascript">
if(self != top) { top.location = self.location; }
</script>
</head> </head>
<body class="hold-transition skin-green sidebar-mini fixed {if $config.fastadmin.multiplenav}multiplenav{/if}" id="tabs"> <body class="hold-transition skin-green sidebar-mini fixed {if $config.fastadmin.multiplenav}multiplenav{/if}" id="tabs">
<div class="wrapper"> <div class="wrapper">

View File

@ -2,7 +2,9 @@
<html lang="en"> <html lang="en">
<head> <head>
{include file="common/meta" /} {include file="common/meta" /}
<script type="text/javascript">
if(self != top) { top.location = self.location; }
</script>
<style type="text/css"> <style type="text/css">
body { body {
color:#999; color:#999;

View File

@ -114,9 +114,16 @@ html.ios-fix body {
table.table-template { table.table-template {
overflow: hidden; overflow: hidden;
} }
.sp_container .msg-box { .pp_container {
border: none;
margin: 0;
padding: 0;
position: relative;
vertical-align: middle;
}
.sp_container .msg-box,.pp_container .msg-box {
position: absolute; position: absolute;
right: 0; left: 0;
top: 0; top: 0;
} }
.toast-top-right-index { .toast-top-right-index {
@ -989,6 +996,59 @@ table.table-nowrap thead > tr > th {
.wipecache li a { .wipecache li a {
color: #444444 !important; color: #444444 !important;
} }
.col-md-1-5 {
width: 20% !important;
float: left;
}
.col-xs-1-5,.col-sm-1-5,.col-md-1-5,.col-lg-1-5 {
min-height: 1px;
padding-left: 15px;
padding-right: 15px;
position: relative;
}
@media (min-width: 768px) {
.col-sm-1-5 {
width: 20%;
float: left;
}
}
@media (min-width: 992px) {
.col-md-1-5 {
width: 20%;
float: left;
}
}
@media (min-width: 1200px) {
.col-lg-1-5 {
width: 20%;
float: left;
}
}
div.pre {
display: block;
padding: 5px;
margin: 0 0 5px;
font-size: 11px;
line-height: 1.42857143;
word-break: break-all;
word-wrap: break-word;
color: #333333;
background-color: #f5f5f5;
border: 1px solid #ccc;
border-radius: 3px;
text-align: left;
}
#add-form .panel-body,#edit-form .panel-body{
padding-bottom:0;
}
/*修正开关关闭下的颜色值*/ /*修正开关关闭下的颜色值*/
.btn-switcher.disabled { .btn-switcher.disabled {
opacity: .6; opacity: .6;

File diff suppressed because one or more lines are too long

View File

@ -6,6 +6,9 @@
* *
* @author: Karson <karsonzhang@163.com> * @author: Karson <karsonzhang@163.com>
* @update 2018-04-05 <https://gitee.com/karson/fastadmin> * @update 2018-04-05 <https://gitee.com/karson/fastadmin>
*
* @author: pppscn <35696959@qq.com>
* @update 2019-02-16 <https://gitee.com/pp/fastadmin>
*/ */
!function ($) { !function ($) {
@ -18,12 +21,17 @@
var initCommonSearch = function (pColumns, that) { var initCommonSearch = function (pColumns, that) {
var vFormCommon = createFormCommon(pColumns, that); var vFormCommon = createFormCommon(pColumns, that);
var vModal = sprintf("<div class=\"commonsearch-table %s\">", that.options.searchFormVisible ? "" : "hidden"); var vModal = "<div class=\"commonsearch-table\">";
vModal += vFormCommon; vModal += vFormCommon;
vModal += "</div>"; vModal += "</div>";
that.$container.prepend($(vModal)); that.$container.prepend($(vModal));
that.$commonsearch = $(".commonsearch-table", that.$container); that.$commonsearch = $(".commonsearch-table", that.$container);
var form = $("form.form-commonsearch", that.$commonsearch); var form = $("form.form-commonsearch", that.$commonsearch);
if(!that.options.searchFormVisible){
setTimeout(function () {
that.$commonsearch.addClass('hidden');
},100);
}
require(['form'], function (Form) { require(['form'], function (Form) {
Form.api.bindevent(form); Form.api.bindevent(form);
@ -51,7 +59,7 @@
return Template(that.options.searchFormTemplate, {columns: pColumns, table: that}); return Template(that.options.searchFormTemplate, {columns: pColumns, table: that});
} }
var htmlForm = []; var htmlForm = [];
htmlForm.push(sprintf('<form class="form-horizontal form-commonsearch" novalidate method="post" action="%s" >', that.options.actionForm)); htmlForm.push(sprintf('<form class="%s" novalidate method="post" action="%s">', that.options.searchFormCss.form, that.options.actionForm));
htmlForm.push('<fieldset>'); htmlForm.push('<fieldset>');
if (that.options.titleForm.length > 0) if (that.options.titleForm.length > 0)
htmlForm.push(sprintf("<legend>%s</legend>", that.options.titleForm)); htmlForm.push(sprintf("<legend>%s</legend>", that.options.titleForm));
@ -66,9 +74,9 @@
vObjCol.operate = that.options.renderDefault && operate ? operate : (typeof vObjCol.operate === 'undefined' ? '=' : vObjCol.operate); vObjCol.operate = that.options.renderDefault && operate ? operate : (typeof vObjCol.operate === 'undefined' ? '=' : vObjCol.operate);
ColumnsForSearch.push(vObjCol); ColumnsForSearch.push(vObjCol);
htmlForm.push('<div class="form-group col-xs-12 col-sm-6 col-md-4 col-lg-3">'); htmlForm.push(sprintf('<div class="%s">', that.options.searchFormCss.form_group));
htmlForm.push(sprintf('<label for="%s" class="control-label col-xs-4">%s</label>', vObjCol.field, vObjCol.title)); htmlForm.push(sprintf('<label for="%s" class="%s">%s</label>', vObjCol.field, that.options.searchFormCss.label, vObjCol.title));
htmlForm.push('<div class="col-xs-8">'); htmlForm.push(sprintf('<div class="%s">', that.options.searchFormCss.container));
vObjCol.operate = vObjCol.operate ? vObjCol.operate.toUpperCase() : '='; vObjCol.operate = vObjCol.operate ? vObjCol.operate.toUpperCase() : '=';
htmlForm.push(sprintf('<input type="hidden" class="form-control operate" name="%s-operate" data-name="%s" value="%s" readonly>', vObjCol.field, vObjCol.field, vObjCol.operate)); htmlForm.push(sprintf('<input type="hidden" class="form-control operate" name="%s-operate" data-name="%s" value="%s" readonly>', vObjCol.field, vObjCol.field, vObjCol.operate));
@ -120,7 +128,8 @@
htmlForm.push('</div>'); htmlForm.push('</div>');
} }
} }
htmlForm.push('<div class="form-group col-xs-12 col-sm-6 col-md-4 col-lg-3">'); htmlForm.push(sprintf('<div class="%s">', that.options.searchFormCss.form_group));
htmlForm.push(sprintf('<label class="%s">&nbsp;</label>', that.options.searchFormCss.label_btn));
htmlForm.push(createFormBtn(that).join('')); htmlForm.push(createFormBtn(that).join(''));
htmlForm.push('</div>'); htmlForm.push('</div>');
htmlForm.push('</div>'); htmlForm.push('</div>');
@ -134,7 +143,7 @@
var htmlBtn = []; var htmlBtn = [];
var searchSubmit = that.options.formatCommonSubmitButton(); var searchSubmit = that.options.formatCommonSubmitButton();
var searchReset = that.options.formatCommonResetButton(); var searchReset = that.options.formatCommonResetButton();
htmlBtn.push('<div class="col-sm-8 col-xs-offset-4">'); htmlBtn.push(sprintf('<div class="%s">', that.options.searchFormCss.container));
htmlBtn.push(sprintf('<button type="submit" class="btn btn-success" formnovalidate>%s</button> ', searchSubmit)); htmlBtn.push(sprintf('<button type="submit" class="btn btn-success" formnovalidate>%s</button> ', searchSubmit));
htmlBtn.push(sprintf('<button type="reset" class="btn btn-default" >%s</button> ', searchReset)); htmlBtn.push(sprintf('<button type="reset" class="btn btn-default" >%s</button> ', searchReset));
htmlBtn.push('</div>'); htmlBtn.push('</div>');

View File

@ -1,4 +1,4 @@
define(['jquery', 'bootstrap', 'toastr', 'layer', 'lang'], function ($, undefined, Toastr, Layer, Lang) { define(['jquery', 'bootstrap', 'toastr', 'layer', 'lang', 'slimscroll'], function ($, undefined, Toastr, Layer, Lang, slimScroll) {
var Fast = { var Fast = {
config: { config: {
//toastr默认配置 //toastr默认配置
@ -6,7 +6,7 @@ define(['jquery', 'bootstrap', 'toastr', 'layer', 'lang'], function ($, undefine
"closeButton": true, "closeButton": true,
"debug": false, "debug": false,
"newestOnTop": false, "newestOnTop": false,
"progressBar": false, "progressBar": true,
"positionClass": "toast-top-center", "positionClass": "toast-top-center",
"preventDuplicates": false, "preventDuplicates": false,
"onclick": null, "onclick": null,
@ -315,6 +315,17 @@ define(['jquery', 'bootstrap', 'toastr', 'layer', 'lang'], function ($, undefine
}); });
//公共代码 //公共代码
$(function ($) {
if (self === top) {
$('div[role="main"]').slimScroll({height: $(window).height() + 'px'});
} else {
var ScrollHeight = $('iframe', parent.document).height();
if (!ScrollHeight || ScrollHeight === 100) {
ScrollHeight = $('.content-wrapper', parent.document).height();
}
$('div[role="main"]').slimScroll({height: ScrollHeight + 'px'});
}
});
//配置Toastr的参数 //配置Toastr的参数
Toastr.options = Fast.config.toastr; Toastr.options = Fast.config.toastr;
} }

View File

@ -652,7 +652,489 @@ define('../libs/require-css/css.min',[],function(){if("undefined"==typeof window
} }
})); }));
define('fast',['jquery', 'bootstrap', 'toastr', 'layer', 'lang'], function ($, undefined, Toastr, Layer, Lang) { /*! Copyright (c) 2011 Piotr Rochala (http://rocha.la)
* Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php)
* and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses.
*
* Version: 1.3.8
*
*/
(function($) {
$.fn.extend({
slimScroll: function(options) {
var defaults = {
// width in pixels of the visible scroll area
width : 'auto',
// height in pixels of the visible scroll area
height : '250px',
// width in pixels of the scrollbar and rail
size : '7px',
// scrollbar color, accepts any hex/color value
color: '#000',
// scrollbar position - left/right
position : 'right',
// distance in pixels between the side edge and the scrollbar
distance : '1px',
// default scroll position on load - top / bottom / $('selector')
start : 'top',
// sets scrollbar opacity
opacity : .4,
// enables always-on mode for the scrollbar
alwaysVisible : false,
// check if we should hide the scrollbar when user is hovering over
disableFadeOut : false,
// sets visibility of the rail
railVisible : false,
// sets rail color
railColor : '#333',
// sets rail opacity
railOpacity : .2,
// whether we should use jQuery UI Draggable to enable bar dragging
railDraggable : true,
// defautlt CSS class of the slimscroll rail
railClass : 'slimScrollRail',
// defautlt CSS class of the slimscroll bar
barClass : 'slimScrollBar',
// defautlt CSS class of the slimscroll wrapper
wrapperClass : 'slimScrollDiv',
// check if mousewheel should scroll the window if we reach top/bottom
allowPageScroll : false,
// scroll amount applied to each mouse wheel step
wheelStep : 20,
// scroll amount applied when user is using gestures
touchScrollStep : 200,
// sets border radius
borderRadius: '7px',
// sets border radius of the rail
railBorderRadius : '7px'
};
var o = $.extend(defaults, options);
// do it for every element that matches selector
this.each(function(){
var isOverPanel, isOverBar, isDragg, queueHide, touchDif,
barHeight, percentScroll, lastScroll,
divS = '<div></div>',
minBarHeight = 30,
releaseScroll = false;
// used in event handlers and for better minification
var me = $(this);
// ensure we are not binding it again
if (me.parent().hasClass(o.wrapperClass))
{
// start from last bar position
var offset = me.scrollTop();
// find bar and rail
bar = me.siblings('.' + o.barClass);
rail = me.siblings('.' + o.railClass);
getBarHeight();
// check if we should scroll existing instance
if ($.isPlainObject(options))
{
// Pass height: auto to an existing slimscroll object to force a resize after contents have changed
if ( 'height' in options && options.height == 'auto' ) {
me.parent().css('height', 'auto');
me.css('height', 'auto');
var height = me.parent().parent().height();
me.parent().css('height', height);
me.css('height', height);
} else if ('height' in options) {
var h = options.height;
me.parent().css('height', h);
me.css('height', h);
}
if ('scrollTo' in options)
{
// jump to a static point
offset = parseInt(o.scrollTo);
}
else if ('scrollBy' in options)
{
// jump by value pixels
offset += parseInt(o.scrollBy);
}
else if ('destroy' in options)
{
// remove slimscroll elements
bar.remove();
rail.remove();
me.unwrap();
return;
}
// scroll content by the given offset
scrollContent(offset, false, true);
}
return;
}
else if ($.isPlainObject(options))
{
if ('destroy' in options)
{
return;
}
}
// optionally set height to the parent's height
o.height = (o.height == 'auto') ? me.parent().height() : o.height;
// wrap content
var wrapper = $(divS)
.addClass(o.wrapperClass)
.css({
position: 'relative',
overflow: 'hidden',
width: o.width,
height: o.height
});
// update style for the div
me.css({
overflow: 'hidden',
width: o.width,
height: o.height
});
// create scrollbar rail
var rail = $(divS)
.addClass(o.railClass)
.css({
width: o.size,
height: '100%',
position: 'absolute',
top: 0,
display: (o.alwaysVisible && o.railVisible) ? 'block' : 'none',
'border-radius': o.railBorderRadius,
background: o.railColor,
opacity: o.railOpacity,
zIndex: 90
});
// create scrollbar
var bar = $(divS)
.addClass(o.barClass)
.css({
background: o.color,
width: o.size,
position: 'absolute',
top: 0,
opacity: o.opacity,
display: o.alwaysVisible ? 'block' : 'none',
'border-radius' : o.borderRadius,
BorderRadius: o.borderRadius,
MozBorderRadius: o.borderRadius,
WebkitBorderRadius: o.borderRadius,
zIndex: 99
});
// set position
var posCss = (o.position == 'right') ? { right: o.distance } : { left: o.distance };
rail.css(posCss);
bar.css(posCss);
// wrap it
me.wrap(wrapper);
// append to parent div
me.parent().append(bar);
me.parent().append(rail);
// make it draggable and no longer dependent on the jqueryUI
if (o.railDraggable){
bar.bind("mousedown", function(e) {
var $doc = $(document);
isDragg = true;
t = parseFloat(bar.css('top'));
pageY = e.pageY;
$doc.bind("mousemove.slimscroll", function(e){
currTop = t + e.pageY - pageY;
bar.css('top', currTop);
scrollContent(0, bar.position().top, false);// scroll content
});
$doc.bind("mouseup.slimscroll", function(e) {
isDragg = false;hideBar();
$doc.unbind('.slimscroll');
});
return false;
}).bind("selectstart.slimscroll", function(e){
e.stopPropagation();
e.preventDefault();
return false;
});
}
// on rail over
rail.hover(function(){
showBar();
}, function(){
hideBar();
});
// on bar over
bar.hover(function(){
isOverBar = true;
}, function(){
isOverBar = false;
});
// show on parent mouseover
me.hover(function(){
isOverPanel = true;
showBar();
hideBar();
}, function(){
isOverPanel = false;
hideBar();
});
// support for mobile
me.bind('touchstart', function(e,b){
if (e.originalEvent.touches.length)
{
// record where touch started
touchDif = e.originalEvent.touches[0].pageY;
}
});
me.bind('touchmove', function(e){
// prevent scrolling the page if necessary
if(!releaseScroll)
{
e.originalEvent.preventDefault();
}
if (e.originalEvent.touches.length)
{
// see how far user swiped
var diff = (touchDif - e.originalEvent.touches[0].pageY) / o.touchScrollStep;
// scroll content
scrollContent(diff, true);
touchDif = e.originalEvent.touches[0].pageY;
}
});
// set up initial height
getBarHeight();
// check start position
if (o.start === 'bottom')
{
// scroll content to bottom
bar.css({ top: me.outerHeight() - bar.outerHeight() });
scrollContent(0, true);
}
else if (o.start !== 'top')
{
// assume jQuery selector
scrollContent($(o.start).position().top, null, true);
// make sure bar stays hidden
if (!o.alwaysVisible) { bar.hide(); }
}
// attach scroll events
attachWheel(this);
function _onWheel(e)
{
// use mouse wheel only when mouse is over
if (!isOverPanel) { return; }
var e = e || window.event;
var delta = 0;
if (e.wheelDelta) { delta = -e.wheelDelta/120; }
if (e.detail) { delta = e.detail / 3; }
var target = e.target || e.srcTarget || e.srcElement;
if ($(target).closest('.' + o.wrapperClass).is(me.parent())) {
// scroll content
scrollContent(delta, true);
}
// stop window scroll
if (e.preventDefault && !releaseScroll) { e.preventDefault(); }
if (!releaseScroll) { e.returnValue = false; }
}
function scrollContent(y, isWheel, isJump)
{
releaseScroll = false;
var delta = y;
var maxTop = me.outerHeight() - bar.outerHeight();
if (isWheel)
{
// move bar with mouse wheel
delta = parseInt(bar.css('top')) + y * parseInt(o.wheelStep) / 100 * bar.outerHeight();
// move bar, make sure it doesn't go out
delta = Math.min(Math.max(delta, 0), maxTop);
// if scrolling down, make sure a fractional change to the
// scroll position isn't rounded away when the scrollbar's CSS is set
// this flooring of delta would happened automatically when
// bar.css is set below, but we floor here for clarity
delta = (y > 0) ? Math.ceil(delta) : Math.floor(delta);
// scroll the scrollbar
bar.css({ top: delta + 'px' });
}
// calculate actual scroll amount
percentScroll = parseInt(bar.css('top')) / (me.outerHeight() - bar.outerHeight());
delta = percentScroll * (me[0].scrollHeight - me.outerHeight());
if (isJump)
{
delta = y;
var offsetTop = delta / me[0].scrollHeight * me.outerHeight();
offsetTop = Math.min(Math.max(offsetTop, 0), maxTop);
bar.css({ top: offsetTop + 'px' });
}
// scroll content
me.scrollTop(delta);
// fire scrolling event
me.trigger('slimscrolling', ~~delta);
// ensure bar is visible
showBar();
// trigger hide when scroll is stopped
hideBar();
}
function attachWheel(target)
{
if (window.addEventListener)
{
target.addEventListener('DOMMouseScroll', _onWheel, false );
target.addEventListener('mousewheel', _onWheel, false );
}
else
{
document.attachEvent("onmousewheel", _onWheel)
}
}
function getBarHeight()
{
// calculate scrollbar height and make sure it is not too small
barHeight = Math.max((me.outerHeight() / me[0].scrollHeight) * me.outerHeight(), minBarHeight);
bar.css({ height: barHeight + 'px' });
// hide scrollbar if content is not long enough
var display = barHeight == me.outerHeight() ? 'none' : 'block';
bar.css({ display: display });
}
function showBar()
{
// recalculate bar height
getBarHeight();
clearTimeout(queueHide);
// when bar reached top or bottom
if (percentScroll == ~~percentScroll)
{
//release wheel
releaseScroll = o.allowPageScroll;
// publish approporiate event
if (lastScroll != percentScroll)
{
var msg = (~~percentScroll == 0) ? 'top' : 'bottom';
me.trigger('slimscroll', msg);
}
}
else
{
releaseScroll = false;
}
lastScroll = percentScroll;
// show only when required
if(barHeight >= me.outerHeight()) {
//allow window scroll
releaseScroll = true;
return;
}
bar.stop(true,true).fadeIn('fast');
if (o.railVisible) { rail.stop(true,true).fadeIn('fast'); }
}
function hideBar()
{
// only hide when options allow it
if (!o.alwaysVisible)
{
queueHide = setTimeout(function(){
if (!(o.disableFadeOut && isOverPanel) && !isOverBar && !isDragg)
{
bar.fadeOut('slow');
rail.fadeOut('slow');
}
}, 1000);
}
}
});
// maintain chainability
return this;
}
});
$.fn.extend({
slimscroll: $.fn.slimScroll
});
})(jQuery);
define("slimscroll", ["jquery"], (function (global) {
return function () {
var ret, fn;
return ret || global.$.fn.extend;
};
}(this)));
define('fast',['jquery', 'bootstrap', 'toastr', 'layer', 'lang', 'slimscroll'], function ($, undefined, Toastr, Layer, Lang, slimScroll) {
var Fast = { var Fast = {
config: { config: {
//toastr默认配置 //toastr默认配置
@ -660,7 +1142,7 @@ define('fast',['jquery', 'bootstrap', 'toastr', 'layer', 'lang'], function ($, u
"closeButton": true, "closeButton": true,
"debug": false, "debug": false,
"newestOnTop": false, "newestOnTop": false,
"progressBar": false, "progressBar": true,
"positionClass": "toast-top-center", "positionClass": "toast-top-center",
"preventDuplicates": false, "preventDuplicates": false,
"onclick": null, "onclick": null,
@ -969,6 +1451,17 @@ define('fast',['jquery', 'bootstrap', 'toastr', 'layer', 'lang'], function ($, u
}); });
//公共代码 //公共代码
$(function ($) {
if (self === top) {
$('div[role="main"]').slimScroll({height: $(window).height() + 'px'});
} else {
var ScrollHeight = $('iframe', parent.document).height();
if (!ScrollHeight || ScrollHeight === 100) {
ScrollHeight = $('.content-wrapper', parent.document).height();
}
$('div[role="main"]').slimScroll({height: ScrollHeight + 'px'});
}
});
//配置Toastr的参数 //配置Toastr的参数
Toastr.options = Fast.config.toastr; Toastr.options = Fast.config.toastr;
} }
@ -8797,8 +9290,9 @@ define('form',['jquery', 'bootstrap', 'upload', 'validator'], function ($, undef
validClass: 'has-success', validClass: 'has-success',
invalidClass: 'has-error', invalidClass: 'has-error',
bindClassTo: '.form-group', bindClassTo: '.form-group',
formClass: 'n-default n-bootstrap', formClass: 'n-yellow n-bootstrap',
msgClass: 'n-right', msgClass: 'n-top',
theme: 'yellow_top',
stopOnError: true, stopOnError: true,
display: function (elem) { display: function (elem) {
return $(elem).closest('.form-group').find(".control-label").text().replace(/\:/, ''); return $(elem).closest('.form-group').find(".control-label").text().replace(/\:/, '');
@ -9283,6 +9777,9 @@ define('form',['jquery', 'bootstrap', 'upload', 'validator'], function ($, undef
* *
* @author: Karson <karsonzhang@163.com> * @author: Karson <karsonzhang@163.com>
* @update 2018-04-05 <https://gitee.com/karson/fastadmin> * @update 2018-04-05 <https://gitee.com/karson/fastadmin>
*
* @author: pppscn <35696959@qq.com>
* @update 2019-02-16 <https://gitee.com/pp/fastadmin>
*/ */
!function ($) { !function ($) {
@ -9295,12 +9792,17 @@ define('form',['jquery', 'bootstrap', 'upload', 'validator'], function ($, undef
var initCommonSearch = function (pColumns, that) { var initCommonSearch = function (pColumns, that) {
var vFormCommon = createFormCommon(pColumns, that); var vFormCommon = createFormCommon(pColumns, that);
var vModal = sprintf("<div class=\"commonsearch-table %s\">", that.options.searchFormVisible ? "" : "hidden"); var vModal = "<div class=\"commonsearch-table\">";
vModal += vFormCommon; vModal += vFormCommon;
vModal += "</div>"; vModal += "</div>";
that.$container.prepend($(vModal)); that.$container.prepend($(vModal));
that.$commonsearch = $(".commonsearch-table", that.$container); that.$commonsearch = $(".commonsearch-table", that.$container);
var form = $("form.form-commonsearch", that.$commonsearch); var form = $("form.form-commonsearch", that.$commonsearch);
if(!that.options.searchFormVisible){
setTimeout(function () {
that.$commonsearch.addClass('hidden');
},100);
}
require(['form'], function (Form) { require(['form'], function (Form) {
Form.api.bindevent(form); Form.api.bindevent(form);
@ -9328,7 +9830,7 @@ define('form',['jquery', 'bootstrap', 'upload', 'validator'], function ($, undef
return Template(that.options.searchFormTemplate, {columns: pColumns, table: that}); return Template(that.options.searchFormTemplate, {columns: pColumns, table: that});
} }
var htmlForm = []; var htmlForm = [];
htmlForm.push(sprintf('<form class="form-horizontal form-commonsearch" novalidate method="post" action="%s" >', that.options.actionForm)); htmlForm.push(sprintf('<form class="%s" novalidate method="post" action="%s">', that.options.searchFormCss.form, that.options.actionForm));
htmlForm.push('<fieldset>'); htmlForm.push('<fieldset>');
if (that.options.titleForm.length > 0) if (that.options.titleForm.length > 0)
htmlForm.push(sprintf("<legend>%s</legend>", that.options.titleForm)); htmlForm.push(sprintf("<legend>%s</legend>", that.options.titleForm));
@ -9343,9 +9845,9 @@ define('form',['jquery', 'bootstrap', 'upload', 'validator'], function ($, undef
vObjCol.operate = that.options.renderDefault && operate ? operate : (typeof vObjCol.operate === 'undefined' ? '=' : vObjCol.operate); vObjCol.operate = that.options.renderDefault && operate ? operate : (typeof vObjCol.operate === 'undefined' ? '=' : vObjCol.operate);
ColumnsForSearch.push(vObjCol); ColumnsForSearch.push(vObjCol);
htmlForm.push('<div class="form-group col-xs-12 col-sm-6 col-md-4 col-lg-3">'); htmlForm.push(sprintf('<div class="%s">', that.options.searchFormCss.form_group));
htmlForm.push(sprintf('<label for="%s" class="control-label col-xs-4">%s</label>', vObjCol.field, vObjCol.title)); htmlForm.push(sprintf('<label for="%s" class="%s">%s</label>', vObjCol.field, that.options.searchFormCss.label, vObjCol.title));
htmlForm.push('<div class="col-xs-8">'); htmlForm.push(sprintf('<div class="%s">', that.options.searchFormCss.container));
vObjCol.operate = vObjCol.operate ? vObjCol.operate.toUpperCase() : '='; vObjCol.operate = vObjCol.operate ? vObjCol.operate.toUpperCase() : '=';
htmlForm.push(sprintf('<input type="hidden" class="form-control operate" name="%s-operate" data-name="%s" value="%s" readonly>', vObjCol.field, vObjCol.field, vObjCol.operate)); htmlForm.push(sprintf('<input type="hidden" class="form-control operate" name="%s-operate" data-name="%s" value="%s" readonly>', vObjCol.field, vObjCol.field, vObjCol.operate));
@ -9397,7 +9899,8 @@ define('form',['jquery', 'bootstrap', 'upload', 'validator'], function ($, undef
htmlForm.push('</div>'); htmlForm.push('</div>');
} }
} }
htmlForm.push('<div class="form-group col-xs-12 col-sm-6 col-md-4 col-lg-3">'); htmlForm.push(sprintf('<div class="%s">', that.options.searchFormCss.form_group));
htmlForm.push(sprintf('<label class="%s">&nbsp;</label>', that.options.searchFormCss.label_btn));
htmlForm.push(createFormBtn(that).join('')); htmlForm.push(createFormBtn(that).join(''));
htmlForm.push('</div>'); htmlForm.push('</div>');
htmlForm.push('</div>'); htmlForm.push('</div>');
@ -9411,7 +9914,7 @@ define('form',['jquery', 'bootstrap', 'upload', 'validator'], function ($, undef
var htmlBtn = []; var htmlBtn = [];
var searchSubmit = that.options.formatCommonSubmitButton(); var searchSubmit = that.options.formatCommonSubmitButton();
var searchReset = that.options.formatCommonResetButton(); var searchReset = that.options.formatCommonResetButton();
htmlBtn.push('<div class="col-sm-8 col-xs-offset-4">'); htmlBtn.push(sprintf('<div class="%s">', that.options.searchFormCss.container));
htmlBtn.push(sprintf('<button type="submit" class="btn btn-success" formnovalidate>%s</button> ', searchSubmit)); htmlBtn.push(sprintf('<button type="submit" class="btn btn-success" formnovalidate>%s</button> ', searchSubmit));
htmlBtn.push(sprintf('<button type="reset" class="btn btn-default" >%s</button> ', searchReset)); htmlBtn.push(sprintf('<button type="reset" class="btn btn-default" >%s</button> ', searchReset));
htmlBtn.push('</div>'); htmlBtn.push('</div>');
@ -9806,6 +10309,13 @@ define('table',['jquery', 'bootstrap', 'moment', 'moment/locale/zh-cn', 'bootstr
import_url: '', import_url: '',
multi_url: '', multi_url: '',
dragsort_url: 'ajax/weigh', dragsort_url: 'ajax/weigh',
},
searchFormCss: {
form: 'form-commonsearch',
form_group: 'form-group col-xs-12 col-sm-6 col-md-4 col-lg-3',
label: 'control-label',
label_btn: 'control-label hidden-xs',
container: 'pp_container',
} }
}, },
// Bootstrap-table 列配置 // Bootstrap-table 列配置
@ -9889,6 +10399,9 @@ define('table',['jquery', 'bootstrap', 'moment', 'moment/locale/zh-cn', 'bootstr
} }
//当内容渲染完成后 //当内容渲染完成后
table.on('post-body.bs.table', function (e, settings, json, xhr) { table.on('post-body.bs.table', function (e, settings, json, xhr) {
var ScrollHeight = self == top ? $(window).height() : $('.content-wrapper', parent.document).height();
table.closest('#main').height(ScrollHeight);
table.closest('.slimScrollDiv').height(ScrollHeight);
$(Table.config.refreshbtn, toolbar).find(".fa").removeClass("fa-spin"); $(Table.config.refreshbtn, toolbar).find(".fa").removeClass("fa-spin");
$(Table.config.disabledbtn, toolbar).toggleClass('disabled', true); $(Table.config.disabledbtn, toolbar).toggleClass('disabled', true);
if ($(Table.config.firsttd, table).find("input[type='checkbox'][data-index]").size() > 0) { if ($(Table.config.firsttd, table).find("input[type='checkbox'][data-index]").size() > 0) {
@ -9918,6 +10431,11 @@ define('table',['jquery', 'bootstrap', 'moment', 'moment/locale/zh-cn', 'bootstr
}); });
}); });
} }
if (table.find("div.pre").size() > 0) {
require(['slimscroll'], function () {
$('div.pre').slimScroll({width: '300px', height: '50px'});
});
}
}); });
// 处理选中筛选框后按钮的状态统一变更 // 处理选中筛选框后按钮的状态统一变更
table.on('check.bs.table uncheck.bs.table check-all.bs.table uncheck-all.bs.table', function () { table.on('check.bs.table uncheck.bs.table check-all.bs.table uncheck-all.bs.table', function () {

View File

@ -12,8 +12,9 @@ define(['jquery', 'bootstrap', 'upload', 'validator'], function ($, undefined, U
validClass: 'has-success', validClass: 'has-success',
invalidClass: 'has-error', invalidClass: 'has-error',
bindClassTo: '.form-group', bindClassTo: '.form-group',
formClass: 'n-default n-bootstrap', formClass: 'n-yellow n-bootstrap',
msgClass: 'n-right', msgClass: 'n-top',
theme: 'yellow_top',
stopOnError: true, stopOnError: true,
display: function (elem) { display: function (elem) {
return $(elem).closest('.form-group').find(".control-label").text().replace(/\:/, ''); return $(elem).closest('.form-group').find(".control-label").text().replace(/\:/, '');

View File

@ -48,6 +48,13 @@ define(['jquery', 'bootstrap', 'moment', 'moment/locale/zh-cn', 'bootstrap-table
import_url: '', import_url: '',
multi_url: '', multi_url: '',
dragsort_url: 'ajax/weigh', dragsort_url: 'ajax/weigh',
},
searchFormCss: {
form: 'form-commonsearch',
form_group: 'form-group col-xs-12 col-sm-6 col-md-4 col-lg-3',
label: 'control-label',
label_btn: 'control-label hidden-xs',
container: 'pp_container',
} }
}, },
// Bootstrap-table 列配置 // Bootstrap-table 列配置
@ -131,6 +138,9 @@ define(['jquery', 'bootstrap', 'moment', 'moment/locale/zh-cn', 'bootstrap-table
} }
//当内容渲染完成后 //当内容渲染完成后
table.on('post-body.bs.table', function (e, settings, json, xhr) { table.on('post-body.bs.table', function (e, settings, json, xhr) {
var ScrollHeight = self == top ? $(window).height() : $('.content-wrapper', parent.document).height();
table.closest('#main').height(ScrollHeight);
table.closest('.slimScrollDiv').height(ScrollHeight);
$(Table.config.refreshbtn, toolbar).find(".fa").removeClass("fa-spin"); $(Table.config.refreshbtn, toolbar).find(".fa").removeClass("fa-spin");
$(Table.config.disabledbtn, toolbar).toggleClass('disabled', true); $(Table.config.disabledbtn, toolbar).toggleClass('disabled', true);
if ($(Table.config.firsttd, table).find("input[type='checkbox'][data-index]").size() > 0) { if ($(Table.config.firsttd, table).find("input[type='checkbox'][data-index]").size() > 0) {
@ -160,6 +170,11 @@ define(['jquery', 'bootstrap', 'moment', 'moment/locale/zh-cn', 'bootstrap-table
}); });
}); });
} }
if (table.find("div.pre").size() > 0) {
require(['slimscroll'], function () {
$('div.pre').slimScroll({width: '300px', height: '50px'});
});
}
}); });
// 处理选中筛选框后按钮的状态统一变更 // 处理选中筛选框后按钮的状态统一变更
table.on('check.bs.table uncheck.bs.table check-all.bs.table uncheck-all.bs.table', function () { table.on('check.bs.table uncheck.bs.table check-all.bs.table uncheck-all.bs.table', function () {