同步项目代码

This commit is contained in:
邹景立 2021-07-25 22:49:41 +08:00
parent c107e208dc
commit b426fb7a65
33 changed files with 211 additions and 167 deletions

View File

@ -45,7 +45,7 @@ class Auth extends Controller
{
$this->title = '系统权限管理';
$query = $this->_query($this->table)->dateBetween('create_at');
$query->like('title,desc')->equal('status')->order('sort desc,id desc')->page();
$query->like('title,desc')->equal('status')->layTable();
}
/**
@ -81,7 +81,6 @@ class Auth extends Controller
*/
public function state()
{
$this->_applyFormToken();
$this->_save($this->table, $this->_vali([
'status.in:0,1' => '状态值范围异常!',
'status.require' => '状态值不能为空!',
@ -125,7 +124,6 @@ class Auth extends Controller
*/
public function remove()
{
$this->_applyFormToken();
$this->_delete($this->table);
}

View File

@ -48,7 +48,8 @@ class Oplog extends Controller
$this->title = '系统日志管理';
$this->isSupper = AdminService::instance()->isSuper();
$this->actions = $this->app->db->name($this->table)->distinct(true)->column('action');
$query = $this->_query($this->table)->dateBetween('create_at')->order('id desc');
// 数据列表处理
$query = $this->_query($this->table)->dateBetween('create_at');
$query->like('action,node,content,username,geoip')->layTable();
}

View File

@ -1,18 +1,18 @@
<form class="layui-form layui-card" action="{:request()->url()}" data-auto="true" method="post" autocomplete="off">
<form class="layui-form layui-card" action="{:sysuri()}" data-auto="true" method="post" autocomplete="off">
<div class="layui-card-body padding-left-40">
<label class="layui-form-item relative block">
<span class="color-green font-w7">访问权限名称</span>
<span class="color-green font-w7">系统权限名称</span>
<span class="color-desc margin-left-5">Role Name</span>
<input type="text" name="title" maxlength="100" class="layui-input" value='{$vo.title|default=""}' required placeholder="请输入访问权限名称">
<span class="help-block">访问权限名称需要保持不重复,在给用户授权时需要根据名称选择!</span>
<input maxlength="100" class="layui-input" name="title" value='{$vo.title|default=""}' required placeholder="请输入系统权限名称">
<!--<span class="help-block">访问权限名称需要保持不重复,在给用户授权时需要根据名称选择!</span>-->
</label>
<label class="layui-form-item relative block">
<span class="color-green font-w7">访问权限描述</span>
<span class="color-green font-w7">系统权限描述</span>
<span class="color-desc margin-left-5">Role Remark</span>
<textarea placeholder="请输入访问权限描述" maxlength="200" class="layui-textarea" name="desc">{$vo.desc|default=""}</textarea>
<textarea placeholder="请输入系统权限描述" maxlength="200" class="layui-textarea" name="desc">{$vo.desc|default=""}</textarea>
</label>
</div>

View File

@ -1,4 +1,4 @@
{extend name='main'}
{extend name='table'}
{block name="button"}
<!--{if auth("add")}-->
@ -6,67 +6,73 @@
<!--{/if}-->
<!--{if auth("remove")}-->
<button data-action='{:url("remove")}' data-rule="id#{key}" data-csrf="{:systoken('remove')}" data-confirm="确定要删除这些权限吗?" class='layui-btn layui-btn-sm layui-btn-primary'>删除权限</button>
<button data-action='{:url("remove")}' data-rule="id#{key}" data-confirm="确定要批量删除权限吗?" class='layui-btn layui-btn-sm layui-btn-primary'>批量删除</button>
<!--{/if}-->
{/block}
{block name="content"}
<div class="think-box-shadow">
{include file='auth/index_search'}
<table class="layui-table margin-top-10" lay-skin="line">
{notempty name='list'}
<thead>
<tr>
<th class='list-table-check-td think-checkbox'>
<label><input data-auto-none data-check-target='.list-check-box' type='checkbox'></label>
</th>
<th class='list-table-sort-td'>
<button type="button" data-reload class="layui-btn layui-btn-xs"> </button>
</th>
<th class='text-left nowrap'>权限名称</th>
<th class='text-left nowrap'>权限描述</th>
<th class='text-left nowrap'>创建时间</th>
<th class="text-left nowrap">使用状态</th>
<th></th>
</tr>
</thead>
{/notempty}
<tbody>
{foreach $list as $key => $vo}
<tr data-dbclick>
<td class='list-table-check-td think-checkbox'>
<label><input class="list-check-box" value='{$vo.id}' type='checkbox'></label>
</td>
<td class='list-table-sort-td'>
<label><input data-action-blur="{:request()->url()}" data-value="id#{$vo.id};action#sort;sort#{value}" data-loading="false" value="{$vo.sort}" class="list-sort-input"></label>
</td>
<td class='text-left nowrap'>{$vo.title|default='-'}</td>
<td class='text-left nowrap'>{$vo.desc|default="没有写描述哦!"}</td>
<td class="text-left nowrap">{$vo.create_at|format_datetime}</td>
<td class='text-left nowrap'>{eq name='vo.status' value='0'}<span class="color-red">已禁用</span>{else}<span class="color-green">已激活</span>{/eq}</td>
<td class='text-left nowrap'>
<!--{if auth("edit")}-->
<a data-dbclick class="layui-btn layui-btn-sm" data-title="编辑权限" data-modal='{:url("edit")}?id={$vo.id}'> </a>
<!--{/if}-->
<!--{if auth("apply")}-->
<a class="layui-btn layui-btn-normal layui-btn-sm" data-open='{:url("apply")}?id={$vo.id}'> </a>
<!--{/if}-->
<!--{if $vo.status eq 1 and auth("state")}-->
<a class="layui-btn layui-btn-warm layui-btn-sm" data-confirm="确定禁用该权限吗?" data-action="{:url('state')}" data-value="id#{$vo.id};status#0" data-csrf="{:systoken('state')}"> </a>
<!--{elseif $vo.status eq 0 and auth("state")}-->
<a class="layui-btn layui-btn-warm layui-btn-sm" data-confirm="确定启用该权限吗?" data-action="{:url('state')}" data-value="id#{$vo.id};status#1" data-csrf="{:systoken('state')}"> </a>
<!--{/if}-->
<!--{if auth("remove")}-->
<a class="layui-btn layui-btn-danger layui-btn-sm" data-confirm="确定要删除权限吗?" data-action="{:url('remove')}" data-value="id#{$vo.id}" data-csrf="{:systoken('remove')}"> </a>
<!--{/if}-->
</td>
</tr>
{/foreach}
</tbody>
</table>
{empty name='list'}<span class="notdata">没有记录哦</span>{else}{$pagehtml|raw|default=''}{/empty}
<table id="RoleData" data-url="{:sysuri()}" data-target-search="form.form-search"></table>
</div>
{/block}
{block name='script'}
<script>
$(function () {
$('#RoleData').layTable({
sort: {field: 'sort desc,id', type: 'desc'},
even: true,
cols: [[
{checkbox: true, fixed: true},
{field: 'sort', title: '排序权重', width: 100, align: 'center', sort: true, templet: '#SortInputTpl', fixed: true},
{field: 'title', title: '权限名称', minWidth: 140, align: 'center', sort: false, fixed: true},
{
field: 'desc', title: '权限描述', align: 'center', sort: false, templet: function (d) {
return d.desc || '<span class="color-desc">未填写权限描述</span>'
}
},
{field: 'create_at', title: '创建时间', align: 'center', sort: true},
{field: 'status', title: '权限状态', align: 'center', minWidth: 110, fixed: 'right', templet: '#StatusSwitchTpl'},
{toolbar: '#toolbar', align: 'center', minWidth: 200, title: '权限操作', fixed: 'right'},
]]
}).trigger('setFullHeight');
// 数据状态切换操作
layui.form.on('switch(StatusSwitch)', function (obj) {
$.form.load("{:url('state')}", {id: obj.value, status: obj.elem.checked > 0 ? 1 : 0}, 'post', function (ret) {
if (ret.code > 0) return false;
}, false);
});
});
</script>
<!-- 列表排序权重模板 -->
<script type="text/html" id="SortInputTpl">
<input min="0" type="number" data-blur-number="0" data-action-blur="{:sysuri()}" data-value="id#{{d.id}};action#sort;sort#{value}" data-loading="false" value="{{d.sort}}" class="layui-input text-center">
</script>
<!-- 数据状态切换模板 -->
<script type="text/html" id="StatusSwitchTpl">
<!--{if auth("state")}-->
<input type="checkbox" value="{{d.id}}" lay-skin="switch" lay-text="已激活|已禁用" lay-filter="StatusSwitch" {{d.status>0?'checked':''}}>
<!--{else}-->
{{d.status ? '<b class="color-green">已启用</b>' : '<b class="color-red">已禁用</b>'}}
<!--{/if}-->
</script>
<!-- 数据操作工具条模板 -->
<script type="text/html" id="toolbar">
<!--{if auth('edit')}-->
<a class="layui-btn layui-btn-primary layui-btn-sm" data-title="编辑权限" data-modal='{:url("edit")}?id={{d.id}}'> </a>
<!--{/if}-->
<!--{if auth("apply")}-->
<a class="layui-btn layui-btn-normal layui-btn-sm" data-open='{:url("apply")}?id={{d.id}}'> </a>
<!--{/if}-->
<!--{if auth("remove")}-->
<a class="layui-btn layui-btn-danger layui-btn-sm" data-confirm="确定要删除权限吗?" data-action="{:url('remove')}" data-value="id#{{d.id}}"> </a>
<!--{/if}-->
</script>
{/block}

View File

@ -1,6 +1,7 @@
<fieldset>
<legend>条件搜索</legend>
<form class="layui-form layui-form-pane form-search" action="{:request()->url()}" onsubmit="return false" method="get" autocomplete="off">
<form class="layui-form layui-form-pane form-search" action="{:sysuri()}" onsubmit="return false" method="get" autocomplete="off">
<div class="layui-form-item layui-inline">
<label class="layui-form-label">权限名称</label>
<div class="layui-input-inline">

View File

@ -119,27 +119,27 @@
<table class="layui-table" lay-even>
<tbody>
<tr>
<td class="nowrap text-center">核心框架</td>
<th class="nowrap text-center">核心框架</th>
<td><a target="_blank" href="https://www.thinkphp.cn">ThinkPHP Version {$app->version()}</a></td>
</tr>
<tr>
<td class="nowrap text-center">管理程序</td>
<th class="nowrap text-center">管理程序</th>
<td><a target="_blank" href="https://thinkadmin.top">ThinkAdmin Version {$version|default='6.0.0'}</a></td>
</tr>
<tr>
<td class="nowrap text-center">服务器信息</td>
<th class="nowrap text-center">服务器信息</th>
<td>{:php_uname()}</td>
</tr>
<tr>
<td class="nowrap text-center">服务器软件</td>
<th class="nowrap text-center">服务器软件</th>
<td>{$request->server('SERVER_SOFTWARE',php_sapi_name())}</td>
</tr>
<tr>
<td class="nowrap text-center">PHP 版本</td>
<th class="nowrap text-center">PHP 版本</th>
<td>PHP Version {$Think.const.PHP_VERSION}</td>
</tr>
<tr>
<td class="nowrap text-center">MySQL 版本</td>
<th class="nowrap text-center">MySQL 版本</th>
<td>MySQL Version {$app->db->query('SELECT VERSION()')[0]['VERSION()']}</td>
</tr>
</tbody>

View File

@ -1,4 +1,4 @@
<form onsubmit="return false" data-auto="true" action="{:request()->url()}" method="post" class='layui-form layui-card' autocomplete="off">
<form onsubmit="return false" data-auto="true" action="{:sysuri()}" method="post" class='layui-form layui-card' autocomplete="off">
<div class="layui-card-body padding-top-20">
<div class="color-text margin-left-40 margin-bottom-20 layui-code text-center layui-bg-gray" style="border-left-width:1px">

View File

@ -1,4 +1,4 @@
<form onsubmit="return false" data-auto="true" action="{:request()->url()}" method="post" class='layui-form layui-card' autocomplete="off">
<form onsubmit="return false" data-auto="true" action="{:sysuri()}" method="post" class='layui-form layui-card' autocomplete="off">
<div class="layui-card-body padding-top-20">
<div class="color-text margin-left-40 margin-bottom-20 layui-code text-center layui-bg-gray" style="border-left-width:1px">

View File

@ -1,4 +1,4 @@
<form onsubmit="return false" data-auto="true" action="{:request()->url()}" method="post" class='layui-form layui-card' autocomplete="off">
<form onsubmit="return false" data-auto="true" action="{:sysuri()}" method="post" class='layui-form layui-card' autocomplete="off">
<div class="layui-card-body padding-top-20">
<div class="color-text margin-left-40 margin-bottom-20 layui-code text-center layui-bg-gray" style="border-left-width:1px">

View File

@ -1,4 +1,4 @@
<form onsubmit="return false" data-auto="true" action="{:request()->url()}" method="post" class='layui-form layui-card' autocomplete="off">
<form onsubmit="return false" data-auto="true" action="{:sysuri()}" method="post" class='layui-form layui-card' autocomplete="off">
<div class="layui-card-body padding-top-20">
<div class="color-text margin-left-40 margin-bottom-20 layui-code text-center layui-bg-gray" style="border-left-width:1px">

View File

@ -1,4 +1,4 @@
<form onsubmit="return false" data-auto="true" action="{:request()->url()}" method="post" class='layui-form layui-card' autocomplete="off">
<form onsubmit="return false" data-auto="true" action="{:sysuri()}" method="post" class='layui-form layui-card' autocomplete="off">
<div class="layui-card-body padding-left-40">
<div class="layui-form-item">

View File

@ -11,7 +11,7 @@
{foreach $one.sub as $two}{empty name='two.sub'}
<li class="layui-nav-item">
<a data-target-tips="{$two.title}" data-menu-node="m-{$one.id}-{$two.id}" data-open="{$two.url}">
<span class='{$two.icon|default="layui-icon layui-icon-link"}'></span>
<span class='nav-icon {$two.icon|default="layui-icon layui-icon-senior"}'></span>
<span class="nav-text">{$two.title|default=''}</span>
</a>
</li>
@ -25,7 +25,7 @@
{foreach $two.sub as $thr}
<dd>
<a data-target-tips="{$thr.title}" data-open="{$thr.url}" data-menu-node="m-{$one.id}-{$two.id}-{$thr.id}">
<span class='nav-icon {$thr.icon|default="layui-icon layui-icon-link"}'></span>
<span class='nav-icon {$thr.icon|default="layui-icon layui-icon-senior"}'></span>
<span class="nav-text">{$thr.title|default=''}</span>
</a>
</dd>

View File

@ -1,11 +1,13 @@
<div class="layui-card">
{block name='style'}{/block}
{block name='header'}{notempty name='title'}
{block name='header'}
{notempty name='title'}
<div class="layui-card-header notselect">
<span class="layui-icon layui-icon-next font-s10 color-desc margin-right-5"></span>{$title|default=''}
<div class="pull-right">{block name='button'}{/block}</div>
</div>
{/notempty}{/block}
{/notempty}
{/block}
<div class="layui-card-body">
<div class="layui-card-html">
{block name='content'}{/block}

View File

@ -1,4 +1,4 @@
<form class="layui-form layui-card" action="{:request()->url()}" data-auto="true" method="post" autocomplete="off">
<form class="layui-form layui-card" action="{:sysuri()}" data-auto="true" method="post" autocomplete="off">
<div class="layui-card-body">

View File

@ -50,7 +50,7 @@
<label><input class="list-check-box" value='{$vo.ids}' type='checkbox'></label>
</td>
<td class='list-table-sort-td'>
<input data-action-blur="{:request()->url()}" data-value="id#{$vo.id};action#sort;sort#{value}" data-loading="false" value="{$vo.sort}" class="list-sort-input">
<input data-action-blur="{:sysuri()}" data-value="id#{$vo.id};action#sort;sort#{value}" data-loading="false" value="{$vo.sort}" class="list-sort-input">
</td>
<td class='text-center'><i class="{$vo.icon} font-s18"></i></td>
<td class="nowrap"><span class="color-desc">{$vo.spl|raw}</span>{$vo.title}</td>

View File

@ -1,4 +1,4 @@
<form class="layui-form layui-card" action="{:request()->url()}" data-auto="true" method="post" autocomplete="off">
<form class="layui-form layui-card" action="{:sysuri()}" data-auto="true" method="post" autocomplete="off">
<div class="layui-card-body padding-left-40">
<div class="layui-textarea border-0 font-s14 layui-bg-gray padding-top-20 padding-left-20">
<div class="layui-row margin-bottom-15">

View File

@ -1,6 +1,6 @@
<fieldset>
<legend>条件搜索</legend>
<form class="layui-form layui-form-pane form-search" action="{:request()->url()}" onsubmit="return false" method="get" autocomplete="off">
<form class="layui-form layui-form-pane form-search" action="{:sysuri()}" onsubmit="return false" method="get" autocomplete="off">
<div class="layui-form-item layui-inline">
<label class="layui-form-label">任务编号</label>
<div class="layui-input-inline">

View File

@ -33,13 +33,13 @@
{field: 'create_at', title: '操作时间', sort: true},
{toolbar: '#toolbar', align: 'center'}
]]
});
}).trigger('setFullHeight');
});
</script>
<script type="text/html" id="toolbar">
<!--{if auth('remove')}-->
<a data-action='{:url("remove")}' data-value="id#{{d.id}}" data-table-id="oplog" data-confirm="确认要删除这条记录吗?" class="layui-btn layui-btn-danger layui-btn-sm"> </a>
<a data-action='{:url("remove")}' data-value="id#{{d.id}}" data-confirm="确认要删除这条记录吗?" class="layui-btn layui-btn-danger layui-btn-sm"> </a>
<!--{/if}-->
</script>
{/block}

View File

@ -1,6 +1,6 @@
<fieldset>
<legend>条件搜索</legend>
<form class="layui-form layui-form-pane form-search" action="{:request()->url()}" onsubmit="return false" method="get" autocomplete="off">
<form class="layui-form layui-form-pane form-search" action="{:sysuri()}" onsubmit="return false" method="get" autocomplete="off">
<div class="layui-form-item layui-inline">
<label class="layui-form-label">操作账号</label>
<label class="layui-input-inline">

View File

@ -56,7 +56,7 @@
</div>
{include file='queue/index_search'}
<table class="layui-table" lay-skin="line">
<table class="layui-table" lay-skin="line" lay-even>
{notempty name='list'}
<thead>
<tr>

View File

@ -13,7 +13,7 @@
<fieldset>
<legend>条件搜索</legend>
<form class="layui-form layui-form-pane form-search" action="{:request()->url()}" onsubmit="return false" method="get" autocomplete="off">
<form class="layui-form layui-form-pane form-search" action="{:sysuri()}" onsubmit="return false" method="get" autocomplete="off">
<div class="layui-form-item layui-inline">
<label class="layui-form-label">任务编号</label>
<label class="layui-input-inline">

View File

@ -1,4 +1,4 @@
<form class="layui-form layui-card" action="{:request()->url()}" data-auto="true" method="post" autocomplete="off">
<form class="layui-form layui-card" action="{:sysuri()}" data-auto="true" method="post" autocomplete="off">
<div class="layui-card-body padding-left-40">
<div class="layui-row layui-col-space15">
<div class="layui-col-xs2 text-center">
@ -56,7 +56,7 @@
<div class="hr-line-dashed margin-top-10 margin-bottom-10"></div>
<div class="layui-form-item">
<span class="color-green font-w7">访问权限</span>
<span class="color-desc margin-left-5">Authorize</span>
<span class="color-desc margin-left-5">User Authorize</span>
<div class="layui-textarea">
{if isset($vo.username) and $vo.username eq $superName}
<span class="color-desc">超级用户不需要配置权限</span>

View File

@ -53,7 +53,7 @@
<label><input class="list-check-box" value='{$vo.id}' type='checkbox'></label>
</td>
<td class='list-table-sort-td'>
<label><input data-action-blur="{:request()->url()}" data-value="id#{$vo.id};action#sort;sort#{value}" data-loading="false" value="{$vo.sort}" class="list-sort-input"></label>
<label><input data-action-blur="{:sysuri()}" data-value="id#{$vo.id};action#sort;sort#{value}" data-loading="false" value="{$vo.sort}" class="list-sort-input"></label>
</td>
<td class='text-left nowrap'>
<div class="headimg" data-tips-image data-lazy-src="{$vo.headimg|default=''}"></div>

View File

@ -1,6 +1,6 @@
<fieldset>
<legend>条件搜索</legend>
<form class="layui-form layui-form-pane form-search" action="{:request()->url()}" onsubmit="return false" method="get" autocomplete="off">
<form class="layui-form layui-form-pane form-search" action="{:sysuri()}" onsubmit="return false" method="get" autocomplete="off">
<div class="layui-form-item layui-inline">
<label class="layui-form-label">用户账号</label>
<label class="layui-input-inline">
@ -37,6 +37,7 @@
</div>
<div class="layui-form-item layui-inline">
<input type="hidden" name="type" value="{$type|default='all'}">
<button class="layui-btn layui-btn-primary"><i class="layui-icon">&#xe615;</i> 搜 索</button>
</div>
</form>

View File

@ -1,11 +1,11 @@
<form class="layui-form layui-card" action="{:request()->url()}" data-auto="true" method="post" autocomplete="off">
<form class="layui-form layui-card" action="{:sysuri()}" data-auto="true" method="post" autocomplete="off">
<div class="layui-card-body padding-left-40">
<div class="layui-form-item">
<label class="relative block">
<span class="color-green font-w7">登录用户账号</span>
<span class="color-desc margin-left-5">Username</span>
<!--{if isset($vo) and isset($vo.username)}-->
<input disabled value='{$vo.username|default=""}' class="layui-input think-bg-gray">
<input disabled value='{$vo.username|default=""}' class="layui-input layui-disabled">
<!--{else}-->
<input name="username" value='{$vo.username|default=""}' required pattern="^.{4,}$" placeholder="请输入4位及以上字符登录用户账号" class="layui-input">
<!--{/if}-->

View File

@ -18,6 +18,8 @@ namespace think;
use think\admin\service\SystemService;
// 加载基础文件
require __DIR__ . '/../vendor/autoload.php';
// WEB应用初始化
SystemService::instance()->doInit();

View File

@ -115,6 +115,8 @@ $(function () {
for (idx2 in json) if (json[idx2][field]) temp.push(json[idx2][field]);
if (temp.length < 1) return $.msg.tips('请选择需要更改的数据!'), false;
data[idx1] = temp.join(',');
} else {
data[idx1] = rule[idx1];
}
}
return data;
@ -474,9 +476,9 @@ $(function () {
/*! 错误标签插入 */
this.insertError = function (ele) {
if ($(ele).data('input-info')) return $(ele).data('input-info');
var $html = $('<span class="absolute block layui-anim text-center font-s12 notselect" style="color:#a44;z-index:2"></span>');
var $next = $(ele).nextAll('.input-right-icon'), right = ($next ? $next.width() + parseFloat($next.css('right') || '0') : 0) + 10;
var $html = $('<span class="absolute block layui-anim text-center font-s12" style="color:#a44;z-index:2;pointer-events:none"></span>');
var style = {top: $(ele).position().top + 'px', right: right + 'px', lineHeight: $(ele).css('height'), paddingBottom: $(ele).css('paddingBottom')};
var style = {top: $(ele).position().top + 'px', right: right + 'px', lineHeight: ele.nodeName === 'TEXTAREA' ? '32px' : $(ele).css('height')};
return $(ele).data('input-info', $html.css(style).insertAfter(ele)), $html;
};
/*! 表单验证入口 */
@ -655,33 +657,35 @@ $(function () {
$.fn.layTable = function (options) {
return this.each(function (idx, elem) {
// 动态初始化数据表
this.id = this.id || 't' + Math.random().toString().replace('0.', '');
this.dataset.dataFilter = this.getAttribute('lay-filter') || this.id;
this.setAttribute('lay-filter', this.dataset.dataFilter);
this.id = this.id || 't' + Math.random().toString().replace('.', '');
this.dataset.dataId = this.getAttribute('lay-filter') || this.id;
this.setAttribute('lay-filter', this.dataset.dataId);
// 插件初始化参数
var opt = options || {}, data = opt.where || {}, sort = opt.initSort || opt.sort || {};
opt.id = elem.id, opt.elem = elem, opt.url = options.url || elem.dataset.url || location.href;
opt.page = options.page !== false, opt.limit = options.limit || 20, opt.cols = options.cols || [[]];
// 实例表格组件
var table = layui.table.render(bindData(opt));
table.bind = function (name, callable) {
return layui.table.on(name + '(' + elem.dataset.dataFilter + ')', callable), table;
}
// 排序事件处理
table.bind('sort', function (object) {
opt.page = options.page !== false ? (options.page || true) : false, opt.autoSort = options.autoSort === true;
opt.limit = options.limit || 20, opt.cols = options.cols || [[]], opt.done = function () {
$(elem).next().find(".layui-btn:not([data-table-id])").attr('data-table-id', elem.id);
};
// 实例并绑定对象
$(this).data('this', layui.table.render(bindData(opt)));
// 绑定实例重载事件
$(this).bind('reload', function (event, object) {
data = $.extend({}, data, (object || {}).where || {});
layui.table.reload(elem.id, bindData(object || {}));
}).bind('row sort tool edit radio toolbar checkbox rowDouble', function (evt, call) {
layui.table.on(evt.type + '(' + elem.dataset.dataId + ')', call)
}).bind('setFullHeight', function () {
$(elem).trigger('reload', {height: $(window).height() - $(elem).next().offset().top - 35})
}).trigger('sort', function (object) {
(sort = object), $(elem).trigger('reload')
});
// 绑定生成对象,绑定重载事件
$(this).data('this', table).bind('reload', function (event, opts) {
layui.table.reload(elem.id, bindData(opts || {}));
});
// 搜索表单处理
// 搜索表单关联对象
var search = options.search || this.dataset.targetSearch;
if (search) $body.off('submit', search).on('submit', search, function () {
data = $.extend(data, $(this).formToJson());
$(elem).trigger('reload', bindData({page: {curr: 1}}));
if (search) $body.find(search).map(function () {
$(this).attr('data-table-id', elem.id);
});
// 绑定选择项对象
// 绑定选择项关联对象
var checked = options.checked || this.dataset.targetChecked;
if (checked) $body.find(checked).map(function () {
$(this).attr('data-table-id', elem.id);
@ -691,27 +695,27 @@ $(function () {
function bindData(opts) {
data['output'] = 'layui.table';
if (sort.field && sort.type) {
opts.initSort = sort;
data['_order_'] = sort.type;
data['_field_'] = sort.field;
data['_order_'] = sort.type, data['_field_'] = sort.field;
opts.initSort = {type: sort.type.split(',')[0].split(' ')[0], field: sort.field.split(',')[0].split(' ')[0]};
}
return (opts['where'] = data), opts;
}
});
}
/*! 注册 data-serach 表单搜索行为 */
/*! 注册 data-search 表单搜索行为 */
onEvent('submit', 'form.form-search', function () {
var tableId = this.dataset.tableId;
if (tableId) return $('table#' + tableId).trigger('reload', {
page: {curr: 1}, where: $(this).formToJson()
});
var url = $(this).attr('action').replace(/&?page=\d+/g, '');
if ((this.method || 'get').toLowerCase() === 'get') {
var split = url.indexOf('?') === -1 ? '?' : '&';
if (location.href.indexOf('spm=') > -1) {
return location.href = '#' + $.menu.parseUri(url + split + $(this).serialize());
} else {
return location.href = $.menu.parseUri(url + split + $(this).serialize());
}
var split = url.indexOf('?') > -1 ? '&' : '?';
var stype = location.href.indexOf('spm=') > -1 ? '#' : '';
return location.href = stype + $.menu.parseUri(url + split + $(this).serialize());
}
$.form.load(url, this, 'post');
return $.form.load(url, this, 'post');
});
/*! 注册 data-load 事件行为 */

View File

@ -36,6 +36,7 @@
@TopHeaderNavNormalBackColor: @TopHeaderBackColor;
// 导航条按钮颜色
@TopHeaderHeight: 50px;
@TopHeaderNavHoverTextColor: #000;
@TopHeaderNavHoverBackColor: rgba(0, 0, 0, 0.05);
@TopHeaderNavActiveTextColor: #000;
@ -58,6 +59,7 @@
@LoadBackColor: #EEE;
// 窗口页面背景颜色
@BodyMainTop: 51px;
@BodyMainBackColor: #EEE;
// 左侧菜单大小

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -404,24 +404,49 @@ label.think-radio, label.think-checkbox {
}
}
.layui-table-page {
.layui-laypage {
.layui-laypage-prev,
.layui-laypage-next {
padding: 0 8px;
border-radius: 3px;
}
table.layui-table {
input.layui-input, .layui-btn.layui-btn-sm {
height: 28px;
line-height: 28px;
box-sizing: border-box;
}
.layui-laypage-prev {
margin-left: 0 !important;
}
.layui-btn.layui-btn-sm {
margin-top: -1px;
}
}
.layui-laypage-next {
margin-right: 6px !important;
table.layui-table[lay-size="lg"] {
input.layui-input, .layui-btn.layui-btn-sm {
height: 38px;
line-height: 38px;
box-sizing: border-box;
}
}
.layui-table-view {
margin-bottom: 0;
.layui-table-page {
.layui-laypage {
.layui-laypage-prev,
.layui-laypage-next {
padding: 0 8px;
border-radius: 3px;
}
.layui-laypage-prev {
margin-left: 0 !important;
}
.layui-laypage-next {
margin-right: 6px !important;
}
}
}
}
.layui-layer-content {
.layui-form.layui-card {
margin: 0;

View File

@ -18,12 +18,12 @@
> .layui-header {
left: @LayoutDefaLeftSzie;
right: 0;
height: 50px;
position: absolute;
color: @TopHeaderTextColor !important;
height: @TopHeaderHeight;
position: absolute;
box-sizing: content-box;
background: @TopHeaderBackColor !important;
border-bottom: @TopHeaderBottomLine !important;
box-sizing: content-box;
> ul.layui-nav {
margin: 0;
@ -49,10 +49,10 @@
}
.layui-nav-item > a {
height: 50px;
height: @TopHeaderHeight;
padding: 0 18px;
overflow: hidden;
line-height: 50px;
line-height: @TopHeaderHeight;
&:hover {
color: @TopHeaderNavHoverTextColor
@ -65,8 +65,8 @@
}
.layui-nav-item {
height: 50px;
line-height: 50px;
height: @TopHeaderHeight;
line-height: @TopHeaderHeight;
> a {
color: @TopHeaderNavNormalTextColor !important;
@ -84,7 +84,7 @@
}
.layui-nav-child {
top: 51px;
top: @BodyMainTop;
border: 0;
padding: 0;
line-height: 48px;
@ -102,7 +102,7 @@
}
&.layui-show + a {
background: #fff;
background: #FFF;
}
dd {
@ -135,15 +135,15 @@
.layui-logo,
.layui-logo-mini {
color: #fff;
color: #FFF;
width: auto;
height: 50px;
height: @TopHeaderHeight;
display: block;
overflow: hidden;
position: relative;
font-size: 18px;
text-align: center;
line-height: 50px;
line-height: @TopHeaderHeight;
border-bottom: 1px solid rgba(0, 0, 0, .15);
sup {
@ -162,7 +162,7 @@
}
.layui-side-scroll {
top: 51px;
top: @BodyMainTop;
bottom: 0;
width: 100% !important;
height: 100% !important;
@ -174,7 +174,7 @@
}
&:after {
height: 50px;
height: @TopHeaderHeight;
display: block;
content: '';
}
@ -216,15 +216,15 @@
line-height: 45px;
padding-top: 0;
padding-bottom: 0;
color: @LeftMainNavNormalTextColor;
&:hover {
color: @LeftMainNavHoverTextColor;
background: @LeftMainNavHoverBackColor
}
.nav-icon,
.nav-text {
padding-left: 5px
.nav-icon {
padding-right: 5px;
}
}
}
@ -232,7 +232,7 @@
}
> .layui-body {
top: 50px;
top: @BodyMainTop;
left: @LayoutDefaLeftSzie;
padding: 0;
@ -275,7 +275,7 @@
}
> .layui-card-header {
top: 50px;
top: @BodyMainTop;
left: @LayoutDefaLeftSzie;
right: 0;
height: 45px;
@ -283,7 +283,7 @@
z-index: 3;
padding: 0 15px;
position: fixed;
background: #fff;
background: #FFF;
line-height: 45px;
box-shadow: @ShadowMaxOuter;

6
think
View File

@ -16,8 +16,10 @@
namespace think;
use think\admin\service\SystemService;
// 加载基础文件
require __DIR__ . '/vendor/autoload.php';
// 应用初始化
(new App())->console->run();
// 命令行应用初始化
SystemService::instance()->doConsoleInit();