columns数组形式展示不同列数据

function workList() {
var status = $("#status1").val();
if (null == status || status == "") {
status = $("select[name='status']").val();
}
var workStatus;
switch (status) {
case '1'://待办
workStatus = [
{
field: 'id111',
width: 60,
title: "序号",
align: 'center',
formatter: function (value, row, index) {
return index + 1;
}
},
{
field: 'title',
title: '任务名称',
width: 300,
formatter: function (value, row, index) {
var nameIcon = '<span class="edit cursorPointer" title="' + value + '" >' + value + '</span>';
return [nameIcon].join('');
},
events: {
'click .edit': function (e, value, row, index) {
waitViewTask(row.id);
}
}
},
{
field: 'zrrName',
title: '责任人',
align: 'center',
width: 100,
formatter: function (value, row, index) {
var nameIcon = '<span class="edit cursorPointer" title="' + value + '">' + value + '</span>';
return [nameIcon].join('');
},
}, {
field: 'xbrName',
align: 'center',
title: '协办人',
width: 100,
formatter: function (value, row, index) {
var nameIcon = '<span class="edit cursorPointer" title="' + value + '">' + value + '</span>';
return [nameIcon].join('');
},
},
{
field: 'leaderName',
title: '分管领导',
align: 'center',
width: 100,
},
{
field: 'startDate',
title: '交办日期',
align: 'center',
sortable: true,
order: 'desc',
width: 120
}, {
field: 'dueDate',
title: '完成日期',
align: 'center',
sortable: true,
order: 'desc',
width: 120
},
{
field: 'operator2',
title: '操作',
align: 'center',
valign: 'middle',
searchable: false,
clickToSelect: false,
width: 200,
formatter: function (value, row, index) {
var planIcon = '';
if (!!row && row.length > 0) {
for (var i = 0; i < row.length; i++) {
var user = row[i];
if (!!user && user.personnelType === '2') {
if ($("#nowUserId").val() === user.user.id) {
planIcon = '<div align="center"><span class="planIcon cursorPointer" data-toggle="modal" >【计划】</span>';
break;
}
}
}
}
var editIcon = '<span class="editIcon cursorPointer">【工作办理】</span></div>';
return [planIcon, editIcon].join('');
},
events: {
'click .editIcon': function (e, value, row, index) {
waitViewTask(row.id);
},
'click .planIcon': function (e, value, row, index) {
jihua(row);
}
}
}
];
break;
case '2'://超期
workStatus = [{
field: 'id',
title: 'ID',
visible: false
},
{
field: 'id111',
width: 60,
title: "序号",
visible: true,
align: 'center',
formatter: function (value, row, index) {
return index + 1;
}
},
{
field: 'title',
title: '任务名称',
// align:'center',
width: 220,
formatter: function (value, row, index) {
var nameIcon = '<span class="edit cursorPointer" title="' + value + '" >' + value + '</span>';
return [nameIcon].join('');
},
events: {
'click .edit': function (e, value, row, index) {
timeOutViewTask(row.id)
},
}
},
{
field: 'zrrName',
title: '责任人',
align: 'center',
width: 80,
formatter: function (value, row, index) {
var nameIcon = '<span class="edit cursorPointer" title="' + value + '">' + value + '</span>';
return [nameIcon].join('');
},
},
{
field: 'xbrName',
title: '协办人',
align: 'center',
width: 80,
formatter: function (value, row, index) {
var nameIcon = '<span class="edit cursorPointer" title="' + value + '">' + value + '</span>';
return [nameIcon].join('');
},
},
{
field: 'leaderName',
title: '分管领导',
align: 'center',
width: 70
},
{
field: 'startDate',
title: '交办日期',
align: 'center',
sortable: true,
order: 'desc',
width: 80
},
{
field: 'dueDate',
title: '完成日期',
align: 'center',
sortable: true,
order: 'desc',
width: 80
}
,
/* {
field: 'betweenDay',
title: '超期天数',
align: 'center',
width: 80,
sortable: true,
order: 'desc',
},*/
{
field: 'status',
title: '状态',
align: 'center',
//valign: 'middle',
width: 60,
formatter: function (value, row, index) {
if (value == '2') {
var nameIcon = '<span style="width:14px;height:14px;border-radius: 50%;display:inline-block;margin-right:10px" class="edit cursorPointer" title="已超期"></span>';
return '<span></span>' + [nameIcon].join('');
} else if (value == '1') {
var nameIcon = '<span style="width:14px;height:14px;border-radius: 50%;display:inline-block;margin-right:10px" class="edit cursorPointer" title="进行中"></span>';
return '<span></span>' + [nameIcon].join('');
} else if (value == '0') {
var nameIcon = '<span style="width:14px;height:14px;border-radius: 50%;display:inline-block;margin-right:10px" class="edit cursorPointer" title="暂存"></span>';
return '<span></span>' + [nameIcon].join('');
} else if (value == '3' || value == '4') {
var nameIcon = '<span style="width:14px;height:14px;border-radius: 50%;display:inline-block;margin-right:10px" class="edit cursorPointer" title="已办结"></span>';
return '<span></span>' + [nameIcon].join('');
}
return "-";
}
},
{
field: 'operator2',
title: '操作',
align: 'center',
valign: 'middle',
searchable: false,
clickToSelect: false,
width: 100,
formatter: function (value, row, index) {
var editIcon = '<span class="editIcon cursorPointer">【工作办理】</span></div>';
return [editIcon].join('');
},
events: {
'click .editIcon': function (e, value, row, index) {
selectThing(row);
},
'click .delayIcon': function (e, value, row, index) {
if (row.ifDelay == '1') {
layer.msg("您已经申请延期,正在等待审核。。")
} else {
selectThing(row);
}
},
'click .endIcon': function (e, value, row, index) {
selectThing(row);
}
}
}
];
break;
case '5'://已办结
workStatus = [{
checkbox: true,
visible: false
},
{
field: 'id111',
width: 45,
title: "序号",
align: 'center',
formatter: function (value, row, index) {
return index + 1;
}
},
{
field: 'title',
title: '任务名称',
// align:'center',
width: 220,
formatter: function (value, row, index) {
var nameIcon = '<span class="edit cursorPointer" title="' + value + '" >' + value + '</span>';
return [nameIcon].join('');
},
events: {
'click .edit': function (e, value, row, index) {
completedViewTask(row.id)
},
}
},
{
field: 'zrrName',
title: '责任人',
align: 'center',
width: 70,
formatter: function (value, row, index) {
var nameIcon = '<span class="edit cursorPointer" title="' + value + '">' + value + '</span>';
return [nameIcon].join('');
},
}, {
field: 'xbrName',
title: '协办人',
align: 'center',
width: 70,
formatter: function (value, row, index) {
var nameIcon = '<span class="edit cursorPointer" title="' + value + '">' + value + '</span>';
return [nameIcon].join('');
}
},
{
field: 'leaderName',
title: '分管领导',
align: 'center',
width: 70
},
{
field: 'startDate',
title: '交办日期',
align: 'center',
sortable: true,
order: 'desc',
width: 80
},
{
field: 'dueDate',
title: '完成日期',
align: 'center',
sortable: true,
order: 'desc',
width: 80
},
{
field: 'eDueDate',
title: '实际办结时间',
align: 'center',
width: 90,
sortable: true,
order: 'desc',
},
/* {
field: 'betweenDay',
title: '超期天数',
align: 'center',
width: 80,
sortable: true,
order: 'desc',
},*/
{
field: 'status',
title: '状态',
align: 'center',
sortable: true,
order: 'desc',
// valign: 'middle',
width: 60,
formatter: function (value, row, index) {
if (value == '2') {
var nameIcon = '<span style="width:14px;height:14px;border-radius: 50%;display:inline-block;margin-right:10px" class="edit cursorPointer" title="已超期"></span>';
return '<span></span>' + [nameIcon].join('');
} else if (value == '1') {
var nameIcon = '<span style="width:14px;height:14px;border-radius: 50%;display:inline-block;margin-right:10px" class="edit cursorPointer" title="进行中"></span>';
return '<span></span>' + [nameIcon].join('');
} else if (value == '0') {
var nameIcon = '<span style="width:14px;height:14px;border-radius: 50%;display:inline-block;margin-right:10px" class="edit cursorPointer" title="暂存"></span>';
return '<span></span>' + [nameIcon].join('');
} else if (value == '3' || value == '4') {
var nameIcon = '<span style="width:14px;height:14px;border-radius: 50%;display:inline-block;margin-right:10px" class="edit cursorPointer" title="已办结"></span>';
return '<span></span>' + [nameIcon].join('');
}
return "-";
}
}
];
break;
}
console.log("进来我的工作")
$("#workListForm")[0].reset();
$('#workList').bootstrapTable({//待办任务workList
method: 'post',
url: 'v2/myWork/workDateList',
silent: true,
cache: false,
pagination: true,
height: window.bsTableHeight - 70,
contentType: 'application/x-www-form-urlencoded',
showHeader: true,//是否显示列头。
pageSize: 10, //每页的记录行数(*)
pageList: [10, 20, 30, 40], //可供选择的每页的行数(*)
showColumns: false,//是否显示内容列下拉框。
clickToSelect: true,//设置 true 将在点击行时,自动选择 rediobox 和 checkbox。?
sidePagination: 'server',//设置在哪里进行分页,可选值为 'client' 或者 'server'。设置 'server'时,必须设置服务器数据地址(url)或者重写ajax方法。
sortOrder: 'desc',
sortName: 'startDate',
queryParams: searchParam,
singleSelect: true,
responseHandler: function (data) {
data = FastJson.format(data);
return data;
},
columns: workStatus,
});
}
上一篇:Android-Sqlite-SQL操作增删改查


下一篇:CSS从今以后不用发愁