|
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
|
+}); |