view={api:new ec.api("search"),structure:{go:function(t,pn,val){if(txtStructure.get()){document.getElementById("smiles").value=txtStructure.get();document.getElementById("similarMin").value=val||0;document.getElementById("searchType").value=t;view.structure.pn(1)}else{ec.notify(L.G("请先绘制结构式"))}},pn:function(pn){document.getElementById("pageIndex").value=pn;document.getElementById("form").submit()},showInputSimilar:function(){$.messager.prompt(L.G("相似度检索"),L.G("请输入相似度(数值,范围 0-1 )"),function(r){var val=parseFloat(r);if(val<0||val>1){$.messager.notify(L.G("请输入0-1之间的数值"))}else{view.structure.go("similar",1,val)}})},back:function(){view.structure.pn(0)}},batch:{go:function(pn){var data=ke.get("searchWords").value.trim();if(data){ec.loading();view.batch.pn(1)}else{ec.notifyQ(L.G("请输入查询内容"))}},pn:function(pn){document.getElementById("pageIndex").value=pn;document.getElementById("form").submit()},back:function(){view.batch.pn(0)}},document:{group:null,init:function(group){this.group=group;this.content=$("#search_result");this.btn=$("#btn_submit");if(serProductNum.get()){this.go()}},go:function(){var self=this;var num=serProductNum.get();if(!num){ec.notifyQ(L.G("请输入产品编号"));return}var lotno="";if(this.group=="COA"){lotno=serLotno.get();if(!lotno){ec.notifyQ(L.G("请输入批号"));return}}ec.btnLoading(this.btn,L.G("正在查询..."),true);this.content.html(L.G("正在查询,请稍等"));view.api.put("query-document/"+this.group+"/"+num+"?lotno="+lotno,function(r){view.document.data=r;setTimeout("view.document.render();",400)})},render:function(){if(ec.iswap){$(".detail").hide();$(".result").show()}var htm=ke.template.get("searchTemplate").renderForeach(this.data);this.content.html(htm||L.G("未查询到满足条件的数据"));this.content.toggleClass("nodata",this.data.length==0);ec.btnLoading(this.btn,L.G("查询"),false)},back:function(){$(".detail").show();$(".result").hide()}},queryProduct:function(wd,callback){this.api.put("query-product",wd,function(r){callback(r)})},cart:{alterAmount:function(el,mins){input=$(el).parents(".amount").find("input");var amount=parseInt(input.val());amount+=mins||0;amount=amount>=0?amount:0;input.val(amount)},getInfo:function(el){var res=[];var priceItem=$(el).parents(".price-box").find("tbody tr");priceItem.each(function(){var proItem={};var num=parseInt($(this).find("input").val());if(num>0&&num<=1e3){proItem.PriceRID=$(this).attr("data-id");proItem.Amount=num;res.push(proItem)}});return res},insert:function(el){var info=this.getInfo(el);var btnText=$(el).find("span");if(info.length<=0)ec.notifyQ(L.G("请输入1-1000之间的产品数量"));else{ec.btnLoading(btnText,L.G("添加中..."));new ec.api("cart").put("insert",info,function(r){ec.btnLoading(btnText,L.G("加入购物车"));ec.notify(L.G("成功添加至购物车中"));ec.hideWindow("cart_simple_layer");$(".cart-amount").html(r.length)},function(){ec.btnLoading(btnText,L.G("加入购物车"))})}}},price:{toggle:function(num){var v=$("#"+num+"_priceBox").is(":visible");if(!v)this.renderGetData(num);else this.render(false,num)},renderGetData:function(num){var self=this;new ec.api("product").put("getprice/"+num,function(r){self.render(true,num,r)})},render:function(v,num,html){var product=$("#"+num+"_box");$("#"+num+"_priceBox").remove();var l=$("#product_data thead .title th").length;product.toggleClass("active",v);product.find(".buttons span").html(L.G(v?"收回":"价格库存"));product.find(".buttons i").toggleClass("ico16-cirlceup");html=''+html+"";if(v)product.after(html)}}};L.push(["请先绘制结构式","Please draw the structural formula first","相似度检索","Similarity search","请输入相似度(数值,范围 0-1 )","Please enter similarity (numerical value, range 0-1)","请输入0-1之间的数值","Please enter a numerical value between 0-1","请输入查询内容","Please enter the query content","请输入产品编号","Please enter the product number","请输入批号","Please enter the batch number","正在查询...","Querying...","正在查询,请稍等","Querying..., please wait","未查询到满足条件的数据","No data found that meets the criteria","查询","Query","请输入1-1000之间的产品数量","Please enter the quantity of products between 1-1000","添加中...","Adding...","加入购物车","Add to cart","成功添加至购物车中","Successfully added to shopping cart","收回","Hide","价格库存","Price"]);