作者 Karson

添加表格模板渲染条目功能

新增表格模板示例
新增表格未加载完成禁止提交
新增控制台图表动态加载的功能
修改requrejs加载超时为30秒
修复commonsearch存在多个时导致搜索框无法正常加载的BUG
优化后台微信管理中菜单管理的排版问题
优化语言包文字显示
  1 +<?php
  2 +
  3 +namespace app\admin\controller\example;
  4 +
  5 +use app\common\controller\Backend;
  6 +
  7 +/**
  8 + * 表格模板示例
  9 + *
  10 + * @icon fa fa-table
  11 + * @remark 可以通过使用表格模板将表格中的行渲染成一样的展现方式,基于此功能可以任意定制自己想要的展示列表
  12 + */
  13 +class Tabletemplate extends Backend
  14 +{
  15 +
  16 + protected $model = null;
  17 +
  18 + public function _initialize()
  19 + {
  20 + parent::_initialize();
  21 + $this->model = model('AdminLog');
  22 + }
  23 +
  24 + /**
  25 + * 查看
  26 + */
  27 + public function index()
  28 + {
  29 + if ($this->request->isAjax())
  30 + {
  31 + list($where, $sort, $order, $offset, $limit) = $this->buildparams(NULL);
  32 + $total = $this->model
  33 + ->where($where)
  34 + ->order($sort, $order)
  35 + ->count();
  36 + $list = $this->model
  37 + ->where($where)
  38 + ->order($sort, $order)
  39 + ->limit($offset, $limit)
  40 + ->select();
  41 + $result = array("total" => $total, "rows" => $list);
  42 +
  43 + return json($result);
  44 + }
  45 + return $this->view->fetch();
  46 + }
  47 +
  48 + /**
  49 + * 详情
  50 + */
  51 + public function detail($ids)
  52 + {
  53 + $row = $this->model->get(['id' => $ids]);
  54 + if (!$row)
  55 + $this->error(__('No Results were found'));
  56 + $this->view->assign("row", $row->toArray());
  57 + return $this->view->fetch();
  58 + }
  59 +
  60 +}
@@ -69,6 +69,7 @@ return [ @@ -69,6 +69,7 @@ return [
69 'Status' => '状态', 69 'Status' => '状态',
70 'Operate' => '操作', 70 'Operate' => '操作',
71 'Append' => '追加', 71 'Append' => '追加',
  72 + 'Select' => '选择',
72 'Memo' => '备注', 73 'Memo' => '备注',
73 'Parent' => '父级', 74 'Parent' => '父级',
74 'Params' => '参数', 75 'Params' => '参数',
@@ -78,6 +79,7 @@ return [ @@ -78,6 +79,7 @@ return [
78 'Begin time' => '开始时间', 79 'Begin time' => '开始时间',
79 'End time' => '结束时间', 80 'End time' => '结束时间',
80 'Create time' => '创建时间', 81 'Create time' => '创建时间',
  82 + 'Update time' => '更新时间',
81 'Flag' => '标志', 83 'Flag' => '标志',
82 'Redirect now' => '立即跳转', 84 'Redirect now' => '立即跳转',
83 'Operation completed' => '操作成功!', 85 'Operation completed' => '操作成功!',
  1 +<?php
  2 +
  3 +return [
  4 + 'Text' => '文本',
  5 + 'Event key' => '响应标识',
  6 + 'Remark' => '备注',
  7 +];
  1 +<?php
  2 +
  3 +return [
  4 + 'Resource title' => '资源标题',
  5 + 'Event key' => '事件标识',
  6 + 'Text' => '文本',
  7 + 'App' => '应用',
  8 +];
1 <!-- Logo --> 1 <!-- Logo -->
2 <a href="javascript:;" class="logo"> 2 <a href="javascript:;" class="logo">
3 <!-- 迷你模式下Logo的大小为50X50 --> 3 <!-- 迷你模式下Logo的大小为50X50 -->
4 - <span class="logo-mini"><b>F</b>AST</span> 4 + <span class="logo-mini">{$site.name|mb_substr=0,4|strtoupper}</span>
5 <!-- 普通模式下Logo --> 5 <!-- 普通模式下Logo -->
6 - <span class="logo-lg"><b>Fast</b>Admin</span> 6 + <span class="logo-lg"><b>{$site.name|mb_substr=0,4}</b>{$site.name|mb_substr=4}</span>
7 </a> 7 </a>
8 <!-- 顶部通栏样式 --> 8 <!-- 顶部通栏样式 -->
9 <nav class="navbar navbar-static-top"> 9 <nav class="navbar navbar-static-top">
@@ -8,7 +8,7 @@ @@ -8,7 +8,7 @@
8 <div id="toolbar" class="toolbar"> 8 <div id="toolbar" class="toolbar">
9 {:build_toolbar('refresh,delete')} 9 {:build_toolbar('refresh,delete')}
10 <a class="btn btn-info btn-disabled disabled btn-selected" href="javascript:;"><i class="fa fa-leaf"></i> 获取选中项</a> 10 <a class="btn btn-info btn-disabled disabled btn-selected" href="javascript:;"><i class="fa fa-leaf"></i> 获取选中项</a>
11 - <a class="btn btn-warning btn-singlesearch" href="javascript:;"><i class="fa fa-leaf"></i> 单独设置搜索条件</a> 11 + <a class="btn btn-success btn-singlesearch" href="javascript:;"><i class="fa fa-leaf"></i> 单独设置搜索条件</a>
12 <div class="dropdown btn-group"> 12 <div class="dropdown btn-group">
13 <a class="btn btn-primary btn-more dropdown-toggle btn-disabled disabled" data-toggle="dropdown"><i class="fa fa-cog"></i> <?= __('More') ?></a> 13 <a class="btn btn-primary btn-more dropdown-toggle btn-disabled disabled" data-toggle="dropdown"><i class="fa fa-cog"></i> <?= __('More') ?></a>
14 <ul class="dropdown-menu text-left" role="menu"> 14 <ul class="dropdown-menu text-left" role="menu">
  1 +<div class="panel panel-default panel-intro">
  2 + {:build_heading()}
  3 +
  4 + <div class="panel-body">
  5 + <div id="myTabContent" class="tab-content">
  6 + <div class="tab-pane fade active in" id="one">
  7 + <div class="widget-body no-padding">
  8 + <div id="toolbar" class="toolbar">
  9 + {:build_toolbar('refresh,delete')}
  10 + <a class="btn btn-info btn-disabled disabled btn-selected" href="javascript:;"><i class="fa fa-leaf"></i> 获取选中项</a>
  11 + <a class="btn btn-success btn-toggle-view" href="javascript:;"><i class="fa fa-leaf"></i> 切换视图</a>
  12 + </div>
  13 + <table id="table" class="table table-striped table-hover" width="100%">
  14 +
  15 + </table>
  16 +
  17 + </div>
  18 + </div>
  19 +
  20 + </div>
  21 + </div>
  22 +</div>
  23 +<style type="text/css">
  24 + .example {
  25 + height:100%;position: relative;
  26 + }
  27 + .example > span {
  28 + position:absolute;left:15px;top:15px;
  29 + }
  30 +</style>
  31 +
  32 +<script id="itemtpl" type="text/html">
  33 + <!--
  34 + 如果启用了templateView,默认调用的是itemtpl这个模板,可以通过设置templateFormatter来修改
  35 + 在当前模板中可以使用三个变量(item:行数据,i:当前第几行,data:所有的行数据)
  36 + 此模板引擎使用的是art-templatenative,可参考官方文档
  37 + -->
  38 +
  39 + <div class="col-sm-4 col-md-3">
  40 + <!--下面四行是为了展示随机图片和标签,可移除-->
  41 + <% var imagearr = ['https://ws2.sinaimg.cn/large/006tNc79gy1fgphwokqt9j30dw0990tb.jpg', 'https://ws2.sinaimg.cn/large/006tNc79gy1fgphwt8nq8j30e609f3z4.jpg', 'https://ws1.sinaimg.cn/large/006tNc79gy1fgphwn44hvj30go0b5myb.jpg', 'https://ws1.sinaimg.cn/large/006tNc79gy1fgphwnl37mj30dw09agmg.jpg', 'https://ws3.sinaimg.cn/large/006tNc79gy1fgphwqsvh6j30go0b576c.jpg']; %>
  42 + <% var image = imagearr[item.id % 5]; %>
  43 + <% var labelarr = ['primary', 'success', 'info', 'danger', 'warning']; %>
  44 + <% var label = labelarr[item.id % 5]; %>
  45 + <div class="thumbnail example">
  46 + <span class="btn btn-<%=label%>">ID:<%=item.id%></span>
  47 + <img src="<%=image%>" class="img-responsive" alt="<%=item.title%>">
  48 + <div class="caption">
  49 + <h4><%=item.title?item.title:'无'%></h4>
  50 + <p class="text-muted">操作者IP:<%=item.ip%></p>
  51 + <p class="text-muted">操作时间:<%=Moment(item.createtime).format("YYYY-MM-DD HH:mm:ss")%></p>
  52 + <p>
  53 + <!--详情的事件需要在JS中手动绑定-->
  54 + <a href="#" class="btn btn-primary btn-success btn-detail" data-id="<%=item.id%>"><i class="fa fa-camera"></i> 详情</a>
  55 +
  56 + <!--如果需要响应编辑或删除事件,可以给元素添加 btn-editbtn-del的类和data-id这个属性值-->
  57 + <a href="#" class="btn btn-primary btn-edit" data-id="<%=item.id%>"><i class="fa fa-pencil"></i> 编辑</a>
  58 + <a href="#" class="btn btn-danger btn-del" data-id="<%=item.id%>"><i class="fa fa-times"></i> 删除</a>
  59 + <span class="pull-right" style="margin-top:10px;">
  60 + <!--如果需要多选操作,请确保有下面的checkbox元素存在,可移除-->
  61 + <input name="checkbox" data-id="<%=item.id%>" type="checkbox" />
  62 + </span>
  63 + </p>
  64 + </div>
  65 + </div>
  66 + </div>
  67 +</script>
@@ -23,7 +23,7 @@ @@ -23,7 +23,7 @@
23 <div class="form-group"> 23 <div class="form-group">
24 <label for="c-local" class="control-label col-xs-12 col-sm-2"></label> 24 <label for="c-local" class="control-label col-xs-12 col-sm-2"></label>
25 <div class="col-xs-12 col-sm-8"> 25 <div class="col-xs-12 col-sm-8">
26 - <button id="plupload-local" class="btn btn-primary plupload" data-input-id="c-local" data-url="{:url('ajax/upload')}" data-after-upload="afteruploadcallback"><i class="fa fa-upload"></i> {:__("Upload to local")}</button> 26 + <button id="plupload-local" class="btn btn-primary plupload" data-input-id="c-local" data-url="{:url('ajax/upload')}"><i class="fa fa-upload"></i> {:__("Upload to local")}</button>
27 </div> 27 </div>
28 </div> 28 </div>
29 29
  1 +<style type="text/css">
  2 + @media (max-width: 375px) {
  3 + .edit-form tr td input{width:100%;}
  4 + .edit-form tr th:first-child,.edit-form tr td:first-child{
  5 + width:20%;
  6 + }
  7 + .edit-form tr th:last-child,.edit-form tr td:last-child{
  8 + display: none;
  9 + }
  10 + }
  11 +</style>
1 <div class="panel panel-default panel-intro"> 12 <div class="panel panel-default panel-intro">
2 <div class="panel-heading"> 13 <div class="panel-heading">
3 <div class="panel-lead"><em>系统配置</em>可以在此增改系统的变量和分组,也可以自定义分组和变量,如果需要删除请从数据库中删除</div> 14 <div class="panel-lead"><em>系统配置</em>可以在此增改系统的变量和分组,也可以自定义分组和变量,如果需要删除请从数据库中删除</div>
@@ -6,7 +6,7 @@ @@ -6,7 +6,7 @@
6 <div id="myTabContent" class="tab-content"> 6 <div id="myTabContent" class="tab-content">
7 <div class="tab-pane fade active in" id="one"> 7 <div class="tab-pane fade active in" id="one">
8 <div class="widget-body no-padding"> 8 <div class="widget-body no-padding">
9 - <div class="weixin-menu-setting"> 9 + <div class="weixin-menu-setting clearfix">
10 <div class="mobile-menu-preview"> 10 <div class="mobile-menu-preview">
11 <div class="mobile-head-title">{$site.name}</div> 11 <div class="mobile-head-title">{$site.name}</div>
12 <ul class="menu-list" id="menu-list"> 12 <ul class="menu-list" id="menu-list">
@@ -15,53 +15,55 @@ @@ -15,53 +15,55 @@
15 </li> 15 </li>
16 </ul> 16 </ul>
17 </div> 17 </div>
18 - <div class="weixin-content">  
19 - <div class="item-info">  
20 - <form id="form-item" class="form-item" data-value="" >  
21 - <div class="item-head">  
22 - <h4 id="current-item-name">添加子菜单</h4>  
23 - <div class="item-delete"><a href="javascript:;" id="item_delete">删除菜单</a></div>  
24 - </div>  
25 - <div style="margin-top: 20px;">  
26 - <dl>  
27 - <dt id="current-item-option"><span class="is-sub-item"></span>菜单标题:</dt>  
28 - <dd><div class="input-box"><input id="item_title" name="item-title" type="text" value=""></div></dd>  
29 - </dl>  
30 - <dl class="is-item">  
31 - <dt id="current-item-type"><span class="is-sub-item"></span>菜单内容:</dt>  
32 - <dd>  
33 - <input id="type1" type="radio" name="type" value="click"><label for="type1" data-editing="1"><span class="lbl_content">发送消息</span></label>  
34 - <input id="type2" type="radio" name="type" value="view" ><label for="type2" data-editing="1"><span class="lbl_content">跳转网页</span></label>  
35 - <input id="type3" type="radio" name="type" value="scancode_push"><label for="type3" data-editing="1"><span class="lbl_content">扫码推</span></label>  
36 - <input id="type4" type="radio" name="type" value="scancode_waitmsg"><label for="type4" data-editing="1"><span class="lbl_content">扫码推提示框</span></label>  
37 - <input id="type5" type="radio" name="type" value="pic_sysphoto"><label for="type5" data-editing="1"><span class="lbl_content">拍照发图</span></label>  
38 - <input id="type6" type="radio" name="type" value="pic_photo_or_album"><label for="type6" data-editing="1"><span class="lbl_content">拍照相册发图</span></label>  
39 - <input id="type7" type="radio" name="type" value="pic_weixin"><label for="type7" data-editing="1"><span class="lbl_content">相册发图</span></label>  
40 - <input id="type8" type="radio" name="type" value="location_select"><label for="type8" data-editing="1"><span class="lbl_content">地理位置选择</span></label>  
41 - </dd>  
42 - </dl>  
43 - <div id="menu-content" class="is-item">  
44 - <div class="viewbox is-view">  
45 - <p class="menu-content-tips">点击该<span class="is-sub-item"></span>菜单会跳到以下链接</p>  
46 - <dl>  
47 - <dt>页面地址:</dt>  
48 - <dd><div class="input-box"><input type="text" id="url" name="url"></div>  
49 - </dd>  
50 - </dl>  
51 - </div>  
52 - <div class="clickbox is-click" style="display: none;">  
53 - <input type="hidden" name="key" id="key" value="" />  
54 - <span class="create-click"><a href="{:url('wechat.response/select')}" id="select-resources"><i class="weixin-icon big-add-gray"></i><strong>选择现有资源</strong></a></span>  
55 - <span class="create-click"><a href="{:url('wechat.response/add')}" id="add-resources"><i class="weixin-icon big-add-gray"></i><strong>添加新资源</strong></a></span> 18 + <div class="weixin-body">
  19 + <div class="weixin-content" style="display:none">
  20 + <div class="item-info">
  21 + <form id="form-item" class="form-item" data-value="" >
  22 + <div class="item-head">
  23 + <h4 id="current-item-name">添加子菜单</h4>
  24 + <div class="item-delete"><a href="javascript:;" id="item_delete">删除菜单</a></div>
  25 + </div>
  26 + <div style="margin-top: 20px;">
  27 + <dl>
  28 + <dt id="current-item-option"><span class="is-sub-item"></span>菜单标题:</dt>
  29 + <dd><div class="input-box"><input id="item_title" name="item-title" type="text" value=""></div></dd>
  30 + </dl>
  31 + <dl class="is-item">
  32 + <dt id="current-item-type"><span class="is-sub-item"></span>菜单内容:</dt>
  33 + <dd>
  34 + <input id="type1" type="radio" name="type" value="click"><label for="type1" data-editing="1"><span class="lbl_content">发送消息</span></label>
  35 + <input id="type2" type="radio" name="type" value="view" ><label for="type2" data-editing="1"><span class="lbl_content">跳转网页</span></label>
  36 + <input id="type3" type="radio" name="type" value="scancode_push"><label for="type3" data-editing="1"><span class="lbl_content">扫码推</span></label>
  37 + <input id="type4" type="radio" name="type" value="scancode_waitmsg"><label for="type4" data-editing="1"><span class="lbl_content">扫码推提示框</span></label>
  38 + <input id="type5" type="radio" name="type" value="pic_sysphoto"><label for="type5" data-editing="1"><span class="lbl_content">拍照发图</span></label>
  39 + <input id="type6" type="radio" name="type" value="pic_photo_or_album"><label for="type6" data-editing="1"><span class="lbl_content">拍照相册发图</span></label>
  40 + <input id="type7" type="radio" name="type" value="pic_weixin"><label for="type7" data-editing="1"><span class="lbl_content">相册发图</span></label>
  41 + <input id="type8" type="radio" name="type" value="location_select"><label for="type8" data-editing="1"><span class="lbl_content">地理位置选择</span></label>
  42 + </dd>
  43 + </dl>
  44 + <div id="menu-content" class="is-item">
  45 + <div class="viewbox is-view">
  46 + <p class="menu-content-tips">点击该<span class="is-sub-item"></span>菜单会跳到以下链接</p>
  47 + <dl>
  48 + <dt>页面地址:</dt>
  49 + <dd><div class="input-box"><input type="text" id="url" name="url"></div>
  50 + </dd>
  51 + </dl>
  52 + </div>
  53 + <div class="clickbox is-click" style="display: none;">
  54 + <input type="hidden" name="key" id="key" value="" />
  55 + <span class="create-click"><a href="{:url('wechat.response/select')}" id="select-resources"><i class="weixin-icon big-add-gray"></i><strong>选择现有资源</strong></a></span>
  56 + <span class="create-click"><a href="{:url('wechat.response/add')}" id="add-resources"><i class="weixin-icon big-add-gray"></i><strong>添加新资源</strong></a></span>
  57 + </div>
56 </div> 58 </div>
57 </div> 59 </div>
58 - </div>  
59 - </form>  
60 - </div> 60 + </form>
  61 + </div>
61 62
62 - </div>  
63 - <div class="no-weixin-content">  
64 - 点击左侧菜单进行编辑操作 63 + </div>
  64 + <div class="no-weixin-content">
  65 + 点击左侧菜单进行编辑操作
  66 + </div>
65 </div> 67 </div>
66 </div> 68 </div>
67 <div class="row"> 69 <div class="row">
@@ -28,4 +28,6 @@ return array ( @@ -28,4 +28,6 @@ return array (
28 'user' => '会员配置', 28 'user' => '会员配置',
29 'example' => '示例分组', 29 'example' => '示例分组',
30 ), 30 ),
  31 + 'aaaa' => '',
  32 + 'ffff' => 'key2',
31 ); 33 );
@@ -77,6 +77,20 @@ body.is-dialog { @@ -77,6 +77,20 @@ body.is-dialog {
77 -webkit-overflow-scrolling: touch; 77 -webkit-overflow-scrolling: touch;
78 overflow: auto; 78 overflow: auto;
79 } 79 }
  80 +@media only screen and (min-width: 481px) {
  81 + .row-flex {
  82 + display: flex;
  83 + flex-wrap: wrap;
  84 + }
  85 + .row-flex > [class*='col-'] {
  86 + display: flex;
  87 + flex-direction: column;
  88 + }
  89 + .row-flex.row:after,
  90 + .row-flex.row:before {
  91 + display: flex;
  92 + }
  93 +}
80 .common-search-table { 94 .common-search-table {
81 min-height: 20px; 95 min-height: 20px;
82 padding: 15px; 96 padding: 15px;
@@ -86,6 +100,14 @@ body.is-dialog { @@ -86,6 +100,14 @@ body.is-dialog {
86 .searchit { 100 .searchit {
87 border-bottom: 1px dashed #3c8dbc; 101 border-bottom: 1px dashed #3c8dbc;
88 } 102 }
  103 +table.table-template {
  104 + overflow: hidden;
  105 +}
  106 +.sp_container .msg-box {
  107 + position: absolute;
  108 + right: 0;
  109 + top: 0;
  110 +}
89 .toast-top-right-index { 111 .toast-top-right-index {
90 top: 62px; 112 top: 62px;
91 right: 12px; 113 right: 12px;
1 .weixin-menu-setting{ 1 .weixin-menu-setting{
2 margin:0; 2 margin:0;
3 - position:relative;  
4 margin-bottom:10px; 3 margin-bottom:10px;
  4 + width:100%;
5 } 5 }
6 .mobile-head-title{ 6 .mobile-head-title{
7 color: #fff; 7 color: #fff;
@@ -15,12 +15,12 @@ @@ -15,12 +15,12 @@
15 word-wrap: normal; 15 word-wrap: normal;
16 margin: 0 40px 0 70px; 16 margin: 0 40px 0 70px;
17 } 17 }
  18 +.weixin-body {
  19 + padding:0;
  20 + margin:0;
  21 + margin-left:337px;
  22 +}
18 .weixin-content,.no-weixin-content{ 23 .weixin-content,.no-weixin-content{
19 - position:absolute;  
20 - left: 335px;  
21 - top:0;  
22 - right:0px;  
23 - bottom:0;  
24 background-color: #f4f5f9; 24 background-color: #f4f5f9;
25 border: 1px solid #e7e7eb; 25 border: 1px solid #e7e7eb;
26 padding:15px; 26 padding:15px;
@@ -31,7 +31,12 @@ @@ -31,7 +31,12 @@
31 vertical-align: middle; 31 vertical-align: middle;
32 padding-top:200px; 32 padding-top:200px;
33 text-align: center; 33 text-align: center;
34 - 34 +}
  35 +@media (max-width: 720px) {
  36 + .weixin-body {
  37 + margin-left:0;
  38 + margin-top:560px;
  39 + }
35 } 40 }
36 .weixin-menu-title{ 41 .weixin-menu-title{
37 border-bottom: 1px solid #e7e7eb; 42 border-bottom: 1px solid #e7e7eb;
@@ -41,13 +46,16 @@ @@ -41,13 +46,16 @@
41 margin-bottom: 20px; 46 margin-bottom: 20px;
42 } 47 }
43 .mobile-menu-preview{ 48 .mobile-menu-preview{
44 - position: relative; 49 + display:block;
  50 + float:left;
  51 + position:relative;
45 width: 317px; 52 width: 317px;
46 height: 550px; 53 height: 550px;
47 background: transparent url(../../img/wx_mobile_header_bg.png) no-repeat 0 0; 54 background: transparent url(../../img/wx_mobile_header_bg.png) no-repeat 0 0;
48 background-position: 0 0; 55 background-position: 0 0;
49 border: 1px solid #e7e7eb; 56 border: 1px solid #e7e7eb;
50 } 57 }
  58 +
51 .mobile-menu-preview .menu-list { 59 .mobile-menu-preview .menu-list {
52 position: absolute; 60 position: absolute;
53 height:50px; 61 height:50px;
@@ -257,7 +265,7 @@ table.weixin-form td{ @@ -257,7 +265,7 @@ table.weixin-form td{
257 margin:10px 0; 265 margin:10px 0;
258 } 266 }
259 .form-item dl dt{ 267 .form-item dl dt{
260 - width:6em; 268 + width:90px;
261 height: 30px; 269 height: 30px;
262 line-height: 30px; 270 line-height: 30px;
263 text-align: right; 271 text-align: right;
@@ -267,12 +275,12 @@ table.weixin-form td{ @@ -267,12 +275,12 @@ table.weixin-form td{
267 left:0; 275 left:0;
268 bottom:0; 276 bottom:0;
269 display:block; 277 display:block;
270 -  
271 } 278 }
272 .form-item dl dd{ 279 .form-item dl dd{
273 position:relative; 280 position:relative;
274 display:block; 281 display:block;
275 - margin-left: 7em; 282 + margin-left: 90px;
  283 + line-height: 30px;
276 } 284 }
277 .form-item .input-box { 285 .form-item .input-box {
278 display: inline-block; 286 display: inline-block;
@@ -297,6 +305,7 @@ table.weixin-form td{ @@ -297,6 +305,7 @@ table.weixin-form td{
297 background-color: transparent; 305 background-color: transparent;
298 border: 0; 306 border: 0;
299 outline: 0; 307 outline: 0;
  308 + height:30px;
300 } 309 }
301 310
302 .clickbox{ 311 .clickbox{
@@ -204,7 +204,7 @@ define(['jquery', 'bootstrap', 'toastr', 'layer', 'lang', 'moment'], function ($ @@ -204,7 +204,7 @@ define(['jquery', 'bootstrap', 'toastr', 'layer', 'lang', 'moment'], function ($
204 if (layerfooter.size() > 0) { 204 if (layerfooter.size() > 0) {
205 footer.on("click", ".btn", function () { 205 footer.on("click", ".btn", function () {
206 if ($(this).hasClass("disabled") || $(this).parent().hasClass("disabled")) { 206 if ($(this).hasClass("disabled") || $(this).parent().hasClass("disabled")) {
207 - //return; 207 + return;
208 } 208 }
209 $(".btn:eq(" + $(this).index() + ")", layerfooter).trigger("click"); 209 $(".btn:eq(" + $(this).index() + ")", layerfooter).trigger("click");
210 }); 210 });
@@ -347,13 +347,13 @@ define(['jquery', 'bootstrap', 'toastr', 'layer', 'lang', 'moment'], function ($ @@ -347,13 +347,13 @@ define(['jquery', 'bootstrap', 'toastr', 'layer', 'lang', 'moment'], function ($
347 Toastr.options = Backend.config.toastr; 347 Toastr.options = Backend.config.toastr;
348 //点击包含.btn-dialog的元素时弹出dialog 348 //点击包含.btn-dialog的元素时弹出dialog
349 $(document).on('click', '.btn-dialog,.dialogit', function (e) { 349 $(document).on('click', '.btn-dialog,.dialogit', function (e) {
350 - Backend.api.open(Backend.api.fixurl($(this).attr('href')), $(this).attr('title'));  
351 e.preventDefault(); 350 e.preventDefault();
  351 + Backend.api.open(Backend.api.fixurl($(this).attr('href')), $(this).attr('title'));
352 }); 352 });
353 //点击包含.btn-addtabs的元素时事件 353 //点击包含.btn-addtabs的元素时事件
354 $(document).on('click', '.btn-addtabs,.addtabsit', function (e) { 354 $(document).on('click', '.btn-addtabs,.addtabsit', function (e) {
355 - Backend.api.addtabs($(this).attr("href"), $(this).attr("title"));  
356 e.preventDefault(); 355 e.preventDefault();
  356 + Backend.api.addtabs($(this).attr("href"), $(this).attr("title"));
357 }); 357 });
358 //点击加入到Shortcut 358 //点击加入到Shortcut
359 $(document).on('click', '#ribbon ol li:last a[data-url]', function (e) { 359 $(document).on('click', '#ribbon ol li:last a[data-url]', function (e) {
@@ -36,7 +36,7 @@ define(['jquery', 'bootstrap', 'backend', 'addtabs', 'table', 'echarts', 'echart @@ -36,7 +36,7 @@ define(['jquery', 'bootstrap', 'backend', 'addtabs', 'table', 'echarts', 'echart
36 left: 'left', 36 left: 'left',
37 top: 'top', 37 top: 'top',
38 right: '10', 38 right: '10',
39 - bottom:30 39 + bottom: 30
40 }], 40 }],
41 series: [{ 41 series: [{
42 name: '成交', 42 name: '成交',
@@ -48,7 +48,7 @@ define(['jquery', 'bootstrap', 'backend', 'addtabs', 'table', 'echarts', 'echart @@ -48,7 +48,7 @@ define(['jquery', 'bootstrap', 'backend', 'addtabs', 'table', 'echarts', 'echart
48 }, 48 },
49 lineStyle: { 49 lineStyle: {
50 normal: { 50 normal: {
51 - width:1.5 51 + width: 1.5
52 } 52 }
53 }, 53 },
54 data: Orderdata.paydata 54 data: Orderdata.paydata
@@ -63,7 +63,7 @@ define(['jquery', 'bootstrap', 'backend', 'addtabs', 'table', 'echarts', 'echart @@ -63,7 +63,7 @@ define(['jquery', 'bootstrap', 'backend', 'addtabs', 'table', 'echarts', 'echart
63 }, 63 },
64 lineStyle: { 64 lineStyle: {
65 normal: { 65 normal: {
66 - width:1.5 66 + width: 1.5
67 } 67 }
68 }, 68 },
69 data: Orderdata.createdata 69 data: Orderdata.createdata
@@ -72,8 +72,37 @@ define(['jquery', 'bootstrap', 'backend', 'addtabs', 'table', 'echarts', 'echart @@ -72,8 +72,37 @@ define(['jquery', 'bootstrap', 'backend', 'addtabs', 'table', 'echarts', 'echart
72 72
73 // 使用刚指定的配置项和数据显示图表。 73 // 使用刚指定的配置项和数据显示图表。
74 myChart.setOption(option); 74 myChart.setOption(option);
75 - $(window).resize(function(){  
76 - myChart.resize(); 75 +
  76 + //动态添加数据,可以通过Ajax获取数据然后填充
  77 + setInterval(function () {
  78 + Orderdata.column.push((new Date()).toLocaleTimeString().replace(/^\D*/, ''));
  79 + var amount = Math.floor(Math.random() * 200) + 20;
  80 + Orderdata.createdata.push(amount);
  81 + Orderdata.paydata.push(Math.floor(Math.random() * amount) + 1);
  82 +
  83 + //按自己需求可以取消这个限制
  84 + if (Orderdata.column.length >= 20) {
  85 + //移除最开始的一条数据
  86 + Orderdata.column.shift();
  87 + Orderdata.paydata.shift();
  88 + Orderdata.createdata.shift();
  89 + }
  90 + myChart.setOption({
  91 + xAxis: {
  92 + data: Orderdata.column
  93 + },
  94 + series: [{
  95 + name: '成交',
  96 + data: Orderdata.paydata
  97 + },
  98 + {
  99 + name: '下单',
  100 + data: Orderdata.createdata
  101 + }]
  102 + });
  103 + }, 2000);
  104 + $(window).resize(function () {
  105 + myChart.resize();
77 }); 106 });
78 } 107 }
79 }; 108 };
@@ -20,13 +20,16 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin @@ -20,13 +20,16 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
20 url: $.fn.bootstrapTable.defaults.extend.index_url, 20 url: $.fn.bootstrapTable.defaults.extend.index_url,
21 columns: [ 21 columns: [
22 [ 22 [
  23 + //该列为复选框字段,如果后台的返回state值将会默认选中
23 {field: 'state', checkbox: true, }, 24 {field: 'state', checkbox: true, },
24 {field: 'id', title: 'ID', operate: false}, 25 {field: 'id', title: 'ID', operate: false},
  26 + //默认隐藏该列
  27 + {field: 'admin_id', title: __('Admin_id'), visible: false, operate: false},
25 //直接响应搜索 28 //直接响应搜索
26 {field: 'username', title: __('Username'), formatter: Table.api.formatter.search}, 29 {field: 'username', title: __('Username'), formatter: Table.api.formatter.search},
27 //模糊搜索 30 //模糊搜索
28 {field: 'title', title: __('Title'), operate: 'LIKE %...%', placeholder: '模糊搜索,*表示任意字符', style: 'width:200px'}, 31 {field: 'title', title: __('Title'), operate: 'LIKE %...%', placeholder: '模糊搜索,*表示任意字符', style: 'width:200px'},
29 - //通过Ajax渲染searchList 32 + //通过Ajax渲染searchList,也可以使用JSON数据
30 {field: 'url', title: __('Url'), align: 'left', searchList: $.getJSON('ajax/typeahead?search=a&field=row[user_id]'), formatter: Controller.api.formatter.url}, 33 {field: 'url', title: __('Url'), align: 'left', searchList: $.getJSON('ajax/typeahead?search=a&field=row[user_id]'), formatter: Controller.api.formatter.url},
31 //点击IP时同时执行搜索此IP,同时普通搜索使用下拉列表的形式 34 //点击IP时同时执行搜索此IP,同时普通搜索使用下拉列表的形式
32 {field: 'ip', title: __('IP'), searchList: ['127.0.0.1', '127.0.0.2'], events: Controller.api.events.ip, formatter: Controller.api.formatter.ip}, 35 {field: 'ip', title: __('IP'), searchList: ['127.0.0.1', '127.0.0.2'], events: Controller.api.events.ip, formatter: Controller.api.formatter.ip},
@@ -70,7 +73,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin @@ -70,7 +73,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
70 bindevent: function () { 73 bindevent: function () {
71 Form.api.bindevent($("form[role=form]")); 74 Form.api.bindevent($("form[role=form]"));
72 }, 75 },
73 - formatter: { 76 + formatter: {//渲染的方法
74 url: function (value, row, index) { 77 url: function (value, row, index) {
75 return '<div class="input-group input-group-sm" style="width:250px;"><input type="text" class="form-control input-sm" value="' + value + '"><span class="input-group-btn input-group-sm"><a href="' + value + '" target="_blank" class="btn btn-default btn-sm"><i class="fa fa-link"></i></a></span></div>'; 78 return '<div class="input-group input-group-sm" style="width:250px;"><input type="text" class="form-control input-sm" value="' + value + '"><span class="input-group-btn input-group-sm"><a href="' + value + '" target="_blank" class="btn btn-default btn-sm"><i class="fa fa-link"></i></a></span></div>';
76 }, 79 },
@@ -89,8 +92,9 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin @@ -89,8 +92,9 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
89 + Table.api.formatter.operate(value, row, index, $("#table")); 92 + Table.api.formatter.operate(value, row, index, $("#table"));
90 }, 93 },
91 }, 94 },
92 - events: { 95 + events: {//绑定事件的方法
93 ip: { 96 ip: {
  97 + //格式为:方法名+空格+DOM元素
94 'click .btn-ip': function (e, value, row, index) { 98 'click .btn-ip': function (e, value, row, index) {
95 var options = $("#table").bootstrapTable('getOptions'); 99 var options = $("#table").bootstrapTable('getOptions');
96 //这里我们手动将数据填充到表单然后提交 100 //这里我们手动将数据填充到表单然后提交
  1 +define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'template'], function ($, undefined, Backend, Table, Form, Template) {
  2 +
  3 + var Controller = {
  4 + index: function () {
  5 + // 初始化表格参数配置
  6 + Table.api.init({
  7 + extend: {
  8 + index_url: 'example/tabletemplate/index',
  9 + add_url: '',
  10 + edit_url: '',
  11 + del_url: 'example/tabletemplate/del',
  12 + multi_url: '',
  13 + }
  14 + });
  15 +
  16 + var table = $("#table");
  17 +
  18 + Template.helper("Moment", Moment);
  19 +
  20 + // 初始化表格
  21 + table.bootstrapTable({
  22 + url: $.fn.bootstrapTable.defaults.extend.index_url,
  23 + templateView: true,
  24 + columns: [
  25 + [
  26 + {field: 'state', checkbox: true, },
  27 + {field: 'id', title: 'ID', operate: false},
  28 + //直接响应搜索
  29 + {field: 'username', title: __('Username'), formatter: Table.api.formatter.search},
  30 + //模糊搜索
  31 + {field: 'title', title: __('Title'), operate: 'LIKE %...%', placeholder: '模糊搜索,*表示任意字符', style: 'width:200px'},
  32 + //通过Ajax渲染searchList
  33 + {field: 'url', title: __('Url'), align: 'left', searchList: $.getJSON('ajax/typeahead?search=a&field=row[user_id]'), formatter: Controller.api.formatter.url},
  34 + //点击IP时同时执行搜索此IP,同时普通搜索使用下拉列表的形式
  35 + {field: 'ip', title: __('IP'), searchList: ['127.0.0.1', '127.0.0.2'], events: Controller.api.events.ip, formatter: Controller.api.formatter.ip},
  36 + //browser是一个不存在的字段
  37 + //通过formatter来渲染数据,同时为它添加上事件
  38 + {field: 'browser', title: __('Browser'), operate: false, events: Controller.api.events.browser, formatter: Controller.api.formatter.browser},
  39 + //启用时间段搜索
  40 + {field: 'createtime', title: __('Create time'), formatter: Table.api.formatter.datetime, operate: 'BETWEEN', type: 'datetime', addclass: 'datetimepicker', data: 'data-date-format="YYYY-MM-DD HH:mm:ss"'},
  41 + //我们向操作栏额外添加上一个详情按钮,并保留已有的编辑和删除控制,同时为这个按钮添加上点击事件
  42 + {field: 'operate', title: __('Operate'), events: Controller.api.events.operate, formatter: Controller.api.formatter.operate}
  43 + ],
  44 + ],
  45 + //禁用默认搜索
  46 + search: false,
  47 + //启用普通表单搜索
  48 + commonSearch: false,
  49 + //可以控制是否默认显示搜索单表,false则隐藏,默认为false
  50 + searchFormVisible: false
  51 + });
  52 +
  53 + // 为表格绑定事件
  54 + Table.api.bindevent(table);
  55 +
  56 + //指定搜索条件
  57 + $(document).on("click", ".btn-toggle-view", function () {
  58 + var options = table.bootstrapTable('getOptions');
  59 + table.bootstrapTable('refreshOptions', {templateView: !options.templateView});
  60 + });
  61 +
  62 + //点击详情
  63 + $(document).on("click", ".btn-detail[data-id]", function () {
  64 + Backend.api.open('example/bootstraptable/detail/ids/' + $(this).data('id'), __('Detail'));
  65 + });
  66 +
  67 + //获取选中项
  68 + $(document).on("click", ".btn-selected", function () {
  69 + //在templateView的模式下不能调用table.bootstrapTable('getSelections')来获取选中的ID,只能通过下面的Table.api.selectedids来获取
  70 + Layer.alert(JSON.stringify(Table.api.selectedids(table)));
  71 + });
  72 + },
  73 + add: function () {
  74 + Controller.api.bindevent();
  75 + },
  76 + edit: function () {
  77 + Controller.api.bindevent();
  78 + },
  79 + api: {
  80 + bindevent: function () {
  81 + Form.api.bindevent($("form[role=form]"));
  82 + },
  83 + formatter: {
  84 + url: function (value, row, index) {
  85 + return '<div class="input-group input-group-sm" style="width:250px;"><input type="text" class="form-control input-sm" value="' + value + '"><span class="input-group-btn input-group-sm"><a href="' + value + '" target="_blank" class="btn btn-default btn-sm"><i class="fa fa-link"></i></a></span></div>';
  86 + },
  87 + ip: function (value, row, index) {
  88 + return '<a class="btn btn-xs btn-ip bg-success"><i class="fa fa-map-marker"></i> ' + value + '</a>';
  89 + },
  90 + browser: function (value, row, index) {
  91 + //这里我们直接使用row的数据
  92 + return '<a class="btn btn-xs btn-browser">' + row.useragent.split(" ")[0] + '</a>';
  93 + },
  94 + operate: function (value, row, index) {
  95 + //返回字符串加上Table.api.formatter.operate的结果
  96 + //默认需要按需显示排序/编辑/删除按钮,则需要在Table.api.formatter.operate将table传入
  97 + //传入了table以后如果edit_url为空则不显示编辑按钮,如果del_url为空则不显显删除按钮
  98 + return '<a class="btn btn-info btn-xs btn-detail"><i class="fa fa-list"></i> ' + __('Detail') + '</a> '
  99 + + Table.api.formatter.operate(value, row, index, $("#table"));
  100 + },
  101 + },
  102 + events: {
  103 + ip: {
  104 + 'click .btn-ip': function (e, value, row, index) {
  105 + var options = $("#table").bootstrapTable('getOptions');
  106 + //这里我们手动将数据填充到表单然后提交
  107 + $("#commonSearchContent_" + options.idTable + " form [name='ip']").val(value);
  108 + $("#commonSearchContent_" + options.idTable + " form").trigger('submit');
  109 + Toastr.info("执行了自定义搜索操作");
  110 + }
  111 + },
  112 + browser: {
  113 + 'click .btn-browser': function (e, value, row, index) {
  114 + Layer.alert("该行数据为: <code>" + JSON.stringify(row) + "</code>");
  115 + }
  116 + },
  117 + operate: $.extend({
  118 + 'click .btn-detail': function (e, value, row, index) {
  119 + Backend.api.open('example/tabletemplate/detail/ids/' + row['id'], __('Detail'));
  120 + }
  121 + }, Table.api.events.operate)
  122 + }
  123 + }
  124 + };
  125 + return Controller;
  126 +});
@@ -27,7 +27,8 @@ define(['jquery', 'bootstrap', 'backend', 'form', 'table'], function ($, undefin @@ -27,7 +27,8 @@ define(['jquery', 'bootstrap', 'backend', 'form', 'table'], function ($, undefin
27 {field: 'text', title: __('Text')}, 27 {field: 'text', title: __('Text')},
28 {field: 'eventkey', title: __('Event key')}, 28 {field: 'eventkey', title: __('Event key')},
29 {field: 'remark', title: __('Remark')}, 29 {field: 'remark', title: __('Remark')},
30 - {field: 'createtime', title: __('Createtime'), formatter: Table.api.formatter.datetime}, 30 + {field: 'createtime', title: __('Create time'), formatter: Table.api.formatter.datetime},
  31 + {field: 'updatetime', title: __('Update time'), formatter: Table.api.formatter.datetime},
31 {field: 'status', title: __('Status'), formatter: Table.api.formatter.status}, 32 {field: 'status', title: __('Status'), formatter: Table.api.formatter.status},
32 {field: 'operate', title: __('Operate'), events: Table.api.events.operate, formatter: Table.api.formatter.operate} 33 {field: 'operate', title: __('Operate'), events: Table.api.events.operate, formatter: Table.api.formatter.operate}
33 ] 34 ]
@@ -8,19 +8,19 @@ @@ -8,19 +8,19 @@
8 !function ($) { 8 !function ($) {
9 'use strict'; 9 'use strict';
10 10
11 - var firstLoad = false, ColumnsForSearch = []; 11 + var ColumnsForSearch = [];
12 12
13 var sprintf = $.fn.bootstrapTable.utils.sprintf; 13 var sprintf = $.fn.bootstrapTable.utils.sprintf;
14 14
15 var initCommonSearch = function (pColumns, that) { 15 var initCommonSearch = function (pColumns, that) {
16 - var vFormCommon = createFormCommon(pColumns, that), timeoutId = 0; 16 + var vFormCommon = createFormCommon(pColumns, that);
17 17
18 - var vModal = sprintf("<div id=\"commonSearchContent_%s\" class=\"common-search-table %s\">", that.options.idTable, that.options.searchFormVisible ? "" : "hidden"); 18 + var vModal = sprintf("<div class=\"commonsearch-table %s\">", that.options.searchFormVisible ? "" : "hidden");
19 vModal += vFormCommon.join(''); 19 vModal += vFormCommon.join('');
20 vModal += "</div>"; 20 vModal += "</div>";
21 that.$container.prepend($(vModal)); 21 that.$container.prepend($(vModal));
22 22
23 - var form = $("#commonSearchForm" + "_" + that.options.idTable); 23 + var form = $("form.form-commonsearch", that.$container);
24 24
25 //绑定日期时间元素事件 25 //绑定日期时间元素事件
26 if ($(".datetimepicker", form).size() > 0) { 26 if ($(".datetimepicker", form).size() > 0) {
@@ -48,12 +48,13 @@ @@ -48,12 +48,13 @@
48 48
49 // 表单提交 49 // 表单提交
50 form.on("submit", function (event) { 50 form.on("submit", function (event) {
  51 + event.preventDefault();
51 that.onColumnCommonSearch(); 52 that.onColumnCommonSearch();
52 return false; 53 return false;
53 }); 54 });
54 55
55 // 重置搜索 56 // 重置搜索
56 - form.on("click", "#btnResetCommon" + "_" + that.options.idTable, function (event) { 57 + form.on("click", "button[type=reset]", function (event) {
57 form[0].reset(); 58 form[0].reset();
58 that.onColumnCommonSearch(); 59 that.onColumnCommonSearch();
59 }); 60 });
@@ -63,7 +64,7 @@ @@ -63,7 +64,7 @@
63 var createFormCommon = function (pColumns, that) { 64 var createFormCommon = function (pColumns, that) {
64 var htmlForm = []; 65 var htmlForm = [];
65 var opList = ['=', '>', '>=', '<', '<=', '!=', 'LIKE', 'LIKE %...%', 'NOT LIKE', 'IN(...)', 'NOT IN(...)', 'BETWEEN', 'NOT BETWEEN', 'IS NULL', 'IS NOT NULL']; 66 var opList = ['=', '>', '>=', '<', '<=', '!=', 'LIKE', 'LIKE %...%', 'NOT LIKE', 'IN(...)', 'NOT IN(...)', 'BETWEEN', 'NOT BETWEEN', 'IS NULL', 'IS NOT NULL'];
66 - htmlForm.push(sprintf('<form class="form-inline" id="commonSearchForm_%s" action="%s" >', that.options.idTable, that.options.actionForm)); 67 + htmlForm.push(sprintf('<form class="form-inline form-commonsearch" action="%s" >', that.options.actionForm));
67 htmlForm.push('<fieldset>'); 68 htmlForm.push('<fieldset>');
68 if (that.options.titleForm.length > 0) 69 if (that.options.titleForm.length > 0)
69 htmlForm.push(sprintf("<legend>%s</legend>", that.options.titleForm)); 70 htmlForm.push(sprintf("<legend>%s</legend>", that.options.titleForm));
@@ -83,7 +84,7 @@ @@ -83,7 +84,7 @@
83 if (vObjCol.searchList) { 84 if (vObjCol.searchList) {
84 if (typeof vObjCol.searchList === 'object' && typeof vObjCol.searchList.then === 'function') { 85 if (typeof vObjCol.searchList === 'object' && typeof vObjCol.searchList.then === 'function') {
85 htmlForm.push(sprintf('<select class="form-control" name="%s" %s>%s</select>', vObjCol.field, style, sprintf('<option value="">%s</option>', that.options.formatCommonChoose()))); 86 htmlForm.push(sprintf('<select class="form-control" name="%s" %s>%s</select>', vObjCol.field, style, sprintf('<option value="">%s</option>', that.options.formatCommonChoose())));
86 - (function (vObjCol, options) { 87 + (function (vObjCol, that) {
87 $.when(vObjCol.searchList).done(function (ret) { 88 $.when(vObjCol.searchList).done(function (ret) {
88 if (ret.data && ret.data.searchlist && $.isArray(ret.data.searchlist)) { 89 if (ret.data && ret.data.searchlist && $.isArray(ret.data.searchlist)) {
89 var optionList = []; 90 var optionList = [];
@@ -91,10 +92,10 @@ @@ -91,10 +92,10 @@
91 var isSelect = value.id === vObjCol.defaultValue ? 'selected' : ''; 92 var isSelect = value.id === vObjCol.defaultValue ? 'selected' : '';
92 optionList.push(sprintf("<option value='" + value.id + "' %s>" + value.name + "</option>", isSelect)); 93 optionList.push(sprintf("<option value='" + value.id + "' %s>" + value.name + "</option>", isSelect));
93 }); 94 });
94 - $("#commonSearchForm_" + options.idTable + " select[name='" + vObjCol.field + "']").append(optionList.join('')); 95 + $("form.form-commonsearch select[name='" + vObjCol.field + "']", that.$container).append(optionList.join(''));
95 } 96 }
96 }); 97 });
97 - })(vObjCol, that.options); 98 + })(vObjCol, that);
98 } else if (typeof vObjCol.searchList == 'function') { 99 } else if (typeof vObjCol.searchList == 'function') {
99 htmlForm.push(vObjCol.searchList.call(this, vObjCol)); 100 htmlForm.push(vObjCol.searchList.call(this, vObjCol));
100 } else { 101 } else {
@@ -139,29 +140,27 @@ @@ -139,29 +140,27 @@
139 var searchReset = that.options.formatCommonResetButton(); 140 var searchReset = that.options.formatCommonResetButton();
140 htmlBtn.push('<div class="form-group" style="margin:5px">'); 141 htmlBtn.push('<div class="form-group" style="margin:5px">');
141 htmlBtn.push('<div class="col-sm-12 text-center">'); 142 htmlBtn.push('<div class="col-sm-12 text-center">');
142 - htmlBtn.push(sprintf('<button type="submit" id="btnSubmitCommon%s" class="btn btn-success" >%s</button> ', "_" + that.options.idTable, searchSubmit));  
143 - htmlBtn.push(sprintf('<button type="button" id="btnResetCommon%s" class="btn btn-default" >%s</button> ', "_" + that.options.idTable, searchReset)); 143 + htmlBtn.push(sprintf('<button type="submit" class="btn btn-success" >%s</button> ', searchSubmit));
  144 + htmlBtn.push(sprintf('<button type="reset" class="btn btn-default" >%s</button> ', searchReset));
144 htmlBtn.push('</div>'); 145 htmlBtn.push('</div>');
145 htmlBtn.push('</div>'); 146 htmlBtn.push('</div>');
146 return htmlBtn; 147 return htmlBtn;
147 }; 148 };
148 149
149 var isSearchAvailble = function (that) { 150 var isSearchAvailble = function (that) {
  151 +
150 //只支持服务端搜索 152 //只支持服务端搜索
151 if (!that.options.commonSearch || that.options.sidePagination != 'server' || !that.options.url) { 153 if (!that.options.commonSearch || that.options.sidePagination != 'server' || !that.options.url) {
152 return false; 154 return false;
153 } 155 }
154 156
155 - if (!that.options.idTable) {  
156 - return false;  
157 - }  
158 return true; 157 return true;
159 }; 158 };
160 159
161 var getSearchQuery = function (that) { 160 var getSearchQuery = function (that) {
162 var op = {}; 161 var op = {};
163 var filter = {}; 162 var filter = {};
164 - $("#commonSearchContent_" + that.options.idTable + " input.operate").each(function (i) { 163 + $("form.form-commonsearch input.operate", that.$container).each(function (i) {
165 var name = $(this).data("name"); 164 var name = $(this).data("name");
166 var sym = $(this).val(); 165 var sym = $(this).val();
167 var obj = $("[name='" + name + "']"); 166 var obj = $("[name='" + name + "']");
@@ -206,7 +205,6 @@ @@ -206,7 +205,6 @@
206 commonSearch: false, 205 commonSearch: false,
207 titleForm: "Common search", 206 titleForm: "Common search",
208 actionForm: "", 207 actionForm: "",
209 - idTable: undefined,  
210 searchFormVisible: true, 208 searchFormVisible: true,
211 searchClass: 'searchit', 209 searchClass: 'searchit',
212 renderDefault: true, 210 renderDefault: true,
@@ -266,7 +264,7 @@ @@ -266,7 +264,7 @@
266 264
267 initCommonSearch(that.columns, that); 265 initCommonSearch(that.columns, that);
268 266
269 - var searchContainer = $("#commonSearchContent_" + that.options.idTable); 267 + var searchContainer = $(".commonsearch-table", that.$container);
270 268
271 that.$toolbar.find('button[name="commonSearch"]') 269 that.$toolbar.find('button[name="commonSearch"]')
272 .off('click').on('click', function () { 270 .off('click').on('click', function () {
@@ -299,12 +297,6 @@ @@ -299,12 +297,6 @@
299 if (!isSearchAvailble(this)) { 297 if (!isSearchAvailble(this)) {
300 return; 298 return;
301 } 299 }
302 - if (!firstLoad) {  
303 - var height = parseInt($(".bootstrap-table").height());  
304 - height += 10;  
305 - $("#" + this.options.idTable).bootstrapTable("resetView", {height: height});  
306 - firstLoad = true;  
307 - }  
308 }; 300 };
309 301
310 BootstrapTable.prototype.initSearch = function () { 302 BootstrapTable.prototype.initSearch = function () {
  1 +!function ($) {
  2 + 'use strict';
  3 +
  4 + $.extend($.fn.bootstrapTable.defaults, {
  5 + templateView: false,
  6 + templateFormatter: "itemtpl",
  7 + templateParentClass: "row row-flex",
  8 + templateTableClass: "table-template",
  9 +
  10 + });
  11 +
  12 + var BootstrapTable = $.fn.bootstrapTable.Constructor,
  13 + _initContainer = BootstrapTable.prototype.initContainer,
  14 + _initBody = BootstrapTable.prototype.initBody,
  15 + _initRow = BootstrapTable.prototype.initRow;
  16 +
  17 + BootstrapTable.prototype.initContainer = function () {
  18 + _initContainer.apply(this, Array.prototype.slice.apply(arguments));
  19 + var that = this;
  20 + if (!that.options.templateView) {
  21 + return;
  22 + }
  23 +
  24 + };
  25 +
  26 + BootstrapTable.prototype.initBody = function () {
  27 + var that = this;
  28 + $.extend(that.options, {
  29 + showHeader: !that.options.templateView ? $.fn.bootstrapTable.defaults.showHeader : false,
  30 + showFooter: !that.options.templateView ? $.fn.bootstrapTable.defaults.showFooter : false,
  31 + });
  32 + $(that.$el).toggleClass(that.options.templateTableClass, that.options.templateView);
  33 +
  34 + _initBody.apply(this, Array.prototype.slice.apply(arguments));
  35 +
  36 + if (!that.options.templateView) {
  37 + return;
  38 + } else {
  39 + //由于Bootstrap是基于Table的,添加一个父类容器
  40 + $("> *", that.$body).wrapAll($("<div />").addClass(that.options.templateParentClass));
  41 + }
  42 + };
  43 +
  44 + BootstrapTable.prototype.initRow = function (item, i, data, parentDom) {
  45 + var that = this;
  46 + //如果未启用则使用原生的initRow方法
  47 + if (!that.options.templateView) {
  48 + return _initRow.apply(that, Array.prototype.slice.apply(arguments));
  49 + }
  50 + var $content = '';
  51 + if (typeof that.options.templateFormatter === 'function') {
  52 + $content = that.options.templateFormatter.call(that, item, i, data);
  53 + } else {
  54 + var Template = require('template');
  55 + $content = Template(that.options.templateFormatter, {item: item, i: i, data: data});
  56 + }
  57 + return $content;
  58 + };
  59 +
  60 +}(jQuery);
@@ -19,6 +19,7 @@ require.config({ @@ -19,6 +19,7 @@ require.config({
19 'echarts-theme': 'echarts-theme', 19 'echarts-theme': 'echarts-theme',
20 'adminlte': 'adminlte', 20 'adminlte': 'adminlte',
21 'bootstrap-table-commonsearch': 'bootstrap-table-commonsearch', 21 'bootstrap-table-commonsearch': 'bootstrap-table-commonsearch',
  22 + 'bootstrap-table-template': 'bootstrap-table-template',
22 // 23 //
23 // 以下的包从bower的libs目录加载 24 // 以下的包从bower的libs目录加载
24 'jquery': '../libs/jquery/dist/jquery.min', 25 'jquery': '../libs/jquery/dist/jquery.min',
@@ -81,6 +82,10 @@ require.config({ @@ -81,6 +82,10 @@ require.config({
81 deps: ['bootstrap-table'], 82 deps: ['bootstrap-table'],
82 exports: '$.fn.bootstrapTable.defaults' 83 exports: '$.fn.bootstrapTable.defaults'
83 }, 84 },
  85 + 'bootstrap-table-template': {
  86 + deps: ['bootstrap-table', 'template'],
  87 + exports: '$.fn.bootstrapTable.defaults'
  88 + },
84 'tableexport': { 89 'tableexport': {
85 deps: ['jquery'], 90 deps: ['jquery'],
86 exports: '$.fn.extend' 91 exports: '$.fn.extend'
@@ -121,6 +126,7 @@ require.config({ @@ -121,6 +126,7 @@ require.config({
121 'css': '../libs/require-css/css.min' 126 'css': '../libs/require-css/css.min'
122 } 127 }
123 }, 128 },
  129 + waitSeconds: 30,
124 charset: 'utf-8' // 文件编码 130 charset: 'utf-8' // 文件编码
125 }); 131 });
126 132
@@ -33,6 +33,7 @@ require.config({ @@ -33,6 +33,7 @@ require.config({
33 'echarts-theme': 'echarts-theme', 33 'echarts-theme': 'echarts-theme',
34 'adminlte': 'adminlte', 34 'adminlte': 'adminlte',
35 'bootstrap-table-commonsearch': 'bootstrap-table-commonsearch', 35 'bootstrap-table-commonsearch': 'bootstrap-table-commonsearch',
  36 + 'bootstrap-table-template': 'bootstrap-table-template',
36 // 37 //
37 // 以下的包从bower的libs目录加载 38 // 以下的包从bower的libs目录加载
38 'jquery': '../libs/jquery/dist/jquery.min', 39 'jquery': '../libs/jquery/dist/jquery.min',
@@ -95,6 +96,10 @@ require.config({ @@ -95,6 +96,10 @@ require.config({
95 deps: ['bootstrap-table'], 96 deps: ['bootstrap-table'],
96 exports: '$.fn.bootstrapTable.defaults' 97 exports: '$.fn.bootstrapTable.defaults'
97 }, 98 },
  99 + 'bootstrap-table-template': {
  100 + deps: ['bootstrap-table', 'template'],
  101 + exports: '$.fn.bootstrapTable.defaults'
  102 + },
98 'tableexport': { 103 'tableexport': {
99 deps: ['jquery'], 104 deps: ['jquery'],
100 exports: '$.fn.extend' 105 exports: '$.fn.extend'
@@ -135,6 +140,7 @@ require.config({ @@ -135,6 +140,7 @@ require.config({
135 'css': '../libs/require-css/css.min' 140 'css': '../libs/require-css/css.min'
136 } 141 }
137 }, 142 },
  143 + waitSeconds: 30,
138 charset: 'utf-8' // 文件编码 144 charset: 'utf-8' // 文件编码
139 }); 145 });
140 146
@@ -6609,7 +6615,7 @@ define('backend',['jquery', 'bootstrap', 'toastr', 'layer', 'lang', 'moment'], f @@ -6609,7 +6615,7 @@ define('backend',['jquery', 'bootstrap', 'toastr', 'layer', 'lang', 'moment'], f
6609 if (layerfooter.size() > 0) { 6615 if (layerfooter.size() > 0) {
6610 footer.on("click", ".btn", function () { 6616 footer.on("click", ".btn", function () {
6611 if ($(this).hasClass("disabled") || $(this).parent().hasClass("disabled")) { 6617 if ($(this).hasClass("disabled") || $(this).parent().hasClass("disabled")) {
6612 - //return; 6618 + return;
6613 } 6619 }
6614 $(".btn:eq(" + $(this).index() + ")", layerfooter).trigger("click"); 6620 $(".btn:eq(" + $(this).index() + ")", layerfooter).trigger("click");
6615 }); 6621 });
@@ -6752,13 +6758,13 @@ define('backend',['jquery', 'bootstrap', 'toastr', 'layer', 'lang', 'moment'], f @@ -6752,13 +6758,13 @@ define('backend',['jquery', 'bootstrap', 'toastr', 'layer', 'lang', 'moment'], f
6752 Toastr.options = Backend.config.toastr; 6758 Toastr.options = Backend.config.toastr;
6753 //点击包含.btn-dialog的元素时弹出dialog 6759 //点击包含.btn-dialog的元素时弹出dialog
6754 $(document).on('click', '.btn-dialog,.dialogit', function (e) { 6760 $(document).on('click', '.btn-dialog,.dialogit', function (e) {
6755 - Backend.api.open(Backend.api.fixurl($(this).attr('href')), $(this).attr('title'));  
6756 e.preventDefault(); 6761 e.preventDefault();
  6762 + Backend.api.open(Backend.api.fixurl($(this).attr('href')), $(this).attr('title'));
6757 }); 6763 });
6758 //点击包含.btn-addtabs的元素时事件 6764 //点击包含.btn-addtabs的元素时事件
6759 $(document).on('click', '.btn-addtabs,.addtabsit', function (e) { 6765 $(document).on('click', '.btn-addtabs,.addtabsit', function (e) {
6760 - Backend.api.addtabs($(this).attr("href"), $(this).attr("title"));  
6761 e.preventDefault(); 6766 e.preventDefault();
  6767 + Backend.api.addtabs($(this).attr("href"), $(this).attr("title"));
6762 }); 6768 });
6763 //点击加入到Shortcut 6769 //点击加入到Shortcut
6764 $(document).on('click', '#ribbon ol li:last a[data-url]', function (e) { 6770 $(document).on('click', '#ribbon ol li:last a[data-url]', function (e) {
@@ -7224,19 +7230,19 @@ return d.keepInvalid=a,l},l.datepickerInput=function(a){if(0===arguments.length) @@ -7224,19 +7230,19 @@ return d.keepInvalid=a,l},l.datepickerInput=function(a){if(0===arguments.length)
7224 !function ($) { 7230 !function ($) {
7225 'use strict'; 7231 'use strict';
7226 7232
7227 - var firstLoad = false, ColumnsForSearch = []; 7233 + var ColumnsForSearch = [];
7228 7234
7229 var sprintf = $.fn.bootstrapTable.utils.sprintf; 7235 var sprintf = $.fn.bootstrapTable.utils.sprintf;
7230 7236
7231 var initCommonSearch = function (pColumns, that) { 7237 var initCommonSearch = function (pColumns, that) {
7232 - var vFormCommon = createFormCommon(pColumns, that), timeoutId = 0; 7238 + var vFormCommon = createFormCommon(pColumns, that);
7233 7239
7234 - var vModal = sprintf("<div id=\"commonSearchContent_%s\" class=\"common-search-table %s\">", that.options.idTable, that.options.searchFormVisible ? "" : "hidden"); 7240 + var vModal = sprintf("<div class=\"commonsearch-table %s\">", that.options.searchFormVisible ? "" : "hidden");
7235 vModal += vFormCommon.join(''); 7241 vModal += vFormCommon.join('');
7236 vModal += "</div>"; 7242 vModal += "</div>";
7237 that.$container.prepend($(vModal)); 7243 that.$container.prepend($(vModal));
7238 7244
7239 - var form = $("#commonSearchForm" + "_" + that.options.idTable); 7245 + var form = $("form.form-commonsearch", that.$container);
7240 7246
7241 //绑定日期时间元素事件 7247 //绑定日期时间元素事件
7242 if ($(".datetimepicker", form).size() > 0) { 7248 if ($(".datetimepicker", form).size() > 0) {
@@ -7264,12 +7270,13 @@ return d.keepInvalid=a,l},l.datepickerInput=function(a){if(0===arguments.length) @@ -7264,12 +7270,13 @@ return d.keepInvalid=a,l},l.datepickerInput=function(a){if(0===arguments.length)
7264 7270
7265 // 表单提交 7271 // 表单提交
7266 form.on("submit", function (event) { 7272 form.on("submit", function (event) {
  7273 + event.preventDefault();
7267 that.onColumnCommonSearch(); 7274 that.onColumnCommonSearch();
7268 return false; 7275 return false;
7269 }); 7276 });
7270 7277
7271 // 重置搜索 7278 // 重置搜索
7272 - form.on("click", "#btnResetCommon" + "_" + that.options.idTable, function (event) { 7279 + form.on("click", "button[type=reset]", function (event) {
7273 form[0].reset(); 7280 form[0].reset();
7274 that.onColumnCommonSearch(); 7281 that.onColumnCommonSearch();
7275 }); 7282 });
@@ -7279,7 +7286,7 @@ return d.keepInvalid=a,l},l.datepickerInput=function(a){if(0===arguments.length) @@ -7279,7 +7286,7 @@ return d.keepInvalid=a,l},l.datepickerInput=function(a){if(0===arguments.length)
7279 var createFormCommon = function (pColumns, that) { 7286 var createFormCommon = function (pColumns, that) {
7280 var htmlForm = []; 7287 var htmlForm = [];
7281 var opList = ['=', '>', '>=', '<', '<=', '!=', 'LIKE', 'LIKE %...%', 'NOT LIKE', 'IN(...)', 'NOT IN(...)', 'BETWEEN', 'NOT BETWEEN', 'IS NULL', 'IS NOT NULL']; 7288 var opList = ['=', '>', '>=', '<', '<=', '!=', 'LIKE', 'LIKE %...%', 'NOT LIKE', 'IN(...)', 'NOT IN(...)', 'BETWEEN', 'NOT BETWEEN', 'IS NULL', 'IS NOT NULL'];
7282 - htmlForm.push(sprintf('<form class="form-inline" id="commonSearchForm_%s" action="%s" >', that.options.idTable, that.options.actionForm)); 7289 + htmlForm.push(sprintf('<form class="form-inline form-commonsearch" action="%s" >', that.options.actionForm));
7283 htmlForm.push('<fieldset>'); 7290 htmlForm.push('<fieldset>');
7284 if (that.options.titleForm.length > 0) 7291 if (that.options.titleForm.length > 0)
7285 htmlForm.push(sprintf("<legend>%s</legend>", that.options.titleForm)); 7292 htmlForm.push(sprintf("<legend>%s</legend>", that.options.titleForm));
@@ -7299,7 +7306,7 @@ return d.keepInvalid=a,l},l.datepickerInput=function(a){if(0===arguments.length) @@ -7299,7 +7306,7 @@ return d.keepInvalid=a,l},l.datepickerInput=function(a){if(0===arguments.length)
7299 if (vObjCol.searchList) { 7306 if (vObjCol.searchList) {
7300 if (typeof vObjCol.searchList === 'object' && typeof vObjCol.searchList.then === 'function') { 7307 if (typeof vObjCol.searchList === 'object' && typeof vObjCol.searchList.then === 'function') {
7301 htmlForm.push(sprintf('<select class="form-control" name="%s" %s>%s</select>', vObjCol.field, style, sprintf('<option value="">%s</option>', that.options.formatCommonChoose()))); 7308 htmlForm.push(sprintf('<select class="form-control" name="%s" %s>%s</select>', vObjCol.field, style, sprintf('<option value="">%s</option>', that.options.formatCommonChoose())));
7302 - (function (vObjCol, options) { 7309 + (function (vObjCol, that) {
7303 $.when(vObjCol.searchList).done(function (ret) { 7310 $.when(vObjCol.searchList).done(function (ret) {
7304 if (ret.data && ret.data.searchlist && $.isArray(ret.data.searchlist)) { 7311 if (ret.data && ret.data.searchlist && $.isArray(ret.data.searchlist)) {
7305 var optionList = []; 7312 var optionList = [];
@@ -7307,10 +7314,10 @@ return d.keepInvalid=a,l},l.datepickerInput=function(a){if(0===arguments.length) @@ -7307,10 +7314,10 @@ return d.keepInvalid=a,l},l.datepickerInput=function(a){if(0===arguments.length)
7307 var isSelect = value.id === vObjCol.defaultValue ? 'selected' : ''; 7314 var isSelect = value.id === vObjCol.defaultValue ? 'selected' : '';
7308 optionList.push(sprintf("<option value='" + value.id + "' %s>" + value.name + "</option>", isSelect)); 7315 optionList.push(sprintf("<option value='" + value.id + "' %s>" + value.name + "</option>", isSelect));
7309 }); 7316 });
7310 - $("#commonSearchForm_" + options.idTable + " select[name='" + vObjCol.field + "']").append(optionList.join('')); 7317 + $("form.form-commonsearch select[name='" + vObjCol.field + "']", that.$container).append(optionList.join(''));
7311 } 7318 }
7312 }); 7319 });
7313 - })(vObjCol, that.options); 7320 + })(vObjCol, that);
7314 } else if (typeof vObjCol.searchList == 'function') { 7321 } else if (typeof vObjCol.searchList == 'function') {
7315 htmlForm.push(vObjCol.searchList.call(this, vObjCol)); 7322 htmlForm.push(vObjCol.searchList.call(this, vObjCol));
7316 } else { 7323 } else {
@@ -7355,29 +7362,27 @@ return d.keepInvalid=a,l},l.datepickerInput=function(a){if(0===arguments.length) @@ -7355,29 +7362,27 @@ return d.keepInvalid=a,l},l.datepickerInput=function(a){if(0===arguments.length)
7355 var searchReset = that.options.formatCommonResetButton(); 7362 var searchReset = that.options.formatCommonResetButton();
7356 htmlBtn.push('<div class="form-group" style="margin:5px">'); 7363 htmlBtn.push('<div class="form-group" style="margin:5px">');
7357 htmlBtn.push('<div class="col-sm-12 text-center">'); 7364 htmlBtn.push('<div class="col-sm-12 text-center">');
7358 - htmlBtn.push(sprintf('<button type="submit" id="btnSubmitCommon%s" class="btn btn-success" >%s</button> ', "_" + that.options.idTable, searchSubmit));  
7359 - htmlBtn.push(sprintf('<button type="button" id="btnResetCommon%s" class="btn btn-default" >%s</button> ', "_" + that.options.idTable, searchReset)); 7365 + htmlBtn.push(sprintf('<button type="submit" class="btn btn-success" >%s</button> ', searchSubmit));
  7366 + htmlBtn.push(sprintf('<button type="reset" class="btn btn-default" >%s</button> ', searchReset));
7360 htmlBtn.push('</div>'); 7367 htmlBtn.push('</div>');
7361 htmlBtn.push('</div>'); 7368 htmlBtn.push('</div>');
7362 return htmlBtn; 7369 return htmlBtn;
7363 }; 7370 };
7364 7371
7365 var isSearchAvailble = function (that) { 7372 var isSearchAvailble = function (that) {
  7373 +
7366 //只支持服务端搜索 7374 //只支持服务端搜索
7367 if (!that.options.commonSearch || that.options.sidePagination != 'server' || !that.options.url) { 7375 if (!that.options.commonSearch || that.options.sidePagination != 'server' || !that.options.url) {
7368 return false; 7376 return false;
7369 } 7377 }
7370 7378
7371 - if (!that.options.idTable) {  
7372 - return false;  
7373 - }  
7374 return true; 7379 return true;
7375 }; 7380 };
7376 7381
7377 var getSearchQuery = function (that) { 7382 var getSearchQuery = function (that) {
7378 var op = {}; 7383 var op = {};
7379 var filter = {}; 7384 var filter = {};
7380 - $("#commonSearchContent_" + that.options.idTable + " input.operate").each(function (i) { 7385 + $("form.form-commonsearch input.operate", that.$container).each(function (i) {
7381 var name = $(this).data("name"); 7386 var name = $(this).data("name");
7382 var sym = $(this).val(); 7387 var sym = $(this).val();
7383 var obj = $("[name='" + name + "']"); 7388 var obj = $("[name='" + name + "']");
@@ -7422,7 +7427,6 @@ return d.keepInvalid=a,l},l.datepickerInput=function(a){if(0===arguments.length) @@ -7422,7 +7427,6 @@ return d.keepInvalid=a,l},l.datepickerInput=function(a){if(0===arguments.length)
7422 commonSearch: false, 7427 commonSearch: false,
7423 titleForm: "Common search", 7428 titleForm: "Common search",
7424 actionForm: "", 7429 actionForm: "",
7425 - idTable: undefined,  
7426 searchFormVisible: true, 7430 searchFormVisible: true,
7427 searchClass: 'searchit', 7431 searchClass: 'searchit',
7428 renderDefault: true, 7432 renderDefault: true,
@@ -7482,7 +7486,7 @@ return d.keepInvalid=a,l},l.datepickerInput=function(a){if(0===arguments.length) @@ -7482,7 +7486,7 @@ return d.keepInvalid=a,l},l.datepickerInput=function(a){if(0===arguments.length)
7482 7486
7483 initCommonSearch(that.columns, that); 7487 initCommonSearch(that.columns, that);
7484 7488
7485 - var searchContainer = $("#commonSearchContent_" + that.options.idTable); 7489 + var searchContainer = $(".commonsearch-table", that.$container);
7486 7490
7487 that.$toolbar.find('button[name="commonSearch"]') 7491 that.$toolbar.find('button[name="commonSearch"]')
7488 .off('click').on('click', function () { 7492 .off('click').on('click', function () {
@@ -7515,12 +7519,6 @@ return d.keepInvalid=a,l},l.datepickerInput=function(a){if(0===arguments.length) @@ -7515,12 +7519,6 @@ return d.keepInvalid=a,l},l.datepickerInput=function(a){if(0===arguments.length)
7515 if (!isSearchAvailble(this)) { 7519 if (!isSearchAvailble(this)) {
7516 return; 7520 return;
7517 } 7521 }
7518 - if (!firstLoad) {  
7519 - var height = parseInt($(".bootstrap-table").height());  
7520 - height += 10;  
7521 - $("#" + this.options.idTable).bootstrapTable("resetView", {height: height});  
7522 - firstLoad = true;  
7523 - }  
7524 }; 7522 };
7525 7523
7526 BootstrapTable.prototype.initSearch = function () { 7524 BootstrapTable.prototype.initSearch = function () {
@@ -7595,7 +7593,77 @@ define("bootstrap-table-commonsearch", ["bootstrap-table"], (function (global) { @@ -7595,7 +7593,77 @@ define("bootstrap-table-commonsearch", ["bootstrap-table"], (function (global) {
7595 }; 7593 };
7596 }(this))); 7594 }(this)));
7597 7595
7598 -define('table',['jquery', 'bootstrap', 'backend', 'toastr', 'moment', 'bootstrap-table', 'bootstrap-table-lang', 'bootstrap-table-mobile', 'bootstrap-table-export', 'bootstrap-table-commonsearch'], function ($, undefined, Backend, Toastr, Moment) { 7596 +/*!art-template - Template Engine | http://aui.github.com/artTemplate/*/
  7597 +!function(){function a(a){return a.replace(t,"").replace(u,",").replace(v,"").replace(w,"").replace(x,"").split(y)}function b(a){return"'"+a.replace(/('|\\)/g,"\\$1").replace(/\r/g,"\\r").replace(/\n/g,"\\n")+"'"}function c(c,d){function e(a){return m+=a.split(/\n/).length-1,k&&(a=a.replace(/\s+/g," ").replace(/<!--[\w\W]*?-->/g,"")),a&&(a=s[1]+b(a)+s[2]+"\n"),a}function f(b){var c=m;if(j?b=j(b,d):g&&(b=b.replace(/\n/g,function(){return m++,"$line="+m+";"})),0===b.indexOf("=")){var e=l&&!/^=[=#]/.test(b);if(b=b.replace(/^=[=#]?|[\s;]*$/g,""),e){var f=b.replace(/\s*\([^\)]+\)/,"");n[f]||/^(include|print)$/.test(f)||(b="$escape("+b+")")}else b="$string("+b+")";b=s[1]+b+s[2]}return g&&(b="$line="+c+";"+b),r(a(b),function(a){if(a&&!p[a]){var b;b="print"===a?u:"include"===a?v:n[a]?"$utils."+a:o[a]?"$helpers."+a:"$data."+a,w+=a+"="+b+",",p[a]=!0}}),b+"\n"}var g=d.debug,h=d.openTag,i=d.closeTag,j=d.parser,k=d.compress,l=d.escape,m=1,p={$data:1,$filename:1,$utils:1,$helpers:1,$out:1,$line:1},q="".trim,s=q?["$out='';","$out+=",";","$out"]:["$out=[];","$out.push(",");","$out.join('')"],t=q?"$out+=text;return $out;":"$out.push(text);",u="function(){var text=''.concat.apply('',arguments);"+t+"}",v="function(filename,data){data=data||$data;var text=$utils.$include(filename,data,$filename);"+t+"}",w="'use strict';var $utils=this,$helpers=$utils.$helpers,"+(g?"$line=0,":""),x=s[0],y="return new String("+s[3]+");";r(c.split(h),function(a){a=a.split(i);var b=a[0],c=a[1];1===a.length?x+=e(b):(x+=f(b),c&&(x+=e(c)))});var z=w+x+y;g&&(z="try{"+z+"}catch(e){throw {filename:$filename,name:'Render Error',message:e.message,line:$line,source:"+b(c)+".split(/\\n/)[$line-1].replace(/^\\s+/,'')};}");try{var A=new Function("$data","$filename",z);return A.prototype=n,A}catch(a){throw a.temp="function anonymous($data,$filename) {"+z+"}",a}}var d=function(a,b){return"string"==typeof b?q(b,{filename:a}):g(a,b)};d.version="3.0.0",d.config=function(a,b){e[a]=b};var e=d.defaults={openTag:"<%",closeTag:"%>",escape:!0,cache:!0,compress:!1,parser:null},f=d.cache={};d.render=function(a,b){return q(a)(b)};var g=d.renderFile=function(a,b){var c=d.get(a)||p({filename:a,name:"Render Error",message:"Template not found"});return b?c(b):c};d.get=function(a){var b;if(f[a])b=f[a];else if("object"==typeof document){var c=document.getElementById(a);if(c){var d=(c.value||c.innerHTML).replace(/^\s*|\s*$/g,"");b=q(d,{filename:a})}}return b};var h=function(a,b){return"string"!=typeof a&&(b=typeof a,"number"===b?a+="":a="function"===b?h(a.call(a)):""),a},i={"<":"&#60;",">":"&#62;",'"':"&#34;","'":"&#39;","&":"&#38;"},j=function(a){return i[a]},k=function(a){return h(a).replace(/&(?![\w#]+;)|[<>"']/g,j)},l=Array.isArray||function(a){return"[object Array]"==={}.toString.call(a)},m=function(a,b){var c,d;if(l(a))for(c=0,d=a.length;c<d;c++)b.call(a,a[c],c,a);else for(c in a)b.call(a,a[c],c)},n=d.utils={$helpers:{},$include:g,$string:h,$escape:k,$each:m};d.helper=function(a,b){o[a]=b};var o=d.helpers=n.$helpers;d.onerror=function(a){var b="Template Error\n\n";for(var c in a)b+="<"+c+">\n"+a[c]+"\n\n";"object"==typeof console&&console.error(b)};var p=function(a){return d.onerror(a),function(){return"{Template Error}"}},q=d.compile=function(a,b){function d(c){try{return new i(c,h)+""}catch(d){return b.debug?p(d)():(b.debug=!0,q(a,b)(c))}}b=b||{};for(var g in e)void 0===b[g]&&(b[g]=e[g]);var h=b.filename;try{var i=c(a,b)}catch(a){return a.filename=h||"anonymous",a.name="Syntax Error",p(a)}return d.prototype=i.prototype,d.toString=function(){return i.toString()},h&&b.cache&&(f[h]=d),d},r=n.$each,s="break,case,catch,continue,debugger,default,delete,do,else,false,finally,for,function,if,in,instanceof,new,null,return,switch,this,throw,true,try,typeof,var,void,while,with,abstract,boolean,byte,char,class,const,double,enum,export,extends,final,float,goto,implements,import,int,interface,long,native,package,private,protected,public,short,static,super,synchronized,throws,transient,volatile,arguments,let,yield,undefined",t=/\/\*[\w\W]*?\*\/|\/\/[^\n]*\n|\/\/[^\n]*$|"(?:[^"\\]|\\[\w\W])*"|'(?:[^'\\]|\\[\w\W])*'|\s*\.\s*[$\w\.]+/g,u=/[^\w$]+/g,v=new RegExp(["\\b"+s.replace(/,/g,"\\b|\\b")+"\\b"].join("|"),"g"),w=/^\d[^,]*|,\d[^,]*/g,x=/^,+|,+$/g,y=/^$|,+/;"object"==typeof exports&&"undefined"!=typeof module?module.exports=d:"function"==typeof define?define('template',[],function(){return d}):this.template=d}();
  7598 +!function ($) {
  7599 + 'use strict';
  7600 +
  7601 + $.extend($.fn.bootstrapTable.defaults, {
  7602 + templateView: false,
  7603 + templateFormatter: "itemtpl",
  7604 + templateParentClass: "row row-flex",
  7605 + templateTableClass: "table-template",
  7606 +
  7607 + });
  7608 +
  7609 + var BootstrapTable = $.fn.bootstrapTable.Constructor,
  7610 + _initContainer = BootstrapTable.prototype.initContainer,
  7611 + _initBody = BootstrapTable.prototype.initBody,
  7612 + _initRow = BootstrapTable.prototype.initRow;
  7613 +
  7614 + BootstrapTable.prototype.initContainer = function () {
  7615 + _initContainer.apply(this, Array.prototype.slice.apply(arguments));
  7616 + var that = this;
  7617 + if (!that.options.templateView) {
  7618 + return;
  7619 + }
  7620 +
  7621 + };
  7622 +
  7623 + BootstrapTable.prototype.initBody = function () {
  7624 + var that = this;
  7625 + $.extend(that.options, {
  7626 + showHeader: !that.options.templateView ? $.fn.bootstrapTable.defaults.showHeader : false,
  7627 + showFooter: !that.options.templateView ? $.fn.bootstrapTable.defaults.showFooter : false,
  7628 + });
  7629 + $(that.$el).toggleClass(that.options.templateTableClass, that.options.templateView);
  7630 +
  7631 + _initBody.apply(this, Array.prototype.slice.apply(arguments));
  7632 +
  7633 + if (!that.options.templateView) {
  7634 + return;
  7635 + } else {
  7636 + //由于Bootstrap是基于Table的,添加一个父类容器
  7637 + $("> *", that.$body).wrapAll($("<div />").addClass(that.options.templateParentClass));
  7638 + }
  7639 + };
  7640 +
  7641 + BootstrapTable.prototype.initRow = function (item, i, data, parentDom) {
  7642 + var that = this;
  7643 + //如果未启用则使用原生的initRow方法
  7644 + if (!that.options.templateView) {
  7645 + return _initRow.apply(that, Array.prototype.slice.apply(arguments));
  7646 + }
  7647 + var $content = '';
  7648 + if (typeof that.options.templateFormatter === 'function') {
  7649 + $content = that.options.templateFormatter.call(that, item, i, data);
  7650 + } else {
  7651 + var Template = require('template');
  7652 + $content = Template(that.options.templateFormatter, {item: item, i: i, data: data});
  7653 + }
  7654 + return $content;
  7655 + };
  7656 +
  7657 +}(jQuery);
  7658 +
  7659 +define("bootstrap-table-template", ["bootstrap-table","template"], (function (global) {
  7660 + return function () {
  7661 + var ret, fn;
  7662 + return ret || global.$.fn.bootstrapTable.defaults;
  7663 + };
  7664 +}(this)));
  7665 +
  7666 +define('table',['jquery', 'bootstrap', 'backend', 'toastr', 'moment', 'bootstrap-table', 'bootstrap-table-lang', 'bootstrap-table-mobile', 'bootstrap-table-export', 'bootstrap-table-commonsearch', 'bootstrap-table-template'], function ($, undefined, Backend, Toastr, Moment) {
7599 var Table = { 7667 var Table = {
7600 list: {}, 7668 list: {},
7601 // Bootstrap-table 基础配置 7669 // Bootstrap-table 基础配置
@@ -7738,8 +7806,9 @@ define('table',['jquery', 'bootstrap', 'backend', 'toastr', 'moment', 'bootstrap @@ -7738,8 +7806,9 @@ define('table',['jquery', 'bootstrap', 'backend', 'toastr', 'moment', 'bootstrap
7738 }); 7806 });
7739 7807
7740 // 处理选中筛选框后按钮的状态统一变更 7808 // 处理选中筛选框后按钮的状态统一变更
7741 - table.on('check.bs.table uncheck.bs.table check-all.bs.table uncheck-all.bs.table', function () {  
7742 - $(Table.config.disabledbtn, toolbar).toggleClass('disabled', !table.bootstrapTable('getSelections').length); 7809 + table.on('check.bs.table uncheck.bs.table check-all.bs.table uncheck-all.bs.table fa.event.check', function () {
  7810 + var ids = Table.api.selectedids(table);
  7811 + $(Table.config.disabledbtn, toolbar).toggleClass('disabled', !ids.length);
7743 }); 7812 });
7744 7813
7745 // 刷新按钮事件 7814 // 刷新按钮事件
@@ -7751,7 +7820,7 @@ define('table',['jquery', 'bootstrap', 'backend', 'toastr', 'moment', 'bootstrap @@ -7751,7 +7820,7 @@ define('table',['jquery', 'bootstrap', 'backend', 'toastr', 'moment', 'bootstrap
7751 var ids = Table.api.selectedids(table); 7820 var ids = Table.api.selectedids(table);
7752 Backend.api.open(options.extend.add_url + "/ids" + (ids.length > 0 ? '/' : '') + ids.join(","), __('Add')); 7821 Backend.api.open(options.extend.add_url + "/ids" + (ids.length > 0 ? '/' : '') + ids.join(","), __('Add'));
7753 }); 7822 });
7754 - // 编辑按钮事件 7823 + // 批量编辑按钮事件
7755 $(toolbar).on('click', Table.config.editbtn, function () { 7824 $(toolbar).on('click', Table.config.editbtn, function () {
7756 var ids = Table.api.selectedids(table); 7825 var ids = Table.api.selectedids(table);
7757 //循环弹出多个编辑框 7826 //循环弹出多个编辑框
@@ -7812,6 +7881,27 @@ define('table',['jquery', 'bootstrap', 'backend', 'toastr', 'moment', 'bootstrap @@ -7812,6 +7881,27 @@ define('table',['jquery', 'bootstrap', 'backend', 'toastr', 'moment', 'bootstrap
7812 placeHolderTemplate: "" 7881 placeHolderTemplate: ""
7813 }); 7882 });
7814 }); 7883 });
  7884 + $(table).on("click", "input[data-id][name='checkbox']", function (e) {
  7885 + table.trigger('fa.event.check');
  7886 + });
  7887 + $(table).on("click", "[data-id].btn-edit", function (e) {
  7888 + e.preventDefault();
  7889 + Backend.api.open(options.extend.edit_url + "/ids/" + $(this).data("id"), __('Edit'));
  7890 + });
  7891 + $(table).on("click", "[data-id].btn-del", function (e) {
  7892 + e.preventDefault();
  7893 + var id = $(this).data("id");
  7894 + var that = this;
  7895 + var index = Backend.api.layer.confirm(
  7896 + __('Are you sure you want to delete this item?'),
  7897 + {icon: 3, title: __('Warning'), shadeClose: true},
  7898 + function () {
  7899 + Table.api.multi("del", id, table, that);
  7900 + Backend.api.layer.close(index);
  7901 + }
  7902 + );
  7903 +
  7904 + });
7815 7905
7816 var id = table.attr("id"); 7906 var id = table.attr("id");
7817 Table.list[id] = table; 7907 Table.list[id] = table;
@@ -7952,9 +8042,15 @@ define('table',['jquery', 'bootstrap', 'backend', 'toastr', 'moment', 'bootstrap @@ -7952,9 +8042,15 @@ define('table',['jquery', 'bootstrap', 'backend', 'toastr', 'moment', 'bootstrap
7952 // 获取选中的条目ID集合 8042 // 获取选中的条目ID集合
7953 selectedids: function (table) { 8043 selectedids: function (table) {
7954 var options = table.bootstrapTable('getOptions'); 8044 var options = table.bootstrapTable('getOptions');
7955 - return $.map(table.bootstrapTable('getSelections'), function (row) {  
7956 - return row[options.pk];  
7957 - }); 8045 + if (options.templateView) {
  8046 + return $.map($("input[data-id][name='checkbox']:checked"), function (dom) {
  8047 + return $(dom).data("id");
  8048 + });
  8049 + } else {
  8050 + return $.map(table.bootstrapTable('getSelections'), function (row) {
  8051 + return row[options.pk];
  8052 + });
  8053 + }
7958 }, 8054 },
7959 // 切换复选框状态 8055 // 切换复选框状态
7960 toggleattr: function (table) { 8056 toggleattr: function (table) {
@@ -8380,8 +8476,6 @@ define("../libs/plupload/js/moxie.min", function(){}); @@ -8380,8 +8476,6 @@ define("../libs/plupload/js/moxie.min", function(){});
8380 8476
8381 define("dragsort", function(){}); 8477 define("dragsort", function(){});
8382 8478
8383 -/*!art-template - Template Engine | http://aui.github.com/artTemplate/*/  
8384 -!function(){function a(a){return a.replace(t,"").replace(u,",").replace(v,"").replace(w,"").replace(x,"").split(y)}function b(a){return"'"+a.replace(/('|\\)/g,"\\$1").replace(/\r/g,"\\r").replace(/\n/g,"\\n")+"'"}function c(c,d){function e(a){return m+=a.split(/\n/).length-1,k&&(a=a.replace(/\s+/g," ").replace(/<!--[\w\W]*?-->/g,"")),a&&(a=s[1]+b(a)+s[2]+"\n"),a}function f(b){var c=m;if(j?b=j(b,d):g&&(b=b.replace(/\n/g,function(){return m++,"$line="+m+";"})),0===b.indexOf("=")){var e=l&&!/^=[=#]/.test(b);if(b=b.replace(/^=[=#]?|[\s;]*$/g,""),e){var f=b.replace(/\s*\([^\)]+\)/,"");n[f]||/^(include|print)$/.test(f)||(b="$escape("+b+")")}else b="$string("+b+")";b=s[1]+b+s[2]}return g&&(b="$line="+c+";"+b),r(a(b),function(a){if(a&&!p[a]){var b;b="print"===a?u:"include"===a?v:n[a]?"$utils."+a:o[a]?"$helpers."+a:"$data."+a,w+=a+"="+b+",",p[a]=!0}}),b+"\n"}var g=d.debug,h=d.openTag,i=d.closeTag,j=d.parser,k=d.compress,l=d.escape,m=1,p={$data:1,$filename:1,$utils:1,$helpers:1,$out:1,$line:1},q="".trim,s=q?["$out='';","$out+=",";","$out"]:["$out=[];","$out.push(",");","$out.join('')"],t=q?"$out+=text;return $out;":"$out.push(text);",u="function(){var text=''.concat.apply('',arguments);"+t+"}",v="function(filename,data){data=data||$data;var text=$utils.$include(filename,data,$filename);"+t+"}",w="'use strict';var $utils=this,$helpers=$utils.$helpers,"+(g?"$line=0,":""),x=s[0],y="return new String("+s[3]+");";r(c.split(h),function(a){a=a.split(i);var b=a[0],c=a[1];1===a.length?x+=e(b):(x+=f(b),c&&(x+=e(c)))});var z=w+x+y;g&&(z="try{"+z+"}catch(e){throw {filename:$filename,name:'Render Error',message:e.message,line:$line,source:"+b(c)+".split(/\\n/)[$line-1].replace(/^\\s+/,'')};}");try{var A=new Function("$data","$filename",z);return A.prototype=n,A}catch(a){throw a.temp="function anonymous($data,$filename) {"+z+"}",a}}var d=function(a,b){return"string"==typeof b?q(b,{filename:a}):g(a,b)};d.version="3.0.0",d.config=function(a,b){e[a]=b};var e=d.defaults={openTag:"<%",closeTag:"%>",escape:!0,cache:!0,compress:!1,parser:null},f=d.cache={};d.render=function(a,b){return q(a)(b)};var g=d.renderFile=function(a,b){var c=d.get(a)||p({filename:a,name:"Render Error",message:"Template not found"});return b?c(b):c};d.get=function(a){var b;if(f[a])b=f[a];else if("object"==typeof document){var c=document.getElementById(a);if(c){var d=(c.value||c.innerHTML).replace(/^\s*|\s*$/g,"");b=q(d,{filename:a})}}return b};var h=function(a,b){return"string"!=typeof a&&(b=typeof a,"number"===b?a+="":a="function"===b?h(a.call(a)):""),a},i={"<":"&#60;",">":"&#62;",'"':"&#34;","'":"&#39;","&":"&#38;"},j=function(a){return i[a]},k=function(a){return h(a).replace(/&(?![\w#]+;)|[<>"']/g,j)},l=Array.isArray||function(a){return"[object Array]"==={}.toString.call(a)},m=function(a,b){var c,d;if(l(a))for(c=0,d=a.length;c<d;c++)b.call(a,a[c],c,a);else for(c in a)b.call(a,a[c],c)},n=d.utils={$helpers:{},$include:g,$string:h,$escape:k,$each:m};d.helper=function(a,b){o[a]=b};var o=d.helpers=n.$helpers;d.onerror=function(a){var b="Template Error\n\n";for(var c in a)b+="<"+c+">\n"+a[c]+"\n\n";"object"==typeof console&&console.error(b)};var p=function(a){return d.onerror(a),function(){return"{Template Error}"}},q=d.compile=function(a,b){function d(c){try{return new i(c,h)+""}catch(d){return b.debug?p(d)():(b.debug=!0,q(a,b)(c))}}b=b||{};for(var g in e)void 0===b[g]&&(b[g]=e[g]);var h=b.filename;try{var i=c(a,b)}catch(a){return a.filename=h||"anonymous",a.name="Syntax Error",p(a)}return d.prototype=i.prototype,d.toString=function(){return i.toString()},h&&b.cache&&(f[h]=d),d},r=n.$each,s="break,case,catch,continue,debugger,default,delete,do,else,false,finally,for,function,if,in,instanceof,new,null,return,switch,this,throw,true,try,typeof,var,void,while,with,abstract,boolean,byte,char,class,const,double,enum,export,extends,final,float,goto,implements,import,int,interface,long,native,package,private,protected,public,short,static,super,synchronized,throws,transient,volatile,arguments,let,yield,undefined",t=/\/\*[\w\W]*?\*\/|\/\/[^\n]*\n|\/\/[^\n]*$|"(?:[^"\\]|\\[\w\W])*"|'(?:[^'\\]|\\[\w\W])*'|\s*\.\s*[$\w\.]+/g,u=/[^\w$]+/g,v=new RegExp(["\\b"+s.replace(/,/g,"\\b|\\b")+"\\b"].join("|"),"g"),w=/^\d[^,]*|,\d[^,]*/g,x=/^,+|,+$/g,y=/^$|,+/;"object"==typeof exports&&"undefined"!=typeof module?module.exports=d:"function"==typeof define?define('template',[],function(){return d}):this.template=d}();  
8385 define('upload',['jquery', 'bootstrap', 'backend', 'plupload', 'dragsort', 'template'], function ($, undefined, Backend, Plupload, Dragsort, Template) { 8479 define('upload',['jquery', 'bootstrap', 'backend', 'plupload', 'dragsort', 'template'], function ($, undefined, Backend, Plupload, Dragsort, Template) {
8386 var Upload = { 8480 var Upload = {
8387 list: {}, 8481 list: {},
@@ -10951,6 +11045,9 @@ define('form',['jquery', 'bootstrap', 'backend', 'toastr', 'upload', 'validator' @@ -10951,6 +11045,9 @@ define('form',['jquery', 'bootstrap', 'backend', 'toastr', 'upload', 'validator'
10951 return false; 11045 return false;
10952 }, 11046 },
10953 bindevent: function (form, onBeforeSubmit, onAfterSubmit) { 11047 bindevent: function (form, onBeforeSubmit, onAfterSubmit) {
  11048 + //移除提交按钮的disabled类
  11049 + $(".layer-footer .btn.disabled", form).removeClass("disabled");
  11050 + //绑定表单事件
10954 form.validator($.extend({ 11051 form.validator($.extend({
10955 validClass: 'has-success', 11052 validClass: 'has-success',
10956 invalidClass: 'has-error', 11053 invalidClass: 'has-error',
@@ -11001,6 +11098,10 @@ define('form',['jquery', 'bootstrap', 'backend', 'toastr', 'upload', 'validator' @@ -11001,6 +11098,10 @@ define('form',['jquery', 'bootstrap', 'backend', 'toastr', 'upload', 'validator'
11001 source: 'ajax/selectpage', 11098 source: 'ajax/selectpage',
11002 }); 11099 });
11003 }); 11100 });
  11101 + //给隐藏的元素添加上validate验证触发事件
  11102 + $(form).on("change", ".selectpage-input-hidden", function () {
  11103 + $(this).trigger("validate");
  11104 + });
11004 } 11105 }
11005 11106
11006 //绑定cxselect元素事件 11107 //绑定cxselect元素事件
@@ -11160,7 +11261,9 @@ $.fn.addtabs = function (options) { @@ -11160,7 +11261,9 @@ $.fn.addtabs = function (options) {
11160 //浏览器前进后退事件 11261 //浏览器前进后退事件
11161 $(window).on("popstate", function (e) { 11262 $(window).on("popstate", function (e) {
11162 var state = e.originalEvent.state; 11263 var state = e.originalEvent.state;
11163 - $("a[addtabs=" + state.id + "]", options.monitor).data("pushstate", true).trigger("click"); 11264 + if (state) {
  11265 + $("a[addtabs=" + state.id + "]", options.monitor).data("pushstate", true).trigger("click");
  11266 + }
11164 }); 11267 });
11165 } 11268 }
11166 $(options.monitor).on('click', '[addtabs]', function (e) { 11269 $(options.monitor).on('click', '[addtabs]', function (e) {
@@ -11473,6 +11576,11 @@ define("addtabs", function(){}); @@ -11473,6 +11576,11 @@ define("addtabs", function(){});
11473 */ 11576 */
11474 format_item: false, 11577 format_item: false,
11475 11578
  11579 + /**
  11580 + * 是否使用Formatter的text文本来填充文本框
  11581 + */
  11582 + format_fill: false,
  11583 +
11476 //只选择模式 11584 //只选择模式
11477 select_only: true, 11585 select_only: true,
11478 }, option); 11586 }, option);
@@ -11883,6 +11991,7 @@ define("addtabs", function(){}); @@ -11883,6 +11991,7 @@ define("addtabs", function(){});
11883 id: input_id 11991 id: input_id
11884 }); 11992 });
11885 } 11993 }
  11994 + $(elem.hidden).addClass("selectpage-input-hidden");
11886 // 2. DOM内容放置 11995 // 2. DOM内容放置
11887 $(elem.container).append(elem.button).append(elem.result_area).append(elem.hidden); 11996 $(elem.container).append(elem.button).append(elem.result_area).append(elem.hidden);
11888 $(elem.button).append(elem.img); 11997 $(elem.button).append(elem.img);
@@ -12060,6 +12169,7 @@ define("addtabs", function(){}); @@ -12060,6 +12169,7 @@ define("addtabs", function(){});
12060 //该句会去除当前高亮项目的显示,暂时屏蔽 12169 //该句会去除当前高亮项目的显示,暂时屏蔽
12061 //$(self.elem.results).children('li').removeClass(self.css_class.select); 12170 //$(self.elem.results).children('li').removeClass(self.css_class.select);
12062 }).blur(function () { 12171 }).blur(function () {
  12172 + $(self.elem.hidden).trigger("blur");
12063 }); 12173 });
12064 if (self.option.multiple) { 12174 if (self.option.multiple) {
12065 $(self.elem.element_box).click(function (e) { 12175 $(self.elem.element_box).click(function (e) {
@@ -12942,6 +13052,7 @@ define("addtabs", function(){}); @@ -12942,6 +13052,7 @@ define("addtabs", function(){});
12942 //XSS対策 13052 //XSS対策
12943 var list = $('<li>').html(itemText).attr({ 13053 var list = $('<li>').html(itemText).attr({
12944 pkey: arr_primary_key[i], 13054 pkey: arr_primary_key[i],
  13055 + pvalue: arr_candidate[i],
12945 title: itemText 13056 title: itemText
12946 }); 13057 });
12947 13058
@@ -13218,13 +13329,15 @@ define("addtabs", function(){}); @@ -13218,13 +13329,15 @@ define("addtabs", function(){});
13218 13329
13219 var current = self._getCurrentLine(self); 13330 var current = self._getCurrentLine(self);
13220 if (current) { 13331 if (current) {
  13332 + var pkey = $(current).attr('pkey');
  13333 + var text = self.option.format_fill ? $(current).text() : $(current).attr("pvalue");
13221 if (!self.option.multiple) { 13334 if (!self.option.multiple) {
13222 - $(self.elem.combo_input).val($(current).text());  
13223 - self._setHiddenValue($(current).attr('pkey')); 13335 + $(self.elem.combo_input).val(text);
  13336 + self._setHiddenValue(pkey);
13224 } else { 13337 } else {
13225 //多选模式的项目选择处理 13338 //多选模式的项目选择处理
13226 $(self.elem.combo_input).val(''); 13339 $(self.elem.combo_input).val('');
13227 - var item = {text: $(current).text(), value: $(current).attr('pkey')}; 13340 + var item = {text: text, value: pkey};
13228 if (!self._isAlreadySelected(self, item)) { 13341 if (!self._isAlreadySelected(self, item)) {
13229 self._addNewTag(self, item); 13342 self._addNewTag(self, item);
13230 self._tagValuesSet(self); 13343 self._tagValuesSet(self);
@@ -13240,7 +13353,6 @@ define("addtabs", function(){}); @@ -13240,7 +13353,6 @@ define("addtabs", function(){});
13240 if (typeof self.option.callback === 'function') { 13353 if (typeof self.option.callback === 'function') {
13241 self.option.callback.call(self, $(current).data('dataObj')); 13354 self.option.callback.call(self, $(current).data('dataObj'));
13242 } 13355 }
13243 -  
13244 //触发指定事件 13356 //触发指定事件
13245 if (self.option.bind_to) { 13357 if (self.option.bind_to) {
13246 $(self.elem.combo_input).trigger(self.option.bind_to, $(current).data('dataObj')); 13358 $(self.elem.combo_input).trigger(self.option.bind_to, $(current).data('dataObj'));
@@ -13251,8 +13363,8 @@ define("addtabs", function(){}); @@ -13251,8 +13363,8 @@ define("addtabs", function(){});
13251 } 13363 }
13252 13364
13253 //$(self.elem.combo_input).focus(); 13365 //$(self.elem.combo_input).focus();
13254 - $(self.elem.combo_input).change();  
13255 - $(self.elem.combo_input).blur(); 13366 + $(self.elem.combo_input).trigger("change");
  13367 + $(self.elem.combo_input).trigger("blur");
13256 self._setCssFocusedInput(self); 13368 self._setCssFocusedInput(self);
13257 self._inputResize(self); 13369 self._inputResize(self);
13258 }, 13370 },
@@ -67,6 +67,9 @@ define(['jquery', 'bootstrap', 'backend', 'toastr', 'upload', 'validator'], func @@ -67,6 +67,9 @@ define(['jquery', 'bootstrap', 'backend', 'toastr', 'upload', 'validator'], func
67 return false; 67 return false;
68 }, 68 },
69 bindevent: function (form, onBeforeSubmit, onAfterSubmit) { 69 bindevent: function (form, onBeforeSubmit, onAfterSubmit) {
  70 + //移除提交按钮的disabled类
  71 + $(".layer-footer .btn.disabled", form).removeClass("disabled");
  72 + //绑定表单事件
70 form.validator($.extend({ 73 form.validator($.extend({
71 validClass: 'has-success', 74 validClass: 'has-success',
72 invalidClass: 'has-error', 75 invalidClass: 'has-error',
@@ -117,6 +120,10 @@ define(['jquery', 'bootstrap', 'backend', 'toastr', 'upload', 'validator'], func @@ -117,6 +120,10 @@ define(['jquery', 'bootstrap', 'backend', 'toastr', 'upload', 'validator'], func
117 source: 'ajax/selectpage', 120 source: 'ajax/selectpage',
118 }); 121 });
119 }); 122 });
  123 + //给隐藏的元素添加上validate验证触发事件
  124 + $(form).on("change", ".selectpage-input-hidden", function () {
  125 + $(this).trigger("validate");
  126 + });
120 } 127 }
121 128
122 //绑定cxselect元素事件 129 //绑定cxselect元素事件
@@ -114,6 +114,7 @@ require.config({ @@ -114,6 +114,7 @@ require.config({
114 'css': '../libs/require-css/css.min' 114 'css': '../libs/require-css/css.min'
115 } 115 }
116 }, 116 },
  117 + waitSeconds: 30,
117 charset: 'utf-8' // 文件编码 118 charset: 'utf-8' // 文件编码
118 }); 119 });
119 120
@@ -128,6 +128,7 @@ require.config({ @@ -128,6 +128,7 @@ require.config({
128 'css': '../libs/require-css/css.min' 128 'css': '../libs/require-css/css.min'
129 } 129 }
130 }, 130 },
  131 + waitSeconds: 30,
131 charset: 'utf-8' // 文件编码 132 charset: 'utf-8' // 文件编码
132 }); 133 });
133 134
1 -define(['jquery', 'bootstrap', 'backend', 'toastr', 'moment', 'bootstrap-table', 'bootstrap-table-lang', 'bootstrap-table-mobile', 'bootstrap-table-export', 'bootstrap-table-commonsearch'], function ($, undefined, Backend, Toastr, Moment) { 1 +define(['jquery', 'bootstrap', 'backend', 'toastr', 'moment', 'bootstrap-table', 'bootstrap-table-lang', 'bootstrap-table-mobile', 'bootstrap-table-export', 'bootstrap-table-commonsearch', 'bootstrap-table-template'], function ($, undefined, Backend, Toastr, Moment) {
2 var Table = { 2 var Table = {
3 list: {}, 3 list: {},
4 // Bootstrap-table 基础配置 4 // Bootstrap-table 基础配置
@@ -141,8 +141,9 @@ define(['jquery', 'bootstrap', 'backend', 'toastr', 'moment', 'bootstrap-table', @@ -141,8 +141,9 @@ define(['jquery', 'bootstrap', 'backend', 'toastr', 'moment', 'bootstrap-table',
141 }); 141 });
142 142
143 // 处理选中筛选框后按钮的状态统一变更 143 // 处理选中筛选框后按钮的状态统一变更
144 - table.on('check.bs.table uncheck.bs.table check-all.bs.table uncheck-all.bs.table', function () {  
145 - $(Table.config.disabledbtn, toolbar).toggleClass('disabled', !table.bootstrapTable('getSelections').length); 144 + table.on('check.bs.table uncheck.bs.table check-all.bs.table uncheck-all.bs.table fa.event.check', function () {
  145 + var ids = Table.api.selectedids(table);
  146 + $(Table.config.disabledbtn, toolbar).toggleClass('disabled', !ids.length);
146 }); 147 });
147 148
148 // 刷新按钮事件 149 // 刷新按钮事件
@@ -154,7 +155,7 @@ define(['jquery', 'bootstrap', 'backend', 'toastr', 'moment', 'bootstrap-table', @@ -154,7 +155,7 @@ define(['jquery', 'bootstrap', 'backend', 'toastr', 'moment', 'bootstrap-table',
154 var ids = Table.api.selectedids(table); 155 var ids = Table.api.selectedids(table);
155 Backend.api.open(options.extend.add_url + "/ids" + (ids.length > 0 ? '/' : '') + ids.join(","), __('Add')); 156 Backend.api.open(options.extend.add_url + "/ids" + (ids.length > 0 ? '/' : '') + ids.join(","), __('Add'));
156 }); 157 });
157 - // 编辑按钮事件 158 + // 批量编辑按钮事件
158 $(toolbar).on('click', Table.config.editbtn, function () { 159 $(toolbar).on('click', Table.config.editbtn, function () {
159 var ids = Table.api.selectedids(table); 160 var ids = Table.api.selectedids(table);
160 //循环弹出多个编辑框 161 //循环弹出多个编辑框
@@ -215,6 +216,27 @@ define(['jquery', 'bootstrap', 'backend', 'toastr', 'moment', 'bootstrap-table', @@ -215,6 +216,27 @@ define(['jquery', 'bootstrap', 'backend', 'toastr', 'moment', 'bootstrap-table',
215 placeHolderTemplate: "" 216 placeHolderTemplate: ""
216 }); 217 });
217 }); 218 });
  219 + $(table).on("click", "input[data-id][name='checkbox']", function (e) {
  220 + table.trigger('fa.event.check');
  221 + });
  222 + $(table).on("click", "[data-id].btn-edit", function (e) {
  223 + e.preventDefault();
  224 + Backend.api.open(options.extend.edit_url + "/ids/" + $(this).data("id"), __('Edit'));
  225 + });
  226 + $(table).on("click", "[data-id].btn-del", function (e) {
  227 + e.preventDefault();
  228 + var id = $(this).data("id");
  229 + var that = this;
  230 + var index = Backend.api.layer.confirm(
  231 + __('Are you sure you want to delete this item?'),
  232 + {icon: 3, title: __('Warning'), shadeClose: true},
  233 + function () {
  234 + Table.api.multi("del", id, table, that);
  235 + Backend.api.layer.close(index);
  236 + }
  237 + );
  238 +
  239 + });
218 240
219 var id = table.attr("id"); 241 var id = table.attr("id");
220 Table.list[id] = table; 242 Table.list[id] = table;
@@ -355,9 +377,15 @@ define(['jquery', 'bootstrap', 'backend', 'toastr', 'moment', 'bootstrap-table', @@ -355,9 +377,15 @@ define(['jquery', 'bootstrap', 'backend', 'toastr', 'moment', 'bootstrap-table',
355 // 获取选中的条目ID集合 377 // 获取选中的条目ID集合
356 selectedids: function (table) { 378 selectedids: function (table) {
357 var options = table.bootstrapTable('getOptions'); 379 var options = table.bootstrapTable('getOptions');
358 - return $.map(table.bootstrapTable('getSelections'), function (row) {  
359 - return row[options.pk];  
360 - }); 380 + if (options.templateView) {
  381 + return $.map($("input[data-id][name='checkbox']:checked"), function (dom) {
  382 + return $(dom).data("id");
  383 + });
  384 + } else {
  385 + return $.map(table.bootstrapTable('getSelections'), function (row) {
  386 + return row[options.pk];
  387 + });
  388 + }
361 }, 389 },
362 // 切换复选框状态 390 // 切换复选框状态
363 toggleattr: function (table) { 391 toggleattr: function (table) {
@@ -100,6 +100,20 @@ body.is-dialog { @@ -100,6 +100,20 @@ body.is-dialog {
100 } 100 }
101 } 101 }
102 } 102 }
  103 +@media only screen and (min-width : 481px) {
  104 + .row-flex {
  105 + display: flex;
  106 + flex-wrap: wrap;
  107 + }
  108 + .row-flex > [class*='col-'] {
  109 + display: flex;
  110 + flex-direction: column;
  111 + }
  112 + .row-flex.row:after,
  113 + .row-flex.row:before {
  114 + display: flex;
  115 + }
  116 +}
103 .common-search-table { 117 .common-search-table {
104 min-height: 20px; 118 min-height: 20px;
105 padding: 15px; 119 padding: 15px;
@@ -110,6 +124,14 @@ body.is-dialog { @@ -110,6 +124,14 @@ body.is-dialog {
110 border-bottom:1px dashed @link-color; 124 border-bottom:1px dashed @link-color;
111 } 125 }
112 126
  127 +table.table-template{
  128 + overflow:hidden;
  129 +}
  130 +.sp_container .msg-box{
  131 + position: absolute;
  132 + right: 0;
  133 + top: 0;
  134 +}
113 .toast-top-right-index{ 135 .toast-top-right-index{
114 top:62px; 136 top:62px;
115 right:12px; 137 right:12px;