Merge branch 'master' of http://gitlab.posedu.cn:8099/cdd/employed
正在显示
15 个修改的文件
包含
705 行增加
和
52 行删除
| 1 | +<?php | ||
| 2 | + | ||
| 3 | +namespace app\common\model; | ||
| 4 | + | ||
| 5 | +use think\Model; | ||
| 6 | + | ||
| 7 | +class StationAppointment extends Model | ||
| 8 | +{ | ||
| 9 | + // 表名 | ||
| 10 | + protected $name = 'station_appointment'; | ||
| 11 | + // 自动写入时间戳字段 | ||
| 12 | + protected $autoWriteTimestamp = 'int'; | ||
| 13 | + // 定义时间戳字段名 | ||
| 14 | + protected $createTime = 'createtime'; | ||
| 15 | + protected $updateTime = 'updatetime'; | ||
| 16 | + // 追加属性 | ||
| 17 | + protected $append = [ | ||
| 18 | + 'status_text' | ||
| 19 | + ]; | ||
| 20 | + | ||
| 21 | + public function getStatusList() | ||
| 22 | + { | ||
| 23 | + return ['0' => __('待审核'), '1' => __('已通过'),'2' => __('未通过')]; | ||
| 24 | + } | ||
| 25 | + | ||
| 26 | + public function getStatusTextAttr($value, $data) | ||
| 27 | + { | ||
| 28 | + $value = $value ? $value : $data['status']; | ||
| 29 | + $list = $this->getStatusList(); | ||
| 30 | + return isset($list[$value]) ? $list[$value] : ''; | ||
| 31 | + } | ||
| 32 | +} |
| @@ -77,9 +77,9 @@ class Building extends Frontend | @@ -77,9 +77,9 @@ class Building extends Frontend | ||
| 77 | if(!isset($params['room_id']) || empty($params['room_id'])){ | 77 | if(!isset($params['room_id']) || empty($params['room_id'])){ |
| 78 | $this->error('请选择房间'); | 78 | $this->error('请选择房间'); |
| 79 | } | 79 | } |
| 80 | - if(strtotime($params['start_time']) <= time()) { | ||
| 81 | - $this->error('请选择未来时间'); | ||
| 82 | - } | 80 | +// if(strtotime($params['start_time']) <= time()) { |
| 81 | +// $this->error('请选择未来时间'); | ||
| 82 | +// } | ||
| 83 | $startTime = strtotime($params['apply_date'].$params['start_time']); | 83 | $startTime = strtotime($params['apply_date'].$params['start_time']); |
| 84 | $endTime = strtotime($params['apply_date'].$params['end_time']); | 84 | $endTime = strtotime($params['apply_date'].$params['end_time']); |
| 85 | 85 |
| @@ -21,6 +21,28 @@ class Project | @@ -21,6 +21,28 @@ class Project | ||
| 21 | // ]; | 21 | // ]; |
| 22 | // $isJobDone = $this->doHelloJob($data); | 22 | // $isJobDone = $this->doHelloJob($data); |
| 23 | // } | 23 | // } |
| 24 | + | ||
| 25 | + public function saveTest() | ||
| 26 | + { | ||
| 27 | + ini_set("memory_limit","2048M"); | ||
| 28 | + $server = array( | ||
| 29 | + 'host' => 'r-8vb3mizdy07emeuv4upd.redis.zhangbei.rds.aliyuncs.com',//IP | ||
| 30 | + 'port' => 6379, //端口 | ||
| 31 | + 'password' => 'Yundai2019', //密码 | ||
| 32 | + ); | ||
| 33 | + $redisKey = 'checkProject:124_330'; | ||
| 34 | + $redis = new Client($server);//实例化 | ||
| 35 | + $redis->select(8); | ||
| 36 | + $infos = $redis->hvals($redisKey); | ||
| 37 | + dump($infos);die; | ||
| 38 | + | ||
| 39 | + $textField = $infos['21759_700']; | ||
| 40 | + | ||
| 41 | + $time = 10000; | ||
| 42 | + for ($i = 0;$i <= $time; $i++) { | ||
| 43 | + $redis->hset($redisKey, mt_rand (1,10000).'_'.mt_rand (1,10000),json_encode($textField)); | ||
| 44 | + } | ||
| 45 | + } | ||
| 24 | //消费者 | 46 | //消费者 |
| 25 | public function fire(Job $job,$data) { | 47 | public function fire(Job $job,$data) { |
| 26 | $isJobDone = $this->doRegisterJob($data); | 48 | $isJobDone = $this->doRegisterJob($data); |
| 1 | +<?php | ||
| 2 | + | ||
| 3 | +namespace app\school\controller; | ||
| 4 | + | ||
| 5 | +use app\common\controller\DoubleBase; | ||
| 6 | +use think\Db; | ||
| 7 | +use app\common\model\StationAppointment as AppointmentModel; | ||
| 8 | + | ||
| 9 | +/** | ||
| 10 | + * 工位审核 | ||
| 11 | + */ | ||
| 12 | +class StationAppointment extends DoubleBase | ||
| 13 | +{ | ||
| 14 | + | ||
| 15 | + protected $noNeedRight = ['*']; | ||
| 16 | + protected $model = null; | ||
| 17 | + public function _initialize() | ||
| 18 | + { | ||
| 19 | + parent::_initialize(); | ||
| 20 | + $this->model = new AppointmentModel(); | ||
| 21 | + } | ||
| 22 | + | ||
| 23 | + /** | ||
| 24 | + * 预约审核index | ||
| 25 | + * @return array|\think\response\Json | ||
| 26 | + * @author cdd | ||
| 27 | + */ | ||
| 28 | + public function index() | ||
| 29 | + { | ||
| 30 | + //设置过滤方法 | ||
| 31 | + $this->request->filter(['strip_tags', 'trim']); | ||
| 32 | + if ($this->request->isAjax()) { | ||
| 33 | + list($where, $sort, $order, $offset, $limit) = $this->buildparams(null,true); | ||
| 34 | + $params = json_decode($this->request->get('filter'),true); | ||
| 35 | + $newwhere = []; | ||
| 36 | + if(isset($params['station_name'])) { | ||
| 37 | + $newwhere['s.station_name'] = ['like',"%".$params['station_name']."%"]; | ||
| 38 | + } | ||
| 39 | + if(isset($params['username']) && !empty($params['username'])) { | ||
| 40 | + $newwhere['u.username'] = ['like',"%".$params['username']."%"]; | ||
| 41 | + } | ||
| 42 | + $list = $this->model | ||
| 43 | + ->alias('a') | ||
| 44 | + ->field('a.*,s.station_name,u.username') | ||
| 45 | + ->join('station s','a.station_id = s.id','inner') | ||
| 46 | + ->join('user u','a.user_id = u.id','left') | ||
| 47 | + ->where(['s.school_id' => SCHOOL_ID]) | ||
| 48 | + ->where($newwhere) | ||
| 49 | + ->order('a.createtime', $order) | ||
| 50 | + ->paginate($limit); | ||
| 51 | + $result = array("total" => $list->total(), "rows" => $list->items()); | ||
| 52 | + return json($result); | ||
| 53 | + } | ||
| 54 | + return $this->view->fetch(); | ||
| 55 | + } | ||
| 56 | + | ||
| 57 | + public function verify() | ||
| 58 | + { | ||
| 59 | + $params = $this->request->param(); | ||
| 60 | + $info = $this->model->find($params['id']); | ||
| 61 | + $info->status = $params['status']; | ||
| 62 | + if(!$info->save()) { | ||
| 63 | + $this->error('审核失败'); | ||
| 64 | + } | ||
| 65 | + $this->success('成功'); | ||
| 66 | + } | ||
| 67 | + | ||
| 68 | + | ||
| 69 | +} |
| @@ -41,13 +41,16 @@ class RoomOrder extends DoubleBase | @@ -41,13 +41,16 @@ class RoomOrder extends DoubleBase | ||
| 41 | $params = json_decode($this->request->get('filter'),true); | 41 | $params = json_decode($this->request->get('filter'),true); |
| 42 | $newwhere = []; | 42 | $newwhere = []; |
| 43 | if(isset($params['room_name'])) { | 43 | if(isset($params['room_name'])) { |
| 44 | - | ||
| 45 | $newwhere['r.room_name'] = ['like',"%".$params['room_name']."%"]; | 44 | $newwhere['r.room_name'] = ['like',"%".$params['room_name']."%"]; |
| 46 | } | 45 | } |
| 46 | + if(isset($params['username']) && !empty($params['username'])) { | ||
| 47 | + $newwhere['u.username'] = ['like',"%".$params['username']."%"]; | ||
| 48 | + } | ||
| 47 | $list = $this->model | 49 | $list = $this->model |
| 48 | - ->field('o.*,r.room_name') | 50 | + ->field('o.*,r.room_name,u.username') |
| 49 | ->alias('o') | 51 | ->alias('o') |
| 50 | ->join('project_room r','o.room_id = r.id','inner') | 52 | ->join('project_room r','o.room_id = r.id','inner') |
| 53 | + ->join('user u','o.user_id = u.id','left') | ||
| 51 | ->where(['r.school_id' => SCHOOL_ID]) | 54 | ->where(['r.school_id' => SCHOOL_ID]) |
| 52 | ->where($newwhere) | 55 | ->where($newwhere) |
| 53 | ->order('o.createtime', $order) | 56 | ->order('o.createtime', $order) |
| 1 | +<?php | ||
| 2 | + | ||
| 3 | +namespace app\school\controller\station; | ||
| 4 | + | ||
| 5 | +use app\common\controller\DoubleBase; | ||
| 6 | +use think\Db; | ||
| 7 | +use think\Exception; | ||
| 8 | +use think\exception\PDOException; | ||
| 9 | + | ||
| 10 | +/** | ||
| 11 | + * 工位管理 | ||
| 12 | + * | ||
| 13 | + * @icon fa fa-circle-o | ||
| 14 | + */ | ||
| 15 | +class Station extends DoubleBase | ||
| 16 | +{ | ||
| 17 | + | ||
| 18 | + /** | ||
| 19 | + * Station模型对象 | ||
| 20 | + * @var \app\school\model\station\Station | ||
| 21 | + */ | ||
| 22 | + protected $noNeedRight = ['*']; | ||
| 23 | + protected $model = null; | ||
| 24 | + | ||
| 25 | + public function _initialize() | ||
| 26 | + { | ||
| 27 | + parent::_initialize(); | ||
| 28 | + $this->model = new \app\school\model\station\Station; | ||
| 29 | + $type = [ | ||
| 30 | + '1' => '个人', | ||
| 31 | + '2' => '会议室', | ||
| 32 | + ]; | ||
| 33 | + $this->assign('type',$type); | ||
| 34 | + $this->assignconfig('type',$type); | ||
| 35 | + } | ||
| 36 | + | ||
| 37 | + public function import() | ||
| 38 | + { | ||
| 39 | + parent::import(); | ||
| 40 | + } | ||
| 41 | + | ||
| 42 | + /** | ||
| 43 | + * 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法 | ||
| 44 | + * 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑 | ||
| 45 | + * 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改 | ||
| 46 | + */ | ||
| 47 | + public function index() | ||
| 48 | + { | ||
| 49 | + //设置过滤方法 | ||
| 50 | + $this->request->filter(['strip_tags', 'trim']); | ||
| 51 | + if ($this->request->isAjax()) { | ||
| 52 | + list($where, $sort, $order, $offset, $limit) = $this->buildparams(null,true); | ||
| 53 | + $list = $this->model | ||
| 54 | + ->where($where) | ||
| 55 | + ->order('createtime', $order) | ||
| 56 | + ->paginate($limit); | ||
| 57 | + $result = array("total" => $list->total(), "rows" => $list->items()); | ||
| 58 | + return json($result); | ||
| 59 | + } | ||
| 60 | + return $this->view->fetch(); | ||
| 61 | + } | ||
| 62 | + | ||
| 63 | + /** | ||
| 64 | + * 添加 | ||
| 65 | + */ | ||
| 66 | + public function add() | ||
| 67 | + { | ||
| 68 | + if ($this->request->isPost()) { | ||
| 69 | + $params = $this->request->post("row/a"); | ||
| 70 | + if ($params) { | ||
| 71 | + $params = $this->preExcludeFields($params); | ||
| 72 | + $params['school_id'] = SCHOOL_ID; | ||
| 73 | + if (!$params['capacity']){ | ||
| 74 | + $this->error("该工位可容纳人数应大于0"); | ||
| 75 | + } | ||
| 76 | + Db::startTrans(); | ||
| 77 | + try { | ||
| 78 | + $result = $this->model->allowField(true)->save($params); | ||
| 79 | + Db::commit(); | ||
| 80 | + } catch (Exception $e) { | ||
| 81 | + Db::rollback(); | ||
| 82 | + $this->error($e->getMessage()); | ||
| 83 | + } | ||
| 84 | + $this->success(); | ||
| 85 | + } | ||
| 86 | + $this->error(__('Parameter %s can not be empty', '')); | ||
| 87 | + } | ||
| 88 | + return $this->view->fetch(); | ||
| 89 | + } | ||
| 90 | + /** | ||
| 91 | + * 编辑 | ||
| 92 | + */ | ||
| 93 | + public function edit($ids = null) | ||
| 94 | + { | ||
| 95 | + if(empty($ids)){ | ||
| 96 | + $ids = $this->request->param('id'); | ||
| 97 | + } | ||
| 98 | + $row = $this->model->get($ids); | ||
| 99 | + if (!$row) { | ||
| 100 | + $this->error(__('No Results were found')); | ||
| 101 | + } | ||
| 102 | + if ($this->request->isPost()) { | ||
| 103 | + | ||
| 104 | + $params = $this->request->post("row/a"); | ||
| 105 | + if ($params) { | ||
| 106 | + $params = $this->preExcludeFields($params); | ||
| 107 | + $params['school_id'] = SCHOOL_ID; | ||
| 108 | + if (!$params['capacity']){ | ||
| 109 | + $this->error("该工位可容纳人数应大于0"); | ||
| 110 | + } | ||
| 111 | + Db::startTrans(); | ||
| 112 | + try { | ||
| 113 | + $result = $row->allowField(true)->save($params); | ||
| 114 | + Db::commit(); | ||
| 115 | + } catch (Exception $e) { | ||
| 116 | + Db::rollback(); | ||
| 117 | + $this->error($e->getMessage()); | ||
| 118 | + } | ||
| 119 | + $this->success(); | ||
| 120 | + } | ||
| 121 | + $this->error(__('Parameter %s can not be empty', '')); | ||
| 122 | + } | ||
| 123 | + | ||
| 124 | + $this->view->assign("row", $row); //选中的数据 | ||
| 125 | + $this->assignconfig('id',$ids); | ||
| 126 | + return $this->view->fetch(); | ||
| 127 | + } | ||
| 128 | + | ||
| 129 | + /** | ||
| 130 | + * 删除 | ||
| 131 | + */ | ||
| 132 | + public function del($ids = "") | ||
| 133 | + { | ||
| 134 | + if ($ids) { | ||
| 135 | + $pk = $this->model->getPk(); | ||
| 136 | + | ||
| 137 | + if($this->shopIdAutoCondition){ | ||
| 138 | + $this->model->where(array('school_id'=>SCHOOL_ID)); | ||
| 139 | + } | ||
| 140 | + $list = $this->model->where($pk, 'in', $ids)->select(); | ||
| 141 | + | ||
| 142 | + $count = 0; | ||
| 143 | + Db::startTrans(); | ||
| 144 | + try { | ||
| 145 | + foreach ($list as $k => $v) { | ||
| 146 | + $count += $v->delete(); | ||
| 147 | + } | ||
| 148 | + Db::commit(); | ||
| 149 | + } catch (PDOException $e) { | ||
| 150 | + Db::rollback(); | ||
| 151 | + $this->error($e->getMessage()); | ||
| 152 | + } catch (Exception $e) { | ||
| 153 | + Db::rollback(); | ||
| 154 | + $this->error($e->getMessage()); | ||
| 155 | + } | ||
| 156 | + if ($count) { | ||
| 157 | + $this->success(); | ||
| 158 | + } else { | ||
| 159 | + $this->error(__('No rows were deleted')); | ||
| 160 | + } | ||
| 161 | + } | ||
| 162 | + $this->error(__('Parameter %s can not be empty', 'ids')); | ||
| 163 | + } | ||
| 164 | +} |
application/school/model/station/Station.php
0 → 100644
| 1 | +<?php | ||
| 2 | + | ||
| 3 | +namespace app\school\model\station; | ||
| 4 | + | ||
| 5 | +use think\Model; | ||
| 6 | +use traits\model\SoftDelete; | ||
| 7 | + | ||
| 8 | +class Station extends Model | ||
| 9 | +{ | ||
| 10 | + use SoftDelete; | ||
| 11 | + // 表名 | ||
| 12 | + protected $name = 'station'; | ||
| 13 | + | ||
| 14 | + // 自动写入时间戳字段 | ||
| 15 | + protected $autoWriteTimestamp = 'int'; | ||
| 16 | + | ||
| 17 | + // 定义时间戳字段名 | ||
| 18 | + protected $createTime = 'createtime'; | ||
| 19 | + protected $updateTime = 'updatetime'; | ||
| 20 | + protected $deleteTime = 'deletetime'; | ||
| 21 | + | ||
| 22 | + // 追加属性 | ||
| 23 | + protected $append = [ | ||
| 24 | + 'status_text', | ||
| 25 | + ]; | ||
| 26 | + | ||
| 27 | + public function getStatusTextAttr($value,$data) | ||
| 28 | + { | ||
| 29 | + return isset($data['status']) ? ($data['status'] == 1 ? '开放' : '不开放') : ''; | ||
| 30 | + } | ||
| 31 | + | ||
| 32 | + | ||
| 33 | + | ||
| 34 | + | ||
| 35 | + | ||
| 36 | + | ||
| 37 | + | ||
| 38 | + | ||
| 39 | +} |
| 1 | +<?php | ||
| 2 | + | ||
| 3 | +namespace app\school\validate\station; | ||
| 4 | + | ||
| 5 | +use think\Validate; | ||
| 6 | + | ||
| 7 | +class Station extends Validate | ||
| 8 | +{ | ||
| 9 | + /** | ||
| 10 | + * 验证规则 | ||
| 11 | + */ | ||
| 12 | + protected $rule = [ | ||
| 13 | + ]; | ||
| 14 | + /** | ||
| 15 | + * 提示消息 | ||
| 16 | + */ | ||
| 17 | + protected $message = [ | ||
| 18 | + ]; | ||
| 19 | + /** | ||
| 20 | + * 验证场景 | ||
| 21 | + */ | ||
| 22 | + protected $scene = [ | ||
| 23 | + 'add' => [], | ||
| 24 | + 'edit' => [], | ||
| 25 | + ]; | ||
| 26 | + | ||
| 27 | +} |
| 1 | <div class="panel panel-default panel-intro"> | 1 | <div class="panel panel-default panel-intro"> |
| 2 | - {:build_heading()} | 2 | + <div class="panel-heading"> |
| 3 | + <ul class="nav nav-tabs"> | ||
| 4 | + <li class="active"><a href="#first" data-toggle="tab">场地预约审核</a></li> | ||
| 5 | + <li><a href="#second" data-toggle="tab">工位预约审核</a></li> | ||
| 6 | + </ul> | ||
| 7 | + </div> | ||
| 3 | <div class="panel-body"> | 8 | <div class="panel-body"> |
| 4 | <div id="myTabContent" class="tab-content"> | 9 | <div id="myTabContent" class="tab-content"> |
| 5 | - <div class="tab-pane fade active in" id="one"> | ||
| 6 | - <div class="widget-body no-padding"> | ||
| 7 | - <div id="toolbar" class="toolbar"> | 10 | + <div class="tab-pane fade active in" id="first"> |
| 11 | + <div id="toolbar1" class="toolbar"> | ||
| 8 | {:build_toolbar('refresh')} | 12 | {:build_toolbar('refresh')} |
| 9 | </div> | 13 | </div> |
| 10 | - <table id="table" class="table table-striped table-bordered table-hover" | ||
| 11 | - data-operate-auth="{:$auth->check('auth/manystore/edit')}" | ||
| 12 | - | ||
| 13 | - width="100%"> | 14 | + <table id="table1" class="table table-striped table-bordered table-hover" width="100%"> |
| 14 | </table> | 15 | </table> |
| 15 | </div> | 16 | </div> |
| 17 | + <div class="tab-pane fade" id="second"> | ||
| 18 | + <div id="toolbar2" class="toolbar"> | ||
| 19 | + {:build_toolbar('refresh')} | ||
| 20 | + </div> | ||
| 21 | + <table id="table2" class="table table-striped table-bordered table-hover" width="100%"> | ||
| 22 | + </table> | ||
| 16 | </div> | 23 | </div> |
| 17 | - | ||
| 18 | </div> | 24 | </div> |
| 19 | </div> | 25 | </div> |
| 20 | </div> | 26 | </div> |
| 1 | +<form id="add-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action=""> | ||
| 2 | + | ||
| 3 | + <div class="form-group" style="margin-top: 30px;"> | ||
| 4 | + <label class="control-label col-xs-12 col-sm-2">{:__('Station_name')}:</label> | ||
| 5 | + <div class="col-xs-12 col-sm-8"> | ||
| 6 | + <input id="c-station_name" class="form-control" name="row[station_name]" type="text"> | ||
| 7 | + </div> | ||
| 8 | + </div> | ||
| 9 | + <div class="form-group"> | ||
| 10 | + <label class="control-label col-xs-12 col-sm-2">{:__('Type')}:</label> | ||
| 11 | + <div class="col-xs-12 col-sm-8"> | ||
| 12 | + <select id="c-type" data-rule="required" class="form-control selectpicker" name="row[type]"> | ||
| 13 | + {foreach name="type" item="vo"} | ||
| 14 | + <option value="{$key}" >{$vo}</option> | ||
| 15 | + {/foreach} | ||
| 16 | + </select> | ||
| 17 | + </div> | ||
| 18 | + </div> | ||
| 19 | + <div class="form-group"> | ||
| 20 | + <label class="control-label col-xs-12 col-sm-2">{:__('Status')}:</label> | ||
| 21 | + <div class="col-xs-12 col-sm-8"> | ||
| 22 | + <label class="radio-inline"> | ||
| 23 | + <input type="radio" name="row[status]" class="status" value="0" checked> 不开放 | ||
| 24 | + </label> | ||
| 25 | + <label class="radio-inline"> | ||
| 26 | + <input type="radio" name="row[status]" class="status" value="1"> 开放 | ||
| 27 | + </label> | ||
| 28 | + </div> | ||
| 29 | + </div> | ||
| 30 | + <div class="form-group"> | ||
| 31 | + <label class="control-label col-xs-12 col-sm-2">{:__('Capacity')}:</label> | ||
| 32 | + <div class="col-xs-12 col-sm-8"> | ||
| 33 | + <input id="c-capacity" class="form-control" name="row[capacity]" type="number" value="" oninput="javascript:this.value=this.value.replace(/[^\d]/g,'')"> | ||
| 34 | + </div> | ||
| 35 | + </div> | ||
| 36 | + <div class="form-group"> | ||
| 37 | + <label class="control-label col-xs-12 col-sm-2">{:__('Describe')}:</label> | ||
| 38 | + <div class="col-xs-12 col-sm-8"> | ||
| 39 | + <textarea id="c-describe" class="form-control" rows="5" name="row[describe]" cols="50"></textarea> | ||
| 40 | + </div> | ||
| 41 | + </div> | ||
| 42 | + <div class="form-group layer-footer"> | ||
| 43 | + <label class="control-label col-xs-12 col-sm-2"></label> | ||
| 44 | + <div class="col-xs-12 col-sm-8"> | ||
| 45 | + <button type="submit" class="btn btn-success btn-embossed disabled">{:__('OK')}</button> | ||
| 46 | + <button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button> | ||
| 47 | + </div> | ||
| 48 | + </div> | ||
| 49 | +</form> |
| 1 | +<form id="edit-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action=""> | ||
| 2 | + | ||
| 3 | + <div class="form-group" style="margin-top: 30px;"> | ||
| 4 | + <label class="control-label col-xs-12 col-sm-2">{:__('Station_name')}:</label> | ||
| 5 | + <div class="col-xs-12 col-sm-8"> | ||
| 6 | + <input id="c-station_name" class="form-control" name="row[station_name]" type="text" value="{$row.station_name|htmlentities}"> | ||
| 7 | + </div> | ||
| 8 | + </div> | ||
| 9 | + <div class="form-group"> | ||
| 10 | + <label class="control-label col-xs-12 col-sm-2">{:__('Type')}:</label> | ||
| 11 | + <div class="col-xs-12 col-sm-8"> | ||
| 12 | + <select id="c-type" data-rule="required" class="form-control selectpicker" name="row[type]"> | ||
| 13 | + {foreach name="type" item="vo"} | ||
| 14 | + <option value="{$key}" {if $row['type'] == $key} selected {/if}>{$vo}</option> | ||
| 15 | + {/foreach} | ||
| 16 | + </select> | ||
| 17 | + </div> | ||
| 18 | + </div> | ||
| 19 | + <div class="form-group"> | ||
| 20 | + <label class="control-label col-xs-12 col-sm-2">{:__('Status')}:</label> | ||
| 21 | + <div class="col-xs-12 col-sm-8"> | ||
| 22 | + <label class="radio-inline"> | ||
| 23 | + <input type="radio" name="row[status]" class="status" value="0" {if $row['status'] == 0} checked {/if}> 不开放 | ||
| 24 | + </label> | ||
| 25 | + <label class="radio-inline"> | ||
| 26 | + <input type="radio" name="row[status]" class="status" value="1" {if $row['status'] == 1} checked {/if}> 开放 | ||
| 27 | + </label> | ||
| 28 | + </div> | ||
| 29 | + </div> | ||
| 30 | + <div class="form-group"> | ||
| 31 | + <label class="control-label col-xs-12 col-sm-2">{:__('Capacity')}:</label> | ||
| 32 | + <div class="col-xs-12 col-sm-8"> | ||
| 33 | + <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> | ||
| 34 | + </div> | ||
| 35 | + </div> | ||
| 36 | + <div class="form-group"> | ||
| 37 | + <label class="control-label col-xs-12 col-sm-2">{:__('Describe')}:</label> | ||
| 38 | + <div class="col-xs-12 col-sm-8"> | ||
| 39 | + <textarea id="c-describe" class="form-control" rows="5" name="row[describe]" cols="50">{$row.describe|htmlentities}</textarea> | ||
| 40 | + </div> | ||
| 41 | + </div> | ||
| 42 | + <div class="form-group layer-footer"> | ||
| 43 | + <label class="control-label col-xs-12 col-sm-2"></label> | ||
| 44 | + <div class="col-xs-12 col-sm-8"> | ||
| 45 | + <button type="submit" class="btn btn-success btn-embossed disabled">{:__('OK')}</button> | ||
| 46 | + <button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button> | ||
| 47 | + </div> | ||
| 48 | + </div> | ||
| 49 | +</form> |
| 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 | + <a href="javascript:;" class="btn btn-primary btn-refresh" title="{:__('Refresh')}" ><i class="fa fa-refresh"></i> </a> | ||
| 10 | + <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> | ||
| 11 | +<!-- <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>--> | ||
| 12 | +<!-- <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>--> | ||
| 13 | +<!-- <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>--> | ||
| 14 | + | ||
| 15 | + <div class="dropdown btn-group {:$auth->check('station/station/multi')?'':'hide'}"> | ||
| 16 | +<!-- <a class="btn btn-primary btn-more dropdown-toggle btn-disabled disabled" data-toggle="dropdown"><i class="fa fa-cog"></i> {:__('More')}</a>--> | ||
| 17 | + <ul class="dropdown-menu text-left" role="menu"> | ||
| 18 | + <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> | ||
| 19 | + <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> | ||
| 20 | + </ul> | ||
| 21 | + </div> | ||
| 22 | + | ||
| 23 | + | ||
| 24 | + </div> | ||
| 25 | + <table id="table" class="table table-striped table-bordered table-hover table-nowrap" | ||
| 26 | + data-operate-edit="{:$auth->check('station/station/edit')}" | ||
| 27 | + data-operate-del="{:$auth->check('station/station/del')}" | ||
| 28 | + width="100%"> | ||
| 29 | + </table> | ||
| 30 | + </div> | ||
| 31 | + </div> | ||
| 32 | + | ||
| 33 | + </div> | ||
| 34 | + </div> | ||
| 35 | +</div> |
| 1 | define(['jquery', 'bootstrap', 'backend', 'table', 'form','layer'], function ($, undefined, Backend, Table, Form,Layer) { | 1 | define(['jquery', 'bootstrap', 'backend', 'table', 'form','layer'], function ($, undefined, Backend, Table, Form,Layer) { |
| 2 | 2 | ||
| 3 | var Controller = { | 3 | var Controller = { |
| 4 | - index: function () { | ||
| 5 | - //修改弹框大小 | ||
| 6 | - // $(".btn-add").data("area",["100%","100%"]); | ||
| 7 | - // $(".btn-edit").data("area",["100%","100%"]); | 4 | + index: function() { |
| 8 | // 初始化表格参数配置 | 5 | // 初始化表格参数配置 |
| 9 | - Table.api.init({ | ||
| 10 | - extend: { | ||
| 11 | - index_url: 'project_appointment/room_order/index' + location.search, | ||
| 12 | - auth_url: 'project_appointment/room_order/verify', | ||
| 13 | - table: 'room', | 6 | + Table.api.init(); |
| 7 | + | ||
| 8 | + //绑定事件 | ||
| 9 | + $('a[data-toggle="tab"]').on('shown.bs.tab', function (e) { | ||
| 10 | + var panel = $($(this).attr("href")); | ||
| 11 | + if (panel.size() > 0) { | ||
| 12 | + Controller.table[panel.attr("id")].call(this); | ||
| 13 | + $(this).on('click', function (e) { | ||
| 14 | + $($(this).attr("href")).find(".btn-refresh").trigger("click"); | ||
| 15 | + }); | ||
| 14 | } | 16 | } |
| 17 | + //移除绑定的事件 | ||
| 18 | + $(this).unbind('shown.bs.tab'); | ||
| 15 | }); | 19 | }); |
| 16 | 20 | ||
| 17 | - var table = $("#table"); | ||
| 18 | - // 初始化表格 | ||
| 19 | - table.bootstrapTable({ | ||
| 20 | - url: $.fn.bootstrapTable.defaults.extend.index_url, | ||
| 21 | - pk: 'id', | 21 | + //必须默认触发shown.bs.tab事件 |
| 22 | + $('ul.nav-tabs li.active a[data-toggle="tab"]').trigger("shown.bs.tab"); | ||
| 23 | + }, | ||
| 24 | + table: { | ||
| 25 | + first: function () { | ||
| 26 | + // 表格1 | ||
| 27 | + var table1 = $("#table1"); | ||
| 28 | + table1.bootstrapTable({ | ||
| 29 | + url: 'project_appointment/room_order/index' + location.search, | ||
| 30 | + toolbar: '#toolbar1', | ||
| 22 | sortName: 'id', | 31 | sortName: 'id', |
| 23 | - pageSize:10, | 32 | + search: false, |
| 24 | columns: [ | 33 | columns: [ |
| 25 | [ | 34 | [ |
| 26 | {checkbox: true}, | 35 | {checkbox: true}, |
| 27 | {field: 'id', title: __('Id'),operate: false}, | 36 | {field: 'id', title: __('Id'),operate: false}, |
| 28 | - {field: 'apply_name', title: __('申请人'),operate: 'LIKE'}, | 37 | + {field: 'username', title: __('申请人'),operate: 'LIKE'}, |
| 29 | {field: 'room_name', title: __('房间名称'),operate: 'LIKE'}, | 38 | {field: 'room_name', title: __('房间名称'),operate: 'LIKE'}, |
| 30 | {field: 'apply_date', title: __('预约日期'),operate: false}, | 39 | {field: 'apply_date', title: __('预约日期'),operate: false}, |
| 31 | - {field: 'start_time', title: __('预约结束时间'),operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime}, | ||
| 32 | - {field: 'end_time', title: __('预约结束时间'),operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime}, | 40 | + {field: 'start_time', title: __('预约结束时间'),operate:false, addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime}, |
| 41 | + {field: 'end_time', title: __('预约结束时间'),operate:false, addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime}, | ||
| 33 | {field: 'use_count', title: __('使用人数'),operate: false}, | 42 | {field: 'use_count', title: __('使用人数'),operate: false}, |
| 34 | {field: 'apply_desc', title: __('预约说明'),operate: false}, | 43 | {field: 'apply_desc', title: __('预约说明'),operate: false}, |
| 35 | {field: 'status_text', title: __('审核状态'),operate: false}, | 44 | {field: 'status_text', title: __('审核状态'),operate: false}, |
| 36 | - {field: 'createtime', title: __('创建时间'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime}, | 45 | + {field: 'createtime', title: __('创建时间'), operate:false, addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime}, |
| 37 | { | 46 | { |
| 38 | field: 'operate', | 47 | field: 'operate', |
| 39 | title: __('Operate'), | 48 | title: __('Operate'), |
| 40 | - table: table, | 49 | + table: table1, |
| 41 | events: Table.api.events.operate, | 50 | events: Table.api.events.operate, |
| 42 | formatter: Table.api.formatter.operate, | 51 | formatter: Table.api.formatter.operate, |
| 43 | buttons:[ | 52 | buttons:[ |
| @@ -59,12 +68,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form','layer'], function ($, | @@ -59,12 +68,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form','layer'], function ($, | ||
| 59 | dataType:'json', | 68 | dataType:'json', |
| 60 | success:function(res){ | 69 | success:function(res){ |
| 61 | if(parseInt(res.code) !=0){ | 70 | if(parseInt(res.code) !=0){ |
| 62 | - $('#table').bootstrapTable('updateRow', { | ||
| 63 | - index: row_index, | ||
| 64 | - row: { | ||
| 65 | - status_text: '审核通过', | ||
| 66 | - } | ||
| 67 | - }); | 71 | + $('.btn-refresh').click(); |
| 68 | } | 72 | } |
| 69 | 73 | ||
| 70 | layer.msg(res.msg, {icon: 1}); | 74 | layer.msg(res.msg, {icon: 1}); |
| @@ -82,12 +86,97 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form','layer'], function ($, | @@ -82,12 +86,97 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form','layer'], function ($, | ||
| 82 | dataType:'json', | 86 | dataType:'json', |
| 83 | success:function(res){ | 87 | success:function(res){ |
| 84 | if(parseInt(res.code) !=0){ | 88 | if(parseInt(res.code) !=0){ |
| 85 | - $('#table').bootstrapTable('updateRow', { | ||
| 86 | - index: row_index, | ||
| 87 | - row: { | ||
| 88 | - status_text: '已驳回', | 89 | + $('.btn-refresh').click(); |
| 90 | + } | ||
| 91 | + layer.msg(res.msg, {icon: 1}); | ||
| 92 | + }, | ||
| 93 | + error:function(error){ | ||
| 94 | + console.log(error); | ||
| 89 | } | 95 | } |
| 90 | }); | 96 | }); |
| 97 | + | ||
| 98 | + }); | ||
| 99 | + }, | ||
| 100 | + visible: function (val) { | ||
| 101 | + if(val.status == 1) { | ||
| 102 | + return true; | ||
| 103 | + } | ||
| 104 | + } | ||
| 105 | + }, | ||
| 106 | + ] | ||
| 107 | + }, | ||
| 108 | + | ||
| 109 | + ] | ||
| 110 | + ], | ||
| 111 | + }); | ||
| 112 | + | ||
| 113 | + // 为表格1绑定事件 | ||
| 114 | + Table.api.bindevent(table1); | ||
| 115 | + }, | ||
| 116 | + second: function () { | ||
| 117 | + // 表格2 | ||
| 118 | + var table2 = $("#table2"); | ||
| 119 | + table2.bootstrapTable({ | ||
| 120 | + url: 'station_appointment/index' + location.search, | ||
| 121 | + toolbar: '#toolbar2', | ||
| 122 | + sortName: 'id', | ||
| 123 | + search: false, | ||
| 124 | + columns: [ | ||
| 125 | + [ | ||
| 126 | + {checkbox: true}, | ||
| 127 | + {field: 'id', title: __('Id'),operate: false}, | ||
| 128 | + {field: 'username', title: __('申请人'),operate: 'LIKE'}, | ||
| 129 | + {field: 'station_name', title: __('工位名称'),operate: 'LIKE'}, | ||
| 130 | + {field: 'station_date', title: __('预约日期'),operate: false}, | ||
| 131 | + {field: 'station_start_time', title: __('预约结束时间'),operate:false, addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime}, | ||
| 132 | + {field: 'station_end_time', title: __('预约结束时间'),operate:false, addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime}, | ||
| 133 | + {field: 'station_user_count', title: __('使用人数'),operate: false}, | ||
| 134 | + {field: 'station_desc', title: __('预约说明'),operate: false}, | ||
| 135 | + {field: 'status_text', title: __('审核状态'),operate: false}, | ||
| 136 | + {field: 'createtime', title: __('创建时间'), operate:false, addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime}, | ||
| 137 | + { | ||
| 138 | + field: 'operate', | ||
| 139 | + title: __('Operate'), | ||
| 140 | + table: table2, | ||
| 141 | + events: Table.api.events.operate, | ||
| 142 | + formatter: Table.api.formatter.operate, | ||
| 143 | + buttons:[ | ||
| 144 | + { | ||
| 145 | + name: 'btn', | ||
| 146 | + text: '审核', | ||
| 147 | + title: '审核', | ||
| 148 | + classname: 'btn btn-xs btn-success btn-click', | ||
| 149 | + click: function (val, row) { | ||
| 150 | + var id = row.id; | ||
| 151 | + layer.confirm('您想?', { | ||
| 152 | + btn: ['通过审核','驳回审核'] //按钮 | ||
| 153 | + }, function(){ | ||
| 154 | + $.ajax({ | ||
| 155 | + type:'post', | ||
| 156 | + url:'station_appointment/verify', | ||
| 157 | + data:{id:id,status:1}, | ||
| 158 | + dataType:'json', | ||
| 159 | + success:function(res){ | ||
| 160 | + if(parseInt(res.code) !=0){ | ||
| 161 | + $('.btn-refresh').click(); | ||
| 162 | + } | ||
| 163 | + | ||
| 164 | + layer.msg(res.msg, {icon: 1}); | ||
| 165 | + }, | ||
| 166 | + error:function(error){ | ||
| 167 | + console.log(error); | ||
| 168 | + } | ||
| 169 | + }); | ||
| 170 | + | ||
| 171 | + }, function(){ | ||
| 172 | + $.ajax({ | ||
| 173 | + type:'post', | ||
| 174 | + url:'station_appointment/verify', | ||
| 175 | + data:{id:id,status:2}, | ||
| 176 | + dataType:'json', | ||
| 177 | + success:function(res){ | ||
| 178 | + if(parseInt(res.code) !=0){ | ||
| 179 | + $('.btn-refresh').click(); | ||
| 91 | } | 180 | } |
| 92 | layer.msg(res.msg, {icon: 1}); | 181 | layer.msg(res.msg, {icon: 1}); |
| 93 | }, | 182 | }, |
| @@ -98,13 +187,11 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form','layer'], function ($, | @@ -98,13 +187,11 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form','layer'], function ($, | ||
| 98 | 187 | ||
| 99 | }); | 188 | }); |
| 100 | }, | 189 | }, |
| 101 | - /* visible: function (val) { | ||
| 102 | - if(val.status != 1) { | ||
| 103 | - return false; | ||
| 104 | - }else{ | 190 | + visible: function (val) { |
| 191 | + if(val.status == 0) { | ||
| 105 | return true; | 192 | return true; |
| 106 | } | 193 | } |
| 107 | - }*/ | 194 | + } |
| 108 | }, | 195 | }, |
| 109 | ] | 196 | ] |
| 110 | }, | 197 | }, |
| @@ -113,9 +200,9 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form','layer'], function ($, | @@ -113,9 +200,9 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form','layer'], function ($, | ||
| 113 | ], | 200 | ], |
| 114 | }); | 201 | }); |
| 115 | 202 | ||
| 116 | - $('.search input').attr('placeholder','搜索'); | ||
| 117 | - // 为表格绑定事件 | ||
| 118 | - Table.api.bindevent(table); | 203 | + // 为表格2绑定事件 |
| 204 | + Table.api.bindevent(table2); | ||
| 205 | + } | ||
| 119 | }, | 206 | }, |
| 120 | add: function () { | 207 | add: function () { |
| 121 | Controller.api.bindevent(); | 208 | Controller.api.bindevent(); |
public/assets/js/school/station/station.js
0 → 100644
| 1 | +define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) { | ||
| 2 | + | ||
| 3 | + var Controller = { | ||
| 4 | + index: function () { | ||
| 5 | + // 初始化表格参数配置 | ||
| 6 | + Table.api.init({ | ||
| 7 | + extend: { | ||
| 8 | + index_url: 'station/station/index' + location.search, | ||
| 9 | + add_url: 'station/station/add', | ||
| 10 | + edit_url: 'station/station/edit', | ||
| 11 | + del_url: 'station/station/del', | ||
| 12 | + multi_url: 'station/station/multi', | ||
| 13 | + import_url: 'station/station/import', | ||
| 14 | + table: 'station', | ||
| 15 | + } | ||
| 16 | + }); | ||
| 17 | + | ||
| 18 | + var table = $("#table"); | ||
| 19 | + | ||
| 20 | + // 初始化表格 | ||
| 21 | + table.bootstrapTable({ | ||
| 22 | + url: $.fn.bootstrapTable.defaults.extend.index_url, | ||
| 23 | + pk: 'id', | ||
| 24 | + sortName: 'id', | ||
| 25 | + //禁用默认搜索 | ||
| 26 | + search: false, | ||
| 27 | + //启用普通表单搜索 | ||
| 28 | + // commonSearch: false, | ||
| 29 | + //可以控制是否默认显示搜索单表,false则隐藏,默认为false | ||
| 30 | + // searchFormVisible: false, | ||
| 31 | + | ||
| 32 | + columns: [ | ||
| 33 | + [ | ||
| 34 | + {checkbox: true}, | ||
| 35 | + {field: 'id', title: __('Id'),visible:false, operate: false}, | ||
| 36 | + {field: 'station_name', title: __('Station_name'), operate: 'LIKE'}, | ||
| 37 | + {field: 'type', title: __('Type'),searchList:Config.type, formatter: Table.api.formatter.normal}, | ||
| 38 | + {field: 'status', title: __('Status'),searchList:{"0":__("不开放"),"1":__("开放")}, formatter: Table.api.formatter.normal}, | ||
| 39 | + {field: 'capacity', title: __('Capacity'), operate: false}, | ||
| 40 | + {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate} | ||
| 41 | + ] | ||
| 42 | + ] | ||
| 43 | + }); | ||
| 44 | + | ||
| 45 | + // 为表格绑定事件 | ||
| 46 | + Table.api.bindevent(table); | ||
| 47 | + }, | ||
| 48 | + add: function () { | ||
| 49 | + Controller.api.bindevent(); | ||
| 50 | + }, | ||
| 51 | + edit: function () { | ||
| 52 | + Controller.api.bindevent(); | ||
| 53 | + }, | ||
| 54 | + api: { | ||
| 55 | + bindevent: function () { | ||
| 56 | + Form.api.bindevent($("form[role=form]")); | ||
| 57 | + } | ||
| 58 | + } | ||
| 59 | + }; | ||
| 60 | + return Controller; | ||
| 61 | +}); |
-
请 注册 或 登录 后发表评论