苗总组局小程序
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

80 lines
4.9 KiB

define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
var Controller = {
index: function () {
// 初始化表格参数配置
Table.api.init({
extend: {
index_url: 'venue/index' + location.search,
add_url: 'venue/add',
edit_url: 'venue/edit',
del_url: 'venue/del',
multi_url: 'venue/multi',
import_url: 'venue/import',
table: 'venue',
}
});
var table = $("#table");
// 初始化表格
table.bootstrapTable({
url: $.fn.bootstrapTable.defaults.extend.index_url,
pk: 'id',
sortName: 'id',
fixedColumns: true,
fixedRightNumber: 1,
columns: [
[
{checkbox: true},
{field: 'id', title: __('Id')},
{field: 'gid', title: __('组局名称'),searchList:$.getJSON('venue/getgroup'),visible:false},
{field: 'group_title', title: __('组局名称'),searchable:false},
{field: 'part_date', title: __('Part_date'), operate:'RANGE', addclass:'datetimerange', autocomplete:false},
{field: 'start_time_text', title: __('Start_time'), operate: 'LIKE'},
{field: 'end_time_text', title: __('End_time'), operate: 'LIKE'},
{field: 'min_people', title: __('Min_people')},
{field: 'max_people', title: __('Max_people')},
{field: 'pay_price', title: __('Pay_price'), operate:'BETWEEN'},
{field: 'status', title: __('状态'), searchList: {"0":'未开场',"1":'组局中',"2":'可开场',"3":'已结束'}, formatter: Table.api.formatter.status},
{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
]
]
});
// 为表格绑定事件
Table.api.bindevent(table);
},
add: function () {
$("#addshiduan").on("click",function(){
console.log($(".datetimerange").length);
var i = 1+$(".datetimerange2").length;
$("#start_time_div").after('<div class="form-group remove'+i+'" style="margin-top:20px"><a href="javascript:;" class="btn btn-xs btn-danger btn-delone removediv" type="button" onclick="removediv('+i+')" ><i class="fa fa-trash"></i></a> <label class="control-label col-xs-12 col-sm-2">场次标题'+i+':</label><div class="col-xs-12 col-sm-8"><input id="c-title" class="form-control" name="row[title][]" type="text" value=""></div></div><div class="form-group remove'+i+'"><label class="control-label col-xs-12 col-sm-2">场次时段'+i+':</label><div class="col-xs-12 col-sm-8"><input id="c-start_time'+i+'" class="form-control datetimerange datetimerange2" placeholder="请选择场次时段" date-show-dropdowns="false" data-time-picker="true" data-locale=\'{"format":"HH:mm","separator":" - "}\' style="margin-top:10px" data-use-current="true" name="row[start_time][]" type="text" value="00:00 - 00:00" ></div></div><div class="form-group remove'+i+'" ><label class="control-label col-xs-12 col-sm-2">最小人数'+i+':</label><div class="col-xs-12 col-sm-8"><input id="c-min_people" class="form-control" name="row[min_people][]" type="number" placeholder="请输入最小人数"></div></div><div class="form-group remove'+i+'"><label class="control-label col-xs-12 col-sm-2">最大人数'+i+':</label><div class="col-xs-12 col-sm-8"><input id="c-max_people" class="form-control" name="row[max_people][]" type="number" placeholder="请输入最大人数"></div></div><div class="form-group remove'+i+'"><label class="control-label col-xs-12 col-sm-2">付费价格'+i+':</label><div class="col-xs-12 col-sm-8"><input id="c-pay_price" class="form-control" step="0.01" name="row[pay_price][]" type="number" placeholder="请输入付费价格"></div></div>')
$('.datetimerange2').daterangepicker({
autoUpdateInput : true,
timePicker:true,
timePicker24Hour:true,
locale: {
format: 'HH:mm',
separator:" - "
}
});
});
Controller.api.bindevent();
},
edit: function () {
Controller.api.bindevent();
},
pushall: function () {
Controller.api.bindevent();
},
api: {
bindevent: function () {
Form.api.bindevent($("form[role=form]"));
}
}
};
return Controller;
});