作者 曹东东
<?php
namespace app\common\model;
use think\Model;
class StationAppointment extends Model
{
// 表名
protected $name = 'station_appointment';
// 自动写入时间戳字段
protected $autoWriteTimestamp = 'int';
// 定义时间戳字段名
protected $createTime = 'createtime';
protected $updateTime = 'updatetime';
// 追加属性
protected $append = [
'status_text'
];
public function getStatusList()
{
return ['0' => __('待审核'), '1' => __('已通过'),'2' => __('未通过')];
}
public function getStatusTextAttr($value, $data)
{
$value = $value ? $value : $data['status'];
$list = $this->getStatusList();
return isset($list[$value]) ? $list[$value] : '';
}
}
... ...
... ... @@ -77,9 +77,9 @@ class Building extends Frontend
if(!isset($params['room_id']) || empty($params['room_id'])){
$this->error('请选择房间');
}
if(strtotime($params['start_time']) <= time()) {
$this->error('请选择未来时间');
}
// if(strtotime($params['start_time']) <= time()) {
// $this->error('请选择未来时间');
// }
$startTime = strtotime($params['apply_date'].$params['start_time']);
$endTime = strtotime($params['apply_date'].$params['end_time']);
... ...
... ... @@ -21,6 +21,28 @@ class Project
// ];
// $isJobDone = $this->doHelloJob($data);
// }
public function saveTest()
{
ini_set("memory_limit","2048M");
$server = array(
'host' => 'r-8vb3mizdy07emeuv4upd.redis.zhangbei.rds.aliyuncs.com',//IP
'port' => 6379, //端口
'password' => 'Yundai2019', //密码
);
$redisKey = 'checkProject:124_330';
$redis = new Client($server);//实例化
$redis->select(8);
$infos = $redis->hvals($redisKey);
dump($infos);die;
$textField = $infos['21759_700'];
$time = 10000;
for ($i = 0;$i <= $time; $i++) {
$redis->hset($redisKey, mt_rand (1,10000).'_'.mt_rand (1,10000),json_encode($textField));
}
}
//消费者
public function fire(Job $job,$data) {
$isJobDone = $this->doRegisterJob($data);
... ...
<?php
namespace app\school\controller;
use app\common\controller\DoubleBase;
use think\Db;
use app\common\model\StationAppointment as AppointmentModel;
/**
* 工位审核
*/
class StationAppointment extends DoubleBase
{
protected $noNeedRight = ['*'];
protected $model = null;
public function _initialize()
{
parent::_initialize();
$this->model = new AppointmentModel();
}
/**
* 预约审核index
* @return array|\think\response\Json
* @author cdd
*/
public function index()
{
//设置过滤方法
$this->request->filter(['strip_tags', 'trim']);
if ($this->request->isAjax()) {
list($where, $sort, $order, $offset, $limit) = $this->buildparams(null,true);
$params = json_decode($this->request->get('filter'),true);
$newwhere = [];
if(isset($params['station_name'])) {
$newwhere['s.station_name'] = ['like',"%".$params['station_name']."%"];
}
if(isset($params['username']) && !empty($params['username'])) {
$newwhere['u.username'] = ['like',"%".$params['username']."%"];
}
$list = $this->model
->alias('a')
->field('a.*,s.station_name,u.username')
->join('station s','a.station_id = s.id','inner')
->join('user u','a.user_id = u.id','left')
->where(['s.school_id' => SCHOOL_ID])
->where($newwhere)
->order('a.createtime', $order)
->paginate($limit);
$result = array("total" => $list->total(), "rows" => $list->items());
return json($result);
}
return $this->view->fetch();
}
public function verify()
{
$params = $this->request->param();
$info = $this->model->find($params['id']);
$info->status = $params['status'];
if(!$info->save()) {
$this->error('审核失败');
}
$this->success('成功');
}
}
... ...
... ... @@ -41,13 +41,16 @@ class RoomOrder extends DoubleBase
$params = json_decode($this->request->get('filter'),true);
$newwhere = [];
if(isset($params['room_name'])) {
$newwhere['r.room_name'] = ['like',"%".$params['room_name']."%"];
}
if(isset($params['username']) && !empty($params['username'])) {
$newwhere['u.username'] = ['like',"%".$params['username']."%"];
}
$list = $this->model
->field('o.*,r.room_name')
->field('o.*,r.room_name,u.username')
->alias('o')
->join('project_room r','o.room_id = r.id','inner')
->join('user u','o.user_id = u.id','left')
->where(['r.school_id' => SCHOOL_ID])
->where($newwhere)
->order('o.createtime', $order)
... ...
<?php
namespace app\school\controller\station;
use app\common\controller\DoubleBase;
use think\Db;
use think\Exception;
use think\exception\PDOException;
/**
* 工位管理
*
* @icon fa fa-circle-o
*/
class Station extends DoubleBase
{
/**
* Station模型对象
* @var \app\school\model\station\Station
*/
protected $noNeedRight = ['*'];
protected $model = null;
public function _initialize()
{
parent::_initialize();
$this->model = new \app\school\model\station\Station;
$type = [
'1' => '个人',
'2' => '会议室',
];
$this->assign('type',$type);
$this->assignconfig('type',$type);
}
public function import()
{
parent::import();
}
/**
* 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
* 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
* 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
*/
public function index()
{
//设置过滤方法
$this->request->filter(['strip_tags', 'trim']);
if ($this->request->isAjax()) {
list($where, $sort, $order, $offset, $limit) = $this->buildparams(null,true);
$list = $this->model
->where($where)
->order('createtime', $order)
->paginate($limit);
$result = array("total" => $list->total(), "rows" => $list->items());
return json($result);
}
return $this->view->fetch();
}
/**
* 添加
*/
public function add()
{
if ($this->request->isPost()) {
$params = $this->request->post("row/a");
if ($params) {
$params = $this->preExcludeFields($params);
$params['school_id'] = SCHOOL_ID;
if (!$params['capacity']){
$this->error("该工位可容纳人数应大于0");
}
Db::startTrans();
try {
$result = $this->model->allowField(true)->save($params);
Db::commit();
} catch (Exception $e) {
Db::rollback();
$this->error($e->getMessage());
}
$this->success();
}
$this->error(__('Parameter %s can not be empty', ''));
}
return $this->view->fetch();
}
/**
* 编辑
*/
public function edit($ids = null)
{
if(empty($ids)){
$ids = $this->request->param('id');
}
$row = $this->model->get($ids);
if (!$row) {
$this->error(__('No Results were found'));
}
if ($this->request->isPost()) {
$params = $this->request->post("row/a");
if ($params) {
$params = $this->preExcludeFields($params);
$params['school_id'] = SCHOOL_ID;
if (!$params['capacity']){
$this->error("该工位可容纳人数应大于0");
}
Db::startTrans();
try {
$result = $row->allowField(true)->save($params);
Db::commit();
} catch (Exception $e) {
Db::rollback();
$this->error($e->getMessage());
}
$this->success();
}
$this->error(__('Parameter %s can not be empty', ''));
}
$this->view->assign("row", $row); //选中的数据
$this->assignconfig('id',$ids);
return $this->view->fetch();
}
/**
* 删除
*/
public function del($ids = "")
{
if ($ids) {
$pk = $this->model->getPk();
if($this->shopIdAutoCondition){
$this->model->where(array('school_id'=>SCHOOL_ID));
}
$list = $this->model->where($pk, 'in', $ids)->select();
$count = 0;
Db::startTrans();
try {
foreach ($list as $k => $v) {
$count += $v->delete();
}
Db::commit();
} catch (PDOException $e) {
Db::rollback();
$this->error($e->getMessage());
} catch (Exception $e) {
Db::rollback();
$this->error($e->getMessage());
}
if ($count) {
$this->success();
} else {
$this->error(__('No rows were deleted'));
}
}
$this->error(__('Parameter %s can not be empty', 'ids'));
}
}
... ...
<?php
return [
'Id' => '主键ID',
'Station_name' => '工位名称',
'Type' => '类型',// 0:个人 1:会议室
'Status' => '状态',// 0:不开放 1:开放
'Capacity' => '容纳人数',
'Describe' => '描述'
];
... ...
<?php
namespace app\school\model\station;
use think\Model;
use traits\model\SoftDelete;
class Station extends Model
{
use SoftDelete;
// 表名
protected $name = 'station';
// 自动写入时间戳字段
protected $autoWriteTimestamp = 'int';
// 定义时间戳字段名
protected $createTime = 'createtime';
protected $updateTime = 'updatetime';
protected $deleteTime = 'deletetime';
// 追加属性
protected $append = [
'status_text',
];
public function getStatusTextAttr($value,$data)
{
return isset($data['status']) ? ($data['status'] == 1 ? '开放' : '不开放') : '';
}
}
... ...
<?php
namespace app\school\validate\station;
use think\Validate;
class Station extends Validate
{
/**
* 验证规则
*/
protected $rule = [
];
/**
* 提示消息
*/
protected $message = [
];
/**
* 验证场景
*/
protected $scene = [
'add' => [],
'edit' => [],
];
}
... ...
<div class="panel panel-default panel-intro">
{:build_heading()}
<div class="panel-heading">
<ul class="nav nav-tabs">
<li class="active"><a href="#first" data-toggle="tab">场地预约审核</a></li>
<li><a href="#second" data-toggle="tab">工位预约审核</a></li>
</ul>
</div>
<div class="panel-body">
<div id="myTabContent" class="tab-content">
<div class="tab-pane fade active in" id="one">
<div class="widget-body no-padding">
<div id="toolbar" class="toolbar">
<div class="tab-pane fade active in" id="first">
<div id="toolbar1" class="toolbar">
{:build_toolbar('refresh')}
</div>
<table id="table" class="table table-striped table-bordered table-hover"
data-operate-auth="{:$auth->check('auth/manystore/edit')}"
width="100%">
<table id="table1" class="table table-striped table-bordered table-hover" width="100%">
</table>
</div>
<div class="tab-pane fade" id="second">
<div id="toolbar2" class="toolbar">
{:build_toolbar('refresh')}
</div>
<table id="table2" class="table table-striped table-bordered table-hover" width="100%">
</table>
</div>
</div>
</div>
</div>
\ No newline at end of file
... ...
<form id="add-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">
<div class="form-group" style="margin-top: 30px;">
<label class="control-label col-xs-12 col-sm-2">{:__('Station_name')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-station_name" class="form-control" name="row[station_name]" type="text">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Type')}:</label>
<div class="col-xs-12 col-sm-8">
<select id="c-type" data-rule="required" class="form-control selectpicker" name="row[type]">
{foreach name="type" item="vo"}
<option value="{$key}" >{$vo}</option>
{/foreach}
</select>
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Status')}:</label>
<div class="col-xs-12 col-sm-8">
<label class="radio-inline">
<input type="radio" name="row[status]" class="status" value="0" checked> 不开放
</label>
<label class="radio-inline">
<input type="radio" name="row[status]" class="status" value="1"> 开放
</label>
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Capacity')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-capacity" class="form-control" name="row[capacity]" type="number" value="" oninput="javascript:this.value=this.value.replace(/[^\d]/g,'')">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Describe')}:</label>
<div class="col-xs-12 col-sm-8">
<textarea id="c-describe" class="form-control" rows="5" name="row[describe]" cols="50"></textarea>
</div>
</div>
<div class="form-group layer-footer">
<label class="control-label col-xs-12 col-sm-2"></label>
<div class="col-xs-12 col-sm-8">
<button type="submit" class="btn btn-success btn-embossed disabled">{:__('OK')}</button>
<button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button>
</div>
</div>
</form>
... ...
<form id="edit-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">
<div class="form-group" style="margin-top: 30px;">
<label class="control-label col-xs-12 col-sm-2">{:__('Station_name')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-station_name" class="form-control" name="row[station_name]" type="text" value="{$row.station_name|htmlentities}">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Type')}:</label>
<div class="col-xs-12 col-sm-8">
<select id="c-type" data-rule="required" class="form-control selectpicker" name="row[type]">
{foreach name="type" item="vo"}
<option value="{$key}" {if $row['type'] == $key} selected {/if}>{$vo}</option>
{/foreach}
</select>
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Status')}:</label>
<div class="col-xs-12 col-sm-8">
<label class="radio-inline">
<input type="radio" name="row[status]" class="status" value="0" {if $row['status'] == 0} checked {/if}> 不开放
</label>
<label class="radio-inline">
<input type="radio" name="row[status]" class="status" value="1" {if $row['status'] == 1} checked {/if}> 开放
</label>
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Capacity')}:</label>
<div class="col-xs-12 col-sm-8">
<div class='control-relative'><input id="c-capacity" class="form-control" data-toggle="city-picker" name="row[capacity]" type="text" value="{$row.capacity|htmlentities}" oninput="javascript:this.value=this.value.replace(/[^\d]/g,'')"></div>
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Describe')}:</label>
<div class="col-xs-12 col-sm-8">
<textarea id="c-describe" class="form-control" rows="5" name="row[describe]" cols="50">{$row.describe|htmlentities}</textarea>
</div>
</div>
<div class="form-group layer-footer">
<label class="control-label col-xs-12 col-sm-2"></label>
<div class="col-xs-12 col-sm-8">
<button type="submit" class="btn btn-success btn-embossed disabled">{:__('OK')}</button>
<button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button>
</div>
</div>
</form>
... ...
<div class="panel panel-default panel-intro">
{:build_heading()}
<div class="panel-body">
<div id="myTabContent" class="tab-content">
<div class="tab-pane fade active in" id="one">
<div class="widget-body no-padding">
<div id="toolbar" class="toolbar">
<a href="javascript:;" class="btn btn-primary btn-refresh" title="{:__('Refresh')}" ><i class="fa fa-refresh"></i> </a>
<a href="javascript:;" class="btn btn-success btn-add {:$auth->check('station/station/add')?'':'hide'}" title="{:__('Add')}" ><i class="fa fa-plus"></i> {:__('Add')}</a>
<!-- <a href="javascript:;" class="btn btn-success btn-edit btn-disabled disabled {:$auth->check('station/station/edit')?'':'hide'}" title="{:__('Edit')}" ><i class="fa fa-pencil"></i> {:__('Edit')}</a>-->
<!-- <a href="javascript:;" class="btn btn-danger btn-del btn-disabled disabled {:$auth->check('station/station/del')?'':'hide'}" title="{:__('Delete')}" ><i class="fa fa-trash"></i> {:__('Delete')}</a>-->
<!-- <a href="javascript:;" class="btn btn-danger btn-import {:$auth->check('station/station/import')?'':'hide'}" title="{:__('Import')}" id="btn-import-file" data-url="ajax/upload" data-mimetype="csv,xls,xlsx" data-multiple="false"><i class="fa fa-upload"></i> {:__('Import')}</a>-->
<div class="dropdown btn-group {:$auth->check('station/station/multi')?'':'hide'}">
<!-- <a class="btn btn-primary btn-more dropdown-toggle btn-disabled disabled" data-toggle="dropdown"><i class="fa fa-cog"></i> {:__('More')}</a>-->
<ul class="dropdown-menu text-left" role="menu">
<li><a class="btn btn-link btn-multi btn-disabled disabled" href="javascript:;" data-params="status=normal"><i class="fa fa-eye"></i> {:__('Set to normal')}</a></li>
<li><a class="btn btn-link btn-multi btn-disabled disabled" href="javascript:;" data-params="status=hidden"><i class="fa fa-eye-slash"></i> {:__('Set to hidden')}</a></li>
</ul>
</div>
</div>
<table id="table" class="table table-striped table-bordered table-hover table-nowrap"
data-operate-edit="{:$auth->check('station/station/edit')}"
data-operate-del="{:$auth->check('station/station/del')}"
width="100%">
</table>
</div>
</div>
</div>
</div>
</div>
... ...
define(['jquery', 'bootstrap', 'backend', 'table', 'form','layer'], function ($, undefined, Backend, Table, Form,Layer) {
var Controller = {
index: function () {
//修改弹框大小
// $(".btn-add").data("area",["100%","100%"]);
// $(".btn-edit").data("area",["100%","100%"]);
index: function() {
// 初始化表格参数配置
Table.api.init({
extend: {
index_url: 'project_appointment/room_order/index' + location.search,
auth_url: 'project_appointment/room_order/verify',
table: 'room',
Table.api.init();
//绑定事件
$('a[data-toggle="tab"]').on('shown.bs.tab', function (e) {
var panel = $($(this).attr("href"));
if (panel.size() > 0) {
Controller.table[panel.attr("id")].call(this);
$(this).on('click', function (e) {
$($(this).attr("href")).find(".btn-refresh").trigger("click");
});
}
//移除绑定的事件
$(this).unbind('shown.bs.tab');
});
var table = $("#table");
// 初始化表格
table.bootstrapTable({
url: $.fn.bootstrapTable.defaults.extend.index_url,
pk: 'id',
//必须默认触发shown.bs.tab事件
$('ul.nav-tabs li.active a[data-toggle="tab"]').trigger("shown.bs.tab");
},
table: {
first: function () {
// 表格1
var table1 = $("#table1");
table1.bootstrapTable({
url: 'project_appointment/room_order/index' + location.search,
toolbar: '#toolbar1',
sortName: 'id',
pageSize:10,
search: false,
columns: [
[
{checkbox: true},
{field: 'id', title: __('Id'),operate: false},
{field: 'apply_name', title: __('申请人'),operate: 'LIKE'},
{field: 'username', title: __('申请人'),operate: 'LIKE'},
{field: 'room_name', title: __('房间名称'),operate: 'LIKE'},
{field: 'apply_date', title: __('预约日期'),operate: false},
{field: 'start_time', title: __('预约结束时间'),operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
{field: 'end_time', title: __('预约结束时间'),operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
{field: 'start_time', title: __('预约结束时间'),operate:false, addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
{field: 'end_time', title: __('预约结束时间'),operate:false, addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
{field: 'use_count', title: __('使用人数'),operate: false},
{field: 'apply_desc', title: __('预约说明'),operate: false},
{field: 'status_text', title: __('审核状态'),operate: false},
{field: 'createtime', title: __('创建时间'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
{field: 'createtime', title: __('创建时间'), operate:false, addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
{
field: 'operate',
title: __('Operate'),
table: table,
table: table1,
events: Table.api.events.operate,
formatter: Table.api.formatter.operate,
buttons:[
... ... @@ -59,12 +68,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form','layer'], function ($,
dataType:'json',
success:function(res){
if(parseInt(res.code) !=0){
$('#table').bootstrapTable('updateRow', {
index: row_index,
row: {
status_text: '审核通过',
}
});
$('.btn-refresh').click();
}
layer.msg(res.msg, {icon: 1});
... ... @@ -82,12 +86,97 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form','layer'], function ($,
dataType:'json',
success:function(res){
if(parseInt(res.code) !=0){
$('#table').bootstrapTable('updateRow', {
index: row_index,
row: {
status_text: '已驳回',
$('.btn-refresh').click();
}
layer.msg(res.msg, {icon: 1});
},
error:function(error){
console.log(error);
}
});
});
},
visible: function (val) {
if(val.status == 1) {
return true;
}
}
},
]
},
]
],
});
// 为表格1绑定事件
Table.api.bindevent(table1);
},
second: function () {
// 表格2
var table2 = $("#table2");
table2.bootstrapTable({
url: 'station_appointment/index' + location.search,
toolbar: '#toolbar2',
sortName: 'id',
search: false,
columns: [
[
{checkbox: true},
{field: 'id', title: __('Id'),operate: false},
{field: 'username', title: __('申请人'),operate: 'LIKE'},
{field: 'station_name', title: __('工位名称'),operate: 'LIKE'},
{field: 'station_date', title: __('预约日期'),operate: false},
{field: 'station_start_time', title: __('预约结束时间'),operate:false, addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
{field: 'station_end_time', title: __('预约结束时间'),operate:false, addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
{field: 'station_user_count', title: __('使用人数'),operate: false},
{field: 'station_desc', title: __('预约说明'),operate: false},
{field: 'status_text', title: __('审核状态'),operate: false},
{field: 'createtime', title: __('创建时间'), operate:false, addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
{
field: 'operate',
title: __('Operate'),
table: table2,
events: Table.api.events.operate,
formatter: Table.api.formatter.operate,
buttons:[
{
name: 'btn',
text: '审核',
title: '审核',
classname: 'btn btn-xs btn-success btn-click',
click: function (val, row) {
var id = row.id;
layer.confirm('您想?', {
btn: ['通过审核','驳回审核'] //按钮
}, function(){
$.ajax({
type:'post',
url:'station_appointment/verify',
data:{id:id,status:1},
dataType:'json',
success:function(res){
if(parseInt(res.code) !=0){
$('.btn-refresh').click();
}
layer.msg(res.msg, {icon: 1});
},
error:function(error){
console.log(error);
}
});
}, function(){
$.ajax({
type:'post',
url:'station_appointment/verify',
data:{id:id,status:2},
dataType:'json',
success:function(res){
if(parseInt(res.code) !=0){
$('.btn-refresh').click();
}
layer.msg(res.msg, {icon: 1});
},
... ... @@ -98,13 +187,11 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form','layer'], function ($,
});
},
/* visible: function (val) {
if(val.status != 1) {
return false;
}else{
visible: function (val) {
if(val.status == 0) {
return true;
}
}*/
}
},
]
},
... ... @@ -113,9 +200,9 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form','layer'], function ($,
],
});
$('.search input').attr('placeholder','搜索');
// 为表格绑定事件
Table.api.bindevent(table);
// 为表格2绑定事件
Table.api.bindevent(table2);
}
},
add: function () {
Controller.api.bindevent();
... ...
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
var Controller = {
index: function () {
// 初始化表格参数配置
Table.api.init({
extend: {
index_url: 'station/station/index' + location.search,
add_url: 'station/station/add',
edit_url: 'station/station/edit',
del_url: 'station/station/del',
multi_url: 'station/station/multi',
import_url: 'station/station/import',
table: 'station',
}
});
var table = $("#table");
// 初始化表格
table.bootstrapTable({
url: $.fn.bootstrapTable.defaults.extend.index_url,
pk: 'id',
sortName: 'id',
//禁用默认搜索
search: false,
//启用普通表单搜索
// commonSearch: false,
//可以控制是否默认显示搜索单表,false则隐藏,默认为false
// searchFormVisible: false,
columns: [
[
{checkbox: true},
{field: 'id', title: __('Id'),visible:false, operate: false},
{field: 'station_name', title: __('Station_name'), operate: 'LIKE'},
{field: 'type', title: __('Type'),searchList:Config.type, formatter: Table.api.formatter.normal},
{field: 'status', title: __('Status'),searchList:{"0":__("不开放"),"1":__("开放")}, formatter: Table.api.formatter.normal},
{field: 'capacity', title: __('Capacity'), operate: false},
{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
]
]
});
// 为表格绑定事件
Table.api.bindevent(table);
},
add: function () {
Controller.api.bindevent();
},
edit: function () {
Controller.api.bindevent();
},
api: {
bindevent: function () {
Form.api.bindevent($("form[role=form]"));
}
}
};
return Controller;
});
\ No newline at end of file
... ...