211 lines
10 KiB
JavaScript
211 lines
10 KiB
JavaScript
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
|
|
|
|
var Controller = {
|
|
index: function () {
|
|
// 初始化表格参数配置
|
|
Table.api.init({
|
|
extend: {
|
|
index_url: 'wdsxh/jielong/index' + location.search,
|
|
add_url: 'wdsxh/jielong/add',
|
|
edit_url: 'wdsxh/jielong/edit',
|
|
del_url: 'wdsxh/jielong/del',
|
|
multi_url: 'wdsxh/jielong/multi',
|
|
import_url: 'wdsxh/jielong/import',
|
|
table: 'wdsxh_jielong',
|
|
}
|
|
});
|
|
|
|
var table = $("#table");
|
|
|
|
table.on('post-body.bs.table', function (e, settings, json, xhr) {
|
|
$(".btn-editone,.btn-edit,.btn-add").data("area", ["100%", "100%"]);
|
|
});
|
|
|
|
// 初始化表格
|
|
table.bootstrapTable({
|
|
url: $.fn.bootstrapTable.defaults.extend.index_url,
|
|
pk: 'id',
|
|
sortName: 'weigh',
|
|
// fixedColumns: true,
|
|
// fixedRightNumber: 1,
|
|
columns: [
|
|
[
|
|
{checkbox: true},
|
|
{field: 'id', title: __('Id')},
|
|
{field: 'name', title: __('Name'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
|
|
{field: 'member_name', title: __('发布人名称'), operate: false},
|
|
{field: 'type', title: __('Type'), searchList: {"1":__('Type 1'),"2":__('Type 2')}, formatter: Table.api.formatter.normal},
|
|
{field: 'expire_time', title: __('Expire_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
|
|
// {field: 'member_ids', title: __('Member_ids'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
|
|
{field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
|
|
// {field: 'updatetime', title: __('Updatetime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
|
|
{field: 'weigh', title: __('Weigh'), operate: false},
|
|
{field: 'status', title: __('Status'), searchList: {"normal":__('Status normal'),"hidden":__('Status hidden')}, formatter: Table.api.formatter.status},
|
|
{field: 'applet_jielong_qrcode_path', title: __('Applet_jielong_qrcode_path'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.image},
|
|
{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate,buttons:[
|
|
{
|
|
name: 'copy_relay',
|
|
text: __('复制接龙'),
|
|
title: __('复制接龙'),
|
|
classname: 'btn btn-xs btn-info btn-magic btn-ajax',
|
|
icon: 'fa fa-floppy-o',
|
|
url: 'wdsxh/jielong/copy_relay',
|
|
confirm: '确认复制此条接龙信息?',
|
|
success: function (data, ret) {
|
|
$("#table").bootstrapTable('refresh',{});
|
|
},
|
|
error: function (data, ret) {
|
|
Toastr.error(ret.msg);
|
|
return false;
|
|
}
|
|
},
|
|
{
|
|
name: 'list',
|
|
text: __('反馈信息'),
|
|
title: __('反馈信息'),
|
|
classname: 'btn btn-xs btn-info btn-dialog',
|
|
icon: 'fa fa-list',
|
|
url: 'wdsxh/jielong/lists?jielong_id={id}',
|
|
callback: function (data) {
|
|
Layer.alert("接收到回传数据:" + JSON.stringify(data), {title: "回传数据"});
|
|
},
|
|
visible: function (row) {
|
|
//返回true时按钮显示,返回false隐藏
|
|
return true;
|
|
}
|
|
},
|
|
]}
|
|
]
|
|
]
|
|
});
|
|
|
|
// 为表格绑定事件
|
|
Table.api.bindevent(table);
|
|
},
|
|
recyclebin: function () {
|
|
// 初始化表格参数配置
|
|
Table.api.init({
|
|
extend: {
|
|
'dragsort_url': ''
|
|
}
|
|
});
|
|
|
|
var table = $("#table");
|
|
|
|
// 初始化表格
|
|
table.bootstrapTable({
|
|
url: 'wdsxh/jielong/recyclebin' + location.search,
|
|
pk: 'id',
|
|
sortName: 'id',
|
|
columns: [
|
|
[
|
|
{checkbox: true},
|
|
{field: 'id', title: __('Id')},
|
|
{field: 'name', title: __('Name'), align: 'left'},
|
|
{
|
|
field: 'deletetime',
|
|
title: __('Deletetime'),
|
|
operate: 'RANGE',
|
|
addclass: 'datetimerange',
|
|
formatter: Table.api.formatter.datetime
|
|
},
|
|
{
|
|
field: 'operate',
|
|
width: '140px',
|
|
title: __('Operate'),
|
|
table: table,
|
|
events: Table.api.events.operate,
|
|
buttons: [
|
|
{
|
|
name: 'Restore',
|
|
text: __('Restore'),
|
|
classname: 'btn btn-xs btn-info btn-ajax btn-restoreit',
|
|
icon: 'fa fa-rotate-left',
|
|
url: 'wdsxh/jielong/restore',
|
|
refresh: true
|
|
},
|
|
{
|
|
name: 'Destroy',
|
|
text: __('Destroy'),
|
|
classname: 'btn btn-xs btn-danger btn-ajax btn-destroyit',
|
|
icon: 'fa fa-times',
|
|
url: 'wdsxh/jielong/destroy',
|
|
refresh: true
|
|
}
|
|
],
|
|
formatter: Table.api.formatter.operate
|
|
}
|
|
]
|
|
]
|
|
});
|
|
|
|
// 为表格绑定事件
|
|
Table.api.bindevent(table);
|
|
},
|
|
|
|
add: function () {
|
|
Controller.api.bindevent();
|
|
},
|
|
edit: function () {
|
|
Controller.api.bindevent();
|
|
},
|
|
config: function () {
|
|
Controller.api.bindevent();
|
|
},
|
|
lists: function () {
|
|
// 初始化表格参数配置
|
|
Table.api.init({
|
|
extend: {
|
|
'dragsort_url': ''
|
|
}
|
|
});
|
|
|
|
var table = $("#table");
|
|
|
|
// 初始化表格
|
|
table.bootstrapTable({
|
|
url: 'wdsxh/jielong/lists'+ location.search,
|
|
pk: 'id',
|
|
sortName: 'weigh',
|
|
// fixedColumns: true,
|
|
// fixedRightNumber: 1,
|
|
search:false,
|
|
showToggle: false,
|
|
showColumns: false,
|
|
visible: false,
|
|
columns: [
|
|
[
|
|
// {checkbox: true},
|
|
{field: 'id', title: __('Id')},
|
|
{field: 'name', title: __('会员名称'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
|
|
{field: 'images', title: __('图片'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.images},
|
|
{field: 'content', title: __('内容'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
|
|
{field: 'status', title: __('参加状态'), searchList: {"1":__('参加'),"2":__('不参加'),"3":__('参加其他')}, formatter: Table.api.formatter.status},
|
|
{field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
|
|
]
|
|
]
|
|
});
|
|
|
|
// 为表格绑定事件
|
|
Table.api.bindevent(table);
|
|
},
|
|
api: {
|
|
bindevent: function () {
|
|
Form.api.bindevent($("form[role=form]"));
|
|
$(document).on('change','input[name="row[type]"]',function (){
|
|
var type=$(this).val();
|
|
switch (type){
|
|
case "1":
|
|
$('.MemberIds').addClass('hide');
|
|
break;
|
|
case "2":
|
|
$('.MemberIds').removeClass('hide');
|
|
break;
|
|
}
|
|
});
|
|
}
|
|
}
|
|
};
|
|
return Controller;
|
|
});
|