2.18-样品补送

样品补送

目前為 2024-11-21 提交的版本,檢視 最新版本

此腳本不應該直接安裝,它是一個供其他腳本使用的函式庫。欲使用本函式庫,請在腳本 metadata 寫上: // @require https://update.cn-greasyfork.org/scripts/496569/1488282/218-%E6%A0%B7%E5%93%81%E8%A1%A5%E9%80%81.js

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

You will need to install an extension such as Tampermonkey to install this script.

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

function 样品补送(src){
	console.log('新的样品补送界面')
	var local_打印样品标签=localStorage.getItem('打印样品标签');
	var local_查询引物已清或不足=localStorage.getItem('查询引物已清或不足');
	var local_标颜色引物已清或不足=localStorage.getItem('标颜色引物已清或不足');
	var html=$('iframe[src="'+src+'"]')//页面
	html=html.contents().find('body').eq(0)
	var toolbar=html.find('.toolbar').eq(0)  // 找到了toolbar工具栏
	var table=html.find('.ui-jqgrid-btable').eq(0)  // 找到了样品的table
	//添加toolbar工具栏按钮
	添加toolbar按钮(html)
	//添加toolbar工具栏按钮
	function 添加toolbar按钮(html){
		if (toolbar.find('.weiyiyici').length==0){
			//添加标记
			toolbar.addClass('weiyiyici')
			//改成每页100个数据
			html.find('#pager_center').eq(0).find("option[value='10']").eq(0).val('100')
			//点击 打印样品标签 按钮
			if (local_打印样品标签 == 'true'){
				toolbar.append('<button id="button_print_ypbq" onclick="return false">打印样品标签</button>')
			}
			//查询引物已清或不足
			if (local_查询引物已清或不足 == 'true'){
				toolbar.append('<button id="button_show_yinwu_yiqing_buzu" onclick="return false">查询引物已清或不足</button>')
			}
			//点击 打印样品标签 按钮
			toolbar.find('#button_print_ypbq').click(function(){
				打印样品标签()
			})
			//点击  查询引物已清或不足 按钮
			toolbar.find('#button_show_yinwu_yiqing_buzu').click(function(){
				函数_查询引物已清或不足()
			})
			
		}
	}
	
	//打印样品标签
	function 打印样品标签(){
		selecteds=table.find('tbody').find("[aria-selected='true']")
		if (selecteds.size()==0){return false}
		res="<NewDataSet>"
		selecteds.each(function(){
			shengchanbianhao=$(this).find('[aria-describedby=list_undefined]').text() //生产编号
			kehu_xingming=$(this).find('[aria-describedby=list_seqo_cust_name]').text()  //客户姓名
			yangpinbianhao=$(this).find('[aria-describedby=list_seqs_sam_num]').text() //样品编号
			yangpinleixing=$(this).find('[aria-describedby=list_seqs_sam_type]').text() //样品类型
			res+="<Table1>"
			res+="<seqs_prod_id>"+shengchanbianhao+"</seqs_prod_id>"
			res+="<seqo_cust_name>"+kehu_xingming+"</seqo_cust_name>"
			res+="<seqs_sam_num>"+yangpinbianhao+"</seqs_sam_num>"
			res+="<seqs_ant_type />"
			res+="<seqs_sam_type>"+'质粒'+"</seqs_sam_type>"
			res+="<seqs_fragment_size />"
			当天日期=getday_y_n('---')
			res+="<seqo_send_sample_time>"+当天日期+"T18:47:08+08:00</seqo_send_sample_time>"
			res+="</Table1>"
		})
		res+="</NewDataSet>"
		保存文本到本地(res,'down.html')
		
	}
	
	//保存文本到本地
	function 保存文本到本地(text, filename){
		// 创建一个Blob实例,类型为纯文本
		    var blob = new Blob([text], { type: 'text/plain' });
		 
		    // 创建一个指向Blob对象的URL
		    var url = URL.createObjectURL(blob);
		 
		    // 创建一个a标签
		    var a = document.createElement("a");
		 
		    // 设置a标签属性
		    a.href = url;
		    a.download =filename;
		 
		    // 模拟a标签点击,触发下载
		    document.body.appendChild(a);
		    a.click();
		 
		    // 清理临时DOM和对象URL
		    document.body.removeChild(a);
		    URL.revokeObjectURL(url);
			window.open('http://localhost//打印/print.html')
	}
	
	//查询引物已清或不足
	function 函数_查询引物已清或不足(){
		toolbar.find('#a_search').eq(0).find('.l-btn-left').eq(0).click();  //点击 查询按钮
		$('#searchForm').eq(0).find("option[value='seqs_complete']").eq(0).attr('selected','selected')  //把找到的第一个查询条件改成 完成情况
		$('.searchOper:lt(14)').find("option[value='cn']").attr('selected','selected')  //查询方式前14个变成包含
		$('#searchForm').eq(0).find("[class='txt02 searchString']").eq(0).val('引物')
		$("#AB").click()
	}
}