|
@@ -324,7 +324,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
|
|
|
Controller.api.bindevent2();
|
|
|
},
|
|
|
edituser: function () {
|
|
|
- Controller.api.bindevent();
|
|
|
+ Controller.api.bindevent2();
|
|
|
},
|
|
|
edit: function () {
|
|
|
Controller.api.bindevent1();
|
|
@@ -333,17 +333,56 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
|
|
|
bindevent1: function () {
|
|
|
Form.api.bindevent($("form[role=form]"));
|
|
|
},
|
|
|
+ initSubTable: function (index, row, $detail,parent_table) {
|
|
|
+ var admin_id = row.id;
|
|
|
+ var cur_table = $detail.html('<table id="sub_'+ admin_id +'" style="background-color:#d7d1d147"></table>').find('table');
|
|
|
+ var sub_table = $(cur_table);
|
|
|
+ sub_table.bootstrapTable({
|
|
|
+ // url: 'area/index',
|
|
|
+ toolbar: false,
|
|
|
+ showColumns: false,
|
|
|
+ showToggle: false,
|
|
|
+ showExport: false,
|
|
|
+ search: false,
|
|
|
+ pagination:false,
|
|
|
+ commonSearch: false,
|
|
|
+ sortOrder: 'ASC',
|
|
|
+ checkboxHeader: false,
|
|
|
+ columns: [
|
|
|
+ {checkbox: true,
|
|
|
+ formatter: function(value,row,index){
|
|
|
+ if(Config.user_ids != undefined && Config.user_ids.indexOf(row.id)>-1){
|
|
|
+ return true;
|
|
|
+ }else{
|
|
|
+ return {disabled : true}
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // {field: 'id', title: 'ID'},
|
|
|
+ {field: 'username', title: __('学号')},
|
|
|
+ {field: 'nickname', title: __('姓名')},
|
|
|
+ ],
|
|
|
+ data: row.alluser
|
|
|
+ });
|
|
|
+ Table.api.bindevent(sub_table);
|
|
|
+ sub_table.on("check.bs.table uncheck.bs.table check-all.bs.table uncheck-all.bs.table post-body.bs.table", function (e) {
|
|
|
+ var selectedIds = Table.api.selectedids(sub_table);
|
|
|
+ console.log(selectedIds);
|
|
|
+ $(".depart_ids").val(selectedIds.join());
|
|
|
+ })
|
|
|
+ },
|
|
|
bindevent2: function () {
|
|
|
var rel_Ids = [];
|
|
|
var qudui_total = 0;
|
|
|
var xueyuan_total = 0;
|
|
|
Table.api.init({
|
|
|
extend: {
|
|
|
- // index_url: 'department/admin/departadmintotal' + location.search,
|
|
|
- index_url: 'auth/admin/admintotal' + location.search,
|
|
|
+ index_url: 'department/admin/departadmintotal' + location.search,
|
|
|
+ // index_url: 'auth/admin/admintotal' + location.search,
|
|
|
}
|
|
|
});
|
|
|
var table = $("#table1");
|
|
|
+ // var oInit = new Object();
|
|
|
// 初始化表格
|
|
|
table.bootstrapTable({
|
|
|
url: $.fn.bootstrapTable.defaults.extend.index_url,
|
|
@@ -353,53 +392,28 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
|
|
|
fixedRightNumber: 1,
|
|
|
searchFormVisible:false,
|
|
|
// pagination:false,
|
|
|
+ detailView: true,//父子表
|
|
|
Search:false,
|
|
|
columns: [
|
|
|
[
|
|
|
- {checkbox: true,
|
|
|
- formatter: function(value,row,index){
|
|
|
- if(Config.user_ids != undefined && Config.user_ids.indexOf(row.id)>-1){
|
|
|
- rel_Ids.push(row.id);
|
|
|
- return true;
|
|
|
- }
|
|
|
- return false;
|
|
|
- }
|
|
|
- },
|
|
|
- {field: 'department_text', title: __('区队名称'), operate: false,width: '400px', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
|
|
|
- {field: 'nickname', title: __('姓名'),operate: false},
|
|
|
+ {checkbox: true},
|
|
|
+ {field: 'department_name', title: __('区队名称'), operate: false,width: '400px', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
|
|
|
+ {field: 'department_admin_count', title: __('人员数量'),operate: false},
|
|
|
]
|
|
|
],
|
|
|
- onLoadSuccess: function(data) {
|
|
|
- $.each(data.rows, function(index, row) {
|
|
|
- if(Config.user_ids != undefined && Config.user_ids.indexOf(row.id)>-1){
|
|
|
- xueyuan_total = xueyuan_total+1;
|
|
|
- }
|
|
|
-
|
|
|
- });
|
|
|
- $(".xueyuan_total").html(xueyuan_total);
|
|
|
- $(".xueyuan_input").val(xueyuan_total);
|
|
|
+ onExpandRow: function (index, row, $detail) {
|
|
|
+ Controller.api.initSubTable(index, row, $detail);
|
|
|
},
|
|
|
- // 点击每一个单选框时触发的操作
|
|
|
- onCheck:function(row){
|
|
|
- rel_Ids.push(row.id);
|
|
|
- xueyuan_total = xueyuan_total+1;
|
|
|
+ onCheck: function (row, $element) {
|
|
|
+ $('.btn-disabled').addClass('disabled');
|
|
|
+ var id = row.id;
|
|
|
+ $("#sub_" + id).bootstrapTable("checkAll");
|
|
|
|
|
|
- $(".depart_ids").val(rel_Ids.join());
|
|
|
- $(".xueyuan_total").html(xueyuan_total);
|
|
|
- $(".xueyuan_input").val(xueyuan_total);
|
|
|
},
|
|
|
- // 取消每一个单选框时对应的操作;
|
|
|
- onUncheck:function(row){
|
|
|
- var index = rel_Ids.indexOf(row.id);
|
|
|
- if(index > -1) {
|
|
|
- rel_Ids.splice(index, 1);
|
|
|
- }
|
|
|
- xueyuan_total = xueyuan_total-1;
|
|
|
-
|
|
|
- $(".depart_ids").val(rel_Ids.join());
|
|
|
- $(".xueyuan_total").html(xueyuan_total);
|
|
|
- $(".xueyuan_input").val(xueyuan_total);
|
|
|
- }
|
|
|
+ onUncheck: function (row) {
|
|
|
+ var id = row.id;
|
|
|
+ $("#sub_" + id).bootstrapTable("uncheckAll");
|
|
|
+ },
|
|
|
});
|
|
|
|
|
|
// 为表格绑定事件
|
|
@@ -480,73 +494,6 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
|
|
|
$("input[name='btSelectAll']").css('display','none');
|
|
|
Form.api.bindevent($("form[role=form]"));
|
|
|
},
|
|
|
- bindevent: function () {
|
|
|
- var rel_Ids = [];
|
|
|
- Table.api.init({
|
|
|
- extend: {
|
|
|
- // index_url: 'department/admin/departadmintotal' + location.search,
|
|
|
- index_url: 'auth/admin/admintotal' + location.search,
|
|
|
- }
|
|
|
- });
|
|
|
- var table = $("#table1");
|
|
|
-
|
|
|
- // 初始化表格
|
|
|
- table.bootstrapTable({
|
|
|
- url: $.fn.bootstrapTable.defaults.extend.index_url,
|
|
|
- pk: 'id',
|
|
|
- sortName: 'id',
|
|
|
- fixedColumns: true,
|
|
|
- fixedRightNumber: 1,
|
|
|
- searchFormVisible:false,
|
|
|
- // pagination:false,
|
|
|
- Search:false,
|
|
|
- columns: [
|
|
|
- [
|
|
|
- {checkbox: true,
|
|
|
- formatter: function(value,row,index){
|
|
|
- if(Config.user_ids != undefined && Config.user_ids.indexOf(row.id)>-1){
|
|
|
- // rel_Ids.push(row.id);
|
|
|
- return true;
|
|
|
- }else{
|
|
|
- return {disabled : true}
|
|
|
- }
|
|
|
- }
|
|
|
- },
|
|
|
- // {field: 'id', title: __('ID'),operate: false},
|
|
|
- {field: 'department_text', title: __('区队名称'), operate: false,width: '400px', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
|
|
|
- {field: 'nickname', title: __('姓名'),operate: false},
|
|
|
- ]
|
|
|
- ],
|
|
|
- onLoadSuccess: function(data) {
|
|
|
- // $.each(data.rows, function(index, row) {
|
|
|
- // if(Config.user_ids != undefined && Config.user_ids.indexOf(row.id)>-1){
|
|
|
- // xueyuan_total = xueyuan_total+1;
|
|
|
- // }
|
|
|
- // });
|
|
|
- },
|
|
|
- // 点击每一个单选框时触发的操作
|
|
|
- onCheck:function(row){
|
|
|
- var index = rel_Ids.indexOf(row.id);
|
|
|
- if(index > -1) {
|
|
|
- rel_Ids.splice(index, 1);
|
|
|
- };
|
|
|
- $(".depart_id").val(rel_Ids.join());
|
|
|
- },
|
|
|
- // 取消每一个单选框时对应的操作;
|
|
|
- onUncheck:function(row){
|
|
|
- rel_Ids.push(row.id);
|
|
|
- $(".depart_id").val(rel_Ids.join());
|
|
|
- }
|
|
|
- });
|
|
|
-
|
|
|
- // 为表格绑定事件
|
|
|
- Table.api.bindevent(table);
|
|
|
-
|
|
|
- $("button[name=commonSearch]").css('display','none');
|
|
|
- $("input[name='btSelectAll']").css('display','none');
|
|
|
- Form.api.bindevent($("form[role=form]"));
|
|
|
- }
|
|
|
-
|
|
|
}
|
|
|
};
|
|
|
return Controller;
|