setTimeout 模拟setInterval 效果,上次一缓存不能完全清除
var myVarfunction setColor() {
//clearInterval(myVar);
var s;
if (f_audio_finish) {
var result = minSum(FR.remoteEvaluate('=format(now(),"yyyy-MM-dd HH:mm:ss")'), f_rk_time) + 60 * testBatch;
if (result > 0) {
s = format_time(result);
} else {
s = "-" + format_time(Math.abs(result));
}
} else if (!f_audio_finish && s1 > 60 * testBatch) {
s = format_time(minSum(f_audio_finish, f_rk_time));
} else if (f_audio_finish != null || f_audio_finish != "" || f_audio_finish != undefined) {
console.log(11);
s = "";
}
//将得到的秒数转化成分钟数
var min_result = result / 60;
//contentPane.setCellValue(22,row-1,Math.floor(min_result));
contentPane.setCellValue(5, row - 1, s);
//拼接对应单元格的选择器
var selector = "F" + row + "-0-" + $(".x-table").attr('id') + ">div>input";
//根据对应单元格分钟数的大小动态设置对应单元格字体的颜色
if (min_result < -10000) {
//小于-3000字体红色
$("#" + selector).css("color", "rgb(255,0,0)");
} else {
//不小于则为黄色
$("#" + selector).css("color", "rgb(255,204,0)");
}
//console.log($("#"+selector));
myVar = setTimeout(setColor, 1000);
if(flag.length>0){
clearTimeout(myVar);
return;
}
}
setColor();