初始化项目
This commit is contained in:
87
application/admin/view/model/add.html
Normal file
87
application/admin/view/model/add.html
Normal file
@@ -0,0 +1,87 @@
|
||||
{extend name="public/base"/}
|
||||
|
||||
{block name="body"}
|
||||
<div class="main-box clearfix">
|
||||
<header class="main-box-header clearfix">
|
||||
<div class="pull-left">
|
||||
<h2>新增模型</h2>
|
||||
</div>
|
||||
<div class="pull-right">
|
||||
</div>
|
||||
</header>
|
||||
<div class="main-box-body clearfix">
|
||||
|
||||
<!-- 表单 -->
|
||||
<form id="form" action="{:url('update')}" method="post" class="form-horizontal form">
|
||||
<!-- 基础 -->
|
||||
<div id="tab1" class="tab-pane in tab1">
|
||||
<div class="form-group">
|
||||
<label class="col-lg-2 control-label">模型标识</label>
|
||||
<div class="col-lg-6 col-sm-10">
|
||||
<input type="text" class="form-control " name="name" value="">
|
||||
<span class="help-block">(请输入文档模型标识)</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-lg-2 control-label">模型名称</label>
|
||||
<div class="col-lg-6 col-sm-10">
|
||||
<input type="text" class="form-control " name="title" value="">
|
||||
<span class="help-block">(请输入模型的名称)</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-lg-2 control-label">模型类型</label>
|
||||
<div class="col-lg-3 col-sm-10">
|
||||
<select name="extend" class="form-control" style="width:auto">
|
||||
<option value="2">独立模型</option>
|
||||
<option value="1" selected="selected">文档模型</option>
|
||||
</select>
|
||||
<span class="help-block">(目前只支持独立模型和文档模型)</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-lg-2 control-label">引擎类型</label>
|
||||
<div class="col-lg-3 col-sm-10">
|
||||
<select name="engine_type" class="form-control" style="width:auto">
|
||||
<option value="MyISAM">MyISAM</option>
|
||||
<option value="InnoDB">InnoDB</option>
|
||||
<option value="MEMORY">MEMORY</option>
|
||||
<option value="BLACKHOLE">BLACKHOLE</option>
|
||||
<option value="MRG_MYISAM">MRG_MYISAM</option>
|
||||
<option value="ARCHIVE">ARCHIVE</option>
|
||||
</select>
|
||||
<span class="help-block"></span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-lg-2 control-label">是否需要主键</label>
|
||||
<div class="col-lg-10">
|
||||
<select name="need_pk" class="form-control" style="width:auto">
|
||||
<option value="1" selected="selected">是</option>
|
||||
<option value="0">否</option>
|
||||
</select>
|
||||
<span class="help-block">(选“是”则会新建默认的id字段作为主键)</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-lg-2 control-label">模型图标</label>
|
||||
<div class="col-lg-6 col-sm-10">
|
||||
<input type="text" class="form-control " name="icon" value="">
|
||||
<span class="help-block">(模型图标)</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 按钮 -->
|
||||
<div class="form-group">
|
||||
<div class="col-lg-offset-2 col-lg-10">
|
||||
<input type="hidden" name="id" value="{$info.id|default=''}">
|
||||
<button class="btn btn-success submit-btn ajax-post" type="submit" target-form="form-horizontal">确 定</button>
|
||||
<button class="btn btn-danger btn-return" onclick="javascript:history.back(-1);return false;">返 回</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/block}
|
||||
183
application/admin/view/model/edit.html
Normal file
183
application/admin/view/model/edit.html
Normal file
@@ -0,0 +1,183 @@
|
||||
{extend name="public/base"/}
|
||||
{block name="style"}
|
||||
<link rel="stylesheet" type="text/css" href="__PUBLIC__/plugs/board/board.min.css">
|
||||
{/block}
|
||||
{block name="body"}
|
||||
<div class="main-box clearfix">
|
||||
<header class="main-box-header clearfix">
|
||||
<div class="pull-left">
|
||||
<h2>{if condition="ACTION_NAME eq 'add'"}新增{else/}编辑{/if}模型</h2>
|
||||
</div>
|
||||
<div class="pull-right">
|
||||
</div>
|
||||
</header>
|
||||
<div class="main-box-body clearfix">
|
||||
<form id="form" action="{:url('update')}" method="post" class="form form-horizontal">
|
||||
<div class="tabs-wrapper">
|
||||
<ul class="nav nav-tabs">
|
||||
<li class="active"><a href="#tab1" data-toggle="tab">基 础</a></li>
|
||||
<li><a href="#tab2" data-toggle="tab">设 计</a></li>
|
||||
<li><a href="#tab3" data-toggle="tab">高 级</a></li>
|
||||
</ul>
|
||||
<div class="tab-content">
|
||||
<div class="tab-pane fade in active" id="tab1">
|
||||
<!-- 基础 -->
|
||||
<div class="form-group">
|
||||
<label class="col-lg-2 control-label">模型标识</label>
|
||||
<div class="col-lg-6 col-sm-10">
|
||||
<input type="text" class="form-control disabled" name="name" value="{$info.name}" disabled>
|
||||
<span class="help-block">(请输入文档模型标识)</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-lg-2 control-label">模型名称</label>
|
||||
<div class="col-lg-6 col-sm-10">
|
||||
<input type="text" class="form-control " name="title" value="{$info['title']}">
|
||||
<span class="help-block">(请输入模型的名称)</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-lg-2 control-label">模型类型</label>
|
||||
<div class="col-lg-3 col-sm-10">
|
||||
<select name="extend" class="form-control disabled" readonly disabled>
|
||||
<option value="0" {if condition="$info['extend'] eq '0'"}selected{/if}>--请选择--</option>
|
||||
<option value="1" {if condition="$info['extend'] eq '1'"}selected{/if}>文档模型</option>
|
||||
<option value="2" {if condition="$info['extend'] eq '2'"}selected{/if}>独立模型</option>
|
||||
</select>
|
||||
<span class="help-block">(目前只支持独立模型和文档模型)</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-lg-2 control-label">模型图标</label>
|
||||
<div class="col-lg-6 col-sm-10">
|
||||
<input type="text" class="form-control " name="icon" value="{$info['icon']}">
|
||||
<span class="help-block">(模型图标)</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="tab-pane fade" id="tab2">
|
||||
|
||||
<div class="form-group">
|
||||
<label class="col-lg-2 control-label">字段别名定义</label>
|
||||
<div class="col-lg-6 col-sm-10">
|
||||
<textarea name="attribute_alias" class="form-control">{$info.attribute_alias}</textarea>
|
||||
<span class="help-block">(用于表单显示的名称)</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-lg-2 control-label">表单显示分组</label>
|
||||
<div class="col-lg-6 col-sm-10">
|
||||
<input type="text" class="form-control" name="field_group" value="{$info.field_group}">
|
||||
<span class="help-block">(用于表单显示的分组,以及设置该模型表单排序的显示)</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-lg-2 control-label">表单显示排序</label>
|
||||
<div class="col-lg-10 boards" id="field_group_sort">
|
||||
{volist name=":parse_field_attr($info['field_group'])" id="vo"}
|
||||
<div class="board panel panel-info">
|
||||
<div class="panel-heading">{$vo}</div>
|
||||
<div class="panel-body">
|
||||
<div class="board-list" data-group="{$key}">
|
||||
{foreach name="fields" item="field" key="k"}
|
||||
{if (($field['group'] == -1) or ($field['group'] eq $key))}
|
||||
<div class="board-item">
|
||||
<span data="{$field['id']}">{$field['title']} [{$field['name']}]</span>
|
||||
<input type="hidden" name="field_sort[{$key}][]" value="{$field['id']}"/>
|
||||
</div>
|
||||
{php}
|
||||
unset($fields[$k]);
|
||||
{/php}
|
||||
{/if}
|
||||
{/foreach}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{/volist}
|
||||
<span class="help-block">(直接拖动进行排序)</span>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="col-lg-2 control-label">列表定义</label>
|
||||
<div class="col-lg-6 col-sm-10">
|
||||
<textarea name="list_grid" class="form-control">{$info.list_grid}</textarea>
|
||||
<span class="help-block">(默认列表模板的展示规则)</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="col-lg-2 control-label">默认搜索字段</label>
|
||||
<div class="col-lg-6 col-sm-10">
|
||||
<input type="text" class="form-control" name="search_key" value="{$info.search_key}">
|
||||
<span class="help-block">(默认列表模板的默认搜索项)</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-lg-2 control-label">高级搜索字段</label>
|
||||
<div class="col-lg-6 col-sm-10">
|
||||
<input type="text" class="form-control" name="search_list" value="{$info.search_list}">
|
||||
<span class="help-block">(默认列表模板的高级搜索项)</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="tab-pane fade" id="tab3">
|
||||
<div class="form-group">
|
||||
<label class="col-lg-2 control-label">列表模板</label>
|
||||
<div class="col-lg-6 col-sm-10">
|
||||
<input type="text" class="form-control" name="template_list" value="{$info['template_list']|default=''}">
|
||||
<span class="help-block">(自定义的列表模板,放在Application\Admin\View\Think下,不写则使用默认模板)</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-lg-2 control-label">新增模板</label>
|
||||
<div class="col-lg-6 col-sm-10">
|
||||
<input type="text" class="form-control" name="template_add" value="{$info['template_add']|default=''}">
|
||||
<span class="help-block">(自定义的新增模板,放在Application\Admin\View\Think下,不写则使用默认模板)</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-lg-2 control-label">编辑模板</label>
|
||||
<div class="col-lg-6 col-sm-10">
|
||||
<input type="text" class="form-control" name="template_edit" value="{$info['template_edit']|default=''}">
|
||||
<span class="help-block">(自定义的编辑模板,放在Application\Admin\View\Think下,不写则使用默认模板)</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-lg-2 control-label">列表数据大小</label>
|
||||
<div class="col-lg-6 col-sm-10">
|
||||
<input type="text" class="form-control" name="list_row" value="{$info['list_row']|default=''}">
|
||||
<span class="help-block">(默认列表模板的分页属性)</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="col-lg-offset-2 col-lg-10">
|
||||
<input type="hidden" name="id" value="{$info['id']}">
|
||||
<button type="submit" class="btn btn-success submit-btn ajax-post" target-form="form">确认提交</button>
|
||||
<button class="btn btn-danger btn-return" onclick="javascript:history.back(-1);return false;">返 回</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
{/block}
|
||||
{block name="script"}
|
||||
<script type="text/javascript" src="__PUBLIC__/js/droppable.js"></script>
|
||||
<script type="text/javascript" src="__PUBLIC__/plugs/board/board.min.js"></script>
|
||||
<script type="text/javascript">
|
||||
$(function(){
|
||||
$('.form-group #field_sort').boards();
|
||||
$('.form-group #field_group_sort').boards({
|
||||
drop: function(e){
|
||||
var group = e.target.closest('.board').find('.board-list').attr('data-group');
|
||||
e.element.find('input').attr('name','field_sort[' + group + '][]')
|
||||
}
|
||||
})
|
||||
})
|
||||
</script>
|
||||
{/block}
|
||||
|
||||
92
application/admin/view/model/index.html
Normal file
92
application/admin/view/model/index.html
Normal file
@@ -0,0 +1,92 @@
|
||||
{extend name="public/base"/}
|
||||
|
||||
{block name="body"}
|
||||
<div class="main-box clearfix">
|
||||
<header class="main-box-header clearfix">
|
||||
<div class="pull-left">
|
||||
<h2>{$meta_title}</h2>
|
||||
</div>
|
||||
<div class="pull-right">
|
||||
<a class="btn btn-success" href="{:url('Model/add')}">新 增</a>
|
||||
<button class="btn btn-info ajax-post" target-form="ids" url="{:url('Model/status',array('status'=>1))}">启 用</button>
|
||||
<button class="btn ajax-post" target-form="ids" url="{:url('Model/status',array('status'=>0))}">禁 用</button>
|
||||
</div>
|
||||
</header>
|
||||
<div class="main-box-body clearfix">
|
||||
<div class="table-responsive clearfix">
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="row-selected row-selected">
|
||||
<input class="check-all" type="checkbox"/>
|
||||
</th>
|
||||
<th class="">编号</th>
|
||||
<th class="">标识</th>
|
||||
<th class="">名称</th>
|
||||
<th class="">创建时间</th>
|
||||
<th class="">状态</th>
|
||||
<th class="">操作</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{notempty name="list"}
|
||||
{volist name="list" id="vo"}
|
||||
<tr>
|
||||
<td>
|
||||
<input class="ids" type="checkbox" name="ids[]" value="{$vo.id}" />
|
||||
</td>
|
||||
<td>{$vo.id}</td>
|
||||
<td>{$vo.name}</td>
|
||||
<td>
|
||||
<a data-id="{$vo.id}" href="{:url('model/edit?id='.$vo['id'])}">{$vo.title}</a>
|
||||
</td>
|
||||
<td>
|
||||
<span>{$vo.create_time|time_format}</span>
|
||||
</td>
|
||||
<td>
|
||||
{if $vo['status']}
|
||||
<span class="label label-primary">{$vo['status_text']}</span>
|
||||
{else/}
|
||||
<span class="label label-danger">{$vo['status_text']}</span>
|
||||
{/if}
|
||||
</td>
|
||||
<td>
|
||||
<a href="{:url('admin/attribute/index?model_id='.$vo['id'])}">字段</a>
|
||||
<a href="{:url('model/status?ids='.$vo['id'].'&status='.abs(1-$vo['status']))}" class="ajax-get">{$vo.status|show_status_op}</a>
|
||||
<a href="{:url('model/edit?id='.$vo['id'])}">编辑</a>
|
||||
<a href="{:url('model/del?id='.$vo['id'])}" class="confirm ajax-get">删除</a>
|
||||
{if $vo['extend']}
|
||||
<a href="{:url('admin/content/index?model_id='.$vo['id'])}">数据</a>
|
||||
{/if}
|
||||
</td>
|
||||
</tr>
|
||||
{/volist}
|
||||
{else/}
|
||||
<td colspan="7" class="text-center">aOh! 暂时还没有内容!</td>
|
||||
{/notempty}
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
</div>
|
||||
{$page}
|
||||
</div>
|
||||
</div>
|
||||
{/block}
|
||||
{block name="script"}
|
||||
<script type="text/javascript">
|
||||
$(function(){
|
||||
$("#search").click(function(){
|
||||
var url = $(this).attr('url');
|
||||
var status = $('select[name=status]').val();
|
||||
var search = $('input[name=search]').val();
|
||||
if(status != ''){
|
||||
url += '/status/' + status;
|
||||
}
|
||||
if(search != ''){
|
||||
url += '/search/' + search;
|
||||
}
|
||||
window.location.href = url;
|
||||
});
|
||||
})
|
||||
</script>
|
||||
{/block}
|
||||
Reference in New Issue
Block a user