代码拉取完成,页面将自动刷新
MWF.xApplication.CRM=MWF.xApplication.CRM||{},MWF.xApplication.CRM.Template=MWF.xApplication.CRM.Template||{},MWF.require("MWF.widget.O2Identity",null,!1),MWF.xDesktop.requireApp("Template","MPopupForm",null,!1),String.implement({toDOM:function(e,t){var i=this.test("^<the|^<tf|^<tb|^<colg|^<ca")&&["<table>","</table>",1]||this.test("^<col")&&["<table><colgroup>","</colgroup><tbody></tbody></table>",2]||this.test("^<tr")&&["<table><tbody>","</tbody></table>",2]||this.test("^<th|^<td")&&["<table><tbody><tr>","</tr></tbody></table>",3]||this.test("^<li")&&["<ul>","</ul>",1]||this.test("^<dt|^<dd")&&["<dl>","</dl>",1]||this.test("^<le")&&["<fieldset>","</fieldset>",1]||this.test("^<opt")&&['<select multiple="multiple">',"</select>",1]||["","",0];if(e){for(var s=new Element("div",{html:i[0]+this+i[1]}).getChildren();i[2]--;)s=s[0].getChildren();return s.inject(e),t&&t(e),s}var n=new Element("div",{html:i[0]+this+i[1]});n.setStyle("display","none").inject($(document.body)),t&&t(n);for(s=n.getChildren();i[2]--;)s=s[0].getChildren();return n.dispose(),s}}),MWF.xApplication.CRM.Template.Select=new Class({Extends:MWF.widget.Common,Implements:[Options,Events],options:{style:"default",width:"800",height:"100%"},initialize:function(e,t,i,s){this.setOptions(s),this.app=t.app,this.explorer=t,this.lp=this.app.lp.template,this.actions=this.app.restActions,this.path="/x_component_CRM/Template/",this.loadCss(),this.node=$(e),this.actions=i},loadCss:function(){this.cssPath="/x_component_CRM/$Template/"+this.options.style+"/css.wcss",this._loadCss()},load:function(e,t){this._width=this.options.width?this.options.width:230,this._height=this.options.height?this.options.height:30,this._available=this.options.available?this.options.available:"yes",this.createDefault(),this.explorer.allArrowArr.push(this.selectArrowDiv),t&&t()},createDefault:function(){this.node&&this.node.empty(),this.selectValueDiv=new Element("div.selectValueDiv",{styles:this.css.selectValueDiv,id:this.node.get("id")+"Value",text:this.lp.defaultSelect}).inject(this.node),this.selectArrowDiv=new Element("div.selectArrowDiv",{styles:this.css.selectArrowDiv}).inject(this.node),this.selectArrowDiv.setStyles({width:this._height+"px",height:this._height+"px"}),this.node.setStyles(this.css.selectDiv),this.node.setStyles({width:this._width+"px",height:this._height+"px","background-color":"no"==this._available?"#eeeeee":""}),this.node.set("available",this._available),this.selectValueDiv.setStyles({width:this._width-this._height-10+"px",height:this._height+"px","line-height":this._height+"px"})},setAddress:function(t,i){t=t||{};var s=this;this.node.removeEvents("click"),this.node.addEvents({click:function(e){return!!t&&("no"!=s.node.get("available")&&(s.selectArrowDiv.setStyles({background:"url(/x_component_CRM/$Template/default/icons/arrow-up.png) no-repeat center"}),s.explorer.listContentDiv&&s.explorer.listContentDiv.destroy(),s.explorer.listDiv&&s.explorer.listDiv.destroy(),s.explorer.listContentDiv=new Element("div.listContentDiv",{styles:s.css.listContentDiv,id:"listContentDiv"}).inject(s.node),s.explorer.listContentDiv.setStyles({width:s.node.getSize().x+"px","margin-top":s.node.getSize().y+"px","z-index":"300"}),s.listDiv=new Element("div.listDiv",{styles:s.css.listDiv}).inject(s.explorer.listContentDiv),s.app.setScrollBar(s.listDiv),t.unshift({cityname:s.lp.defaultSelect}),t.each(function(t){var e=new Element("li.listLi",{styles:s.css.listLi,text:t.cityname}).inject(s.listDiv);e.setStyles({color:s.selectValueDiv.get("text")==e.get("text")?"#ffffff":"","background-color":s.selectValueDiv.get("text")==e.get("text")?"#3d77c1":""}),e.addEvents({click:function(e){s.node.set("value",this.get("text")),s.explorer.listContentDiv.destroy(),s.selectArrowDiv.setStyles({background:"url(/x_component_CRM/$Template/default/icons/arrow.png) no-repeat center"}),s.selectValueDiv.get("text")!=this.get("text")&&(s.selectValueDiv.set({text:this.get("text")}),i&&i(t)),e.stopPropagation()},mouseover:function(){this.get("text")!=s.selectValueDiv.get("text")&&this.setStyles({"background-color":"#ccc",color:"#ffffff"})},mouseout:function(){this.get("text")!=s.selectValueDiv.get("text")&&this.setStyles({"background-color":"",color:""})}})}.bind(s)),t.splice(0,1),void e.stopPropagation()))}.bind(this)})},setList:function(t,i){t=t||{};var s=this;this.node.removeEvents("click"),this.node.addEvents({click:function(e){return!!t.childNodes&&("no"!=s.node.get("available")&&(s.selectArrowDiv.setStyles({background:"url(/x_component_CRM/$Template/default/icons/arrow-up.png) no-repeat center"}),s.explorer.listContentDiv&&s.explorer.listContentDiv.destroy(),s.explorer.listDiv&&s.explorer.listDiv.destroy(),s.explorer.listContentDiv=new Element("div.listContentDiv",{styles:s.css.listContentDiv,id:"listContentDiv"}).inject(s.node),s.explorer.listContentDiv.setStyles({width:s.node.getSize().x+"px","margin-top":s.node.getSize().y+"px","z-index":"300"}),s.listDiv=new Element("div.listDiv",{styles:s.css.listDiv}).inject(s.explorer.listContentDiv),s.app.setScrollBar(s.listDiv),t.childNodes.unshift({configname:s.lp.defaultSelect}),t.childNodes.each(function(t){var e=new Element("li.listLi",{styles:s.css.listLi,text:t.configname}).inject(s.listDiv);e.setStyles({color:s.selectValueDiv.get("text")==e.get("text")?"#ffffff":"","background-color":s.selectValueDiv.get("text")==e.get("text")?"#3d77c1":""}),e.addEvents({click:function(e){s.selectValueDiv.set({text:this.get("text")}),s.node.set("value",this.get("text")),s.explorer.listContentDiv.destroy(),s.selectArrowDiv.setStyles({background:"url(/x_component_CRM/$Template/default/icons/arrow.png) no-repeat center"}),i&&i(t),e.stopPropagation()},mouseover:function(){this.get("text")!=s.selectValueDiv.get("text")&&this.setStyles({"background-color":"#ccc",color:"#ffffff"})},mouseout:function(){this.get("text")!=s.selectValueDiv.get("text")&&this.setStyles({"background-color":"",color:""})}})}.bind(s)),t.childNodes.splice(0,1),void e.stopPropagation()))}.bind(this)})}}),MWF.xApplication.CRM.Template.PopupForm=new Class({Extends:MWF.widget.Common,Implements:[Options,Events],options:{style:"default",width:500,height:450,top:0,left:0,hasTop:!1,hasTopIcon:!1,hasTopContent:!1,hasIcon:!0,hasScroll:!0,hasBottom:!0,hasMask:!0,title:"",draggable:!1,maxAction:"false",closeAction:!0,relativeToApp:!0,sizeRelateTo:"app"},initialize:function(e,t,i,s){this.setOptions(i),this.explorer=e,s?this.options.relativeToApp?(this.app=s.app||this.explorer.app,this.container=s.container||this.app.content,this.lp=s.lp||this.explorer.lp||this.app.lp,this.css=s.css||this.explorer.css||this.app.css,this.actions=s.actions||this.explorer.actions||this.app.actions||this.app.restActions):(this.container=s.container,this.lp=s.lp||this.explorer.lp,this.css=s.css||this.explorer.css,this.actions=s.actions||this.explorer.actions):this.options.relativeToApp?(this.app=this.explorer.app,this.container=this.app.content,this.lp=this.explorer.lp||this.app.lp,this.css=this.explorer.css||this.app.css,this.actions=this.explorer.actions||this.app.actions||this.app.restActions):(this.container=window.document.body,this.lp=this.explorer.lp,this.css=this.explorer.css,this.actions=this.explorer.actions),this.data=t||{},this.cssPath="/x_component_CRM/$Template/"+this.options.style+"/popup.wcss",this.load()},load:function(){this._loadCss()},selectPerson:function(e,s,n,t){var i={type:"",types:["person"],values:[],count:t,zIndex:5e4,onComplete:function(e){MWF.require("MWF.widget.O2Identity",function(){var t=[],i=[];e.each(function(e){if("i"==e.data.distinguishedName.split("@").getLast().toLowerCase()){new MWF.widget.O2Identity(e.data,it.form.getItem("invitePersonList").container,{style:"room"});t.push(e.data.distinguishedName)}else t.push(e.data.name),i.push(e.data.distinguishedName)}.bind(this)),document.getElementById(s).innerHTML=t.join(","),""!=n&&(document.getElementById(n).innerHTML=i.join(","))}.bind(this))}.bind(this)};new MWF.O2Selector(e,i)},_loadCss:function(){var i={};new Request.JSON({url:this.cssPath,secure:!1,async:!1,method:"get",noCache:!1,onSuccess:function(e,t){i=e,MWF.widget.css[s]=e}.bind(this),onError:function(e,t){alert(t+e)}}).send();var e=!0;for(var s in i)s&&(e=!1);e||(this.css=Object.merge(i,this.css))},open:function(e){this.fireEvent("queryOpen"),this.isNew=!1,this.isEdited=!1,this._open(),this.fireEvent("postOpen")},create:function(){this.fireEvent("queryCreate"),this.isNew=!0,this._open(),this.fireEvent("postCreate")},edit:function(){this.fireEvent("queryEdit"),this.isEdited=!0,this._open(),this.fireEvent("postEdit")},_open:function(){if(this.options.hasMask&&(this.formMaskNode=new Element("div.formMaskNode",{styles:this.css.formMaskNode,events:{mouseover:function(e){e.stopPropagation()},mouseout:function(e){e.stopPropagation()},click:function(e){e.stopPropagation()}}}).inject(this.container||this.app.content)),this.formAreaNode=new Element("div.formAreaNode",{styles:this.css.formAreaNode}),this.createFormNode(),this.formAreaNode.inject(this.formMaskNode||this.container||this.app.content,"after"),this.formAreaNode.fade("in"),this.setFormNodeSize(),this.setFormNodeSizeFun=this.setFormNodeSize.bind(this),this.app&&this.app.addEvent("resize",this.setFormNodeSizeFun),this.options.draggable&&this.formTopNode){var e=(this.container||this.app.content).getSize(),t=this.formAreaNode.getSize();this.formAreaNode.makeDraggable({handle:this.formTopNode,limit:{x:[0,e.x-t.x],y:[0,e.y-t.y]}})}},createFormNode:function(){this.formNode=new Element("div.formNode",{styles:this.css.formNode}).inject(this.formAreaNode),this.options.hasTop&&this.createTopNode(),this.options.hasIcon&&(this.formIconNode=new Element("div.formIconNode",{styles:this.isNew?this.css.formNewNode:this.css.formIconNode}).inject(this.formNode)),this.createContent(),this.options.hasBottom&&this.createBottomNode(),this._setCustom(),this.options.hasScroll&&MWF.require("MWF.widget.ScrollBar",function(){new MWF.widget.ScrollBar(this.formTableContainer,{indent:!1,style:"default",where:"before",distance:30,friction:4,axis:{x:!1,y:!0},onScroll:function(e){}})}.bind(this))},_setCustom:function(){},createTopNode:function(){this.formTopNode||(this.formTopNode=new Element("div.formTopNode",{styles:this.css.formTopNode}).inject(this.formNode),this.options.hasTopIcon&&(this.formTopIconNode=new Element("div",{styles:this.css.formTopIconNode}).inject(this.formTopNode)),this.formTopTextNode=new Element("div",{styles:this.css.formTopTextNode,text:this.options.title}).inject(this.formTopNode),this.options.closeAction&&(this.formTopCloseActionNode=new Element("div",{styles:this.css.formTopCloseActionNode}).inject(this.formTopNode),this.formTopCloseActionNode.addEvent("click",function(){this.close()}.bind(this))),this.options.hasTopContent&&(this.formTopContentNode=new Element("div.formTopContentNode",{styles:this.css.formTopContentNode}).inject(this.formTopNode),this._createTopContent()))},_createTopContent:function(){},createContent:function(){this.formContentNode=new Element("div.formContentNode",{styles:this.css.formContentNode}).inject(this.formNode),this.formTableContainer=new Element("div.formTableContainer",{styles:this.css.formTableContainer}).inject(this.formContentNode),this.formTableArea=new Element("div.formTableArea",{styles:this.css.formTableArea,text:"loading..."}).inject(this.formTableContainer),this._createTableContent()},_createTableContent:function(){},createBottomNode:function(){this.formBottomNode=new Element("div.formBottomNode",{styles:this.css.formBottomNode}).inject(this.formNode),this._createBottomContent()},_createBottomContent:function(){this.cancelActionNode=new Element("div.formCancelActionNode",{styles:this.css.formCancelActionNode,text:this.lp.actionCancel}).inject(this.formBottomNode),this.cancelActionNode.addEvent("click",function(e){this.cancel(e)}.bind(this))},cancel:function(e){this.fireEvent("queryCancel"),this.close(),this.fireEvent("postCancel")},close:function(e){this.fireEvent("queryClose"),this._close(),this.setFormNodeSizeFun&&this.app&&this.app.removeEvent("resize",this.setFormNodeSizeFun),this.formMaskNode&&this.formMaskNode.destroy(),this.formAreaNode.destroy(),this.fireEvent("postClose")},_close:function(){},ok:function(e){this.fireEvent("queryOk");var t=this.form.getResult(!0,",",!0,!1,!0);t&&this._ok(t,function(e){"error"==e.type?this.app&&this.app.notice(e.message,"error"):(this.formMaskNode&&this.formMaskNode.destroy(),this.formAreaNode.destroy(),this.explorer&&this.explorer.view&&this.explorer.view.reload(),this.app&&this.app.notice(this.isNew?this.lp.createSuccess:this.lp.updateSuccess,"success"),this.fireEvent("postOk"))}.bind(this))},_ok:function(e,t){},setFormNodeSize:function(e,t,i,s){e||(e=this.options.width?this.options.width:"50%"),t||(t=this.options.height?this.options.height:"50%"),i||(i=this.options.top?this.options.top:0),s||(s=this.options.left?this.options.left:0);var n=(this.container||this.app.content).getSize(),o=n.x,a=n.y;"string"==typeof e&&1<e.length&&"%"==e.substr(e.length-1,1)&&(e=parseInt(o*parseInt(e,10)/100,10)),"string"==typeof t&&1<t.length&&"%"==t.substr(t.length-1,1)&&(t=parseInt(a*parseInt(t,10)/100,10)),e<300&&(e=300),t<220&&(t=220),i=i||parseInt((a-t)/2,10),s=s||parseInt((o-e)/2,10),this.formAreaNode.setStyles({width:e+"px",height:t+"px",top:i+"px",left:s+"px"}),this.formNode.setStyles({width:e+"px",height:t+"px"});var l=this.formIconNode?this.formIconNode.getSize():{x:0,y:0},r=this.formTopNode?this.formTopNode.getSize():{x:0,y:0},h=this.formBottomNode?this.formBottomNode.getSize():{x:0,y:0},c=t-l.y-r.y-h.y;this.formContentNode.setStyles({height:c+"px"}),this.formTableContainer.setStyles({height:c+"px"})}}),MWF.xApplication.CRM.Template.ComplexView=new Class({Implements:[Options,Events],options:{style:"default",templateUrl:"",scrollEnable:!1,pagingEnable:!0,documentKeyWord:null,pagingPar:{position:["bottom"],countPerPage:5,visiblePages:10,currentPage:1,currentItem:null,hasPagingBar:!0,hasTruningBar:!0,hasReturn:!1}},initialize:function(e,t,i,s,n,o){this.container=e,this.openDiv=t,this.explorer=s,o?(this.app=i||o.app||this.explorer.app,this.lp=o.lp||this.explorer.lp||this.app.lp,this.css=o.css||this.explorer.css||this.app.css,this.actions=o.actions||this.explorer.actions||this.app.actions||this.app.restActions,this.isAdmin=o.isAdmin):(this.app=i||this.explorer.app,this.lp=this.explorer.lp||this.app.lp,this.css=this.explorer.css||this.app.css,this.actions=this.explorer.actions||this.app.actions||this.app.restActions),n.templateUrl?-1==n.templateUrl.indexOf("/")&&(n.templateUrl=this.explorer.path+n.templateUrl):n.templateUrl=this.explorer.path+"listItem.json",this.setOptions(n)},initData:function(){this.items=[],this.documents={},this.isItemsLoaded=!1,this.isItemLoadding=!1,this.loadItemQueue=0,this.count=0},load:function(){this.initData(),this.ayalyseTemplate(),this.getContentTemplateNode(),this.headTableNode=new Element("div.headTableNode",{styles:this.css.viewContentListNode}).inject(this.container),this.contentTableNode=new Element("div.contentTableNode",{styles:this.css.viewContentListNode}).inject(this.container),this.createViewNode(),this.loadResource(function(){this.loadSearchCondition(),this.useTablePlugins(1,"",""),0==jQuery(".headTableNode:has(div)").length&&jQuery(".headTableNode").remove();var i=this;jQuery(".headSearchBottonDiv").on("click",function(){var e=jQuery(".headSearchInput").val();if(""!=e){parseInt(jQuery(".page-active").attr("value"));var t="";0<jQuery(".headTableNode").find(".se-select-name").length&&(t=jQuery(".headTableNode").find(".se-select-name").text()),i.useTablePlugins(1,e,t)}}),jQuery(".headSearchRemoveImg").on("click",function(){var e=parseInt(jQuery(".page-active").attr("value")),t="";0<jQuery(".headTableNode").find(".se-select-name").length&&(t=jQuery(".headTableNode").find(".se-select-name").text()),i.useTablePlugins(e,"",t)})}.bind(this))},loadResource:function(e){e&&e()},useTablePlugins:function(n,e,t){0<jQuery(".notify").length&&jQuery(".notify").remove(),0<jQuery(".laytable-box").length&&jQuery(".laytable-box").remove();var o,a,l=this,r=[],h=[],s=[],c=this.lp,d=c.fieldList;o=c.sortField,a=c.sortType;var p=this.container.getSize(),u=this.headTableNode.getSize(),g=p.y-u.y-80;for(i in n||(n=1),d)s.push(d[i]);h.push(s),this._getCurrentPageData(function(s){s.data.each(function(e){if(e.createuser){var t=e.owneruser,i=e.createuser;e.owneruser=t.split("@")[0],e.createuser=i.split("@")[0]}else e.owneruser="",e.createuser="";r.push(e)}.bind(this)),layui.config({base:"/x_component_CRM/$Template/plugins/table2/"}).use(["table2","table2"],function(){layui.table2.render({elem:"#contentTable",data:r,height:g,width:"100%",page:{align:"right",groups:5,curr:1,count:s.count,limit:15,limits:[15,30,45,60,75,90]},initSort:{sortField:o,sortType:a},cols:h});jQuery(".clueId").each(function(e,t){jQuery(t).on("click",function(){l._openDocument(jQuery(t).attr("id"),jQuery(t).text())})}),jQuery(".otherId").each(function(e,t){jQuery(t).on("click",function(){l._openOtherDocument(jQuery(t).attr("id"),jQuery(t).text())})}),jQuery(".laytable-page-pagination").find("a").each(function(e,s){jQuery(s).on("click",function(){var e=1;if(e="-1"==jQuery(s).attr("value")||"+1"==jQuery(s).attr("value")?parseInt(jQuery(s).attr("value"))+e:parseInt(jQuery(s).text()),"page-item page-last rayui-disabled"!=jQuery(s).attr("class")&&"page-item page-prev rayui-disabled"!=jQuery(s).attr("class")){var t=jQuery(".headSearchInput").val(),i="";0<jQuery(".headTableNode").find(".se-select-name").length&&(i=jQuery(".headTableNode").find(".se-select-name").text()),""!=t?l.useTablePlugins(e,t,i):l.useTablePlugins(e,"",i)}})}),jQuery(".laytable-page-btnok").on("click",function(){var e=parseInt(jQuery(".laytable-page-input").val()),t=jQuery(".headSearchInput").val(),i="";0<jQuery(".headTableNode").find(".se-select-name").length&&(i=jQuery(".headTableNode").find(".se-select-name").text()),""!=t?l.useTablePlugins(e,t,i):l.useTablePlugins(e,"",i)}),jQuery(".page-item").each(function(e,t){jQuery(t).attr("value")==n+""?jQuery(t).attr("class","page-item page-active"):"-1"!=jQuery(t).attr("value")&&"+1"!=jQuery(t).attr("value")&&jQuery(t).attr("class","page-item")});var e=jQuery(".page-active").attr("value"),t=jQuery(".page-prev").parent().next().find("a")[0],i=jQuery(".page-last").parent().prev().find("a")[0];parseInt(e)>parseInt(jQuery(t).attr("value"))?jQuery(".page-prev").attr("class","page-item page-prev"):jQuery(".page-prev").attr("class","page-item page-prev rayui-disabled"),parseInt(e)==parseInt(jQuery(i).attr("value"))?jQuery(".page-last").attr("class","page-item page-last rayui-disabled"):jQuery(".page-last").attr("class","page-item page-last"),jQuery(".laytable-page-input").attr("value",n+"")})}.bind(this),15,n,e,t)},loadSearchCondition:function(){var t=this;if(this.template.selectSearch){var e='<div class="vux-flexbox se-section vux-flex-row"><div class="se-name" style="font-size:15px;margin-left:10px;">筛选:</div><div class="el-dropdown" style="margin-right: 20px;"><div class="vux-flexbox se-select vux-flex-row el-dropdown-selfdefine" style="border:0px;"><div class="se-select-name" style="font-size:15px;color:#333;">'+this.template.selectSearch.default+'</div><div class="el-icon-arrow-down el-icon--right"><img src="/x_component_CRM/$Clue/default/icons/arrow.png"></div></div></div></div>',i='<ul class="el-dropdown-type" style="display: none;top:170px;" tid="selectSearch">';this.template.selectSearch.items.each(function(e){e.name&&(e.name.indexOf("全部")<0?i=i+'<li class="el-dropdown-menu__item">'+e.name+"</li>":t.isAdmin&&(i=i+'<li class="el-dropdown-menu__item">'+e.name+"</li>"))}.bind(this)),i+='<div class="popper__arrow" style="box-sizing: border-box !important;"></div></ul>',jQuery(".headTableNode").append(e+i),jQuery(".headTableNode").find(".se-select").click(function(){jQuery("[tid='selectSearch']").toggle(100)}),jQuery(".el-dropdown-menu__item").click(function(){"selectSearch"==jQuery(this).parent().attr("tid")&&(jQuery(".se-select-name").text(jQuery(this).text()),t.useTablePlugins(1,jQuery(".headSearchInput").val(),jQuery(".se-select-name").text()),jQuery(this).parent().toggle(100))}),t.dropdown=jQuery(".contentListDiv")[0].getElement(".el-dropdown-type"),t.dropdown&&t.dropdown.setStyles({top:jQuery(".se-name").offset().top+30+"px",left:jQuery(".se-name").offset().left+2})}var s="";if(0<jQuery(".contentListDiv").find(".contentLeftItemSelectd").length&&(s=jQuery(".contentListDiv").find(".contentLeftItemSelectd").text()),""!=s){if(jQuery(".headTableNode").empty(),"今日需联系客户"==s){var n="";e='<div class="vux-flexbox se-section vux-flex-row headTableNode-left"><div class="el-dropdown" style="margin-right: 20px;"><div class="vux-flexbox se-select vux-flex-row el-dropdown-selfdefine" style="border:0px;"><div class="se-select-name" style="font-size:13px;color:#333;">'+this.template.selectContion1.record.default+'</div><div class="el-icon-arrow-down el-icon--right"><img src="/x_component_CRM/$Clue/default/icons/arrow.png"></div></div></div></div>',i='<ul class="el-dropdown-type selectSearch" style="display: none;top:170px;width: 160px;left:395px;" tid="selectSearch">';this.template.selectContion1.record.items.each(function(e){e.name&&(i=i+'<li class="el-dropdown-menu__item">'+e.name+"</li>")}.bind(this)),n=(n=e+(i+='<div class="popper__arrow" style="box-sizing: border-box !important;"></div></ul>'))+'<div class="vux-flexbox se-section vux-flex-row headTableNode-right"><div class="el-dropdown" style="margin-right: 20px;"><div class="vux-flexbox se-select vux-flex-row el-dropdown-selfdefine" style="border:0px;"><div class="se-select-name" style="font-size:13px;color:#333;">'+this.template.selectContion1.competence.default+'</div><div class="el-icon-arrow-down el-icon--right"><img src="/x_component_CRM/$Clue/default/icons/arrow.png"></div></div></div></div>',n+='<ul class="el-dropdown-type selectSearch_right" style="display: none;top:170px;width: 120px;left:578px;" tid="selectSearch_right">',this.template.selectContion1.competence.items.each(function(e){e.name&&(n=n+'<li class="el-dropdown-menu__item">'+e.name+"</li>")}.bind(this)),n+='<div class="popper__arrow" style="box-sizing: border-box !important;"></div></ul>'}if("分配给我的线索"==s){e='<div class="vux-flexbox se-section vux-flex-row headTableNode-left"><div class="el-dropdown" style="margin-right: 20px;"><div class="vux-flexbox se-select vux-flex-row el-dropdown-selfdefine" style="border:0px;"><div class="se-select-name" style="font-size:13px;color:#333;">'+this.template.selectContion2.record.default+'</div><div class="el-icon-arrow-down el-icon--right"><img src="/x_component_CRM/$Clue/default/icons/arrow.png"></div></div></div></div>',i='<ul class="el-dropdown-type selectSearch" style="display: none;top:170px;width: 160px;left:395px;" tid="selectSearch">';this.template.selectContion2.record.items.each(function(e){e.name&&(i=i+'<li class="el-dropdown-menu__item">'+e.name+"</li>")}.bind(this)),i+='<div class="popper__arrow" style="box-sizing: border-box !important;"></div></ul>'}if("分配给我的客户"==s){e='<div class="vux-flexbox se-section vux-flex-row headTableNode-left"><div class="el-dropdown" style="margin-right: 20px;"><div class="vux-flexbox se-select vux-flex-row el-dropdown-selfdefine" style="border:0px;"><div class="se-select-name" style="font-size:13px;color:#333;">'+this.template.selectContion3.record.default+'</div><div class="el-icon-arrow-down el-icon--right"><img src="/x_component_CRM/$Clue/default/icons/arrow.png"></div></div></div></div>',i='<ul class="el-dropdown-type selectSearch" style="display: none;top:170px;width: 160px;left:395px;" tid="selectSearch">';this.template.selectContion3.record.items.each(function(e){e.name&&(i=i+'<li class="el-dropdown-menu__item">'+e.name+"</li>")}.bind(this)),i+='<div class="popper__arrow" style="box-sizing: border-box !important;"></div></ul>'}if("待进入公海的客户"==s){e='<div class="vux-flexbox se-section vux-flex-row headTableNode-right" style="margin-left:20px;"><div class="el-dropdown" style="margin-right: 20px;"><div class="vux-flexbox se-select vux-flex-row el-dropdown-selfdefine" style="border:0px;"><div class="se-select-name" style="font-size:13px;color:#333;">'+this.template.selectContion4.competence.default+'</div><div class="el-icon-arrow-down el-icon--right"><img src="/x_component_CRM/$Clue/default/icons/arrow.png"></div></div></div></div>',i='<ul class="el-dropdown-type selectSearch" style="display: none;top:170px;width: 120px;left:395px;" tid="selectSearch_right">';this.template.selectContion4.competence.items.each(function(e){e.name&&(i=i+'<li class="el-dropdown-menu__item">'+e.name+"</li>")}.bind(this)),i+='<div class="popper__arrow" style="box-sizing: border-box !important;"></div></ul>'}jQuery(".headTableNode-left").find(".se-select").click(function(){jQuery("[tid='selectSearch']").toggle(100)}),jQuery(".headTableNode-right").find(".se-select").click(function(){jQuery("[tid='selectSearch_right']").toggle(100)}),jQuery(".el-dropdown-menu__item").click(function(){"selectSearch"==jQuery(this).parent().attr("tid")&&(jQuery(".headTableNode-left").find(".se-select-name").text(jQuery(this).text()),t.useTablePlugins(1,"",jQuery(".headTableNode-left").find(".se-select-name").text()),jQuery(this).parent().toggle(100)),"selectSearch_right"==jQuery(this).parent().attr("tid")&&(jQuery(".headTableNode-right").find(".se-select-name").text(jQuery(this).text()),t.useTablePlugins(1,"",jQuery(".headTableNode-right").find(".se-select-name").text()),jQuery(this).parent().toggle(0))}),t.dropdown=jQuery("body")[0].getElement(".selectSearch"),t.dropdownRight=jQuery("body")[0].getElement(".selectSearch_right"),t.dropdown&&t.dropdown.setStyles({top:jQuery(".headTableNode").offset().top+45+"px",left:jQuery(".headTableNode").offset().left-30}),t.dropdownRight&&t.dropdownRight.setStyles({top:jQuery(".headTableNode").offset().top+45+"px",left:jQuery(".headTableNode").offset().left+152})}},formatDate:function(e){var t=e.getFullYear(),i=e.getMonth()+1,s=e.getDate();return i<10&&(i="0"+i),s<10&&(s="0"+s),t+"-"+i+"-"+s},reload:function(){this.clear(),this.node=new Element("div",{styles:this.css.viewContentListNode}).inject(this.container),this.createViewNode(),this.createViewHead(),this.createViewBody()},initSortData:function(){this.sortField=null,this.sortType=null,this.sortFieldDefault=null,this.sortTypeDefault=null},destroy:function(){this.documentNodeTemplate&&delete this.documentNodeTemplate,this.template&&delete this.template,this.scrollBar&&(this.scrollBar.scrollVAreaNode&&this.scrollBar.scrollVAreaNode.destroy(),delete this.scrollBar),this.pagingContainerTop&&(this.pagingContainerTopCreated?this.pagingContainerTop.destroy():this.pagingContainerTop.empty()),this.pagingContainerBottom&&(this.pagingContainerBottomCreated?this.pagingContainerBottom.destroy():this.pagingContainerBottom.empty()),this.paging&&this.paging.destroy(),this.clear()},clear:function(){this.documents=null,MWF.release(this.items),this.items=[],this.documents={},this.node.destroy(),this.container.empty(),this.isItemsLoaded=!1,this.isItemLoadding=!1,this.loadItemQueue=0},clearBody:function(){this.items.each(function(e,t){e.destroy()}),this.documents=null,MWF.release(this.items),this.items=[],this.documents={}},resort:function(e){this.sortField=e.retrieve("sortField"),""==e.retrieve("sortType")?this.sortType="asc":"asc"==this.sortType?this.sortType="desc":(this.sortField=null,this.sortType=null),this.reload()},setScroll:function(){MWF.require("MWF.widget.ScrollBar",function(){this.scrollBar=new MWF.widget.ScrollBar(this.container,{indent:!1,style:"xApp_TaskList",where:"before",distance:60,friction:4,axis:{x:!1,y:!0},onScroll:function(e){if(!this.options.pagingEnable){var t=this.container.getScrollSize(),i=this.container.getSize();t.y-i.y<e+200&&(this.isItemsLoaded||this.loadElementList())}}.bind(this)})}.bind(this))},ayalyseTemplate:function(){MWF.getJSON(this.options.templateUrl,function(e){this.template=e}.bind(this),!1)},formatElement:function(i,s,e){var t=s.html.toDOM(i,function(e,t){this.formatStyles(e),this.formatLable(e),i&&this.setEventStyle(e,s)}.bind(this))[0];return s.width&&t.set("width",s.width),e&&i&&i.empty(),t},formatStyles:function(e){e.getElements("[class]").each(function(e){var t=e.get("class");t&&this.css[t]&&e.setStyles(this.css[t])}.bind(this)),e.getElements("[styles]").each(function(e){var t=e.get("styles");t&&this.css[t]&&e.setStyles(this.css[t])}.bind(this))},formatLable:function(e){e.getElements("[lable]").each(function(e){var t=e.get("lable");t&&this.lp[t]&&e.set("text",this.lp[t]+(e.get("colon")?":":""))}.bind(this))},createViewHeadNode:function(){this.fireEvent("queryCreateViewHeadNode"),this._queryCreateViewHeadNode(),this.viewHeadNode=this.formatElement(this.headTableNode,this.template.viewHeadSetting),this._postCreateViewHeadNode(this.viewHeadNode),this.fireEvent("postCreateViewHeadNode"),this.viewHeadNode},createViewNode:function(){this.fireEvent("queryCreateViewNode"),this._queryCreateViewNode(),this.viewNode=this.formatElement(this.contentTableNode,this.template.viewSetting),this._postCreateViewNode(this.viewNode),this.fireEvent("postCreateViewNode"),this.viewNode},getContentTemplateNode:function(){this.documentNodeTemplate=this.formatElement(null,this.template.documentSetting),this.template.items.each(function(e){e.nodeTemplate=this.formatElement(null,e.content)}.bind(this))},createViewHead:function(){if(this.fireEvent("queryCreateViewHead"),this._queryCreateViewHead(),!this.template||this.template.headSetting&&!this.template.headSetting.disable&&this.template.headSetting.html){var i=this,s=this.headNode=this.formatElement(this.viewHeadNode,this.template.headSetting);this.template.items.each(function(e){if(e.head&&(!e.access||this.options[e.access])&&(!e.head.access||this.options[e.head.access])){var t=this.formatElement(s,e.head);"$checkbox"==e.name&&(this.checkboxElement=new Element("input",{type:"checkbox"}).inject(t),this.checkboxElement.addEvent("click",function(){this.selectAllCheckbox()}.bind(this))),e.defaultSort&&""!=e.defaultSort&&(this.sortFieldDefault=e.name,this.sortTypeDefault=e.defaultSort),e.sort&&""!=e.sort&&(t.store("sortField",e.name),this.sortField==e.name&&""!=this.sortType?(t.store("sortType",this.sortType),this.sortIconNode=new Element("div",{styles:"asc"==this.sortType?this.css.sortIconNode_asc:this.css.sortIconNode_desc}).inject(t,"top")):(t.store("sortType",""),this.sortIconNode=new Element("div",{styles:this.css.sortIconNode}).inject(t,"top")),t.setStyle("cursor","pointer"),t.addEvent("click",function(){i.resort(this)}))}}.bind(this)),this.fireEvent("postCreateViewHead"),this._postCreateViewHead(s)}},createViewHeadGroup:function(){var e=this.headTableNode.getElement("table");if(e){this.headColGroup=new Element("colgroup.headColGroup").inject(e),this.headWidthAll=0;this.template.items.each(function(e){e.head&&e.head.width&&(new Element("col.headCol",{width:e.head.width}).inject(this.headColGroup),this.headWidthAll=this.headWidthAll+parseInt(e.head.width.substring(0,e.head.width.length-2)))}.bind(this)),e.setStyles({width:(this.headWidthAll>this.container.getWidth()?this.headWidthAll:this.container.getWidth())+"px"})}},createViewContentGroup:function(){var e=this.contentTableNode.getElement("table");if(e){this.contentColGroup=new Element("colgroup.contentColGroup").inject(e),this.contentWidthAll=0;this.template.items.each(function(e){e.content&&e.content.width&&(new Element("col.contentCol",{width:e.content.width}).inject(this.contentColGroup),this.contentWidthAll=this.contentWidthAll+parseInt(e.content.width.substring(0,e.content.width.length-2)))}.bind(this)),e.setStyles({width:(this.contentWidthAll>this.container.getWidth()?this.contentWidthAll:this.container.getWidth())+"px"})}},setEventStyle:function(node,setting,bingObj,data){var _self=this,styles,overStyles,downStyles,styleStr=setting.styles;if("string"==typeOf(styleStr)?styles=styleStr&&"function"==styleStr.substr(0,"function".length)?(eval("var fun = "+styleStr),fun.call(bingObj,data)):this.css[styleStr]:"object"==typeOf(styleStr)?styles=styleStr:"function"==typeOf(styleStr)&&(eval("var fun = "+styleStr),styles=fun.call(bingObj,data)),!styles){var s=node.get("styles");s||node.get("class"),s&&(styles=this.css[s])}setting.icon&&(styles||(styles={}),styles["background-image"]="url("+this.explorer.path+"/"+this.explorer.options.style+"/icon/"+setting.icon+")"),"string"==typeOf(setting.mouseoverStyles)&&(overStyles=this.css[setting.mouseoverStyles]),"object"==typeOf(setting.mouseoverStyles)&&(overStyles=setting.mouseoverStyles),setting.mouseoverIcon&&(overStyles||(overStyles={}),overStyles["background-image"]="url("+this.explorer.path+"/"+this.explorer.options.style+"/icon/"+setting.mouseoverIcon+")"),"string"==typeOf(setting.mousedownStyles)&&(downStyles=this.css[setting.mousedownStyles]),"object"==typeOf(setting.mousedownStyles)&&(downStyles=setting.mousedownStyles),setting.mousedownIcon&&(downStyles||(downStyles={}),downStyles["background-image"]="url("+this.explorer.path+"/"+this.explorer.options.style+"/icon/"+setting.mousedownIcon+")"),styles&&node.setStyles(styles),overStyles&&styles&&(node.addEvent("mouseover",function(e){_self.lockNodeStyle||this.node.setStyles(this.styles)}.bind({styles:overStyles,node:node})),node.addEvent("mouseout",function(e){_self.lockNodeStyle||this.node.setStyles(this.styles)}.bind({styles:styles,node:node}))),downStyles&&(overStyles||styles)&&(node.addEvent("mousedown",function(e){_self.lockNodeStyle||this.node.setStyles(this.styles)}.bind({styles:downStyles,node:node})),node.addEvent("mouseup",function(e){_self.lockNodeStyle||this.node.setStyles(this.styles)}.bind({styles:overStyles||styles,node:node})))},selectAllCheckbox:function(){var t=this.checkboxElement.get("checked");this.items.each(function(e){e.checkboxElement&&e.checkboxElement.set("checked",t)}.bind(this))},getCheckedItems:function(){var t=[];return this.items.each(function(e){e.checkboxElement.get("checked")&&t.push(e)}.bind(this)),t},createViewBody:function(){this.loadElementList()},loadElementList:function(e){if(this.options.pagingEnable){var t=this.options.pagingPar.currentItem,i=this.options.pagingPar.countPerPage;if(t){var s=Math.ceil(t/i);this.loadPagingElementList(e,s,t)}else this.loadPagingElementList(e,this.options.pagingPar.currentPage)}else this.loadScrollElementList(e)},loadScrollElementList:function(e){this.isItemsLoaded||(this.isItemLoadding?this.loadItemQueue++:(this.isItemLoadding=!0,this._getCurrentPageData(function(e){(this.dataCount=e.count)<=this.items.length&&(this.isItemsLoaded=!0),e.data&&"array"==typeOf(e.data)&&e.data.each(function(e){var t=e[this.options.documentKeyWord||"id"];if(!this.documents[t]){var i=this._createDocument(e,this.items.length);this.items.push(i),this.documents[t]=i}}.bind(this)),this.isItemLoadding=!1,0<this.loadItemQueue&&(this.loadItemQueue--,this.loadElementList())}.bind(this),e)))},loadPagingElementList:function(e,i,s){this.currentPage=i||1,this._getCurrentPageData(function(e){if(this.viewNode.empty(),this.dataCount=e.count,this.createPaging(e.count,i),e.data.each(function(e){var t=this._createDocument(e,this.items.length);this.items.push(t);var i=e[this.options.documentKeyWord||"id"];this.documents[i]=t}.bind(this)),s){if(this.options.documentKeyWord)var t=this.documents[s].node.getTop();else t=this.items[s-1].node.getTop();this.fireEvent("gotoItem",t)}}.bind(this),e,i)},createPaging:function(e,t){if(this.options.pagingEnable&&!this.paging){-1<this.options.pagingPar.position.indexOf("top")&&(this.pagingContainerTop||(this.pagingContainerTopCreated=!0,this.pagingContainerTop=new Element("div",{styles:this.css.pagingContainer}).inject(this.viewNode,"before"))),-1<this.options.pagingPar.position.indexOf("bottom")&&(this.pagingContainerBottom||(this.pagingContainerBottomCreated=!0,this.pagingContainerBottom=new Element("div",{styles:this.css.pagingContainer}).inject(this.viewNode,"after")));var i=Object.merge(this.options.pagingPar,{itemSize:e,onJumpingPage:function(e){this.loadPagingElementList(this.options.pagingPar.countPerPage,e.pageNum,e.itemNum)}.bind(this)});t&&(i.currentPage=t),this.options.pagingPar.hasPagingBar&&(this.paging=new MWF.xApplication.CRM.Template.Paging(this.pagingContainerTop,this.pagingContainerBottom,i,this.css),this.paging.load())}},_getCurrentPageData:function(t,e,i){if(this.options.pagingEnable)this.actions.listDetailFilter(i,e,n,function(e){t&&t(e)}.bind(this));else{e||(e=20);var s=this.items.length?this.items[this.items.length-1].data.id:"(0)",n=this.filterData||{};this.actions.listDetailFilterNext(s,e,n,function(e){t&&t(e)}.bind(this))}},getCurrentPageNum:function(){return this.paging.options.currentPage},getPageSize:function(){return this.paging.options.pageSize},gotoPage:function(e){this.paging.gotoPage(e)},_createDocument:function(e,t){return new MWF.xApplication.CRM.Template.ComplexDocument(this.viewNode,e,this.explorer,this,null,t)},_openDocument:function(){},_openOtherDocument:function(){},_removeDocument:function(e,t){},_create:function(){this.from=new MPopupForm(this.explorer),this.from.create()},_queryCreateViewHeadNode:function(){},_postCreateViewHeadNode:function(e){},_queryCreateViewNode:function(){},_postCreateViewNode:function(e){},_queryCreateViewHead:function(){},_postCreateViewHead:function(e){}}),MWF.xApplication.CRM.Template.ComplexViewOpen=new Class({Implements:[Options,Events],options:{style:"default",templateUrl:"",scrollEnable:!1,pagingEnable:!0,documentKeyWord:null,pagingPar:{position:["bottom"],countPerPage:5,visiblePages:10,currentPage:1,currentItem:null,hasPagingBar:!0,hasTruningBar:!0,hasReturn:!1}},initialize:function(e,t,i,s,n,o){this.container=e,this.openDiv=t,this.explorer=s,o?(this.app=i||o.app||this.explorer.app,this.lp=o.lp||this.explorer.lp||this.app.lp,this.css=o.css||this.explorer.css||this.app.css,this.actions=o.actions||this.explorer.actions||this.app.actions||this.app.restActions,this.isAdmin=o.isAdmin):(this.app=i||this.explorer.app,this.lp=this.explorer.lp||this.app.lp,this.css=this.explorer.css||this.app.css,this.actions=this.explorer.actions||this.app.actions||this.app.restActions),n.templateUrl?-1==n.templateUrl.indexOf("/")&&(n.templateUrl=this.explorer.path+n.templateUrl):n.templateUrl=this.explorer.path+"listItem.json",this.setOptions(n)},initData:function(){this.items=[],this.documents={},this.isItemsLoaded=!1,this.isItemLoadding=!1,this.loadItemQueue=0,this.count=0},load:function(){this.initData(),this.ayalyseTemplate(),this.getContentTemplateNode(),this.headNode=new Element("div.headNode",{styles:this.css.viewContentListNode}).inject(this.container),this.contentTableNode=new Element("div.contentTableNode",{styles:this.css.viewContentListNode}).inject(this.container),this.createViewNode(),this.loadResource(function(){this.loadSearchCondition(),this.useTablePlugins(1,"",""),0==jQuery(".headTableNode:has(div)").length&&jQuery(".headTableNode").remove();var i=this;jQuery(".headSearchBottonDiv").on("click",function(){var e=jQuery(".headSearchInput").val();if(""!=e){parseInt(jQuery(".page-active").attr("value"));var t="";0<jQuery(".headTableNode").find(".se-select-name").length&&(t=jQuery(".headTableNode").find(".se-select-name").text()),i.useTablePlugins(1,e,t)}}),jQuery(".headSearchRemoveImg").on("click",function(){var e=parseInt(jQuery(".page-active").attr("value")),t="";0<jQuery(".headTableNode").find(".se-select-name").length&&(t=jQuery(".headTableNode").find(".se-select-name").text()),i.useTablePlugins(e,"",t)})}.bind(this))},loadResource:function(e){e&&e()},useTablePlugins:function(n,e,t){0<jQuery(".notify").length&&jQuery(".notify").remove(),0<jQuery(".laytable-box").length&&jQuery(".laytable-box").remove();var o,a,l=this,r=[],h=[],s=[],c=this.lp,d=c.fieldList;for(i in o=c.sortField,a=c.sortType,n||(n=1),d)s.push(d[i]);h.push(s),this._getCurrentPageData(function(s){s.data.each(function(e){if(e.owneruser){var t=e.owneruser,i=e.createuser;e.owneruser=t.split("@")[0],e.createuser=i.split("@")[0]}else e.owneruser="",e.createuser="";r.push(e)}.bind(this)),layui.config({base:"/x_component_CRM/$Template/plugins/table2/"}).use(["table2","table2"],function(){layui.table2.render({elem:"#contentTable",data:r,height:850,width:"100%",page:{align:"right",groups:5,curr:1,count:s.count,limit:15,limits:[15,30,45,60,75,90]},initSort:{sortField:o,sortType:a},cols:h});jQuery(".clueId").each(function(e,t){jQuery(t).on("click",function(){l._openDocument(jQuery(t).attr("id"),jQuery(t).text())})}),jQuery(".otherId").each(function(e,t){jQuery(t).on("click",function(){l._openOtherDocument(jQuery(t).attr("id"),jQuery(t).text())})}),jQuery(".laytable-page-pagination").find("a").each(function(e,s){jQuery(s).on("click",function(){var e=1;if(e="-1"==jQuery(s).attr("value")||"+1"==jQuery(s).attr("value")?parseInt(jQuery(s).attr("value"))+e:parseInt(jQuery(s).text()),"page-item page-last rayui-disabled"!=jQuery(s).attr("class")&&"page-item page-prev rayui-disabled"!=jQuery(s).attr("class")){var t=jQuery(".headSearchInput").val(),i="";0<jQuery(".headTableNode").find(".se-select-name").length&&(i=jQuery(".headTableNode").find(".se-select-name").text()),""!=t?l.useTablePlugins(e,t,i):l.useTablePlugins(e,"",i)}})}),jQuery(".laytable-page-btnok").on("click",function(){var e=parseInt(jQuery(".laytable-page-input").val()),t=jQuery(".headSearchInput").val(),i="";0<jQuery(".headTableNode").find(".se-select-name").length&&(i=jQuery(".headTableNode").find(".se-select-name").text()),""!=t?l.useTablePlugins(e,t,i):l.useTablePlugins(e,"",i)}),jQuery(".page-item").each(function(e,t){jQuery(t).attr("value")==n+""?jQuery(t).attr("class","page-item page-active"):"-1"!=jQuery(t).attr("value")&&"+1"!=jQuery(t).attr("value")&&jQuery(t).attr("class","page-item")});var e=jQuery(".page-active").attr("value"),t=jQuery(".page-prev").parent().next().find("a")[0],i=jQuery(".page-last").parent().prev().find("a")[0];parseInt(e)>parseInt(jQuery(t).attr("value"))?jQuery(".page-prev").attr("class","page-item page-prev"):jQuery(".page-prev").attr("class","page-item page-prev rayui-disabled"),parseInt(e)==parseInt(jQuery(i).attr("value"))?jQuery(".page-last").attr("class","page-item page-last rayui-disabled"):jQuery(".page-last").attr("class","page-item page-last"),jQuery(".laytable-page-input").attr("value",n+"")})}.bind(this),15,n,e,t)},loadSearchCondition:function(){var t=this,e='<span class="title">'+this.lp.title+'</span><div class="search-input"><input type="text" autocomplete="off" placeholder="'+this.lp.searchText+'" class="el-input__inner"><div class="el-input-group__append"><img src="/x_component_CRM/$Template/search.png" class="searchimg"></div></div><img src="/x_component_CRM/$Template/close.png" class="close"></div>';jQuery(".headNode").append(e),jQuery(".headNode").find(".el-input-group__append").click(function(){var e=jQuery(".el-input__inner").val();t.useTablePlugins(1,e)}),jQuery(".headNode").find(".close").click(function(){jQuery(".openDiv").empty(),jQuery(".openDiv").hide(),jQuery(".notify").remove()})},openx:function(e){},reload:function(){this.clear(),this.node=new Element("div",{styles:this.css.viewContentListNode}).inject(this.container),this.createViewNode(),this.createViewHead(),this.createViewBody()},initSortData:function(){this.sortField=null,this.sortType=null,this.sortFieldDefault=null,this.sortTypeDefault=null},destroy:function(){this.documentNodeTemplate&&delete this.documentNodeTemplate,this.template&&delete this.template,this.scrollBar&&(this.scrollBar.scrollVAreaNode&&this.scrollBar.scrollVAreaNode.destroy(),delete this.scrollBar),this.pagingContainerTop&&(this.pagingContainerTopCreated?this.pagingContainerTop.destroy():this.pagingContainerTop.empty()),this.pagingContainerBottom&&(this.pagingContainerBottomCreated?this.pagingContainerBottom.destroy():this.pagingContainerBottom.empty()),this.paging&&this.paging.destroy(),this.clear()},clear:function(){this.documents=null,MWF.release(this.items),this.items=[],this.documents={},this.node.destroy(),this.container.empty(),this.isItemsLoaded=!1,this.isItemLoadding=!1,this.loadItemQueue=0},clearBody:function(){this.items.each(function(e,t){e.destroy()}),this.documents=null,MWF.release(this.items),this.items=[],this.documents={}},resort:function(e){this.sortField=e.retrieve("sortField"),""==e.retrieve("sortType")?this.sortType="asc":"asc"==this.sortType?this.sortType="desc":(this.sortField=null,this.sortType=null),this.reload()},setScroll:function(){MWF.require("MWF.widget.ScrollBar",function(){this.scrollBar=new MWF.widget.ScrollBar(this.container,{indent:!1,style:"xApp_TaskList",where:"before",distance:60,friction:4,axis:{x:!1,y:!0},onScroll:function(e){if(!this.options.pagingEnable){var t=this.container.getScrollSize(),i=this.container.getSize();t.y-i.y<e+200&&(this.isItemsLoaded||this.loadElementList())}}.bind(this)})}.bind(this))},ayalyseTemplate:function(){MWF.getJSON(this.options.templateUrl,function(e){this.template=e}.bind(this),!1)},formatElement:function(i,s,e){var t=s.html.toDOM(i,function(e,t){this.formatStyles(e),this.formatLable(e),i&&this.setEventStyle(e,s)}.bind(this))[0];return s.width&&t.set("width",s.width),e&&i&&i.empty(),t},formatStyles:function(e){e.getElements("[class]").each(function(e){var t=e.get("class");t&&this.css[t]&&e.setStyles(this.css[t])}.bind(this)),e.getElements("[styles]").each(function(e){var t=e.get("styles");t&&this.css[t]&&e.setStyles(this.css[t])}.bind(this))},formatLable:function(e){e.getElements("[lable]").each(function(e){var t=e.get("lable");t&&this.lp[t]&&e.set("text",this.lp[t]+(e.get("colon")?":":""))}.bind(this))},createViewHeadNode:function(){this.fireEvent("queryCreateViewHeadNode"),this._queryCreateViewHeadNode(),this.viewHeadNode=this.formatElement(this.headTableNode,this.template.viewHeadSetting),this._postCreateViewHeadNode(this.viewHeadNode),this.fireEvent("postCreateViewHeadNode"),this.viewHeadNode},createViewNode:function(){this.fireEvent("queryCreateViewNode"),this._queryCreateViewNode(),this.viewNode=this.formatElement(this.contentTableNode,this.template.viewSetting),this._postCreateViewNode(this.viewNode),this.fireEvent("postCreateViewNode"),this.viewNode},getContentTemplateNode:function(){this.documentNodeTemplate=this.formatElement(null,this.template.documentSetting),this.template.items.each(function(e){e.nodeTemplate=this.formatElement(null,e.content)}.bind(this))},createViewHead:function(){if(this.fireEvent("queryCreateViewHead"),this._queryCreateViewHead(),!this.template||this.template.headSetting&&!this.template.headSetting.disable&&this.template.headSetting.html){var i=this,s=this.headNode=this.formatElement(this.viewHeadNode,this.template.headSetting);this.template.items.each(function(e){if(e.head&&(!e.access||this.options[e.access])&&(!e.head.access||this.options[e.head.access])){var t=this.formatElement(s,e.head);"$checkbox"==e.name&&(this.checkboxElement=new Element("input",{type:"checkbox"}).inject(t),this.checkboxElement.addEvent("click",function(){this.selectAllCheckbox()}.bind(this))),e.defaultSort&&""!=e.defaultSort&&(this.sortFieldDefault=e.name,this.sortTypeDefault=e.defaultSort),e.sort&&""!=e.sort&&(t.store("sortField",e.name),this.sortField==e.name&&""!=this.sortType?(t.store("sortType",this.sortType),this.sortIconNode=new Element("div",{styles:"asc"==this.sortType?this.css.sortIconNode_asc:this.css.sortIconNode_desc}).inject(t,"top")):(t.store("sortType",""),this.sortIconNode=new Element("div",{styles:this.css.sortIconNode}).inject(t,"top")),t.setStyle("cursor","pointer"),t.addEvent("click",function(){i.resort(this)}))}}.bind(this)),this.fireEvent("postCreateViewHead"),this._postCreateViewHead(s)}},createViewHeadGroup:function(){var e=this.headTableNode.getElement("table");if(e){this.headColGroup=new Element("colgroup.headColGroup").inject(e),this.headWidthAll=0;this.template.items.each(function(e){e.head&&e.head.width&&(new Element("col.headCol",{width:e.head.width}).inject(this.headColGroup),this.headWidthAll=this.headWidthAll+parseInt(e.head.width.substring(0,e.head.width.length-2)))}.bind(this)),e.setStyles({width:(this.headWidthAll>this.container.getWidth()?this.headWidthAll:this.container.getWidth())+"px"})}},createViewContentGroup:function(){var e=this.contentTableNode.getElement("table");if(e){this.contentColGroup=new Element("colgroup.contentColGroup").inject(e),this.contentWidthAll=0;this.template.items.each(function(e){e.content&&e.content.width&&(new Element("col.contentCol",{width:e.content.width}).inject(this.contentColGroup),this.contentWidthAll=this.contentWidthAll+parseInt(e.content.width.substring(0,e.content.width.length-2)))}.bind(this)),e.setStyles({width:(this.contentWidthAll>this.container.getWidth()?this.contentWidthAll:this.container.getWidth())+"px"})}},setEventStyle:function(node,setting,bingObj,data){var _self=this,styles,overStyles,downStyles,styleStr=setting.styles;if("string"==typeOf(styleStr)?styles=styleStr&&"function"==styleStr.substr(0,"function".length)?(eval("var fun = "+styleStr),fun.call(bingObj,data)):this.css[styleStr]:"object"==typeOf(styleStr)?styles=styleStr:"function"==typeOf(styleStr)&&(eval("var fun = "+styleStr),styles=fun.call(bingObj,data)),!styles){var s=node.get("styles");s||node.get("class"),s&&(styles=this.css[s])}setting.icon&&(styles||(styles={}),styles["background-image"]="url("+this.explorer.path+"/"+this.explorer.options.style+"/icon/"+setting.icon+")"),"string"==typeOf(setting.mouseoverStyles)&&(overStyles=this.css[setting.mouseoverStyles]),"object"==typeOf(setting.mouseoverStyles)&&(overStyles=setting.mouseoverStyles),setting.mouseoverIcon&&(overStyles||(overStyles={}),overStyles["background-image"]="url("+this.explorer.path+"/"+this.explorer.options.style+"/icon/"+setting.mouseoverIcon+")"),"string"==typeOf(setting.mousedownStyles)&&(downStyles=this.css[setting.mousedownStyles]),"object"==typeOf(setting.mousedownStyles)&&(downStyles=setting.mousedownStyles),setting.mousedownIcon&&(downStyles||(downStyles={}),downStyles["background-image"]="url("+this.explorer.path+"/"+this.explorer.options.style+"/icon/"+setting.mousedownIcon+")"),styles&&node.setStyles(styles),overStyles&&styles&&(node.addEvent("mouseover",function(e){_self.lockNodeStyle||this.node.setStyles(this.styles)}.bind({styles:overStyles,node:node})),node.addEvent("mouseout",function(e){_self.lockNodeStyle||this.node.setStyles(this.styles)}.bind({styles:styles,node:node}))),downStyles&&(overStyles||styles)&&(node.addEvent("mousedown",function(e){_self.lockNodeStyle||this.node.setStyles(this.styles)}.bind({styles:downStyles,node:node})),node.addEvent("mouseup",function(e){_self.lockNodeStyle||this.node.setStyles(this.styles)}.bind({styles:overStyles||styles,node:node})))},selectAllCheckbox:function(){var t=this.checkboxElement.get("checked");this.items.each(function(e){e.checkboxElement&&e.checkboxElement.set("checked",t)}.bind(this))},getCheckedItems:function(){var t=[];return this.items.each(function(e){e.checkboxElement.get("checked")&&t.push(e)}.bind(this)),t},createViewBody:function(){this.loadElementList()},loadElementList:function(e){if(this.options.pagingEnable){var t=this.options.pagingPar.currentItem,i=this.options.pagingPar.countPerPage;if(t){var s=Math.ceil(t/i);this.loadPagingElementList(e,s,t)}else this.loadPagingElementList(e,this.options.pagingPar.currentPage)}else this.loadScrollElementList(e)},loadScrollElementList:function(e){this.isItemsLoaded||(this.isItemLoadding?this.loadItemQueue++:(this.isItemLoadding=!0,this._getCurrentPageData(function(e){(this.dataCount=e.count)<=this.items.length&&(this.isItemsLoaded=!0),e.data&&"array"==typeOf(e.data)&&e.data.each(function(e){var t=e[this.options.documentKeyWord||"id"];if(!this.documents[t]){var i=this._createDocument(e,this.items.length);this.items.push(i),this.documents[t]=i}}.bind(this)),this.isItemLoadding=!1,0<this.loadItemQueue&&(this.loadItemQueue--,this.loadElementList())}.bind(this),e)))},loadPagingElementList:function(e,i,s){this.currentPage=i||1,this._getCurrentPageData(function(e){if(this.viewNode.empty(),this.dataCount=e.count,this.createPaging(e.count,i),e.data.each(function(e){var t=this._createDocument(e,this.items.length);this.items.push(t);var i=e[this.options.documentKeyWord||"id"];this.documents[i]=t}.bind(this)),s){if(this.options.documentKeyWord)var t=this.documents[s].node.getTop();else t=this.items[s-1].node.getTop();this.fireEvent("gotoItem",t)}}.bind(this),e,i)},createPaging:function(e,t){if(this.options.pagingEnable&&!this.paging){-1<this.options.pagingPar.position.indexOf("top")&&(this.pagingContainerTop||(this.pagingContainerTopCreated=!0,this.pagingContainerTop=new Element("div",{styles:this.css.pagingContainer}).inject(this.viewNode,"before"))),-1<this.options.pagingPar.position.indexOf("bottom")&&(this.pagingContainerBottom||(this.pagingContainerBottomCreated=!0,this.pagingContainerBottom=new Element("div",{styles:this.css.pagingContainer}).inject(this.viewNode,"after")));var i=Object.merge(this.options.pagingPar,{itemSize:e,onJumpingPage:function(e){this.loadPagingElementList(this.options.pagingPar.countPerPage,e.pageNum,e.itemNum)}.bind(this)});t&&(i.currentPage=t),this.options.pagingPar.hasPagingBar&&(this.paging=new MWF.xApplication.CRM.Template.Paging(this.pagingContainerTop,this.pagingContainerBottom,i,this.css),this.paging.load())}},_getCurrentPageData:function(t,e,i){if(this.options.pagingEnable)this.actions.listDetailFilter(i,e,n,function(e){t&&t(e)}.bind(this));else{e||(e=20);var s=this.items.length?this.items[this.items.length-1].data.id:"(0)",n=this.filterData||{};this.actions.listDetailFilterNext(s,e,n,function(e){t&&t(e)}.bind(this))}},getCurrentPageNum:function(){return this.paging.options.currentPage},getPageSize:function(){return this.paging.options.pageSize},gotoPage:function(e){this.paging.gotoPage(e)},_createDocument:function(e,t){return new MWF.xApplication.CRM.Template.ComplexDocument(this.viewNode,e,this.explorer,this,null,t)},_openDocument:function(){},_openOtherDocument:function(){},_removeDocument:function(e,t){},_create:function(){this.from=new MPopupForm(this.explorer),this.from.create()},_queryCreateViewHeadNode:function(){},_postCreateViewHeadNode:function(e){},_queryCreateViewNode:function(){},_postCreateViewNode:function(e){},_queryCreateViewHead:function(){},_postCreateViewHead:function(e){}}),MWF.xApplication.CRM.Template.ComplexDocument=new Class({Implements:[Options,Events],initialize:function(e,t,i,s,n,o){this.explorer=i,this.data=t,this.container=e,this.view=s,this.index=o,this.actions=n?(this.app=n.app||this.view.app||this.explorer.app,this.lp=n.lp||this.view.lp||this.explorer.lp||this.app.lp,this.css=n.css||this.view.css||this.explorer.css||this.app.css,n.actions||this.view.actions||this.explorer.actions||this.app.actions||this.app.restActions):(this.app=this.view.app||this.explorer.app,this.lp=this.view.lp||this.explorer.lp||this.app.lp,this.css=this.view.css||this.explorer.css||this.app.css,this.view.actions||this.explorer.actions||this.app.actions||this.app.restActions),this.load()},load:function(){this.fireEvent("queryCreateDocumentNode"),this._queryCreateDocumentNode(this.data);this.loadResource(function(){this.loadClueForm(this.data)}.bind(this)),this.fireEvent("postCreateDocumentNode"),this._postCreateDocumentNode(this.node,this.data)},loadResource:function(e){var t=["/x_component_CRM/$Template/plugins/jquery.min.js"];COMMON.AjaxModule.loadCss("/x_component_CRM/$Template/form/css/bootstrap.min.css",function(){COMMON.AjaxModule.load(t,function(){jQuery.noConflict(),COMMON.AjaxModule.load("/x_component_CRM/$Template/form/js/bootstrap.min.js",function(){COMMON.AjaxModule.load("/x_component_CRM/$Template/form/js/mejs.js",function(){e&&e()}.bind(this))}.bind(this))}.bind(this))}.bind(this))},loadClueForm:function(e){alert(e)},loadItem:function(s,n,e){var t=this[s]=e.clone();if(this.format(t,s,n)&&t.inject(this.node),n.items){var i=t.getElements("[item]");t.get("item")&&i.push(t),i.each(function(e){var t=e.get("item"),i=n.items[t];i&&(i.value||""==i.value||(i.value=t),this.format(e,s,i)||e.dispose())}.bind(this))}},format:function(e,t,i){var s=this;if(i.access&&!this._getItemAccess(i))return!1;this.getConditionResult(i.show)||e.setStyle("display","none");var n=this.getConditionResult(i.condition);if(i.text){var o=this.getExecuteResult(i.text);e.set("text",this.view.lp&&this.view.lp[o]?this.view.lp[o]:o)}if(i.title){var a=this.getExecuteResult(i.title);e.set("title",this.view.lp&&this.view.lp[a]?this.view.lp[a]:a)}if(!i.text&&i.value&&""!=i.value&&("html"==i.type?e.set("html",this.getValue(i.value)):e.set("text",this.getValue(i.value))),(i.styles||i.mouseoverStyles||i.mousedownStyles||i.icon||i.mouseoverIcon||i.mousedownIcon)&&this.view.setEventStyle(e,i,this,this.data),i.action&&this[i.action]){if(!n)return!1;e.addEvent("click",function(e){this.fun.call(s,this.node,e),e.stopPropagation()}.bind({fun:this[i.action],node:e}))}return i.event&&n&&this.bindEvent(e,i.event),i.attr&&this.setAttr(e,i.attr),"$checkbox"==t&&n&&(this.checkboxElement=new Element("input",{type:"checkbox"}).inject(e),this.checkboxElement.addEvent("click",function(e){e.stopPropagation()}.bind(this)),e.addEvent("click",function(e){this.checkboxElement.set("checked",!this.checkboxElement.get("checked")),e.stopPropagation()}.bind(this))),!0},getExecuteResult:function(str){var result=str;return str&&"function"==str.substr(0,8)&&(eval("var fun = "+str),result=fun.call(this,this.data)),result},getValue:function(str){return"function"==str.substr(0,8)?(eval("var fun = "+str),fun.call(this,this.data)):"number"==typeOf(this.data[str])?this.data[str]:this.data[str]?this.data[str]:""},getConditionResult:function(str){var flag=!0;return str&&"function"==str.substr(0,8)&&(eval("var fun = "+str),flag=fun.call(this,this.data)),flag},setAttr:function(item,attr){if(attr&&""!=attr&&"$none"!=attr){if("string"==typeof attr)if(-1<attr.indexOf("^^")){var attrsArr=attr.split("##");if(2!=attrsArr[0].split("^^").length)return;attrs={};for(var i=0;i<attrsArr.length;i++){var aname=attrsArr[i].split("^^")[0],afunction=attrsArr[i].split("^^")[1];"function"==afunction.substr(0,"function".length)?(eval("var fun = "+afunction),attrs[aname]=fun.call(this,this.data)):attrs[aname]=afunction}}else eval("var attrs = "+attr);if("object"==typeOf(attrs))for(var a in attrs)item.set(a,attrs[a])}},bindEvent:function(item,events){if(events&&""!=events&&"$none"!=events){if("string"==typeof events)if(-1<events.indexOf("^^")){var eventsArr=events.split("##");if(2!=eventsArr[0].split("^^").length)return;events={};for(var i=0;i<eventsArr.length;i++){var ename=eventsArr[i].split("^^")[0],efunction=eventsArr[i].split("^^")[1];events[ename]=eval("(function(){ return "+efunction+" })()")}}else eval("var events = "+events);if("object"==typeOf(events))for(var e in events)item.addEvent(e,function(e){this.fun.call(this.bingObj,this.target,e),e.stopPropagation()}.bind({bingObj:this,target:item,fun:events[e]}))}},_getItemAccess:function(e){return!(e.access&&!this.explorer.options[e.access])},_getActionAccess:function(e){return!0},open:function(e){this.view._openDocument(this.data)},remove:function(e){var t=this.app.lp,i=t.deleteDocument.replace(/{title}/g,this.data.title),s=this;this.node.setStyles(this.css.documentNode_remove),this.readyRemove=!0,this.view.lockNodeStyle=!0,this.app.confirm("warn",e,t.deleteDocumentTitle,i,350,120,function(){s.view._removeDocument(s.data,!1),s.view.lockNodeStyle=!1,this.close()},function(){s.node.setStyles(s.css.documentNode),s.readyRemove=!1,s.view.lockNodeStyle=!1,this.close()})},destroy:function(){this.node.destroy()},_queryCreateDocumentNode:function(e){},_postCreateDocumentNode:function(e,t){}}),MWF.xApplication.CRM.Template.Paging=new Class({Implements:[Options,Events],options:{position:["bottom"],countPerPage:5,visiblePages:10,currentPage:1,itemSize:0,pageSize:0,hasTruningBar:!0,hasJumper:!0,hasReturn:!1,hiddenWithDisable:!0,text:{prePage:"",nextPage:"",firstPage:"",lastPage:""}},initialize:function(e,t,i,s){this.setOptions(i||{}),this.topContainer=e,this.bottomContainer=t,this.css=s},load:function(){this.fireEvent("queryLoad",this),this.options.pageSize=Math.ceil(this.options.itemSize/this.options.countPerPage),(1!=this.options.pageSize&&0!=this.options.pageSize||!this.options.hiddenWithDisable||this.options.hasReturn)&&(this.topContainer&&(this.topContainer.empty(),this.options.hasTruningBar&&-1<this.options.position.indexOf("top")&&this.createNode(this.topContainer)),this.bottomContainer&&(this.bottomContainer.empty(),this.options.hasPrevPage&&this.createPrevPageNode(this.bottomContainer),this.options.hasNextPage&&this.createNextPageNode(this.bottomContainer),this.options.hasTruningBar&&-1<this.options.position.indexOf("bottom")&&this.createNode(this.bottomContainer)),this.fireEvent("postLoad",this))},createNode:function(e){var t,i,s,n=this,o=this.options.visiblePages,a=this.options.pageSize,l=this.options.currentPage,r=Math.floor(o/2);i=a<=o?(s=1,a):a<l+r?(s=a-o,a):l-r<1?(s=1,o):(s=l-r,l+r);var h=this.node=new Element("div.pagingBar",{styles:this.css.pagingBar}).inject(e);this.options.hasReturn&&(this.pageReturn=new Element("div.pageReturn",{styles:this.css.pageReturn,text:this.options.returnText}).inject(h)).addEvents({mouseover:function(e){e.target.setStyles(this.css.pageReturn_over)}.bind(this),mouseout:function(e){e.target.setStyles(this.css.pageReturn)}.bind(this),click:function(){this.fireEvent("pageReturn",this)}.bind(this)});if(1!=a&&0!=a||!this.options.hiddenWithDisable){if(1<s||!this.options.hiddenWithDisable){var c=this.firstPage=new Element("div.firstPage",{styles:this.css.firstPage,text:"1..."}).inject(h);this.options.text.firstPage&&c.set("text",this.options.text.firstPage),c.addEvents({mouseover:function(e){e.target.setStyles(this.css.firstPage_over)}.bind(this),mouseout:function(e){e.target.setStyles(this.css.firstPage)}.bind(this),click:function(){this.gotoPage(1)}.bind(this)})}if(1!=l||!this.options.hiddenWithDisable){var d=this.prePage=new Element("div.prePage",{styles:this.css.prePage}).inject(h);this.options.text.prePage&&d.set("text",this.options.text.prePage),d.addEvents({mouseover:function(e){e.target.setStyles(this.css.prePage_over)}.bind(this),mouseout:function(e){e.target.setStyles(this.css.prePage)}.bind(this),click:function(){this.gotoPage(l-1)}.bind(this)})}for(this.pageTurnNodes=[],t=s;t<=i;t++)if(l==t)this.currentPage=new Element("div.currentPage",{styles:this.css.currentPage,text:t}).inject(h);else{var p=new Element("div.pageItem",{styles:this.css.pageItem,text:t}).inject(h);p.addEvents({mouseover:function(e){e.target.setStyles(this.css.pageItem_over)}.bind(this),mouseout:function(e){e.target.setStyles(this.css.pageItem)}.bind(this),click:function(){this.obj.gotoPage(this.num)}.bind({obj:this,num:t})}),this.pageTurnNodes.push(p)}if(this.options.hasJumper){var u=this.pageJumper=new Element("input.pageJumper",{styles:this.css.pageJumper,title:"输入页码,按回车跳转"}).inject(h);new Element("div.pageText",{styles:this.css.pageText,text:"/"+a}).inject(h),u.addEvents({focus:function(e){e.target.setStyles(this.css.pageJumper_over)}.bind(this),blur:function(e){e.target.setStyles(this.css.pageJumper)}.bind(this),keyup:function(e){this.value=this.value.replace(/[^0-9_]/g,"")},keydown:function(e){13==e.code&&""!=this.value&&(n.gotoPage(this.value),e.stopPropagation())}})}if(l!=a||!this.options.hiddenWithDisable){var g=this.nextPage=new Element("div.nextPage",{styles:this.css.nextPage}).inject(h);this.options.text.nextPage&&g.set("text",this.options.text.nextPage),g.addEvents({mouseover:function(e){e.target.setStyles(this.css.nextPage_over)}.bind(this),mouseout:function(e){e.target.setStyles(this.css.nextPage)}.bind(this),click:function(){this.gotoPage(l+1)}.bind(this)})}if(i<a||!this.options.hiddenWithDisable){var m=this.lastPage=new Element("div.lastPage",{styles:this.css.lastPage,text:"..."+a}).inject(h);this.options.text.lastPage&&m.set("text",this.options.text.lastPage),m.addEvents({mouseover:function(e){e.target.setStyles(this.css.lastPage_over)}.bind(this),mouseout:function(e){e.target.setStyles(this.css.lastPage)}.bind(this),click:function(){this.gotoPage(a)}.bind(this)})}}},createNextPageNode:function(e){this.nextPageNode&&(this.nextPageNode.destroy(),delete this.nextPageNode);var t=this.options.pageSize;this.options.currentPage!=t&&1!=t&&0!=t&&(this.nextPageNode=new Element("div.nextPageNode",{styles:this.css.nextPageNode,text:"下一页"}).inject(e),this.nextPageNode.addEvents({mouseover:function(e){e.target.setStyles(this.css.nextPageNode_over)}.bind(this),mouseout:function(e){e.target.setStyles(this.css.nextPageNode)}.bind(this),click:function(){this.gotoPage(this.options.currentPage+1)}.bind(this)}))},createPrevPageNode:function(e){this.prevPageNode&&(this.prevPageNode.destroy(),delete this.prevPageNode);var t=this.options.pageSize;1!=this.options.currentPage&&1!=t&&0!=t&&(this.prevPageNode=new Element("div.prevPageNode",{styles:this.css.prevPageNode,text:"上一页"}).inject(e),this.prevPageNode.addEvents({mouseover:function(e){e.target.setStyles(this.css.prevPageNode_over)}.bind(this),mouseout:function(e){e.target.setStyles(this.css.prevPageNode)}.bind(this),click:function(){this.gotoPage(this.options.currentPage-1)}.bind(this)}))},gotoPage:function(e){e<1||e>this.options.pageSize||(this.fireEvent("jumpingPage",{pageNum:e}),this.options.currentPage=e,this.load())},gotoItem:function(e){var t=Math.ceil(e/this.options.countPerPage),i=e%this.options.countPerPage;this.fireEvent("jumpingPage",{pageNum:t,itemNum:e,index:i}),this.options.currentPage=t,this.load()},destroy:function(){this.nextPageNode&&this.nextPageNode.destroy()}}),MWF.xApplication.CRM.Template.SelectForm=new Class({Extends:MWF.xApplication.CRM.Template.ComplexView,initialize:function(e,t,i,s,n,o){this.container=e,this.data=t||{},this.explorer=s,this.actions=o?(this.app=i||o.app||this.explorer.app,this.lp=o.lp||this.explorer.lp||this.app.lp,this.css=o.css||this.explorer.css||this.app.css,o.actions||this.explorer.actions||this.app.actions||this.app.restActions):(this.app=i||this.explorer.app,this.lp=this.explorer.lp||this.app.lp,this.css=this.explorer.css||this.app.css,this.explorer.actions||this.app.actions||this.app.restActions),n.templateUrl?-1==n.templateUrl.indexOf("/")&&(n.templateUrl=this.explorer.path+n.templateUrl):n.templateUrl=this.explorer.path+"listItem.json",this.setOptions(n),this.container.setAttribute("id","selectForm"),this.container.setStyle("padding",0)},_createDocument:function(e){return new MWF.xApplication.CRM.Clue.Document(this.viewNode,e,this.explorer,this)},ayalyseTemplate:function(){MWF.getJSON(this.options.templateUrl,function(e){this.template=e,console.log("this is template,",e)}.bind(this),!1)},_getCurrentPageData:function(t,e,i,s){this.category=this.options.category;e||(e=10),i||(i=1);this.items.length&&this.items[this.items.length-1].data.id;var n=this.options.filterData||{};s&&(n={key:s}),this.actions.getCustomerListPage(i,e,n,function(e){t&&t(e)}.bind(this))},getResult:function(){var e={};for(index in console.log(this.dataList,this.selectData),this.dataList){var t=this.dataList[index];if(t.id==this.selectData){e=t;break}}return e},useTablePlugins:function(s,e){this.container.getNext(".laytable-box")&&this.container.getNext(".laytable-box").destroy();var n,o,a,l=this,r=[],t=this.template;o=t.sortField,a=t.sortType,s||(s=1),n=t.field,this._getCurrentPageData(function(t){t.data.each(function(e){r.push(e)}.bind(this)),layui.config({base:"/x_component_CRM/$Template/plugins/table2/"}).use(["table2","table2"],function(){var e=layui.table2;console.log(n);e.render({elem:"#selectForm",data:r,height:600,width:"100%",page:{align:"right",groups:5,curr:1,count:t.count,limit:10,limits:[10,20,30,40,50,60,70,80,90]},initSort:{sortField:o,sortType:a},cols:[n]})});var i=this;this.dataList=r,this.selectData={};var e=this.container.getNext("div");e.getElements(".laytable-body tr").forEach(function(e,t){e.addEvents({mouseover:function(){this.addClass("laytable-tr-hover")}.bind(e),click:function(){var e=this.getElement(".checkbox");e.hasClass("checked")?(i.selectCheckbox=null,i.selectData={},e.removeClass("checked")):(i.selectCheckbox&&i.selectCheckbox.removeClass("checked"),i.selectData=e.getAttribute("sid"),(i.selectCheckbox=e).addClass("checked"))}.bind(e),mouseleave:function(){this.removeClass("laytable-tr-hover")}.bind(e)})}.bind(this)),jQuery(e).find(".laytable-page-pagination a").each(function(e,i){jQuery(i).on("click",function(){var e=1;if(e="-1"==jQuery(i).attr("value")||"+1"==jQuery(i).attr("value")?parseInt(jQuery(i).attr("value"))+e:parseInt(jQuery(i).text()),"page-item page-last rayui-disabled"!=jQuery(i).attr("class")&&"page-item page-prev rayui-disabled"!=jQuery(i).attr("class")){var t=jQuery(".headSearchInput").val();""!=t?l.useTablePlugins(e,t):l.useTablePlugins(e)}})}),jQuery(e).find(".laytable-page-btnok").on("click",function(){var e=parseInt(jQuery(".laytable-page-input").val()),t=jQuery(".headSearchInput").val();""!=t?l.useTablePlugins(e,t):l.useTablePlugins(e)}),jQuery(e).find(".page-item").each(function(e,t){jQuery(t).attr("value")==s+""?jQuery(t).attr("class","page-item page-active"):"-1"!=jQuery(t).attr("value")&&"+1"!=jQuery(t).attr("value")&&jQuery(t).attr("class","page-item")})}.bind(this),8,s,e)}});
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。