作者 曹东东

工位

1 -<?php  
2 -  
3 -namespace app\index\controller;  
4 -  
5 -use app\common\controller\Frontend;  
6 -use app\school\model\project_appointment\Building as BuildingModel;  
7 -use app\school\model\project_appointment\AppointmentRule as AppointmentRuleModel;  
8 -use app\school\model\project_appointment\Room as RoomModel;  
9 -use app\school\model\project_appointment\Floor as FloorModel;  
10 -  
11 -class SxBasement extends Frontend  
12 -{  
13 -  
14 - protected $noNeedLogin = '*';  
15 - protected $noNeedRight = '*';  
16 - protected $layout = 'default';  
17 -  
18 - public function _initialize()  
19 - {  
20 - parent::_initialize(); // TODO: Change the autogenerated stub  
21 - $roomTypeList = RoomModel::$room_type;  
22 - $buildList = (new BuildingModel)->where("school_id",$this->school_id)->select();  
23 - $roomList = (new RoomModel)->getCollegeRoom(["school_id"=>$this->school_id]);  
24 - $enterRules = (new AppointmentRuleModel)->where(['school_id'=>$this->school_id])->find();  
25 - if($enterRules) {  
26 - $enterRules['data_url'] = json_decode($enterRules['data_url'],true);  
27 - }  
28 - $this->assign('roomTypeList',$roomTypeList);  
29 - $this->assign('enterRules',$enterRules);  
30 - $this->assign('buildList',$buildList);  
31 - $this->assign('roomList',$roomList);  
32 - }  
33 -  
34 - public function index()  
35 - {  
36 - $this->assign('index','index');  
37 - return $this->view->fetch();  
38 - }  
39 -  
40 - public function downFiles($file_url)  
41 - {  
42 - $file_url = $this->request->param('file_url');  
43 - $file_name = $this->request->param('file_name');  
44 - downloadFile($file_url,$file_name);  
45 - }  
46 -  
47 -} 1 +<?php
  2 +
  3 +namespace app\index\controller;
  4 +
  5 +use app\common\controller\Frontend;
  6 +use app\school\model\project_appointment\Building as BuildingModel;
  7 +use app\school\model\project_appointment\AppointmentRule as AppointmentRuleModel;
  8 +use app\school\model\project_appointment\Room as RoomModel;
  9 +use app\school\model\project_appointment\Floor as FloorModel;
  10 +
  11 +class SxBasement extends Frontend
  12 +{
  13 +
  14 + protected $noNeedLogin = '*';
  15 + protected $noNeedRight = '*';
  16 + protected $layout = 'default';
  17 +
  18 + public function _initialize()
  19 + {
  20 + parent::_initialize(); // TODO: Change the autogenerated stub
  21 + $roomTypeList = RoomModel::$room_type;
  22 + $buildList = (new BuildingModel)->where("school_id",$this->school_id)->select();
  23 + $roomList = (new RoomModel)->getCollegeRoom(["school_id"=>$this->school_id]);
  24 + $enterRules = (new AppointmentRuleModel)->where(['school_id'=>$this->school_id])->find();
  25 + if($enterRules) {
  26 + $enterRules['data_url'] = json_decode($enterRules['data_url'],true);
  27 + }
  28 + $stationList = ['1' => '工位一','2' => '工位二','3' => '工位三','4' => '工位四','5' => '工位五','6' => '工位六','7' => '工位七','8' => '工位八'];
  29 + $this->assign('roomTypeList',$roomTypeList);
  30 + $this->assign('stationList',$stationList);
  31 + $this->assign('enterRules',$enterRules);
  32 + $this->assign('buildList',$buildList);
  33 + $this->assign('roomList',$roomList);
  34 + }
  35 +
  36 + public function index()
  37 + {
  38 + $this->assign('index','index');
  39 + return $this->view->fetch();
  40 + }
  41 +
  42 + public function downFiles($file_url)
  43 + {
  44 + $file_url = $this->request->param('file_url');
  45 + $file_name = $this->request->param('file_name');
  46 + downloadFile($file_url,$file_name);
  47 + }
  48 +
  49 +}
@@ -41,11 +41,11 @@ @@ -41,11 +41,11 @@
41 .room_choice { 41 .room_choice {
42 display: block; 42 display: block;
43 color: #4A4A4A; 43 color: #4A4A4A;
44 - font-size: 18px; 44 + font-size: 16px;
45 font-weight: bold; 45 font-weight: bold;
46 width: 20%; 46 width: 20%;
  47 + margin: 0 auto;
47 } 48 }
48 -  
49 .screening_conditions div { 49 .screening_conditions div {
50 margin-top: 8px; 50 margin-top: 8px;
51 } 51 }
@@ -75,7 +75,6 @@ @@ -75,7 +75,6 @@
75 background-color: #CCE2F8; 75 background-color: #CCE2F8;
76 border-radius: 1px; 76 border-radius: 1px;
77 } 77 }
78 -  
79 .info { 78 .info {
80 width: 100%; 79 width: 100%;
81 height: 200px; 80 height: 200px;
@@ -180,6 +179,7 @@ @@ -180,6 +179,7 @@
180 <li class="left_active layui-this" id="basement">基地使用情况</li> 179 <li class="left_active layui-this" id="basement">基地使用情况</li>
181 <li id="apply">入驻申请</li> 180 <li id="apply">入驻申请</li>
182 <li id="order">场地预约</li> 181 <li id="order">场地预约</li>
  182 + <li id="station">工位分配</li>
183 </ul> 183 </ul>
184 <!-- <img src="__CDN__/assets/img/bulbs.png" class="bulbs"> --> 184 <!-- <img src="__CDN__/assets/img/bulbs.png" class="bulbs"> -->
185 </ul> 185 </ul>
@@ -369,6 +369,7 @@ @@ -369,6 +369,7 @@
369 <div class="input_control"> 369 <div class="input_control">
370 <span><span class="required_s">*</span>预约日期</span> 370 <span><span class="required_s">*</span>预约日期</span>
371 <input class="datetimepicker" name="apply_date" type="text" id="apply_date" class="form_input" placeholder="预约日期" /> 371 <input class="datetimepicker" name="apply_date" type="text" id="apply_date" class="form_input" placeholder="预约日期" />
  372 +
372 </div> 373 </div>
373 374
374 <div class="input_control"> 375 <div class="input_control">
@@ -531,6 +532,122 @@ @@ -531,6 +532,122 @@
531 </div> 532 </div>
532 </div> 533 </div>
533 534
  535 + <!-- 工位 -->
  536 + <div class="main_right layui-tab-item">
  537 + <div class="outter">
  538 + <div class="title">
  539 + <div class="title_left">
  540 + <text style="color: #555;font-weight: 550;">工位分配</text>
  541 + <text style="color: #999;">STATION</text>
  542 + </div>
  543 + </div>
  544 +
  545 + <div class="right_main ">
  546 + <div class="build_search">
  547 + <span class="room_choice">公共工位座位分布图</span>
  548 + <div class="screening_conditions">
  549 + <div>
  550 + <ul id="stations">
  551 + {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>
  553 + {/foreach}
  554 + </ul>
  555 + </div>
  556 + </div>
  557 + </div>
  558 + <div class="build_search">
  559 + <div class="room_choice"><span>预约信息</span></div>
  560 + <div class="info">
  561 + <div class="input_control">
  562 + <span><span class="required_s">*</span>预约日期</span>
  563 + <input class="datetimepicker" name="station_date" type="text" id="station_date" class="form_input" placeholder="预约日期" />
  564 + </div>
  565 +
  566 + <div class="input_control">
  567 + <span><span class="required_s">*</span>预约时间</span>
  568 + <select class="start_time station_start_time" name="station_start_time">
  569 + <option disabled selected >请选择预约开始时间</option>
  570 + <option value="08:00" >08:00</option>
  571 + <option value="08:30" >08:30</option>
  572 + <option value="09:00" >09:00</option>
  573 + <option value="09:30" >09:30</option>
  574 + <option value="10:00" >10:00</option>
  575 + <option value="10:30" >10:30</option>
  576 + <option value="11:00" >11:00</option>
  577 + <option value="11:30" >11:30</option>
  578 + <option value="12:00" >12:00</option>
  579 + <option value="12:30" >12:30</option>
  580 + <option value="13:00" >13:00</option>
  581 + <option value="13:30" >13:30</option>
  582 + <option value="14:00" >14:00</option>
  583 + <option value="14:30" >14:30</option>
  584 + <option value="15:00" >15:00</option>
  585 + <option value="15:30" >15:30</option>
  586 + <option value="16:00" >16:00</option>
  587 + <option value="16:30" >16:30</option>
  588 + <option value="17:00" >17:00</option>
  589 + <option value="17:30" >17:30</option>
  590 + <option value="18:00" >18:00</option>
  591 + <option value="19:30" >19:30</option>
  592 + <option value="20:00" >20:00</option>
  593 + <option value="20:30" >20:30</option>
  594 + </select>
  595 + <select class="end_time station_end_time" name="station_end_time">
  596 + <option disabled selected>请选择预约结束时间</option>
  597 + <option value="08:30" >08:30</option>
  598 + <option value="09:00" >09:00</option>
  599 + <option value="09:30" >09:30</option>
  600 + <option value="10:00" >10:00</option>
  601 + <option value="10:30" >10:30</option>
  602 + <option value="11:00" >11:00</option>
  603 + <option value="11:30" >11:30</option>
  604 + <option value="12:00" >12:00</option>
  605 + <option value="12:30" >12:30</option>
  606 + <option value="13:00" >13:00</option>
  607 + <option value="13:30" >13:30</option>
  608 + <option value="14:00" >14:00</option>
  609 + <option value="14:30" >14:30</option>
  610 + <option value="15:00" >15:00</option>
  611 + <option value="15:30" >15:30</option>
  612 + <option value="16:00" >16:00</option>
  613 + <option value="16:30" >16:30</option>
  614 + <option value="17:00" >17:00</option>
  615 + <option value="17:30" >17:30</option>
  616 + <option value="18:00" >18:00</option>
  617 + <option value="19:30" >19:30</option>
  618 + <option value="20:00" >20:00</option>
  619 + <option value="20:30" >20:30</option>
  620 + <option value="21:00" >21:00</option>
  621 + </select>
  622 + </div>
  623 + <div class="input_control">
  624 + <span><span class="required_s">*</span>预约形式</span>
  625 + <select class="apply_type station_type" name="station_type" lay-verify="">
  626 + <option value="1" selected>个人</option>
  627 + <option value="2" >公司</option>
  628 + <option value="3" >团队</option>
  629 + </select>
  630 + </div>
  631 + <div class="input_control">
  632 + <span><span class="required_s">*</span>参与人数</span>
  633 + <input name="station_user_count" type="text" class="form_input" placeholder="参与人数" />
  634 + </div>
  635 + <div class="input_control">
  636 + <span>使用设备说明</span>
  637 + <textarea name="station_desc" id="station_desc" required lay-verify="required" placeholder="使用设备说明" class="layui-textarea"></textarea>
  638 + </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>
  642 + </div>
  643 +
  644 + </div>
  645 + </div>
  646 +
  647 + </div>
  648 + </div>
  649 + </div>
  650 +
534 </div> 651 </div>
535 </div> 652 </div>
536 653
1 -define(['jquery', 'bootstrap', 'frontend', 'form', 'template', 'swiper', 'layer', 'layui'], function ($, undefined, Frontend,  
2 - Form, Template, Swiper, Layer, layui) {  
3 - var Controller = {  
4 - index: function () {  
5 - require(['upload'], function (Upload) {  
6 - // console.log(true)  
7 - var first_swiper = new Swiper('#first_swiper', {  
8 - loop: true, // 循环模式选项  
9 - // 如果需要分页器  
10 - autoplay: true,  
11 - pagination: {  
12 - el: '.swiper-pagination',  
13 - }  
14 - })  
15 - Upload.api.upload($('#btn-upload'));  
16 - $(".defaultOption").click(function(){  
17 - $(this).parents(".myCollapse").find(".options").toggleClass("optionShow")  
18 - })  
19 - $(".options .option").click(function(){  
20 - $(this).parents(".myCollapse").find(".defaultOption text").text($(this).text())  
21 -  
22 - $(".options").removeClass("optionShow")  
23 - })  
24 - $(".add").click(function () {  
25 - var len = $(".list").length + 1  
26 - $(".joiner").append(getPeopleItem(len))  
27 - })  
28 - function getPeopleItem(index) {  
29 - return `<div class="list">  
30 - <div>  
31 - <text>姓名</text>  
32 - <input type="text" />  
33 - <text>学号</text>  
34 - <input type="text" />  
35 - </div>  
36 - </div>`  
37 - }  
38 - });  
39 - function getBeforeDate(n){//n为你要传入的参数,当前为0,前一天为-1,后一天为1  
40 - var date = new Date() ;  
41 - var year,month,day ;  
42 - date.setDate(date.getDate()+n);  
43 - year = date.getFullYear();  
44 - month = date.getMonth()+1;  
45 - day = date.getDate() ;  
46 - s = year + '-' + ( month < 10 ? ( '0' + month ) : month ) + '-' + ( day < 10 ? ( '0' + day ) : day) ;  
47 - return s ;  
48 - }  
49 - layui.use('element', function () {  
50 - var $ = layui.jquery  
51 - , element = layui.element;  
52 - });  
53 - layui.use('laydate', function(){  
54 - var laydate = layui.laydate;  
55 - laydate.render({  
56 - elem: '#apply_date',  
57 - type: 'date',  
58 - min:0,  
59 - max:getBeforeDate(7)  
60 - });  
61 - });  
62 -  
63 - layui.use('laydate', function(){  
64 - var laydate = layui.laydate;  
65 - laydate.render({  
66 - elem: '#test10'  
67 - ,type: 'datetime'  
68 - ,range: true  
69 - });  
70 - });  
71 - $(".showdetial").click(function () {  
72 - $(this).parents(".outter").addClass("detial")  
73 - $(this).parents(".outter").siblings().removeClass("detial")  
74 - })  
75 - $(".change").click(function(){  
76 - $(this).parents(".inner").addClass("detial")  
77 - $(this).parents(".inner").siblings().removeClass("detial")  
78 - })  
79 - $(".back").click(function(){  
80 - $(this).parents(".inner").addClass("detial")  
81 - $(this).parents(".inner").siblings().removeClass("detial")  
82 - });  
83 -  
84 - /**  
85 - * 房间预约  
86 - */  
87 - $(document).on('click','#build_type li:not(:first-child)',function(){  
88 - $(this).children('a').addClass("conditions_select");  
89 - $(this).siblings('li').children('a').removeClass("conditions_select");  
90 -  
91 - var $bulidId = $(this).children('a').attr("data-id");  
92 - if($bulidId != '0') {  
93 - Fast.api.ajax({  
94 - url:'building/getFloorList',  
95 - data:{building_id:$bulidId}  
96 - },function (ret) {  
97 - if(ret) {  
98 - clear_floor();  
99 - var str = '';  
100 - $.each(ret,function(i,v) {  
101 - str +='<li><a title="'+v.floor_name+'" href="javascript:;" data-id="'+v.id+'">'+v.floor_name+'</a></li>';  
102 - });  
103 - $("#floor").append(str);  
104 - }  
105 - return false;  
106 - });  
107 - }else{  
108 - clear_floor();  
109 - }  
110 - get_room();  
111 - });  
112 -  
113 - $(document).on('click','#floor li:not(:first-child),#room_type li:not(:first-child) ,#build_type li:not(:first-child)',function(){  
114 - $(this).children('a').addClass("conditions_select");  
115 - $(this).siblings('li').children('a').removeClass("conditions_select");  
116 - get_room();  
117 - });  
118 - //房间选择 不需要请求 房间接口  
119 - $(document).on('click','#room li:not(:first-child)',function(){  
120 - $(this).children('a').addClass("conditions_select");  
121 - $(this).siblings('li').children('a').removeClass("conditions_select");  
122 - })  
123 -  
124 - //清除所有楼层  
125 - function clear_floor() {  
126 - var floor_lis = $("#floor li");  
127 - $.each(floor_lis,function(i,v) {  
128 - if(i > 1) {  
129 - $(this).remove();  
130 - }  
131 - });  
132 - }  
133 - //清除房间  
134 - function clear_room() {  
135 - var room_lis = $("#room li");  
136 - $.each(room_lis,function(i,v) {  
137 - if(i > 1) {  
138 - $(this).remove();  
139 - }  
140 - });  
141 - }  
142 - //查看检索条件 搜索可用房间  
143 - function get_room() {  
144 - var roomType = $("#room_type .conditions_select").attr("data-id"),  
145 - buildId = $("#build_type .conditions_select").attr("data-id"),  
146 - floorId = $("#floor .conditions_select").attr("data-id");  
147 - Fast.api.ajax({  
148 - url:'building/getRoomList',  
149 - data:{room_type:roomType,building_id:buildId,floor_id:floorId}  
150 - },function (ret) {  
151 - if(ret) {  
152 - clear_room();  
153 - var str = '';  
154 - $.each(ret,function(i,v) {  
155 - str +='<li><a title="'+v.room_name+'" href="javascript:;" data-id="'+v.id+'">'+v.room_name+'</a></li>';  
156 - });  
157 - $("#room").append(str);  
158 - }  
159 - return false;  
160 - });  
161 - }  
162 -  
163 - $(document).on('click',"#commit_build",function(){  
164 - var room_id = $("#room .conditions_select").attr("data-id"),  
165 - apply_date = $("input[name='apply_date']").val(),  
166 - use_count = $("input[name='use_count']").val(),  
167 - start_time = $(".start_time option:selected").val(),  
168 - end_time = $(".end_time option:selected").val(),  
169 - apply_desc = $("#apply_desc").val();  
170 - apply_type = $(".apply_type option:selected").val();  
171 - if(room_id == '0') {  
172 - layer.msg('请选择房间');  
173 - return false;  
174 - }  
175 - if(apply_date =='') {  
176 - layer.msg('请选择预约日期');  
177 - return false;  
178 - }  
179 - if(start_time == '') {  
180 - layer.msg('请选择预约开始时间');  
181 - return false;  
182 - }  
183 - if(end_time == '') {  
184 - layer.msg('请选择预约结束时间');  
185 - return false;  
186 - }  
187 - if(use_count == '') {  
188 - layer.msg('使用人数不能为空');  
189 - return false;  
190 - }  
191 - Fast.api.ajax({  
192 - url:'building/roomApply',  
193 - data:{room_id:room_id,apply_date:apply_date,start_time:start_time,end_time:end_time,apply_desc:apply_desc,apply_type:apply_type,use_count:use_count}  
194 - },function (i,ret) {  
195 - if(ret.code == 1) {  
196 - setTimeout(function () {  
197 - location.href = ret.url ? ret.url : "/";  
198 - }, 1000);  
199 - }else{  
200 - return false;  
201 - }  
202 - });  
203 - });  
204 - },  
205 - }  
206 - return Controller;  
207 -}); 1 +define(['jquery', 'bootstrap', 'frontend', 'form', 'template', 'swiper', 'layer', 'layui'], function ($, undefined, Frontend,
  2 + Form, Template, Swiper, Layer, layui) {
  3 + var Controller = {
  4 + index: function () {
  5 + require(['upload'], function (Upload) {
  6 + // console.log(true)
  7 + var first_swiper = new Swiper('#first_swiper', {
  8 + loop: true, // 循环模式选项
  9 + // 如果需要分页器
  10 + autoplay: true,
  11 + pagination: {
  12 + el: '.swiper-pagination',
  13 + }
  14 + })
  15 + Upload.api.upload($('#btn-upload'));
  16 + $(".defaultOption").click(function(){
  17 + $(this).parents(".myCollapse").find(".options").toggleClass("optionShow")
  18 + })
  19 + $(".options .option").click(function(){
  20 + $(this).parents(".myCollapse").find(".defaultOption text").text($(this).text())
  21 +
  22 + $(".options").removeClass("optionShow")
  23 + })
  24 + $(".add").click(function () {
  25 + var len = $(".list").length + 1
  26 + $(".joiner").append(getPeopleItem(len))
  27 + })
  28 + function getPeopleItem(index) {
  29 + return `<div class="list">
  30 + <div>
  31 + <text>姓名</text>
  32 + <input type="text" />
  33 + <text>学号</text>
  34 + <input type="text" />
  35 + </div>
  36 + </div>`
  37 + }
  38 + });
  39 + function getBeforeDate(n){//n为你要传入的参数,当前为0,前一天为-1,后一天为1
  40 + var date = new Date() ;
  41 + var year,month,day ;
  42 + date.setDate(date.getDate()+n);
  43 + year = date.getFullYear();
  44 + month = date.getMonth()+1;
  45 + day = date.getDate() ;
  46 + s = year + '-' + ( month < 10 ? ( '0' + month ) : month ) + '-' + ( day < 10 ? ( '0' + day ) : day) ;
  47 + return s ;
  48 + }
  49 + layui.use('element', function () {
  50 + var $ = layui.jquery
  51 + , element = layui.element;
  52 + });
  53 + layui.use('laydate', function(){
  54 + var laydate = layui.laydate;
  55 + laydate.render({
  56 + elem: '#apply_date',
  57 + type: 'date',
  58 + min:0,
  59 + max:getBeforeDate(7)
  60 + });
  61 + });
  62 +
  63 + layui.use('laydate', function(){
  64 + var laydate = layui.laydate;
  65 + laydate.render({
  66 + elem: '#station_date',
  67 + type: 'date',
  68 + min:0,
  69 + max:getBeforeDate(7)
  70 + });
  71 + });
  72 +
  73 + layui.use('laydate', function(){
  74 + var laydate = layui.laydate;
  75 + laydate.render({
  76 + elem: '#test10'
  77 + ,type: 'datetime'
  78 + ,range: true
  79 + });
  80 + });
  81 + $(".showdetial").click(function () {
  82 + $(this).parents(".outter").addClass("detial")
  83 + $(this).parents(".outter").siblings().removeClass("detial")
  84 + })
  85 + $(".change").click(function(){
  86 + $(this).parents(".inner").addClass("detial")
  87 + $(this).parents(".inner").siblings().removeClass("detial")
  88 + })
  89 + $(".back").click(function(){
  90 + $(this).parents(".inner").addClass("detial")
  91 + $(this).parents(".inner").siblings().removeClass("detial")
  92 + });
  93 +
  94 + /**
  95 + * 房间预约
  96 + */
  97 + $(document).on('click','#build_type li:not(:first-child)',function(){
  98 + $(this).children('a').addClass("conditions_select");
  99 + $(this).siblings('li').children('a').removeClass("conditions_select");
  100 +
  101 + var $bulidId = $(this).children('a').attr("data-id");
  102 + if($bulidId != '0') {
  103 + Fast.api.ajax({
  104 + url:'building/getFloorList',
  105 + data:{building_id:$bulidId}
  106 + },function (ret) {
  107 + if(ret) {
  108 + clear_floor();
  109 + var str = '';
  110 + $.each(ret,function(i,v) {
  111 + str +='<li><a title="'+v.floor_name+'" href="javascript:;" data-id="'+v.id+'">'+v.floor_name+'</a></li>';
  112 + });
  113 + $("#floor").append(str);
  114 + }
  115 + return false;
  116 + });
  117 + }else{
  118 + clear_floor();
  119 + }
  120 + get_room();
  121 + });
  122 +
  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");
  127 + });
  128 + //房间选择 不需要请求 房间接口
  129 + $(document).on('click','#room li:not(:first-child)',function(){
  130 + $(this).children('a').addClass("conditions_select");
  131 + $(this).siblings('li').children('a').removeClass("conditions_select");
  132 + })
  133 +
  134 + $(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");
  136 + $(this).siblings('li').children('a').removeClass("conditions_select");
  137 + get_room();
  138 + });
  139 +
  140 + //清除所有楼层
  141 + function clear_floor() {
  142 + var floor_lis = $("#floor li");
  143 + $.each(floor_lis,function(i,v) {
  144 + if(i > 1) {
  145 + $(this).remove();
  146 + }
  147 + });
  148 + }
  149 + //清除房间
  150 + function clear_room() {
  151 + var room_lis = $("#room li");
  152 + $.each(room_lis,function(i,v) {
  153 + if(i > 1) {
  154 + $(this).remove();
  155 + }
  156 + });
  157 + }
  158 + //查看检索条件 搜索可用房间
  159 + function get_room() {
  160 + var roomType = $("#room_type .conditions_select").attr("data-id"),
  161 + buildId = $("#build_type .conditions_select").attr("data-id"),
  162 + floorId = $("#floor .conditions_select").attr("data-id");
  163 + Fast.api.ajax({
  164 + url:'building/getRoomList',
  165 + data:{room_type:roomType,building_id:buildId,floor_id:floorId}
  166 + },function (ret) {
  167 + if(ret) {
  168 + clear_room();
  169 + var str = '';
  170 + $.each(ret,function(i,v) {
  171 + str +='<li><a title="'+v.room_name+'" href="javascript:;" data-id="'+v.id+'">'+v.room_name+'</a></li>';
  172 + });
  173 + $("#room").append(str);
  174 + }
  175 + return false;
  176 + });
  177 + }
  178 + $(document).on('click',"#commit_station",function(){
  179 + var conditions_select = $("#stations .conditions_select").attr("data-id"),
  180 + 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(),
  183 + station_end_time = $(".station_end_time option:selected").val();
  184 + station_desc = $("#station_desc").val();
  185 + apply_type = $(".station_type option:selected").val();
  186 + console.log(station_start_time);
  187 + console.log(station_end_time);
  188 + if(!conditions_select) {
  189 + layer.msg('请选择工位');
  190 + return false;
  191 + }
  192 +
  193 + if(!station_date) {
  194 + layer.msg('请选择预约日期');
  195 + return false;
  196 + }
  197 + if(!station_start_time) {
  198 + layer.msg('请选择预约开始时间');
  199 + return false;
  200 + }
  201 + if(!station_end_time) {
  202 + layer.msg('请选择预约结束时间');
  203 + return false;
  204 + }
  205 + if(station_user_count == '') {
  206 + layer.msg('使用人数不能为空');
  207 + return false;
  208 + }
  209 + setTimeout(function () {
  210 + layer.msg('提交成功');
  211 + }, 1000);
  212 + });
  213 +
  214 + $(document).on('click',"#commit_build",function(){
  215 + var room_id = $("#room .conditions_select").attr("data-id"),
  216 + apply_date = $("input[name='apply_date']").val(),
  217 + use_count = $("input[name='use_count']").val(),
  218 + start_time = $(".start_time option:selected").val(),
  219 + end_time = $(".end_time option:selected").val(),
  220 + apply_desc = $("#apply_desc").val();
  221 + apply_type = $(".apply_type option:selected").val();
  222 + if(room_id == '0') {
  223 + layer.msg('请选择房间');
  224 + return false;
  225 + }
  226 + if(apply_date =='') {
  227 + layer.msg('请选择预约日期');
  228 + return false;
  229 + }
  230 + if(start_time == '') {
  231 + layer.msg('请选择预约开始时间');
  232 + return false;
  233 + }
  234 + if(end_time == '') {
  235 + layer.msg('请选择预约结束时间');
  236 + return false;
  237 + }
  238 + if(use_count == '') {
  239 + layer.msg('使用人数不能为空');
  240 + return false;
  241 + }
  242 + Fast.api.ajax({
  243 + url:'building/roomApply',
  244 + data:{room_id:room_id,apply_date:apply_date,start_time:start_time,end_time:end_time,apply_desc:apply_desc,apply_type:apply_type,use_count:use_count}
  245 + },function (i,ret) {
  246 + if(ret.code == 1) {
  247 + setTimeout(function () {
  248 + location.href = ret.url ? ret.url : "/";
  249 + }, 1000);
  250 + }else{
  251 + return false;
  252 + }
  253 + });
  254 + });
  255 + },
  256 + }
  257 + return Controller;
  258 +});