|
|
|
define(['jquery', 'bootstrap', 'backend', 'table', 'form','layer'], function ($, undefined, Backend, Table, Form,Layer) {
|
|
|
|
|
|
|
|
var Controller = {
|
|
|
|
index: function () {
|
|
|
|
//修改弹框大小
|
|
|
|
// $(".btn-add").data("area",["100%","100%"]);
|
|
|
|
// $(".btn-edit").data("area",["100%","100%"]);
|
|
|
|
index: function() {
|
|
|
|
// 初始化表格参数配置
|
|
|
|
Table.api.init({
|
|
|
|
extend: {
|
|
|
|
index_url: 'project_appointment/room_order/index' + location.search,
|
|
|
|
auth_url: 'project_appointment/room_order/verify',
|
|
|
|
table: 'room',
|
|
|
|
Table.api.init();
|
|
|
|
|
|
|
|
//绑定事件
|
|
|
|
$('a[data-toggle="tab"]').on('shown.bs.tab', function (e) {
|
|
|
|
var panel = $($(this).attr("href"));
|
|
|
|
if (panel.size() > 0) {
|
|
|
|
Controller.table[panel.attr("id")].call(this);
|
|
|
|
$(this).on('click', function (e) {
|
|
|
|
$($(this).attr("href")).find(".btn-refresh").trigger("click");
|
|
|
|
});
|
|
|
|
}
|
|
|
|
//移除绑定的事件
|
|
|
|
$(this).unbind('shown.bs.tab');
|
|
|
|
});
|
|
|
|
|
|
|
|
var table = $("#table");
|
|
|
|
// 初始化表格
|
|
|
|
table.bootstrapTable({
|
|
|
|
url: $.fn.bootstrapTable.defaults.extend.index_url,
|
|
|
|
pk: 'id',
|
|
|
|
sortName: 'id',
|
|
|
|
pageSize:10,
|
|
|
|
columns: [
|
|
|
|
[
|
|
|
|
{checkbox: true},
|
|
|
|
{field: 'id', title: __('Id'),operate: false},
|
|
|
|
{field: 'apply_name', title: __('申请人'),operate: 'LIKE'},
|
|
|
|
{field: 'room_name', title: __('房间名称'),operate: 'LIKE'},
|
|
|
|
{field: 'apply_date', title: __('预约日期'),operate: false},
|
|
|
|
{field: 'start_time', title: __('预约结束时间'),operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
|
|
|
|
{field: 'end_time', title: __('预约结束时间'),operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
|
|
|
|
{field: 'use_count', title: __('使用人数'),operate: false},
|
|
|
|
{field: 'apply_desc', title: __('预约说明'),operate: false},
|
|
|
|
{field: 'status_text', title: __('审核状态'),operate: false},
|
|
|
|
{field: 'createtime', title: __('创建时间'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
|
|
|
|
{
|
|
|
|
field: 'operate',
|
|
|
|
title: __('Operate'),
|
|
|
|
table: table,
|
|
|
|
events: Table.api.events.operate,
|
|
|
|
formatter: Table.api.formatter.operate,
|
|
|
|
buttons:[
|
|
|
|
{
|
|
|
|
name: 'btn',
|
|
|
|
text: '审核',
|
|
|
|
title: '审核',
|
|
|
|
classname: 'btn btn-xs btn-success btn-click',
|
|
|
|
click: function (val, row) {
|
|
|
|
var id = row.id;
|
|
|
|
var row_index = val.rowIndex;
|
|
|
|
layer.confirm('您想?', {
|
|
|
|
btn: ['通过审核','驳回审核'] //按钮
|
|
|
|
}, function(){
|
|
|
|
$.ajax({
|
|
|
|
type:'post',
|
|
|
|
url:'project_appointment/room_order/verify',
|
|
|
|
data:{id:id,status:2},
|
|
|
|
dataType:'json',
|
|
|
|
success:function(res){
|
|
|
|
if(parseInt(res.code) !=0){
|
|
|
|
$('#table').bootstrapTable('updateRow', {
|
|
|
|
index: row_index,
|
|
|
|
row: {
|
|
|
|
status_text: '审核通过',
|
|
|
|
}
|
|
|
|
});
|
|
|
|
//必须默认触发shown.bs.tab事件
|
|
|
|
$('ul.nav-tabs li.active a[data-toggle="tab"]').trigger("shown.bs.tab");
|
|
|
|
},
|
|
|
|
table: {
|
|
|
|
first: function () {
|
|
|
|
// 表格1
|
|
|
|
var table1 = $("#table1");
|
|
|
|
table1.bootstrapTable({
|
|
|
|
url: 'project_appointment/room_order/index' + location.search,
|
|
|
|
toolbar: '#toolbar1',
|
|
|
|
sortName: 'id',
|
|
|
|
search: false,
|
|
|
|
columns: [
|
|
|
|
[
|
|
|
|
{checkbox: true},
|
|
|
|
{field: 'id', title: __('Id'),operate: false},
|
|
|
|
{field: 'username', title: __('申请人'),operate: 'LIKE'},
|
|
|
|
{field: 'room_name', title: __('房间名称'),operate: 'LIKE'},
|
|
|
|
{field: 'apply_date', title: __('预约日期'),operate: false},
|
|
|
|
{field: 'start_time', title: __('预约结束时间'),operate:false, addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
|
|
|
|
{field: 'end_time', title: __('预约结束时间'),operate:false, addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
|
|
|
|
{field: 'use_count', title: __('使用人数'),operate: false},
|
|
|
|
{field: 'apply_desc', title: __('预约说明'),operate: false},
|
|
|
|
{field: 'status_text', title: __('审核状态'),operate: false},
|
|
|
|
{field: 'createtime', title: __('创建时间'), operate:false, addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
|
|
|
|
{
|
|
|
|
field: 'operate',
|
|
|
|
title: __('Operate'),
|
|
|
|
table: table1,
|
|
|
|
events: Table.api.events.operate,
|
|
|
|
formatter: Table.api.formatter.operate,
|
|
|
|
buttons:[
|
|
|
|
{
|
|
|
|
name: 'btn',
|
|
|
|
text: '审核',
|
|
|
|
title: '审核',
|
|
|
|
classname: 'btn btn-xs btn-success btn-click',
|
|
|
|
click: function (val, row) {
|
|
|
|
var id = row.id;
|
|
|
|
var row_index = val.rowIndex;
|
|
|
|
layer.confirm('您想?', {
|
|
|
|
btn: ['通过审核','驳回审核'] //按钮
|
|
|
|
}, function(){
|
|
|
|
$.ajax({
|
|
|
|
type:'post',
|
|
|
|
url:'project_appointment/room_order/verify',
|
|
|
|
data:{id:id,status:2},
|
|
|
|
dataType:'json',
|
|
|
|
success:function(res){
|
|
|
|
if(parseInt(res.code) !=0){
|
|
|
|
$('.btn-refresh').click();
|
|
|
|
}
|
|
|
|
|
|
|
|
layer.msg(res.msg, {icon: 1});
|
|
|
|
},
|
|
|
|
error:function(error){
|
|
|
|
console.log(error);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
}, function(){
|
|
|
|
$.ajax({
|
|
|
|
type:'post',
|
|
|
|
url:'project_appointment/room_order/verify',
|
|
|
|
data:{id:id,status:3},
|
|
|
|
dataType:'json',
|
|
|
|
success:function(res){
|
|
|
|
if(parseInt(res.code) !=0){
|
|
|
|
$('.btn-refresh').click();
|
|
|
|
}
|
|
|
|
layer.msg(res.msg, {icon: 1});
|
|
|
|
},
|
|
|
|
error:function(error){
|
|
|
|
console.log(error);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
layer.msg(res.msg, {icon: 1});
|
|
|
|
},
|
|
|
|
error:function(error){
|
|
|
|
console.log(error);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
},
|
|
|
|
visible: function (val) {
|
|
|
|
if(val.status == 1) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
]
|
|
|
|
},
|
|
|
|
|
|
|
|
]
|
|
|
|
],
|
|
|
|
});
|
|
|
|
|
|
|
|
// 为表格1绑定事件
|
|
|
|
Table.api.bindevent(table1);
|
|
|
|
},
|
|
|
|
second: function () {
|
|
|
|
// 表格2
|
|
|
|
var table2 = $("#table2");
|
|
|
|
table2.bootstrapTable({
|
|
|
|
url: 'station_appointment/index' + location.search,
|
|
|
|
toolbar: '#toolbar2',
|
|
|
|
sortName: 'id',
|
|
|
|
search: false,
|
|
|
|
columns: [
|
|
|
|
[
|
|
|
|
{checkbox: true},
|
|
|
|
{field: 'id', title: __('Id'),operate: false},
|
|
|
|
{field: 'username', title: __('申请人'),operate: 'LIKE'},
|
|
|
|
{field: 'station_name', title: __('工位名称'),operate: 'LIKE'},
|
|
|
|
{field: 'station_date', title: __('预约日期'),operate: false},
|
|
|
|
{field: 'station_start_time', title: __('预约结束时间'),operate:false, addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
|
|
|
|
{field: 'station_end_time', title: __('预约结束时间'),operate:false, addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
|
|
|
|
{field: 'station_user_count', title: __('使用人数'),operate: false},
|
|
|
|
{field: 'station_desc', title: __('预约说明'),operate: false},
|
|
|
|
{field: 'status_text', title: __('审核状态'),operate: false},
|
|
|
|
{field: 'createtime', title: __('创建时间'), operate:false, addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
|
|
|
|
{
|
|
|
|
field: 'operate',
|
|
|
|
title: __('Operate'),
|
|
|
|
table: table2,
|
|
|
|
events: Table.api.events.operate,
|
|
|
|
formatter: Table.api.formatter.operate,
|
|
|
|
buttons:[
|
|
|
|
{
|
|
|
|
name: 'btn',
|
|
|
|
text: '审核',
|
|
|
|
title: '审核',
|
|
|
|
classname: 'btn btn-xs btn-success btn-click',
|
|
|
|
click: function (val, row) {
|
|
|
|
var id = row.id;
|
|
|
|
layer.confirm('您想?', {
|
|
|
|
btn: ['通过审核','驳回审核'] //按钮
|
|
|
|
}, function(){
|
|
|
|
$.ajax({
|
|
|
|
type:'post',
|
|
|
|
url:'station_appointment/verify',
|
|
|
|
data:{id:id,status:1},
|
|
|
|
dataType:'json',
|
|
|
|
success:function(res){
|
|
|
|
if(parseInt(res.code) !=0){
|
|
|
|
$('.btn-refresh').click();
|
|
|
|
}
|
|
|
|
|
|
|
|
}, function(){
|
|
|
|
$.ajax({
|
|
|
|
type:'post',
|
|
|
|
url:'project_appointment/room_order/verify',
|
|
|
|
data:{id:id,status:3},
|
|
|
|
dataType:'json',
|
|
|
|
success:function(res){
|
|
|
|
if(parseInt(res.code) !=0){
|
|
|
|
$('#table').bootstrapTable('updateRow', {
|
|
|
|
index: row_index,
|
|
|
|
row: {
|
|
|
|
status_text: '已驳回',
|
|
|
|
}
|
|
|
|
});
|
|
|
|
layer.msg(res.msg, {icon: 1});
|
|
|
|
},
|
|
|
|
error:function(error){
|
|
|
|
console.log(error);
|
|
|
|
}
|
|
|
|
layer.msg(res.msg, {icon: 1});
|
|
|
|
},
|
|
|
|
error:function(error){
|
|
|
|
console.log(error);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
});
|
|
|
|
},
|
|
|
|
/* visible: function (val) {
|
|
|
|
if(val.status != 1) {
|
|
|
|
return false;
|
|
|
|
}else{
|
|
|
|
return true;
|
|
|
|
}, function(){
|
|
|
|
$.ajax({
|
|
|
|
type:'post',
|
|
|
|
url:'station_appointment/verify',
|
|
|
|
data:{id:id,status:2},
|
|
|
|
dataType:'json',
|
|
|
|
success:function(res){
|
|
|
|
if(parseInt(res.code) !=0){
|
|
|
|
$('.btn-refresh').click();
|
|
|
|
}
|
|
|
|
layer.msg(res.msg, {icon: 1});
|
|
|
|
},
|
|
|
|
error:function(error){
|
|
|
|
console.log(error);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
});
|
|
|
|
},
|
|
|
|
visible: function (val) {
|
|
|
|
if(val.status == 0) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}*/
|
|
|
|
},
|
|
|
|
]
|
|
|
|
},
|
|
|
|
},
|
|
|
|
]
|
|
|
|
},
|
|
|
|
|
|
|
|
]
|
|
|
|
],
|
|
|
|
});
|
|
|
|
]
|
|
|
|
],
|
|
|
|
});
|
|
|
|
|
|
|
|
$('.search input').attr('placeholder','搜索');
|
|
|
|
// 为表格绑定事件
|
|
|
|
Table.api.bindevent(table);
|
|
|
|
// 为表格2绑定事件
|
|
|
|
Table.api.bindevent(table2);
|
|
|
|
}
|
|
|
|
},
|
|
|
|
add: function () {
|
|
|
|
Controller.api.bindevent();
|
...
|
...
|
|