正在显示
3 个修改的文件
包含
55 行增加
和
10 行删除
| @@ -89,7 +89,6 @@ class SxBasement extends Frontend | @@ -89,7 +89,6 @@ class SxBasement extends Frontend | ||
| 89 | if($endTime <= $startTime) { | 89 | if($endTime <= $startTime) { |
| 90 | $this->error('结束时间不能小于开始时间'); | 90 | $this->error('结束时间不能小于开始时间'); |
| 91 | } | 91 | } |
| 92 | - $start = $startTime - 1; | ||
| 93 | $stationInfo = Station::alias('a') | 92 | $stationInfo = Station::alias('a') |
| 94 | ->field('a.id,a.station_name,a.capacity,count(sa.id) as appoint_count') | 93 | ->field('a.id,a.station_name,a.capacity,count(sa.id) as appoint_count') |
| 95 | ->join('fa_station_appointment sa','a.id = sa.station_id','LEFT') | 94 | ->join('fa_station_appointment sa','a.id = sa.station_id','LEFT') |
| @@ -106,9 +105,9 @@ class SxBasement extends Frontend | @@ -106,9 +105,9 @@ class SxBasement extends Frontend | ||
| 106 | $this->error("该工位可容纳{$stationInfo['capacity']}人"); | 105 | $this->error("该工位可容纳{$stationInfo['capacity']}人"); |
| 107 | } | 106 | } |
| 108 | $res = Db::table('fa_station_appointment') | 107 | $res = Db::table('fa_station_appointment') |
| 109 | - ->whereOr("station_start_time >= {$start} AND station_start_time <= {$endTime}") | ||
| 110 | - ->whereOr("station_start_time <= {$start} AND station_end_time >= {$endTime}") | ||
| 111 | - ->whereOr("station_end_time >= {$start} AND station_end_time <= {$endTime}") | 108 | + ->whereOr("station_start_time >= {$startTime} AND station_start_time <= {$endTime}") |
| 109 | + ->whereOr("station_start_time <= {$startTime} AND station_end_time >= {$endTime}") | ||
| 110 | + ->whereOr("station_end_time >= {$startTime} AND station_end_time <= {$endTime}") | ||
| 112 | ->having("station_id = {$params['station_id']}") | 111 | ->having("station_id = {$params['station_id']}") |
| 113 | ->select(); | 112 | ->select(); |
| 114 | if($res) { | 113 | if($res) { |
| @@ -126,4 +125,26 @@ class SxBasement extends Frontend | @@ -126,4 +125,26 @@ class SxBasement extends Frontend | ||
| 126 | $this->success('预约成功','/index/sx_basement/index'); | 125 | $this->success('预约成功','/index/sx_basement/index'); |
| 127 | } | 126 | } |
| 128 | 127 | ||
| 128 | + /** | ||
| 129 | + * 工位列表 | ||
| 130 | + * @throws \think\db\exception\DataNotFoundException | ||
| 131 | + * @throws \think\db\exception\ModelNotFoundException | ||
| 132 | + * @throws \think\exception\DbException | ||
| 133 | + */ | ||
| 134 | + public function station(){ | ||
| 135 | + $params = $this->request->post(); | ||
| 136 | + $startTime = strtotime($params['station_date'].$params['station_start_time']); | ||
| 137 | + $endTime = strtotime($params['station_date'].$params['station_end_time']); | ||
| 138 | + //工位 | ||
| 139 | + $stationList = Station::alias('a') | ||
| 140 | + ->field('a.id,a.station_name,count(sa.id) as appoint_count') | ||
| 141 | + ->join('fa_station_appointment sa','a.id = sa.station_id','LEFT') | ||
| 142 | + ->whereOr("station_start_time >= {$startTime} AND station_start_time <= {$endTime}") | ||
| 143 | + ->whereOr("station_start_time <= {$startTime} AND station_end_time >= {$endTime}") | ||
| 144 | + ->whereOr("station_end_time >= {$startTime} AND station_end_time <= {$endTime}") | ||
| 145 | + ->where('a.school_id',$this->auth->school_id) | ||
| 146 | + ->group('a.id') | ||
| 147 | + ->select(); | ||
| 148 | + $this->success('查询成功',$stationList); | ||
| 149 | + } | ||
| 129 | } | 150 | } |
| @@ -190,12 +190,12 @@ | @@ -190,12 +190,12 @@ | ||
| 190 | } | 190 | } |
| 191 | /*已预约*/ | 191 | /*已预约*/ |
| 192 | .station_ready_select{ | 192 | .station_ready_select{ |
| 193 | - background-color: #ccc; | 193 | + background-color: #FF6200; |
| 194 | /*background-color: rgb(255, 149, 2);*/ | 194 | /*background-color: rgb(255, 149, 2);*/ |
| 195 | } | 195 | } |
| 196 | /*空闲*/ | 196 | /*空闲*/ |
| 197 | .station_green_select{ | 197 | .station_green_select{ |
| 198 | - background-color: rgb(52, 199, 88); | 198 | + background-color: #C2C7CC; |
| 199 | } | 199 | } |
| 200 | /*已选*/ | 200 | /*已选*/ |
| 201 | .station_check_select{ | 201 | .station_check_select{ |
| @@ -636,13 +636,13 @@ | @@ -636,13 +636,13 @@ | ||
| 636 | <div class="build_search"> | 636 | <div class="build_search"> |
| 637 | <div class="room_choice"><span>预约信息</span></div> | 637 | <div class="room_choice"><span>预约信息</span></div> |
| 638 | <div class="info"> | 638 | <div class="info"> |
| 639 | - <div class="input_control station_block hidden"> | 639 | + <div class="input_control station_block"> |
| 640 | <span><span class="required_s">*</span>已选工位</span> | 640 | <span><span class="required_s">*</span>已选工位</span> |
| 641 | - <span class="station_name" style="margin-left: 40px;">A205</span> | 641 | + <span class="station_name" style="margin-left: 40px;"></span> |
| 642 | </div> | 642 | </div> |
| 643 | <div class="input_control"> | 643 | <div class="input_control"> |
| 644 | <span><span class="required_s">*</span>预约日期</span> | 644 | <span><span class="required_s">*</span>预约日期</span> |
| 645 | - <input class="datetimepicker form_input" name="station_date" type="text" id="station_date" placeholder="预约日期" /> | 645 | + <input class="datetimepicker form_input station_date" name="station_date" type="text" id="station_date" placeholder="预约日期" /> |
| 646 | </div> | 646 | </div> |
| 647 | <div class="input_control"> | 647 | <div class="input_control"> |
| 648 | <span><span class="required_s">*</span>预约时间</span> | 648 | <span><span class="required_s">*</span>预约时间</span> |
| @@ -132,7 +132,7 @@ define(['jquery', 'bootstrap', 'frontend', 'form', 'template', 'swiper', 'layer' | @@ -132,7 +132,7 @@ define(['jquery', 'bootstrap', 'frontend', 'form', 'template', 'swiper', 'layer' | ||
| 132 | } | 132 | } |
| 133 | $(this).children('a').children('div').children('div').addClass("station_check_select"); | 133 | $(this).children('a').children('div').children('div').addClass("station_check_select"); |
| 134 | $(this).siblings('li').children('a').children('div').children('div').removeClass("station_check_select"); | 134 | $(this).siblings('li').children('a').children('div').children('div').removeClass("station_check_select"); |
| 135 | - $('.station_block').removeClass('hidden'); | 135 | + // $('.station_block').removeClass('hidden'); |
| 136 | $('.station_name').text(station_name); | 136 | $('.station_name').text(station_name); |
| 137 | }); | 137 | }); |
| 138 | //房间选择 不需要请求 房间接口 | 138 | //房间选择 不需要请求 房间接口 |
| @@ -246,6 +246,30 @@ define(['jquery', 'bootstrap', 'frontend', 'form', 'template', 'swiper', 'layer' | @@ -246,6 +246,30 @@ define(['jquery', 'bootstrap', 'frontend', 'form', 'template', 'swiper', 'layer' | ||
| 246 | }); | 246 | }); |
| 247 | 247 | ||
| 248 | }); | 248 | }); |
| 249 | + //选择时间切换工位数据 | ||
| 250 | + // $(document).on('change','.station_date,.station_start_time,.station_end_time',function () { | ||
| 251 | + // console.log('time',$(this).val()); | ||
| 252 | + // var station_date = $("input[name='station_date']").val(), | ||
| 253 | + // station_start_time = $(".station_start_time option:selected").val(), | ||
| 254 | + // station_end_time = $(".station_end_time option:selected").val(); | ||
| 255 | + // | ||
| 256 | + // if(station_date != '' && station_start_time != '' && station_end_time != '') { | ||
| 257 | + // Fast.api.ajax({ | ||
| 258 | + // url:'sx_basement/station', | ||
| 259 | + // data:{ | ||
| 260 | + // station_date:station_date, | ||
| 261 | + // station_start_time:station_start_time, | ||
| 262 | + // station_end_time:station_end_time, | ||
| 263 | + // } | ||
| 264 | + // },function (i,ret) { | ||
| 265 | + // if(ret.code == 1) { | ||
| 266 | + // console.log('ret',ret); | ||
| 267 | + // }else{ | ||
| 268 | + // return false; | ||
| 269 | + // } | ||
| 270 | + // }); | ||
| 271 | + // } | ||
| 272 | + // }); | ||
| 249 | 273 | ||
| 250 | $(document).on('click',"#commit_build",function(){ | 274 | $(document).on('click',"#commit_build",function(){ |
| 251 | var room_id = $("#room .conditions_select").attr("data-id"), | 275 | var room_id = $("#room .conditions_select").attr("data-id"), |
-
请 注册 或 登录 后发表评论