公共函数
当前为
此脚本不应直接安装。它是供其他脚本使用的外部库,要使用该库请加入元指令 // @require https://update.cn-greasyfork.org/scripts/469866/1213764/00-%E5%85%AC%E5%85%B1%E5%87%BD%E6%95%B0.js
//备注包含CNAS的行就标个颜色
function 公共_CNAS订单加急(html,搜索信息){
//先运行一遍
html.find('table').find('tr').each(function(){
备注信息=$(this).find(搜索信息)
备注=$(this).find(搜索信息).text()
console.log(备注)
if(备注.toUpperCase().indexOf('CNAS')!==-1){
//设置背景颜色
$(this).find('td').attr('Bgcolor','#24B2C8')
}
})
//当table出现数据改变的时候
$(html).find('#list').on('DOMNodeInserted',function(e) {
//$(e.target)代表的每一行
备注信息=$(e.target).find(搜索信息)[0].innerText
//备注=备注信息.text()
console.log(备注信息)
if(备注信息.toUpperCase().indexOf('CNAS')!==-1){
//设置背景颜色
$(e.target).find(搜索信息).parent().children().attr('Bgcolor','#24B2C8')
}
});
}
//查询年月日的函数
function getday_y_n(d){
var myDate = new Date();
if(d=="yestday" || d==="hecheng_zuotian_riqi" || d=="zuori---"){myDate.setTime(myDate.getTime()-24*60*60*1000);}
var year = (myDate.getFullYear()).toString(); //获取当前年
var mon = (myDate.getMonth() + 1).toString(); //获取当前月
var date = (myDate.getDate()).toString(); //获取当前日
if(mon.length==1){
mon="0"+mon
}
if(date.length==1){
date="0"+date
}
if(d==="hecheng_zuotian_riqi"){
return year+mon+date
}else if(d=="---"){ //---指的格式为XXXX-XX-XX
return year+"-"+mon+"-"+date
}else if(d=="zuori---"){
//返回昨天的日期 比如 2022-05-13
return year+"-"+mon+"-"+date
}else{
return year+mon+date
}
}
//延时函数
var sleep = function(time) {
var startTime = new Date().getTime() + parseInt(time, 10);
while(new Date().getTime() < startTime) {}
};
//设定 页面的高度
function gaodu(html){
//function zhongjian_gonggong(html){
//下面几行是重新设置 测序样品 页面的高度
table_div=html.find('.ui-jqgrid-bdiv').eq(0) // 找到了样品的table的上一级div 用于设置高度
table_height=table_div.css('height') //测序样品 页面的高度
offset_1=$('.footer').eq(0).offset().top
offset_2=html.find('#pager').eq(0).offset().top
if(offset_1-offset_2<=120){
table_div.css('height',table_height.slice(0,-2)-20+"px") //重新设置 页面的高度
}else if(offset_1-offset_2>=160){
table_div.css('height',parseInt(table_height.slice(0,-2))+20+"px") //重新设置 页面的高度
}
//}
}