Ai
2 Star 14 Fork 48

兰德网络O2OA平台软件/o2oa-crm

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
Main.min.js 11.49 KB
一键复制 编辑 原始数据 按行查看 历史
FLY 提交于 2023-04-07 14:58 +08:00 . 修复新增客户的时候地址不保存的问题
MWF.xApplication.CRM=MWF.xApplication.CRM||{},MWF.require("MWF.widget.Identity",null,!1),MWF.xDesktop.requireApp("CRM","Actions.RestActions",null,!1),MWF.xApplication.CRM.options={multitask:!1,executable:!0},MWF.xApplication.CRM.Main=new Class({Extends:MWF.xApplication.Common.Main,Implements:[Options,Events],options:{style:"default",name:"CRM",icon:"icon.png",width:"1400",height:"700",isResize:!0,isMax:!0,title:MWF.xApplication.CRM.LP.title},onQueryLoad:function(){this.lp=MWF.xApplication.CRM.LP,this.inBrowser?COMMON.AjaxModule.loadCss(this.path+this.options.style+"/main.css",function(){console.log("main.css,load complete")}):this.openInNewBrowserX()},openInNewBrowserX:function(){this.desktop.openBrowserApp=this.options.name,this.desktop.openBrowserStatus=this.recordStatus?this.recordStatus():null;var t=this.desktop.openBrowserStatus?JSON.encode(this.desktop.openBrowserStatus):"",i="app.html?app="+this.options.name+"&status="+t;if(window.open(i,"_blank"),!this.inBrowser)try{this.close()}catch(t){this.taskitem.destroy(),this.window=null,this.taskitem=null,this.desktop.closeApp(this),this.fireAppEvent("postClose"),o2.release(this)}},onPostLoad:function(){this.resizeWindow()},loadApplication:function(t){this.maxSize(function(){this.user=layout.desktop.session.user.name,this.userGender=layout.desktop.session.user.genderType,this.actions=new MWF.xApplication.CRM.Actions.RestActions,this.container||(this.content.setStyle("overflow","hidden"),this.container=new Element("div.container",{styles:this.css.container}).inject(this.content)),this.createTopContent(),this.createMiddleContent(),this.addEvent("c",function(){this.resizeWindow()}.bind(this)),MWF.xDesktop.requireApp("CRM","BaiduMap",function(){window.BMap_loadScriptTime=(new Date).getTime();var t=layout.protocol+"//api.map.baidu.com/getscript?v=2.0&ak=Qac4WmBvHXiC87z3HjtRrbotCE3sC9Zg&services=&t=20161219171637";window.BDMapApiLoaded||COMMON.AjaxModule.loadDom(t,function(){window.BDMapApiLoaded=!0,window.BDMarkerToolLoaded||COMMON.AjaxModule.load("/x_component_CRM/BDMarkerTool.js",function(){window.BDMarkerToolLoaded=!0})})}.bind(this)),t&&t()}.bind(this))},reload:function(){this.createMiddleContent(),this.resizeWindow()},createMiddleContent:function(){this.middleContentDiv&&this.middleContentDiv.destroy(),this.middleContentDiv=new Element("div.middleContentDiv",{styles:this.css.middleContentDiv}).inject(this.container),this.createLeftContent()},createTopContent:function(){this.topContentDiv&&this.topContentDiv.destroy(),this.topContentDiv=new Element("div.topContentDiv",{styles:this.css.topContentDiv}).inject(this.container),this.logoDiv=new Element("div.logoDiv",{styles:this.css.logoDiv}).inject(this.topContentDiv),this.logoImg=new Element("img.logoImg",{styles:this.css.logoImg,src:this.path+"default/icons/crm.png"}).inject(this.logoDiv),this.logoTitleDiv=new Element("div.logoTitleDiv",{styles:this.css.logoTitleDiv,text:this.lp.main.title}).inject(this.logoDiv),this.topLeftDiv=new Element("div.topLeftDiv",{styles:this.css.topLeftDiv}).inject(this.topContentDiv);var t=new Element("li.topLeftLi",{styles:this.css.topLeftLi}).inject(this.topLeftDiv);new Element("div.topLeftLiDiv",{styles:this.css.topLeftLiDiv,text:this.user}).inject(t);this.tmpImg=new Element("img.topLeftLiImg",{styles:this.css.topLeftLiImg,src:"../o2_core/o2/xDesktop/$Default/blue/icons/logout.png"}).inject(t),this.tmpImg.addEvents({click:function(){this.logout()}.bind(this)})},isAdmin:function(){return MWF.AC.isCRMManager()||MWF.AC.isAdministrator()},logout:function(){layout.desktop.top?layout.desktop.top.logout():layout.authentication?layout.authentication.logout():MWF.Actions.get("x_organization_assemble_authentication").logout(function(){var t=window.location.hostname;hostList=t.split("."),hostList.shift(),Cookie.dispose("x-token",{domain:"."+hostList.join("."),path:"/"}),window.location.reload()}.bind(this))},createLeftContent:function(){this.leftContentDiv=new Element("div.leftContentDiv",{styles:this.css.leftContentDiv}).inject(this.middleContentDiv),this.quickStartDiv=new Element("div.quickStartDiv",{styles:this.css.quickStartDiv}).inject(this.leftContentDiv),this.quickStartImg=new Element("img.quickStartImg",{styles:this.css.quickStartImg,src:this.path+"default/icons/add.png"}).inject(this.quickStartDiv),this.quickStartTextDiv=new Element("div.quickStartTextDiv",{styles:this.css.quickStartTextDiv,text:this.lp.main.quickStart}).inject(this.quickStartDiv),this.createNavi()},createNavi:function(){var t=this;this.naviDiv=new Element("div.naviDiv",{styles:this.css.naviDiv}).inject(this.leftContentDiv);var i=this.path+"navi.json";MWF.getJSON(i,function(i){i.each(function(i){if("menu"==i.type){var e=new Element("div.naviMenuLi",{styles:this.css.naviMenuLi}).inject(this.naviDiv);new Element("img.naviMenuImg",{styles:this.css.naviMenuImg,src:this.path+i.icon}).inject(e),new Element("div.naviMenuTxtDiv",{styles:this.css.naviMenuTxtDiv,text:i.title}).inject(e);i.items.each(function(i){var e=new Element("div.naviItemLi",{styles:this.css.naviItemLi,id:i.action,action:i.action}).inject(this.naviDiv);new Element("img.naviItemImg",{styles:this.css.naviItemImg,src:this.path+i.icon,df:i.icon,dfFill:i.iconFill}).inject(e),new Element("div.naviItemTxtDiv",{styles:this.css.naviItemTxtDiv,text:i.title}).inject(e);e.addEvents({mouseover:function(){if(this.get("action")!=t.curModule){this.setStyles({color:"#ff8e31"});var i=this.getElement("img");i&&i.set("src",t.path+i.get("dfFill"))}},mouseout:function(){if(this.get("action")!=t.curModule){this.setStyles({color:"#ffffff"});var i=this.getElement("img");i&&i.set("src",t.path+i.get("df"))}},click:function(){t.curModule=this.get("action");var i=t.naviDiv.getElements(".naviItemLi");i.setStyles({color:"#ffffff"}),i.getElement("img").each(function(i){i.set("src",t.path+i.get("df"))}),this.setStyles({color:"#ff8e31"});var e=this.getElement("img");e&&e.set("src",t.path+e.get("dfFill")),t.openModule(this.get("action"))}})}.bind(this))}}.bind(this))}.bind(this),!1),this.naviDiv.getElements(".naviItemLi").each(function(i){if("homePage"==i.get("action")){t.curModule="homePage",i.setStyles({color:"#ff8e31"});var e=i.getElement("img");e&&e.set("src",t.path+e.get("dfFill")),t.openHomePage()}})},openModule:function(t){"homePage"==t?this.openHomePage():"message"==t?this.openMessage():"clue"==t?this.openClue():"customer"==t?this.openCustomer():"publicseas"==t?this.openPublicseas():"contact"==t?this.openContact():"chance"==t?this.openChance():"stat"==t&&this.openStat()},openHomePage:function(){this.indexModule&&delete this.indexModule,MWF.xDesktop.requireApp("CRM","Index",function(){this.rightContentDiv&&this.rightContentDiv.destroy(),this.rightContentDiv=new Element("div.rightContentDiv#rightContentDiv",{styles:this.css.rightContentDiv}).inject(this.middleContentDiv),this.resizeWindow(),this.indexModule=new MWF.xApplication.CRM.Index(this.rightContentDiv,this,this.actions,{isAdmin:this.isAdmin()}),this.indexModule.load()}.bind(this))},openMessage:function(){this.rightContentDiv&&this.rightContentDiv.empty(),this.messageModule&&delete this.messageModule,MWF.xDesktop.requireApp("CRM","Message",function(){this.messageModule=new MWF.xApplication.CRM.Message(this.rightContentDiv,this,this.actions,{isAdmin:this.isAdmin()}),this.messageModule.load()}.bind(this))},openClue:function(){this.rightContentDiv&&this.rightContentDiv.empty(),this.clueModule&&delete this.clueModule,MWF.xDesktop.requireApp("CRM","Clue",function(){this.clueModule=new MWF.xApplication.CRM.Clue(this.rightContentDiv,this,this.actions,{isAdmin:this.isAdmin()}),this.clueModule.load()}.bind(this))},openCustomer:function(){this.rightContentDiv&&this.rightContentDiv.empty(),this.customerModule&&delete this.customerModule,MWF.xDesktop.requireApp("CRM","Customer",function(){this.customerModule=new MWF.xApplication.CRM.Customer(this.rightContentDiv,this,this.actions,{isAdmin:this.isAdmin()}),this.customerModule.load()}.bind(this))},openPublicseas:function(){this.rightContentDiv&&this.rightContentDiv.empty(),this.publicseasModule&&delete this.publicseasModule,MWF.xDesktop.requireApp("CRM","Publicseas",function(){this.publicseasModule=new MWF.xApplication.CRM.Publicseas(this.rightContentDiv,this,this.actions,{isAdmin:this.isAdmin()}),this.publicseasModule.load()}.bind(this))},openContact:function(){this.rightContentDiv&&this.rightContentDiv.empty(),this.contactsModule&&delete this.contactsModule,MWF.xDesktop.requireApp("CRM","Contacts",function(){this.contactsModule=new MWF.xApplication.CRM.Contacts(this.rightContentDiv,this,this.actions,{isAdmin:this.isAdmin()}),this.contactsModule.load()}.bind(this))},openChance:function(){this.rightContentDiv&&this.rightContentDiv.empty(),this.chanceModule&&delete this.chanceModule,MWF.xDesktop.requireApp("CRM","Chance",function(){this.chanceModule=new MWF.xApplication.CRM.Chance(this.rightContentDiv,this,this.actions,{isAdmin:this.isAdmin()}),this.chanceModule.load()}.bind(this))},openStat:function(){},createRightContent:function(){this.rightContentDiv&&this.rightContentDiv.destroy(),this.rightContentDiv=new Element("div.rightContentDiv",{styles:this.css.rightContentDiv}).inject(this.middleContentDiv)},resizeWindow:function(){var t=this.content.getSize();if(this.middleContentDiv&&this.middleContentDiv.setStyles({height:t.y-this.topContentDiv.getSize().y+"px"}),this.middleContentDiv)var i=this.middleContentDiv.getSize();this.leftContentDiv&&this.leftContentDiv.setStyles({height:i.y+"px"}),this.rightContentDiv&&this.rightContentDiv.setStyles({height:i.y+"px",width:i.x-this.leftContentDiv.getSize().x+"px","margin-left":this.leftContentDiv.getSize().x+"px"})},recordStatus:function(){var t;return t={identity:this.identity},t},createShade:function(t,i){var e,s=this.content;t=t||s;e=i||"loading...",this.shadeDiv&&this.shadeDiv.destroy(),this.shadeTxtDiv&&this.shadeTxtDiv.destroy(),this.shadeDiv=new Element("div.shadeDiv").inject(t),this.inforDiv=new Element("div.inforDiv",{styles:{height:"16px",display:"inline-block",position:"absolute","background-color":"#336699","border-radius":"3px",padding:"5px 10px"}}).inject(this.shadeDiv),this.loadImg=new Element("img.loadImg",{styles:{width:"16px",height:"16px",float:"left"},src:"/x_component_CRM/$Main/default/icons/loading.gif"}).inject(this.inforDiv),this.shadeTxtSpan=new Element("span.shadeTxtSpan").inject(this.inforDiv),this.shadeTxtSpan.set("text",e),this.shadeDiv.setStyles({width:"100%",height:"100%",position:"absolute",opacity:"0.7","background-color":"#cccccc","z-index":"999"}),this.shadeTxtSpan.setStyles({color:"#ffffff","font-size":"12px",display:"inline-block","line-height":"16px","padding-left":"5px"});var n=t.getSize().x,o=t.getSize().y;this.shadeDiv.setStyles({left:t.getLeft()-s.getLeft()+"px",top:t.getTop()-s.getTop()+"px",width:n+"px",height:o+"px"}),"absolute"==t.getStyle("position")&&this.shadeDiv.setStyles({left:"0px",top:"0px"}),this.inforDiv.setStyles({left:n/2+"px",top:o/2+"px"})},destroyShade:function(){this.shadeDiv&&this.shadeDiv.destroy()},setScrollBar:function(t,i,e,s,n){return e||(e="default"),s||(s={V:{x:0,y:0},H:{x:0,y:0}}),MWF.require("MWF.widget.ScrollBar",function(){this.scrollbar&&this.scrollbar.scrollVAreaNode&&(this.scrollbar.scrollVAreaNode.destroy(),delete this.scrollbar),this.scrollbar=new MWF.widget.ScrollBar(t,{style:e||"default",offset:s,indent:!1,distance:50,onScroll:function(e){var s=t.getScrollSize(),n=t.getSize(),o=s.y-n.y;e+20>o&&i&&i.loadElementList&&(i.isItemsLoaded||i.loadElementList())}.bind(this)}),n&&n()}.bind(this)),!1},showErrorMessage:function(t,i,e){var s=e;if(t&&(errorMessage=t.responseText),""!=errorMessage){var n=JSON.parse(errorMessage);n.message?this.notice(n.message,"error"):this.notice(s,"error")}else this.notice(s,"error")}});
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/o2oa/o2oa-crm.git
git@gitee.com:o2oa/o2oa-crm.git
o2oa
o2oa-crm
o2oa-crm
master

搜索帮助