Ai
2 Star 14 Fork 48

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

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
Record.min.js 17.17 KB
一键复制 编辑 原始数据 按行查看 历史
鲸歌 提交于 2021-01-13 14:15 +08:00 . crm初始上传
MWF.require("MWF.widget.O2Identity",null,!1),MWF.xApplication.CRM.Chance={},MWF.xDesktop.requireApp("Selector","package",null,!1),MWF.xApplication.CRM.Record=new Class({Extends:MWF.xApplication.CRM.Template.PopupForm,Implements:[Options,Events],options:{style:"default",width:"800",height:"100%",top:0,left:0,hasTop:!0,hasIcon:!1,hasBottom:!0,title:"",draggable:!1,closeAction:!0},initialize:function(t,e,i,o){this.setOptions(o),this.explorer=t,this.app=t.app,this.lp=this.app.lp.contact.contactEdit,this.path="/x_component_CRM/$ClueEdit/",this.cssPath=this.path+this.options.style+"/css.wcss",this._loadCss(),this.options.title=this.lp.title,this.data=i||{},this.actions=e,this.configData=[]},load:function(){(that=this).loadResource(function(){this.createForm(),this.loadEvent()}.bind(this))},loadResource:function(t){t&&t()},createForm:function(){var t=this.options.openName;jQuery(".openDiv").notifyMe("right","default",t,"","","","notify",500,{right:"0px",top:"0px"}),this.createContentHtml()},createContentHtml:function(){var v=this;jQuery(".notify-content").html("<div class='panes'><div class='pane' id='tab-follow' style='display:block;'><p>First tab content</p></div><div></div>");jQuery("#tab-follow").html('<div class="log-cont"><div class="log-inner1"><div class="log-inner2"><div class="log-items"><div class="load"><button type="button" class="el-button el-button--text"></button></div></div><div class="empty-mask" style="display: none;"><div class="empty-content"><img src="/x_component_CRM/$Template/empty.png" class="empty-icon"> <p class="empty-text">没有找到数据</p></div></div></div><div class="el-loading-mask" style="display: none;"><div class="el-loading-spinner"><svg viewBox="25 25 50 50" class="circular"><circle cx="50" cy="50" r="20" fill="none" class="path"></circle></svg></div></div></div></div>'),this.actions.listByTypesAndTimeRange(this.options.openId,this.options.filter,function(t){if("success"==t.type){var e=t.data;jQuery(".fl-c").remove();var o="";for(i in e)if(i<e.length){var s=e[i],n="/x_component_CRM/$Template/portrait.png";s.hasOwnProperty("ICONBase64")&&""!=s.ICONBase64&&(n="data:image/png;base64,"+s.ICONBase64);var a="",r="";if(0<s.attachmentListPreview.length){a+='<div class="my-gallery">';var c=s.attachmentListPreview;for(j in c)if(j<c.length){var l=c[j],d=this.actions.action.address+"/jaxrs/attachment/download/"+l.id+"/work/"+l.wcrm;a=a+'<figure><div class="fl-b-img-item"><a href="'+d+'" data-size="500x400"><img style="height:100%;" src="'+d+'"></a></div><figcaption style="display:none;">'+l.name+"</figcaption></figure>"}a+="</div>"}if(0<s.attachmentList.length){a+='<div class="fl-b-files">';var h=s.attachmentList;for(j in h)if(j<h.length){var p=h[j];a=a+'<div class="vux-flexbox cell vux-flex-row"><img src="/x_component_CRM/$Record/default/icons/att.png" class="cell-head"> <div class="cell-body">'+p.name+'<span style="color: rgb(204, 204, 204);">('+v.toDecimal(p.length)+'KB)</span></div><button type="button" class="el-button el-button--primary aname" aid="'+p.id+'" wcrm="'+p.wcrm+'"><img src="/x_component_CRM/$Record/default/icons/down.png" style="margin-bottom:-3px;"><span>下载</span></button></div>'}a+="</div>"}var m=s.types,f="",u="";"customer"==m&&s.customer&&(f=s.customer.customername,u=s.customer.id),"leads"==m&&s.leads&&(f=s.leads.name,u=s.leads.id),"contacts"==m&&s.contacts&&(f=s.contacts.contactsname,u=s.contacts.id),"opportunity"==m&&s.opportunity&&(f=s.opportunity.name,u=s.opportunity.id),""!=u&&(r='<div class="vux-flexbox relate-cell vux-flex-row" aid="'+u+'" atype="'+m+'"><img src="/x_component_CRM/$Record/default/icons/'+m+'.png" class="cell-head"><div class="relate-cell-body" style="color: rgb(99, 148, 229); cursor: pointer;">'+f+"</div></div>"),o=o+'<div class="fl-c"><div class="vux-flexbox fl-h vux-flex-row"><img class="div-photo fl-h-img" src="'+n+'" lazy="loaded"></img> <div class="fl-h-b"><div class="fl-h-name">'+(s.person?s.person.name:s.createuser)+'</div><div class="fl-h-time">'+s.updateTime+'</div></div></div><div class="fl-b"><div class="fl-b-content">'+s.content+"</div>"+a+'<div class="follow"><span class="follow-info">'+s.category+"</span></div></div>"+r+'<div class="full-container" style="display: none;"></div></div>'}""!=o&&jQuery(".load").before(o),e.length<1&&jQuery(".empty-mask").show(),jQuery(".aname").click(function(){var t=v.actions.action.address+"/jaxrs/attachment/download/"+jQuery(this).attr("aid")+"/work/"+jQuery(this).attr("wcrm");window.open(t)}),jQuery("figure").each(function(t,e){var i=jQuery(e).find("a").attr("href"),o=new Image;o.src=i,o.complete?jQuery(e).find("a").attr("data-size",o.width+"x"+o.height):o.onload=function(){jQuery(e).find("a").attr("data-size",o.width+"x"+o.height)}}),jQuery(".relate-cell").click(function(){var t=jQuery(this).attr("aid"),e=jQuery(this).find(".relate-cell-body").text();"customer"==jQuery(this).attr("atype")&&MWF.xDesktop.requireApp("CRM","CustomerOpen",function(){v.customer=new MWF.xApplication.CRM.CustomerOpen(v,v.actions,{},{openId:t,openName:e,openStyle:{right:"0px",top:"0px"},onReloadView:function(){}.bind(v)}),v.customer.load()}.bind(v)),"leads"==jQuery(this).attr("atype")&&MWF.xDesktop.requireApp("CRM","ClueOpen",function(){v.customer=new MWF.xApplication.CRM.ClueOpen(v,v.actions,{},{clueId:t,clueName:e,openStyle:{right:"0px",top:"0px"},onReloadView:function(){}.bind(v)}),v.customer.load()}.bind(v)),"contacts"==jQuery(this).attr("atype")&&MWF.xDesktop.requireApp("CRM","ContactsOpen",function(){v.customer=new MWF.xApplication.CRM.ContactsOpen(v,v.actions,{},{openId:t,openName:e,openStyle:{right:"0px",top:"0px"},onReloadView:function(){}.bind(v)}),v.customer.load()}.bind(v))})}MWF.xDesktop.requireApp("CRM","PicTool",function(){v.PicToolModule=new MWF.xApplication.CRM.PicTool(v.app),0<jQuery(".my-gallery").length&&v.PicToolModule.initPhotoHtml(".notify"),v.PicToolModule.initPhotoSwipeFromDOM(".my-gallery")}.bind(v)),jQuery(".my-gallery>figure>div").each(function(){jQuery(this).height(jQuery(this).width())})}.bind(this)),jQuery(".panes").css("height",jQuery("body").children(":first").height()-jQuery(".headNode").height())},loadEvent:function(){that=this,jQuery(".tabPanel div").click(function(){jQuery(this).addClass("hit").siblings().removeClass("hit"),jQuery(".panes>div:eq("+jQuery(this).index()+")").show().siblings().hide(),that.createTypeHtml()}),jQuery(".headMoreBottonDiv").click(function(){jQuery(".el-dropdown-menu").toggle(100)}),jQuery(".el-dropdown-menu__item").click(function(){jQuery(this).text(),"recordType"==jQuery(this).parent().attr("tid")&&(jQuery(".se-select-name").text(jQuery(this).text()),jQuery(this).parent().toggle(100))}),jQuery(".headMoveBottonDiv").click(function(){that.transfer()}),jQuery(".headEditBottonDiv").click(function(){that.contactsEdit()}),jQuery("#bar-file").change(function(t){var e=t.target.files;if(jQuery(".fileList").empty(),e&&0<e.length){for(var i='<div class="fileList">',o=0;o<e.length;o++){var s=e[o],n=s.size/1024,a=s.lastModifiedDate;i=i+'<div class="fileItem"><div class="fname">'+s.name+'</div><div class="fsize">'+that.toDecimal(n)+'kb</div><div class="ftime">'+that.getFormateTime(a)+"</div></div>"}i+="</div>",jQuery(".mix-container").append(i)}}),jQuery(".se-send").click(function(){that.sendRecord()}),jQuery(".el-dropdown-selfdefine").click(function(){jQuery("[tid='recordType']").toggle(100)})},sendRecord:function(){that=this;var t=jQuery("#bar-file")[0].files;jQuery(t).each(function(t,e){e.name;var i=new FormData;i.append("fileName",e.name),i.append("file",e),that.actions.updateAttachment(that.options.openId,"record",i,e,function(t){}.bind(that))});var e;e={types:"contacts",typesid:that.options.openId,content:jQuery(".el-textarea__inner").val(),category:jQuery(".se-select-name").text(),nexttime:jQuery(".el-input__inner").text(),businessids:"",contactsids:"",createuser:""},that.actions.createRecord(e,function(t){"success"==t.type&&(Showbo.Msg.alert("跟进记录发布成功!"),that.loadRecord())}.bind(that),function(t,e,i){}.bind(that))},loadRecord:function(){this.actions.getRecord(this.options.openId,function(t){if("success"==t.type){var e=t.data;jQuery(".fl-c").remove();var o="";for(i in e)if(i<e.length){var s=e[i];o=o+'<div class="fl-c"><div class="vux-flexbox fl-h vux-flex-row"><div class="div-photo fl-h-img" style="background-image: url(&quot;http://172.16.93.5/x_component_CRM/$Template/portrait.png&quot;);" lazy="loaded"></div> <div class="fl-h-b"><div class="fl-h-name">'+(s.person?s.person.name:s.createuser)+'</div><div class="fl-h-time">'+s.updateTime+'</div></div></div><div class="fl-b"><div class="fl-b-content">'+s.content+'</div><div class="follow"><span class="follow-info">'+s.category+'</span></div></div><div class="full-container" style="display: none;"></div></div>'}""!=o&&jQuery(".load").before(o),e.length<1&&(jQuery(".load").hide(),jQuery(".empty-mask").show())}}.bind(this))},toDecimal:function(t){if(""==t)return"";var e=parseFloat(t);return isNaN(e)?t:e=Math.round(100*t)/100},open:function(t){this.fireEvent("queryOpen"),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(t){t.stopPropagation()},mouseout:function(t){t.stopPropagation()},click:function(t){t.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 t=(this.container||this.app.content).getSize(),e=this.formAreaNode.getSize();this.formAreaNode.makeDraggable({handle:this.formTopNode,limit:{x:[0,t.x-e.x],y:[0,t.y-e.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(t){}})}.bind(this))},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()},createBottomNode:function(){this.formBottomNode=new Element("div.formBottomNode",{styles:this.css.formBottomNode}).inject(this.formNode),this._createBottomContent()},createTopNode:function(){this.formTopNode||(this.formTopNode=new Element("div.formTopNode",{styles:this.css.formTopNode}).inject(this.formNode),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+(this.data.title?"-"+this.data.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.formTopContentNode=new Element("div",{styles:this.css.formTopContentNode}).inject(this.formTopNode),this._createTopContent())},_createTopContent:function(){},_createTableContent:function(){this.loadFormData()},_createBottomContent:function(){this.cancelActionNode=new Element("div.formCancelActionNode",{styles:this.css.formCancelActionNode,text:this.lp.actionCancel}).inject(this.formBottomNode),(this.options.isNew||this.options.isEdited)&&(this.okActionNode=new Element("div.formOkActionNode",{styles:this.css.formOkActionNode,text:this.lp.actionConfirm}).inject(this.formBottomNode),this.okActionNode.addEvent("click",function(t){this.ok(t)}.bind(this))),this.cancelActionNode.addEvent("click",function(t){this.cancel(t)}.bind(this))},loadFormData:function(){this.loadForm()},ok:function(t){this.fireEvent("queryOk");var e=this.form.getResult(!0,",",!0,!1,!0);e&&this._ok(e,function(t){"error"==t.type?this.app&&this.app.notice(t.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))},loadForm:function(){(_self=this).form=new MForm(this.formTableArea,this.data,{style:"default",isEdited:this.isEdited||this.isNew,itemTemplate:this.getItemTemplate(this.lp)},this.app,this.css);var t="<table width='100%' bordr='0' cellpadding='5' cellspacing='0' styles='formTable'>",e=this.form.itemTemplate;for(i in e)t=t+"<tr> <td styles='formTableTitle'><span lable='"+i+"'>"+e[i].text+"</td> <td styles='formTableValue' item='"+i+"'></td></tr>";t+="</table>",this.formTableArea.set("html",t),this.form.load(),this.isNew||this.actions.getCustomerInfo(this.options.openId,function(t){var e=t.data,i=this.formTableArea.getElements("span");for(j in i)if(j<i.length&&null!=i[j].get("name")){var o=i[j].get("name");for(var s in e)s==o&&i[j].set("text",e[s])}}.bind(this)),this.formTableArea.getElements("textarea").setStyles({height:"100px",overflow:"auto",color:"#666666"}),this.formTableArea.getElements("input").setStyles({color:"#666666"})},getItemTemplate:function(t){return _self=this,{contactsname:{type:"text",text:t.contactsname,value:this.customerData&&this.customerData.customername?this.customerData.customername:""},customername:{text:t.customername,type:"openSelect"},cellphone:{text:t.cellphone,type:"text"},telephone:{type:"text",text:t.telephone},email:{text:t.email,type:"text"},decision:{type:"select",text:t.decision,value:_self.app.lp.contact.decision.value},post:{text:t.post,type:"text"},sex:{type:"select",text:t.sex,value:_self.app.lp.contact.sex.value},detailaddress:{text:t.detailaddress,type:"text"},nexttime:{text:t.nexttime,attr:{id:"nexttime"},type:"datetime"},remark:{text:t.remark,type:"textarea"}}},getContactTemplate:function(t){return _self=this,{contactsname:{text:t.contactsname,type:"text",notEmpty:!0},customername:{text:t.customername,type:"readonly",notEmpty:!0},telephone:{type:"text",text:t.telephone},cellphone:{text:t.cellphone,type:"text"},email:{type:"text",text:t.email},decision:{type:"select",text:t.decision,value:this.app.lp.contact.decision.value},post:{text:t.post,type:"text"},sex:{type:"select",text:t.sex,value:this.app.lp.contact.sex.value},detailaddress:{text:t.detailaddress,type:"text"},nexttime:{text:t.nexttime,attr:{id:"nexttime"},type:"datetime"},remark:{text:t.remark,type:"textarea"}}},selectPerson:function(t,e,s,i){var o={type:"",types:["person"],values:this.configData,count:i,zIndex:5e4,onComplete:function(t){MWF.require("MWF.widget.O2Identity",function(){var i=[],o=[];this.configData=[],this.process=null,t.each(function(t){if("i"==t.data.distinguishedName.split("@").getLast().toLowerCase()){new MWF.widget.O2Identity(t.data,it.form.getItem("invitePersonList").container,{style:"room"});i.push(t.data.distinguishedName)}else{i.push(t.data.name),o.push(t.data.distinguishedName);var e={name:t.data.name,distinguishedName:t.data.distinguishedName,employee:t.data.employee};this.configData.push(e)}}.bind(this)),0==t.length?document.getElementById(e).innerHTML="+点击选择":(document.getElementById(e).innerHTML=i.join(","),""!=s&&(document.getElementById(s).innerHTML=o.join(",")))}.bind(this))}.bind(this)};new MWF.O2Selector(t,o)},getFormateTime:function(t){_self=this;var e=new Date(t);return e.getFullYear()+"-"+_self.checkTime(e.getMonth()+1)+"-"+_self.checkTime(e.getDate())+" "+_self.checkTime(e.getHours())+":"+_self.checkTime(e.getMinutes())+":"+_self.checkTime(e.getSeconds())},checkTime:function(t){return t<10&&(t="0"+t),t},toDecimal:function(t){if(""==t)return"";var e=parseFloat(t);return isNaN(e)?t:e=Math.round(100*t)/100},createCustomBottom:function(){this.okActionNode=new Element("div.formOkActionNode",{styles:this.css.formOkActionNode,text:this.lp.actionConfirm}).inject(this.formBottomNode),this.okActionNode.addEvent("click",function(t){this.ok(t)}.bind(this))},_ok:function(data,callback){var saveDataStr="";for(i in this.data)saveDataStr=saveDataStr+"'"+i+"':'"+this.data[i]+"',";saveDataStr="'{"+saveDataStr.replace(/'/g,'"')+"}'";var saveData=eval("("+saveDataStr.substring(1,saveDataStr.length-1)+")");this.app.createShade(),this.actions.saveClue(saveData,function(t){this.app.destroyShade(),this.app.notice(this.lp.saveSuccess,"success"),this.close(),this.fireEvent("reloadView",t)}.bind(this),function(t,e,i){this.app.showErrorMessage(t,e,i),this.app.destroyShade()}.bind(this))}});
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/o2oa/o2oa-crm.git
git@gitee.com:o2oa/o2oa-crm.git
o2oa
o2oa-crm
o2oa-crm
master

搜索帮助