正在显示
3 个修改的文件
包含
247 行增加
和
46 行删除
| @@ -6,7 +6,9 @@ use app\common\controller\Frontend; | @@ -6,7 +6,9 @@ use app\common\controller\Frontend; | ||
| 6 | use app\school\model\project_appointment\Building as BuildingModel; | 6 | use app\school\model\project_appointment\Building as BuildingModel; |
| 7 | use app\school\model\project_appointment\AppointmentRule as AppointmentRuleModel; | 7 | use app\school\model\project_appointment\AppointmentRule as AppointmentRuleModel; |
| 8 | use app\school\model\project_appointment\Room as RoomModel; | 8 | use app\school\model\project_appointment\Room as RoomModel; |
| 9 | -use app\school\model\project_appointment\Floor as FloorModel; | 9 | +use app\index\model\BuildingEnter; |
| 10 | +use app\school\model\station\Station; | ||
| 11 | +use think\Db; | ||
| 10 | 12 | ||
| 11 | class SxBasement extends Frontend | 13 | class SxBasement extends Frontend |
| 12 | { | 14 | { |
| @@ -25,12 +27,21 @@ class SxBasement extends Frontend | @@ -25,12 +27,21 @@ class SxBasement extends Frontend | ||
| 25 | if($enterRules) { | 27 | if($enterRules) { |
| 26 | $enterRules['data_url'] = json_decode($enterRules['data_url'],true); | 28 | $enterRules['data_url'] = json_decode($enterRules['data_url'],true); |
| 27 | } | 29 | } |
| 28 | - $stationList = ['1' => '工位一','2' => '工位二','3' => '工位三','4' => '工位四','5' => '工位五','6' => '工位六','7' => '工位七','8' => '工位八']; | 30 | + //工位 |
| 31 | + $stationList = Station::alias('a') | ||
| 32 | + ->field('a.id,a.station_name,count(sa.id) as appoint_count') | ||
| 33 | + ->join('fa_station_appointment sa','a.id = sa.station_id','LEFT') | ||
| 34 | + ->where(['a.school_id'=>$this->auth->school_id]) | ||
| 35 | + ->group('a.id') | ||
| 36 | + ->select(); | ||
| 37 | + //入驻公司 | ||
| 38 | + $buildingEnter = BuildingEnter::where(['enter_type' => 2,'status' => 2,'school_id'=>$this->auth->school_id,'user_id' => $this->auth->id])->column('id,enter_project_name'); | ||
| 29 | $this->assign('roomTypeList',$roomTypeList); | 39 | $this->assign('roomTypeList',$roomTypeList); |
| 30 | $this->assign('stationList',$stationList); | 40 | $this->assign('stationList',$stationList); |
| 31 | $this->assign('enterRules',$enterRules); | 41 | $this->assign('enterRules',$enterRules); |
| 32 | $this->assign('buildList',$buildList); | 42 | $this->assign('buildList',$buildList); |
| 33 | $this->assign('roomList',$roomList); | 43 | $this->assign('roomList',$roomList); |
| 44 | + $this->assign('buildingEnter',$buildingEnter); | ||
| 34 | } | 45 | } |
| 35 | 46 | ||
| 36 | public function index() | 47 | public function index() |
| @@ -46,4 +57,73 @@ class SxBasement extends Frontend | @@ -46,4 +57,73 @@ class SxBasement extends Frontend | ||
| 46 | downloadFile($file_url,$file_name); | 57 | downloadFile($file_url,$file_name); |
| 47 | } | 58 | } |
| 48 | 59 | ||
| 60 | + /** | ||
| 61 | + * 工位分配提交 | ||
| 62 | + * @throws \think\db\exception\DataNotFoundException | ||
| 63 | + * @throws \think\db\exception\ModelNotFoundException | ||
| 64 | + * @throws \think\exception\DbException | ||
| 65 | + */ | ||
| 66 | + public function stationApply() | ||
| 67 | + { | ||
| 68 | + $userInfo = $this->auth->getUser(); | ||
| 69 | + if(!$userInfo) { | ||
| 70 | + $this->success('请登入','/index/student_login/index'); | ||
| 71 | + } | ||
| 72 | + $params = $this->request->post(); | ||
| 73 | + if(!isset($params['station_id']) || empty($params['station_id'])){ | ||
| 74 | + $this->error('请选择工位'); | ||
| 75 | + } | ||
| 76 | + if(!isset($params['enter_id']) || empty($params['enter_id'])){ | ||
| 77 | + $this->error('请选择公司'); | ||
| 78 | + } | ||
| 79 | + if(strtotime($params['station_start_time']) <= time()) { | ||
| 80 | + $this->error('开始时间请选择未来时间'); | ||
| 81 | + } | ||
| 82 | + $startTime = strtotime($params['station_date'].$params['station_start_time']); | ||
| 83 | + $endTime = strtotime($params['station_date'].$params['station_end_time']); | ||
| 84 | + | ||
| 85 | + if($startTime == $endTime) { | ||
| 86 | + $this->error('预约开始时间不能等于结束时间'); | ||
| 87 | + } | ||
| 88 | + | ||
| 89 | + if($endTime <= $startTime) { | ||
| 90 | + $this->error('结束时间不能小于开始时间'); | ||
| 91 | + } | ||
| 92 | + $start = $startTime - 1; | ||
| 93 | + $stationInfo = Station::alias('a') | ||
| 94 | + ->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') | ||
| 96 | + ->where('a.deletetime',NULL) | ||
| 97 | + ->where(['a.id' => $params['station_id']]) | ||
| 98 | + ->find(); | ||
| 99 | + if(!$stationInfo) { | ||
| 100 | + $this->error('该工位不存在或已经被下架'); | ||
| 101 | + } | ||
| 102 | + if ($stationInfo['appoint_count']){ | ||
| 103 | + $this->error('该工位已被预约'); | ||
| 104 | + } | ||
| 105 | + if ($stationInfo['capacity'] < $params['station_user_count']){ | ||
| 106 | + $this->error("该工位可容纳{$stationInfo['capacity']}人"); | ||
| 107 | + } | ||
| 108 | + $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}") | ||
| 112 | + ->having("station_id = {$params['station_id']}") | ||
| 113 | + ->select(); | ||
| 114 | + if($res) { | ||
| 115 | + $this->error('该时间存在已经被预约,请重新选择'); | ||
| 116 | + } | ||
| 117 | + $params['station_start_time'] = $startTime; | ||
| 118 | + $params['station_end_time'] = $endTime; | ||
| 119 | + $params['user_id'] = $userInfo['id']; | ||
| 120 | + $params['school_id'] = $userInfo['school_id']; | ||
| 121 | + $params['createtime'] = time(); | ||
| 122 | + $result = Db::table('fa_station_appointment')->insert($params); | ||
| 123 | + if(!$result) { | ||
| 124 | + $this->error('预约失败,请重新尝试'); | ||
| 125 | + } | ||
| 126 | + $this->success('预约成功','/index/sx_basement/index'); | ||
| 127 | + } | ||
| 128 | + | ||
| 49 | } | 129 | } |
| @@ -28,7 +28,7 @@ | @@ -28,7 +28,7 @@ | ||
| 28 | } | 28 | } |
| 29 | 29 | ||
| 30 | .build_search { | 30 | .build_search { |
| 31 | - width: 800px; | 31 | + /*width: 800px;*/ |
| 32 | /* border-top: 1px solid #DEE0ED; */ | 32 | /* border-top: 1px solid #DEE0ED; */ |
| 33 | margin-top: 15px; | 33 | margin-top: 15px; |
| 34 | } | 34 | } |
| @@ -64,11 +64,11 @@ | @@ -64,11 +64,11 @@ | ||
| 64 | font-size: 12px; | 64 | font-size: 12px; |
| 65 | } | 65 | } |
| 66 | 66 | ||
| 67 | - .screening_conditions ul li:first-child { | ||
| 68 | - text-align: right; | ||
| 69 | - font-weight: bold; | ||
| 70 | - font-size: 15px; | ||
| 71 | - } | 67 | + /*.screening_conditions ul li:first-child {*/ |
| 68 | + /* text-align: right;*/ | ||
| 69 | + /* font-weight: bold;*/ | ||
| 70 | + /* font-size: 15px;*/ | ||
| 71 | + /*}*/ | ||
| 72 | 72 | ||
| 73 | .conditions_select { | 73 | .conditions_select { |
| 74 | border: 2px solid #CCE2F8; | 74 | border: 2px solid #CCE2F8; |
| @@ -95,7 +95,7 @@ | @@ -95,7 +95,7 @@ | ||
| 95 | border: 1px solid #c8cccf; | 95 | border: 1px solid #c8cccf; |
| 96 | color: #6a6f77; | 96 | color: #6a6f77; |
| 97 | outline: 0; | 97 | outline: 0; |
| 98 | - width: 35rem; | 98 | + width: 42rem; |
| 99 | } | 99 | } |
| 100 | 100 | ||
| 101 | .input_control { | 101 | .input_control { |
| @@ -111,14 +111,14 @@ | @@ -111,14 +111,14 @@ | ||
| 111 | .info .input_control .start_time { | 111 | .info .input_control .start_time { |
| 112 | margin-left: 40px; | 112 | margin-left: 40px; |
| 113 | border: 1px solid #c8cccf; | 113 | border: 1px solid #c8cccf; |
| 114 | - width: 12rem; | 114 | + /*width: 12rem;*/ |
| 115 | border-radius: 2px; | 115 | border-radius: 2px; |
| 116 | } | 116 | } |
| 117 | 117 | ||
| 118 | .info .input_control .end_time { | 118 | .info .input_control .end_time { |
| 119 | margin-left: 40px; | 119 | margin-left: 40px; |
| 120 | border: 1px solid #c8cccf; | 120 | border: 1px solid #c8cccf; |
| 121 | - width: 12rem; | 121 | + /*width: 12rem;*/ |
| 122 | border-radius: 2px; | 122 | border-radius: 2px; |
| 123 | } | 123 | } |
| 124 | 124 | ||
| @@ -137,7 +137,7 @@ | @@ -137,7 +137,7 @@ | ||
| 137 | } | 137 | } |
| 138 | 138 | ||
| 139 | .layui-btn-container { | 139 | .layui-btn-container { |
| 140 | - margin: 3% 0 0 40%; | 140 | + /*margin: 3% 0 0 40%;*/ |
| 141 | } | 141 | } |
| 142 | 142 | ||
| 143 | .rotation { | 143 | .rotation { |
| @@ -168,6 +168,66 @@ | @@ -168,6 +168,66 @@ | ||
| 168 | color: rgb(139, 138, 138); | 168 | color: rgb(139, 138, 138); |
| 169 | padding-left: 7px; | 169 | padding-left: 7px; |
| 170 | } | 170 | } |
| 171 | + | ||
| 172 | + .bb{ | ||
| 173 | + width: 60px; | ||
| 174 | + height: 60px; | ||
| 175 | + text-align: center; | ||
| 176 | + } | ||
| 177 | + .cc{ | ||
| 178 | + height: 28px; | ||
| 179 | + background-color: #fff; | ||
| 180 | + width: 20px; | ||
| 181 | + margin: 0 auto; | ||
| 182 | + } | ||
| 183 | + .cc-txt{ | ||
| 184 | + margin-top: 5px; | ||
| 185 | + } | ||
| 186 | + #stations{ | ||
| 187 | + display: flex; | ||
| 188 | + justify-content: row; | ||
| 189 | + flex-wrap: wrap; | ||
| 190 | + } | ||
| 191 | + /*已预约*/ | ||
| 192 | + .station_ready_select{ | ||
| 193 | + background-color: #ccc; | ||
| 194 | + /*background-color: rgb(255, 149, 2);*/ | ||
| 195 | + } | ||
| 196 | + /*空闲*/ | ||
| 197 | + .station_green_select{ | ||
| 198 | + background-color: rgb(52, 199, 88); | ||
| 199 | + } | ||
| 200 | + /*已选*/ | ||
| 201 | + .station_check_select{ | ||
| 202 | + background-color: rgb(175, 82, 222); | ||
| 203 | + } | ||
| 204 | + .sta-li{ | ||
| 205 | + margin: 0px 24px | ||
| 206 | + } | ||
| 207 | + .time{ | ||
| 208 | + width: 32.7%; | ||
| 209 | + } | ||
| 210 | + .btn{ | ||
| 211 | + background-color: rgb(50, 145, 248); | ||
| 212 | + border-radius: 5px; | ||
| 213 | + } | ||
| 214 | + .sta-li>a, a:visited, a:link, a:hover{ | ||
| 215 | + color:black;!important; | ||
| 216 | + } | ||
| 217 | + .bb-block{ | ||
| 218 | + display: flex; | ||
| 219 | + justify-content: flex-end; | ||
| 220 | + align-items: center; | ||
| 221 | + margin: 10px 24px -18px 0; | ||
| 222 | + } | ||
| 223 | + .bb-msg{ | ||
| 224 | + width: 20px; | ||
| 225 | + height: 20px; | ||
| 226 | + } | ||
| 227 | + .bb-msg-font{ | ||
| 228 | + font-size: 14px; | ||
| 229 | + margin: 0 10px 0 10px; | ||
| 230 | + } | ||
| 171 | </style> | 231 | </style> |
| 172 | <div class="rotation"> | 232 | <div class="rotation"> |
| 173 | <img src="__CDN__/assets/img/teacherRotation.png" /> | 233 | <img src="__CDN__/assets/img/teacherRotation.png" /> |
| @@ -545,28 +605,49 @@ | @@ -545,28 +605,49 @@ | ||
| 545 | <div class="right_main "> | 605 | <div class="right_main "> |
| 546 | <div class="build_search"> | 606 | <div class="build_search"> |
| 547 | <span class="room_choice">公共工位座位分布图</span> | 607 | <span class="room_choice">公共工位座位分布图</span> |
| 608 | + <div class="bb-block"> | ||
| 609 | + <div class="station_green_select bb-msg"></div> | ||
| 610 | + <span class="bb-msg-font">空闲</span> | ||
| 611 | + <div class="station_ready_select bb-msg"></div> | ||
| 612 | + <span class="bb-msg-font">不可约</span> | ||
| 613 | + <div class="station_check_select bb-msg"></div> | ||
| 614 | + <span class="bb-msg-font">已选</span> | ||
| 615 | + </div> | ||
| 548 | <div class="screening_conditions"> | 616 | <div class="screening_conditions"> |
| 549 | - <div> | ||
| 550 | <ul id="stations"> | 617 | <ul id="stations"> |
| 551 | {foreach $stationList as $key => $val} | 618 | {foreach $stationList as $key => $val} |
| 552 | - <li><a href="javascript:;" title="{$val}" class="{if $key == 0} conditions_select {/if}" href="javascript:;" data-id="{$key}">{$val}</a></li> | 619 | +<!-- <li><a href="javascript:;" title="{$val}" class="{if $key == 0} conditions_select {/if}" data-id="{$key}">{$val}</a></li>--> |
| 620 | + <li class="sta-li"> | ||
| 621 | + <a href="javascript:;" title="{$val}" data-id="{$val.id}" data-station_name="{$val.station_name}" data-appoint_count="{$val.appoint_count}"> | ||
| 622 | + <div class="aa"> | ||
| 623 | + <div class="bb {if $val.appoint_count == 0} station_green_select {else/} station_ready_select {/if}" data-id="{$val.id}"> | ||
| 624 | + <div class="cc"></div> | ||
| 625 | + <div class="cc-txt"> | ||
| 626 | + <span>{$val.station_name}</span> | ||
| 627 | + </div> | ||
| 628 | + </div> | ||
| 629 | + </div> | ||
| 630 | + </a> | ||
| 631 | + </li> | ||
| 553 | {/foreach} | 632 | {/foreach} |
| 554 | </ul> | 633 | </ul> |
| 555 | </div> | 634 | </div> |
| 556 | </div> | 635 | </div> |
| 557 | - </div> | ||
| 558 | <div class="build_search"> | 636 | <div class="build_search"> |
| 559 | <div class="room_choice"><span>预约信息</span></div> | 637 | <div class="room_choice"><span>预约信息</span></div> |
| 560 | <div class="info"> | 638 | <div class="info"> |
| 639 | + <div class="input_control station_block hidden"> | ||
| 640 | + <span><span class="required_s">*</span>已选工位</span> | ||
| 641 | + <span class="station_name" style="margin-left: 40px;">A205</span> | ||
| 642 | + </div> | ||
| 561 | <div class="input_control"> | 643 | <div class="input_control"> |
| 562 | <span><span class="required_s">*</span>预约日期</span> | 644 | <span><span class="required_s">*</span>预约日期</span> |
| 563 | - <input class="datetimepicker" name="station_date" type="text" id="station_date" class="form_input" placeholder="预约日期" /> | 645 | + <input class="datetimepicker form_input" name="station_date" type="text" id="station_date" placeholder="预约日期" /> |
| 564 | </div> | 646 | </div> |
| 565 | - | ||
| 566 | <div class="input_control"> | 647 | <div class="input_control"> |
| 567 | <span><span class="required_s">*</span>预约时间</span> | 648 | <span><span class="required_s">*</span>预约时间</span> |
| 568 | - <select class="start_time station_start_time" name="station_start_time"> | ||
| 569 | - <option disabled selected >请选择预约开始时间</option> | 649 | + <select class="start_time station_start_time time" name="station_start_time"> |
| 650 | + <option value="" disabled selected >请选择预约开始时间</option> | ||
| 570 | <option value="08:00" >08:00</option> | 651 | <option value="08:00" >08:00</option> |
| 571 | <option value="08:30" >08:30</option> | 652 | <option value="08:30" >08:30</option> |
| 572 | <option value="09:00" >09:00</option> | 653 | <option value="09:00" >09:00</option> |
| @@ -592,8 +673,8 @@ | @@ -592,8 +673,8 @@ | ||
| 592 | <option value="20:00" >20:00</option> | 673 | <option value="20:00" >20:00</option> |
| 593 | <option value="20:30" >20:30</option> | 674 | <option value="20:30" >20:30</option> |
| 594 | </select> | 675 | </select> |
| 595 | - <select class="end_time station_end_time" name="station_end_time"> | ||
| 596 | - <option disabled selected>请选择预约结束时间</option> | 676 | + <select class="end_time station_end_time time" name="station_end_time"> |
| 677 | + <option value="" disabled selected>请选择预约结束时间</option> | ||
| 597 | <option value="08:30" >08:30</option> | 678 | <option value="08:30" >08:30</option> |
| 598 | <option value="09:00" >09:00</option> | 679 | <option value="09:00" >09:00</option> |
| 599 | <option value="09:30" >09:30</option> | 680 | <option value="09:30" >09:30</option> |
| @@ -622,7 +703,7 @@ | @@ -622,7 +703,7 @@ | ||
| 622 | </div> | 703 | </div> |
| 623 | <div class="input_control"> | 704 | <div class="input_control"> |
| 624 | <span><span class="required_s">*</span>预约形式</span> | 705 | <span><span class="required_s">*</span>预约形式</span> |
| 625 | - <select class="apply_type station_type" name="station_type" lay-verify=""> | 706 | + <select class="apply_type station_type" name="station_type" lay-verify="" style="width: 70%;"> |
| 626 | <option value="1" selected>个人</option> | 707 | <option value="1" selected>个人</option> |
| 627 | <option value="2" >公司</option> | 708 | <option value="2" >公司</option> |
| 628 | <option value="3" >团队</option> | 709 | <option value="3" >团队</option> |
| @@ -633,12 +714,20 @@ | @@ -633,12 +714,20 @@ | ||
| 633 | <input name="station_user_count" type="text" class="form_input" placeholder="参与人数" /> | 714 | <input name="station_user_count" type="text" class="form_input" placeholder="参与人数" /> |
| 634 | </div> | 715 | </div> |
| 635 | <div class="input_control"> | 716 | <div class="input_control"> |
| 717 | + <span><span class="required_s">*</span>选择公司</span> | ||
| 718 | + <select class="apply_type enter_id" name="enter_id" lay-verify="" style="width: 70%;"> | ||
| 719 | + {foreach name='buildingEnter' item='vo'} | ||
| 720 | + <option value="{$key}" selected>{$vo}</option> | ||
| 721 | + {/foreach} | ||
| 722 | + </select> | ||
| 723 | + </div> | ||
| 724 | + <div class="input_control"> | ||
| 636 | <span>使用设备说明</span> | 725 | <span>使用设备说明</span> |
| 637 | - <textarea name="station_desc" id="station_desc" required lay-verify="required" placeholder="使用设备说明" class="layui-textarea"></textarea> | 726 | + <textarea style="width: 70%;" name="station_desc" id="station_desc" required lay-verify="required" placeholder="使用设备说明" class="layui-textarea"></textarea> |
| 638 | </div> | 727 | </div> |
| 639 | - <div class="layui-btn-container"> | ||
| 640 | - <a type="button" id="commit_station" class="layui-btn layui-btn-sm">提交</a> | ||
| 641 | - <a type="button" href="javascript:history.go(-1);" class="layui-btn layui-btn-sm">取消</a> | 728 | + <div class="input_control" style="padding-left: 11.5%;"> |
| 729 | + <a type="button" id="commit_station" class="layui-btn layui-btn-sm btn">提交</a> | ||
| 730 | + <a type="button" href="javascript:history.go(-1);" class="layui-btn layui-btn-sm btn" style="color: #fff">取消</a> | ||
| 642 | </div> | 731 | </div> |
| 643 | 732 | ||
| 644 | </div> | 733 | </div> |
| @@ -653,10 +742,6 @@ | @@ -653,10 +742,6 @@ | ||
| 653 | 742 | ||
| 654 | 743 | ||
| 655 | 744 | ||
| 656 | - | ||
| 657 | - | ||
| 658 | - | ||
| 659 | - | ||
| 660 | </body> | 745 | </body> |
| 661 | 746 | ||
| 662 | </html> | 747 | </html> |
| @@ -121,15 +121,25 @@ define(['jquery', 'bootstrap', 'frontend', 'form', 'template', 'swiper', 'layer' | @@ -121,15 +121,25 @@ define(['jquery', 'bootstrap', 'frontend', 'form', 'template', 'swiper', 'layer' | ||
| 121 | }); | 121 | }); |
| 122 | 122 | ||
| 123 | //工位 | 123 | //工位 |
| 124 | - $(document).on('click','#stations li:not(:first-child),#stations li:not(:first-child) ,#stations li:not(:first-child)',function(){ | ||
| 125 | - $(this).children('a').addClass("conditions_select"); | ||
| 126 | - $(this).siblings('li').children('a').removeClass("conditions_select"); | 124 | + $(document).on('click','#stations li:first-child, #stations li:not(:first-child),#stations li:not(:first-child),#stations li:not(:first-child)',function(){ |
| 125 | + // $(this).children('a').children('div').children('div').addClass("conditions_select"); | ||
| 126 | + // $(this).siblings('li').children('a').removeClass("conditions_select"); | ||
| 127 | + var appoint_count = $(this).children('a').data('appoint_count'); | ||
| 128 | + var station_name = $(this).children('a').data('station_name'); | ||
| 129 | + if (appoint_count > 0){ | ||
| 130 | + layer.msg('此工位不可约'); | ||
| 131 | + return false; | ||
| 132 | + } | ||
| 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"); | ||
| 135 | + $('.station_block').removeClass('hidden'); | ||
| 136 | + $('.station_name').text(station_name); | ||
| 127 | }); | 137 | }); |
| 128 | //房间选择 不需要请求 房间接口 | 138 | //房间选择 不需要请求 房间接口 |
| 129 | $(document).on('click','#room li:not(:first-child)',function(){ | 139 | $(document).on('click','#room li:not(:first-child)',function(){ |
| 130 | $(this).children('a').addClass("conditions_select"); | 140 | $(this).children('a').addClass("conditions_select"); |
| 131 | $(this).siblings('li').children('a').removeClass("conditions_select"); | 141 | $(this).siblings('li').children('a').removeClass("conditions_select"); |
| 132 | - }) | 142 | + }); |
| 133 | 143 | ||
| 134 | $(document).on('click','#floor li:not(:first-child),#room_type li:not(:first-child) ,#build_type li:not(:first-child)',function(){ | 144 | $(document).on('click','#floor li:not(:first-child),#room_type li:not(:first-child) ,#build_type li:not(:first-child)',function(){ |
| 135 | $(this).children('a').addClass("conditions_select"); | 145 | $(this).children('a').addClass("conditions_select"); |
| @@ -175,40 +185,66 @@ define(['jquery', 'bootstrap', 'frontend', 'form', 'template', 'swiper', 'layer' | @@ -175,40 +185,66 @@ define(['jquery', 'bootstrap', 'frontend', 'form', 'template', 'swiper', 'layer' | ||
| 175 | return false; | 185 | return false; |
| 176 | }); | 186 | }); |
| 177 | } | 187 | } |
| 188 | + //工位分配提交 | ||
| 178 | $(document).on('click',"#commit_station",function(){ | 189 | $(document).on('click',"#commit_station",function(){ |
| 179 | - var conditions_select = $("#stations .conditions_select").attr("data-id"), | 190 | + var conditions_select = $("#stations .station_check_select").attr("data-id"), |
| 180 | station_date = $("input[name='station_date']").val(), | 191 | station_date = $("input[name='station_date']").val(), |
| 181 | - station_user_count = $("input[name='station_user_count']").val(), | ||
| 182 | station_start_time = $(".station_start_time option:selected").val(), | 192 | station_start_time = $(".station_start_time option:selected").val(), |
| 183 | - station_end_time = $(".station_end_time option:selected").val(); | ||
| 184 | - station_desc = $("#station_desc").val(); | 193 | + station_end_time = $(".station_end_time option:selected").val(), |
| 194 | + station_user_count = $("input[name='station_user_count']").val(), | ||
| 195 | + station_desc = $("#station_desc").val(), | ||
| 196 | + enter_id = $(".enter_id option:selected").val(), | ||
| 185 | apply_type = $(".station_type option:selected").val(); | 197 | apply_type = $(".station_type option:selected").val(); |
| 186 | - console.log(station_start_time); | ||
| 187 | - console.log(station_end_time); | ||
| 188 | if(!conditions_select) { | 198 | if(!conditions_select) { |
| 189 | layer.msg('请选择工位'); | 199 | layer.msg('请选择工位'); |
| 190 | return false; | 200 | return false; |
| 191 | } | 201 | } |
| 192 | - | ||
| 193 | - if(!station_date) { | 202 | + if(station_date == '') { |
| 194 | layer.msg('请选择预约日期'); | 203 | layer.msg('请选择预约日期'); |
| 195 | return false; | 204 | return false; |
| 196 | } | 205 | } |
| 197 | - if(!station_start_time) { | 206 | + if(station_start_time == '') { |
| 198 | layer.msg('请选择预约开始时间'); | 207 | layer.msg('请选择预约开始时间'); |
| 199 | return false; | 208 | return false; |
| 200 | } | 209 | } |
| 201 | - if(!station_end_time) { | 210 | + if(station_end_time == '') { |
| 202 | layer.msg('请选择预约结束时间'); | 211 | layer.msg('请选择预约结束时间'); |
| 203 | return false; | 212 | return false; |
| 204 | } | 213 | } |
| 205 | if(station_user_count == '') { | 214 | if(station_user_count == '') { |
| 206 | - layer.msg('使用人数不能为空'); | 215 | + layer.msg('参与人数不能为空'); |
| 216 | + return false; | ||
| 217 | + } | ||
| 218 | + if (enter_id == ''){ | ||
| 219 | + layer.msg('公司不能为空'); | ||
| 207 | return false; | 220 | return false; |
| 208 | } | 221 | } |
| 222 | + // setTimeout(function () { | ||
| 223 | + // layer.msg('提交成功'); | ||
| 224 | + // }, 1000); | ||
| 225 | + | ||
| 226 | + Fast.api.ajax({ | ||
| 227 | + url:'sx_basement/stationApply', | ||
| 228 | + data:{ | ||
| 229 | + station_id:conditions_select, | ||
| 230 | + station_date:station_date, | ||
| 231 | + station_start_time:station_start_time, | ||
| 232 | + station_end_time:station_end_time, | ||
| 233 | + station_user_count:station_user_count, | ||
| 234 | + station_desc:station_desc, | ||
| 235 | + station_type:apply_type, | ||
| 236 | + enter_id:enter_id | ||
| 237 | + } | ||
| 238 | + },function (i,ret) { | ||
| 239 | + if(ret.code == 1) { | ||
| 209 | setTimeout(function () { | 240 | setTimeout(function () { |
| 210 | - layer.msg('提交成功'); | 241 | + location.href = ret.url ? ret.url : "/"; |
| 211 | }, 1000); | 242 | }, 1000); |
| 243 | + }else{ | ||
| 244 | + return false; | ||
| 245 | + } | ||
| 246 | + }); | ||
| 247 | + | ||
| 212 | }); | 248 | }); |
| 213 | 249 | ||
| 214 | $(document).on('click',"#commit_build",function(){ | 250 | $(document).on('click',"#commit_build",function(){ |
-
请 注册 或 登录 后发表评论