{
field:
'gmt_create',
title:
'创建日期',
formatter:
function(value,row,index){
return row.gmt_create?row.gmt_create.substring(
0,
19):
'-';
},
align:
'center',
valign:
'middle'
},{
field:
'actual_execute_date',
title:
'下发日期',
cellStyle:cellStylesales2,
formatter:
function(value,row,index){
return timemoreday(row.actual_execute_date?row.actual_execute_date:
'-',row.gmt_create?row.gmt_create:
'-');
},
align:
'center',
valign:
'middle'
},{
field:
'gmt_mondified ',
title:
'完结日期',
cellStyle:cellStylesales1,
formatter :
function(value,row,index){
//判断创建时间和完结时间
var gmt_mondified = row.gmt_mondified?row.gmt_mondified:
'-'
if(gmt_mondified!=
'-'){
return timemoreday(row.gmt_mondified,row.actual_execute_date);
}
return
'-';
},
align:
'center',
valign:
'middle'
},{
field:
'',
title:
'用时',
cellStyle:cellStylesales,
formatter :
function(value,row,index){
//判断创建时间和结束时间
if(!row.gmt_mondified && !row.gmt_create){
return
'-';
}
return timestampToTime(row.gmt_mondified,row.gmt_create);
},
align:
'center',
//展示实际用时的时间转化
function timestampToTime(date1,date2) {
var end = date1?date1:
'-';
var start = date2?date2:
'-';
if(end ==
'-'){
end =
new Date();
}
var data_strat = Date.parse(start);
var data_end = Date.parse(end);
var times = Math.abs(data_end-data_strat);
var days = (times/(
1000*
60*
60*
24)).toString();
var day_time = days.split(
'.');
//用时展示的形式是天,小时
var clock = Number(
'0.'+day_time[
1]);
return day_time[
0]+
'天'+Math.ceil(clock*
24)+
'小时';