|
@@ -438,6 +438,13 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form','editable'], function
|
|
var admin_id = row.id;
|
|
var admin_id = row.id;
|
|
var cur_table = $detail.html('<table id="sub_'+ admin_id +'" style="background-color:#d7d1d147"></table>').find('table');
|
|
var cur_table = $detail.html('<table id="sub_'+ admin_id +'" style="background-color:#d7d1d147"></table>').find('table');
|
|
var sub_table = $(cur_table);
|
|
var sub_table = $(cur_table);
|
|
|
|
+ var parent_options = parent_table.bootstrapTable("getOptions");
|
|
|
|
+ var parent_selectids = parent_options.selectedIds;
|
|
|
|
+ var checked = false;
|
|
|
|
+ if (parent_selectids.indexOf(admin_id) !== -1) {
|
|
|
|
+ checked = true;
|
|
|
|
+ }
|
|
|
|
+ parent_options.subSelectedIds[admin_id] = [];
|
|
sub_table.bootstrapTable({
|
|
sub_table.bootstrapTable({
|
|
// url: 'area/index',
|
|
// url: 'area/index',
|
|
toolbar: false,
|
|
toolbar: false,
|
|
@@ -452,8 +459,6 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form','editable'], function
|
|
columns: [
|
|
columns: [
|
|
{checkbox: true,
|
|
{checkbox: true,
|
|
formatter: function(value,rows,index){
|
|
formatter: function(value,rows,index){
|
|
- // console.log('Config.user_ids');
|
|
|
|
- // console.log(Config.user_ids);
|
|
|
|
if(Config.user_ids.length==0){
|
|
if(Config.user_ids.length==0){
|
|
return false;
|
|
return false;
|
|
}else if(Config.user_ids.indexOf(rows.id)>-1){
|
|
}else if(Config.user_ids.indexOf(rows.id)>-1){
|
|
@@ -463,20 +468,40 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form','editable'], function
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
},
|
|
- // {field: 'id', title: 'ID'},
|
|
|
|
{field: 'username', title: __('学号')},
|
|
{field: 'username', title: __('学号')},
|
|
{field: 'nickname', title: __('姓名')},
|
|
{field: 'nickname', title: __('姓名')},
|
|
],
|
|
],
|
|
data: row.alluser
|
|
data: row.alluser
|
|
});
|
|
});
|
|
Table.api.bindevent(sub_table);
|
|
Table.api.bindevent(sub_table);
|
|
|
|
+ if(checked){
|
|
|
|
+ sub_table.bootstrapTable("checkAll");
|
|
|
|
+ }else{
|
|
|
|
+ sub_table.bootstrapTable("uncheckAll");
|
|
|
|
+ }
|
|
sub_table.on("check.bs.table uncheck.bs.table check-all.bs.table uncheck-all.bs.table post-body.bs.table", function (e) {
|
|
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);
|
|
var selectedIds = Table.api.selectedids(sub_table);
|
|
- console.log(selectedIds+'@@@@');
|
|
|
|
- $(".xueyuan_input").val(selectedIds.length);
|
|
|
|
- $(".xueyuan_total").html(selectedIds.length);
|
|
|
|
- $(".depart_ids").val(selectedIds.join());
|
|
|
|
- })
|
|
|
|
|
|
+ selectedData = Table.api.selecteddata(sub_table);
|
|
|
|
+
|
|
|
|
+ parent_options.subSelectedIds[admin_id] = selectedIds;
|
|
|
|
+ parent_options.subSelectedData[admin_id] = selectedData;
|
|
|
|
+
|
|
|
|
+ var allSubselectIds = [];
|
|
|
|
+ var allSubselectData = [];
|
|
|
|
+ var allSubselectProjectlib = [];
|
|
|
|
+ for (var i in parent_options.subSelectedIds) {
|
|
|
|
+ allSubselectIds.push.apply(allSubselectIds, parent_options.subSelectedIds[i]);
|
|
|
|
+ }
|
|
|
|
+ for (var j in parent_options.subSelectedData) {
|
|
|
|
+ allSubselectData.push.apply(allSubselectData, parent_options.subSelectedData[j]);
|
|
|
|
+ }
|
|
|
|
+ parent_options.allSubselectIds = allSubselectIds;
|
|
|
|
+ parent_options.allSubselectData = allSubselectData;
|
|
|
|
+
|
|
|
|
+ $(".xueyuan_input").val(parent_options.allSubselectIds.length);
|
|
|
|
+ $(".xueyuan_total").html(parent_options.allSubselectIds.length);
|
|
|
|
+ $(".depart_ids").val(parent_options.allSubselectIds.join());
|
|
|
|
+ });
|
|
},
|
|
},
|
|
bindevent2: function () {
|
|
bindevent2: function () {
|
|
var rel_Ids = [];
|
|
var rel_Ids = [];
|
|
@@ -487,10 +512,11 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form','editable'], function
|
|
index_url: 'department/admin/departadmintotal' + location.search,
|
|
index_url: 'department/admin/departadmintotal' + location.search,
|
|
}
|
|
}
|
|
});
|
|
});
|
|
- var table = $("#table1");//当内容渲染完成后展开详细
|
|
|
|
- table.on('post-body.bs.table', function (e, data) {
|
|
|
|
- $('#table1').bootstrapTable('expandAllRows');
|
|
|
|
- });
|
|
|
|
|
|
+ var table = $("#table1");
|
|
|
|
+ // table.on('post-body.bs.table', function (e, data) {
|
|
|
|
+ // $('#table1').bootstrapTable('expandAllRows');
|
|
|
|
+ // });
|
|
|
|
+ // var oInit = new Object();
|
|
// 初始化表格
|
|
// 初始化表格
|
|
table.bootstrapTable({
|
|
table.bootstrapTable({
|
|
url: $.fn.bootstrapTable.defaults.extend.index_url,
|
|
url: $.fn.bootstrapTable.defaults.extend.index_url,
|
|
@@ -499,6 +525,10 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form','editable'], function
|
|
fixedColumns: true,
|
|
fixedColumns: true,
|
|
fixedRightNumber: 1,
|
|
fixedRightNumber: 1,
|
|
searchFormVisible:false,
|
|
searchFormVisible:false,
|
|
|
|
+ subSelectedIds: {},
|
|
|
|
+ subSelectedData: {},
|
|
|
|
+ allSubselectIds: [],
|
|
|
|
+ allSubselectData: [],
|
|
// pagination:false,
|
|
// pagination:false,
|
|
detailView: true,//父子表
|
|
detailView: true,//父子表
|
|
Search:false,
|
|
Search:false,
|
|
@@ -507,23 +537,53 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form','editable'], function
|
|
showColumns: false,
|
|
showColumns: false,
|
|
columns: [
|
|
columns: [
|
|
[
|
|
[
|
|
- {checkbox: true,},
|
|
|
|
|
|
+ {checkbox: true},
|
|
{field: 'department_name', title: __('区队名称'), operate: false,width: '400px', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
|
|
{field: 'department_name', title: __('区队名称'), operate: false,width: '400px', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
|
|
- {field: 'department_admin_count', title: __('全部人员数量'),operate: false},
|
|
|
|
|
|
+ {field: 'department_admin_count', title: __('人员数量'),operate: false},
|
|
]
|
|
]
|
|
],
|
|
],
|
|
onExpandRow: function (index, row, $detail) {
|
|
onExpandRow: function (index, row, $detail) {
|
|
- Controller.api.initSubTable(index, row, $detail);
|
|
|
|
|
|
+ Controller.api.initSubTable(index, row, $detail,table);
|
|
},
|
|
},
|
|
onCheck: function (row, $element) {
|
|
onCheck: function (row, $element) {
|
|
$('.btn-disabled').addClass('disabled');
|
|
$('.btn-disabled').addClass('disabled');
|
|
var id = row.id;
|
|
var id = row.id;
|
|
$("#sub_" + id).bootstrapTable("checkAll");
|
|
$("#sub_" + id).bootstrapTable("checkAll");
|
|
-
|
|
|
|
|
|
+ var departid = $(".depart_ids").val();
|
|
|
|
+ if(!departid){
|
|
|
|
+ $(".depart_ids").val(row.user_ids.join()+',');
|
|
|
|
+ $(".xueyuan_input").val(row.user_ids.length);
|
|
|
|
+ $(".xueyuan_total").html(row.user_ids.length);
|
|
|
|
+ }else{
|
|
|
|
+ if(departid.indexOf(row.user_ids) !== -1){
|
|
|
|
+ }else{
|
|
|
|
+ $(".depart_ids").val(departid+row.user_ids.join()+',');
|
|
|
|
+ var xueyuan_count = $(".xueyuan_input").val();
|
|
|
|
+ var count= Number(xueyuan_count)+Number(row.user_ids.length);
|
|
|
|
+ $(".xueyuan_input").val(count);
|
|
|
|
+ $(".xueyuan_total").html(count);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
},
|
|
},
|
|
onUncheck: function (row) {
|
|
onUncheck: function (row) {
|
|
var id = row.id;
|
|
var id = row.id;
|
|
$("#sub_" + id).bootstrapTable("uncheckAll");
|
|
$("#sub_" + id).bootstrapTable("uncheckAll");
|
|
|
|
+ var departid = $(".depart_ids").val();
|
|
|
|
+ if(departid.indexOf(row.user_ids.join()) !== -1){
|
|
|
|
+ var newdepartid = departid.replace(row.user_ids.join()+',', '');
|
|
|
|
+ if(newdepartid==','){
|
|
|
|
+ newdepartid = '';
|
|
|
|
+ }
|
|
|
|
+ $(".depart_ids").val(newdepartid);
|
|
|
|
+ var xueyuan_count = $(".xueyuan_input").val();
|
|
|
|
+ var count= Number(xueyuan_count)-Number(row.user_ids.length);
|
|
|
|
+ $(".xueyuan_input").val(count);
|
|
|
|
+ $(".xueyuan_total").html(count);
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ onLoadSuccess: function (data) {
|
|
|
|
+ var parent_options = table.bootstrapTable("getOptions");
|
|
|
|
+ Controller.api.clearSelectIds(parent_options);
|
|
},
|
|
},
|
|
});
|
|
});
|
|
|
|
|
|
@@ -533,21 +593,11 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form','editable'], function
|
|
$(document).on('change', '#c-question_setting_method', function () {
|
|
$(document).on('change', '#c-question_setting_method', function () {
|
|
if($(this).val()==1){
|
|
if($(this).val()==1){
|
|
$(".btn-sm,.btn-task").css('display','none');
|
|
$(".btn-sm,.btn-task").css('display','none');
|
|
- $(".fault_total").css('display','block');
|
|
|
|
- $('form[role=form]').validator("setField", {
|
|
|
|
- "row[fault_total]": "required",
|
|
|
|
- });
|
|
|
|
}else if($(this).val()==2){
|
|
}else if($(this).val()==2){
|
|
$(".btn-sm").show();
|
|
$(".btn-sm").show();
|
|
- $(".btn-task,.fault_total").css('display','none');
|
|
|
|
- $('form[role=form]').validator("setField", {
|
|
|
|
- "row[fault_total]":null,
|
|
|
|
- });
|
|
|
|
|
|
+ $(".btn-task").css('display','none');
|
|
}else if($(this).val()==3){
|
|
}else if($(this).val()==3){
|
|
- $(".btn-sm,.fault_total").css('display','none');
|
|
|
|
- $('form[role=form]').validator("setField", {
|
|
|
|
- "row[fault_total]": null,
|
|
|
|
- });
|
|
|
|
|
|
+ $(".btn-sm").css('display','none');
|
|
$(".btn-task").show();
|
|
$(".btn-task").show();
|
|
}
|
|
}
|
|
$(".question_ids").val(0);
|
|
$(".question_ids").val(0);
|
|
@@ -555,7 +605,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form','editable'], function
|
|
$("#c-task_name").val('');
|
|
$("#c-task_name").val('');
|
|
$("#c-fault_name").val('');
|
|
$("#c-fault_name").val('');
|
|
$("#c-question_name").val('');
|
|
$("#c-question_name").val('');
|
|
- $(".tasks,.questions").css('display','none');
|
|
|
|
|
|
+ $(".tasks,.questions").css('display','none')
|
|
});
|
|
});
|
|
//考题
|
|
//考题
|
|
$(document).on('click', '.btn-sm', function () {
|
|
$(document).on('click', '.btn-sm', function () {
|
|
@@ -616,7 +666,19 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form','editable'], function
|
|
$("button[name=commonSearch]").css('display','none');
|
|
$("button[name=commonSearch]").css('display','none');
|
|
$("input[name='btSelectAll']").css('display','none');
|
|
$("input[name='btSelectAll']").css('display','none');
|
|
Form.api.bindevent($("form[role=form]"));
|
|
Form.api.bindevent($("form[role=form]"));
|
|
- }
|
|
|
|
|
|
+ },
|
|
|
|
+ clearSelectIds: function (parent_options) {
|
|
|
|
+ // var toolbar = $("#toolbar");
|
|
|
|
+ // var allIds = [];
|
|
|
|
+ // var parent_options = $("#table").bootstrapTable("getOptions");
|
|
|
|
+ parent_options.allSubselectIds = [];
|
|
|
|
+ // console.log(parent_options.subSelectedIds)
|
|
|
|
+ parent_options.allSubselectData = [];
|
|
|
|
+ parent_options.subSelectedIds = {};
|
|
|
|
+ parent_options.subSelectedData = {};
|
|
|
|
+ // console.log(parent_options)
|
|
|
|
+ },
|
|
|
|
+
|
|
}
|
|
}
|
|
};
|
|
};
|
|
return Controller;
|
|
return Controller;
|