Ai
2 Star 14 Fork 48

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

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
Index.min.js 30.54 KB
一键复制 编辑 原始数据 按行查看 历史
鲸歌 提交于 2021-01-13 14:15 +08:00 . crm初始上传
MWF.xApplication.CRM=MWF.xApplication.CRM||{},MWF.xDesktop.requireApp("Template","MForm",null,!1),MWF.xDesktop.requireApp("CRM","Template",null,!1),MWF.xDesktop.requireApp("Template","Explorer",null,!1),MWF.require("MWF.widget.O2Identity",null,!1),MWF.xDesktop.requireApp("Selector","package",null,!1),MWF.xDesktop.requireApp("CRM","ClueEdit",null,!1),MWF.xDesktop.requireApp("CRM","Customer",null,!1),MWF.xDesktop.requireApp("CRM","CustomerEdit",null,!1),MWF.xDesktop.requireApp("CRM","Contacts",null,!1),MWF.xDesktop.requireApp("CRM","ContactsEdit",null,!1),MWF.xDesktop.requireApp("CRM","Chance",null,!1),MWF.xDesktop.requireApp("CRM","ChanceEdit",null,!1),MWF.xApplication.CRM.AddressExplorer=null,MWF.xApplication.CRM.PicTool=null,MWF.xApplication.CRM.Index=new Class({Extends:MWF.widget.Common,Implements:[Options,Events],options:{style:"default"},initialize:function(e,t,i,n){this.setOptions(n),this.app=t,this.lp=t.lp.index,this.path="/x_component_CRM/$Index/",this.loadCss(),this.actions=i,this.node=e,this.configData=[];var s=new Date,a=s.getYear();a+=a<2e3?1900:0,this.nowDayOfWeek=s.getDay(),this.nowDay=s.getDate(),this.nowMonth=s.getMonth(),this.nowYear=a,this.now=s},loadCss:function(){this.cssPath="/x_component_CRM/$Index/"+this.options.style+"/css.wcss",this._loadCss()},load:function(){this.formContentArr&&this.formContentArr.empty(),this.formContentArr=[],this.formMarkArr&&this.formMarkArr.empty(),this.formMarkArr=[],this.rightContentDiv=this.rightContentDiv||this.app.rightContentDiv,this.loadResource(function(){this.appArea=jQuery("body").children(":first"),this.createHeadContent(),this.createIndexContent()}.bind(this))},reload:function(){this.createIndexContent()},loadResource:function(e){var t=["/x_component_CRM/$Template/plugins/jquery.min.js"];COMMON.AjaxModule.loadCss("/x_component_CRM/$Template/plugins/table2/css/table2.css",function(){COMMON.AjaxModule.load(t,function(){jQuery.noConflict(),COMMON.AjaxModule.load("/x_component_CRM/$Template/plugins/layui/layui.js",function(){COMMON.AjaxModule.load("/x_component_CRM/$Template/plugins/table2/table2.js",function(){COMMON.AjaxModule.loadCss("/x_component_CRM/$Template/assets/css/notifyme.css",function(){COMMON.AjaxModule.loadCss("/x_component_CRM/$Template/date/css/jquery-ui.css",function(){COMMON.AjaxModule.load("/x_component_CRM/$Template/date/jquery-ym-datePlugin-0.1.js",function(){COMMON.AjaxModule.load("/x_component_CRM/$Template/assets/js/notifyme.js",function(){COMMON.AjaxModule.load("/x_component_CRM/$Template/assets/js/showBo.js",function(){COMMON.AjaxModule.load("/x_component_CRM/$Template/assets/js/echarts.min.js",function(){COMMON.AjaxModule.load("/x_component_CRM/$Template/assets/js/china.js",function(){COMMON.AjaxModule.loadCss("/x_component_CRM/$Template/picTool/css/photoswipe.css",function(){COMMON.AjaxModule.loadCss("/x_component_CRM/$Template/picTool/css/default-skin/default-skin.css",function(){COMMON.AjaxModule.load("/x_component_CRM/$Template/picTool/js/photoswipe.js",function(){COMMON.AjaxModule.load("/x_component_CRM/$Template/picTool/js/photoswipe-ui-default.min.js",function(){e&&e()})})})})}.bind(this))}.bind(this))}.bind(this))}.bind(this))}.bind(this))}.bind(this))}.bind(this))}.bind(this))}.bind(this))}.bind(this))}.bind(this))},createHeadContent:function(){_self=this,0<jQuery(".openDiv").length&&jQuery(".openDiv").remove(),jQuery(_self.appArea).after("<div class='openDiv'></div>"),jQuery(".openDiv").before("<div></div>"),0<jQuery("#layout").length&&jQuery(_self.appArea).find(".MWF_dialod_title_action").find("div").eq(1).hide(),this.headContentDiv&&this.headContentDiv.destroy(),this.headContentDiv=new Element("div.headContentDiv",{styles:this.css.headContentDiv}).inject(this.rightContentDiv),this.headHomeDiv=new Element("div.headHomeDiv",{styles:this.css.headHomeDiv}).inject(this.headContentDiv),this.headHomeImg=new Element("img.headHomeImg",{styles:this.css.headHomeImg,src:this.path+"default/icons/homePage.png"}).inject(this.headHomeDiv),this.headTitleDiv=new Element("div.headTitleDiv",{styles:this.css.headTitleDiv}).inject(this.headContentDiv),this.headTitleinDiv=new Element("div.headTitleinDiv",{styles:this.css.mark_header,text:this.lp.head.headTitle}).inject(this.headTitleDiv),this.user_lineDiv=new Element("div.user_line",{styles:this.css.user_line}).inject(this.headContentDiv),this.user_changeDiv=new Element("div.user_change",{styles:this.css.user_change,text:"切换"}).inject(this.headContentDiv),this.selectDiv=new Element("div.se-select",{styles:this.css.selectDiv}).inject(this.headContentDiv),this.selectnameDiv=new Element("div.se-select-name",{styles:this.css.selectname,text:"本年"}).inject(this.selectDiv),this.arrowdownDiv=new Element("div.el-icon-arrow-down",{styles:this.css.arrowdown}).inject(this.selectDiv),this.selectImg=new Element("img.selectImg",{styles:this.css.selectImg,src:this.path+"default/icons/arrow.png"}).inject(this.arrowdownDiv);jQuery(".headContentDiv").after('<ul class="el-dropdown-type" style="display: none;width:220px;" id="searchDate"></ul>');for(var e="",t=this.lp.searchDate.value.split(","),i=0;i<t.length;i++)e=e+'<li class="el-dropdown-menu__item" style="font-size:15px;">'+t[i]+"</li>";if(jQuery("#searchDate").append(e+'<div class="popper__arrow" style="left:99px;box-sizing: border-box !important;"></div>'),this.dropdown=jQuery("body")[0].getElement("#searchDate"),this.dropdown&&this.dropdown.setStyles({top:jQuery(".user_change").offset().top+52+"px",left:jQuery(".user_change").offset().left+2}),jQuery(".headTitleDiv").append('<div id="selectheadName" style="display: none;"></div><div id="selectheadId" personList="" departList="" style="display: none;"></div>'),jQuery(".se-select").click(function(){jQuery(".el-dropdown-type").toggle(100)}),jQuery(this.dropdown).find(".el-dropdown-menu__item").click(function(){if("自定义"==jQuery(this).text()){0<jQuery(".timeDiv").length?(jQuery(".inputtime").val(""),jQuery(".timeDiv").toggle(100)):jQuery(this).parent().append('<div class="timeDiv"><div class="timeItemDiv"><input name="starttime" class="inputtime" id="starttime" type="text" readonly="readonly"></div><div class="timeItemDiv"><input name="endtime" class="inputtime" id="endtime" type="text" readonly="readonly"></div><div class="timeOk">确定</div></div>'),_self.loadTimeContainer("starttime"),_self.loadTimeContainer("endtime"),jQuery(".timeOk").click(function(){""!=jQuery("#starttime").val()&&""!=jQuery("#endtime").val()?(jQuery(_self.rightContentDiv).find(".se-select-name").text(jQuery("#starttime").val()+"--"+jQuery("#endtime").val()),_self.loadDataContent(),jQuery(this).parent().parent().hide()):Showbo.Msg.alert("请选择开始日期和结束日期!")})}else jQuery(_self.rightContentDiv).find(".se-select-name").text(jQuery(this).text()),_self.loadDataContent(),jQuery(this).parent().toggle(100)}),jQuery(".user_change").click(function(){_self.selectPerson(jQuery(_self.appArea)[0],"selectheadName","selectheadId",0)}),jQuery(".quickNew").length<1){jQuery(".middleContentDiv").append('<div class="quickNew"><div class="quickNew_conent"><div class="quickNew_item"><span class="sImg"><img class="naviItemImg" src="/x_component_CRM/$Main/default/icons/clue-fill.png"></span><span class="sName" stype="clue">线索</span></div><div class="quickNew_item"><span class="sImg"><img class="naviItemImg" src="/x_component_CRM/$Main/default/icons/customer-fill.png"></span><span class="sName" stype="customer">客户</span></div><div class="quickNew_item"><span class="sImg"><img class="naviItemImg" src="/x_component_CRM/$Main/default/icons/contact-fill.png"></span><span class="sName" stype="contact">联系人</span></div> </div></div>'),jQuery(".quickStartDiv").click(function(){jQuery(".quickNew").toggle(100)}),jQuery(".quickNew").mouseleave(function(){jQuery(this).toggle(100)}),_thatnew=_self,jQuery(".quickNew_item").click(function(){_thatnew.openNew(jQuery(this).children().eq(1).attr("stype"))})}jQuery("body").click(function(e){jQuery(e.target).closest(".se-select").length<1&&"自定义"!=jQuery(e.target)[0].innerText&&""!=jQuery(e.target)[0].innerText&&"block"==jQuery("#searchDate").css("display")&&"timeItemDiv"!=jQuery(e.target).parent().attr("class")&&jQuery(".el-dropdown-type").hide()}),_self.app.leftContentDiv.getElements(".naviItemLi").addEvents({click:function(){jQuery(".notify").remove()}.bind(this)})},createToolBarContent:function(){},createIndexContent:function(){this.contentListDiv&&this.contentListDiv.destroy(),this.contentListDiv=new Element("div.contentListDiv",{styles:this.css.contentListDiv}).inject(this.rightContentDiv),this.contentListInDiv&&this.contentListInDiv.destroy(),this.contentListInDiv=new Element("div.contentListInDiv",{styles:this.css.contentListInDiv}).inject(this.contentListDiv),this.loadDataContent()},loadDataContent:function(){(_self=this).contentListInDiv&&this.contentListInDiv.destroy(),this.contentListInDiv=new Element("div.contentListInDiv",{styles:this.css.contentListInDiv}).inject(this.contentListDiv),this.vux_flexbox_item=new Element("div.vux_flexbox_item",{id:"jianbao",styles:this.css.vux_flexbox_item}).inject(this.contentListInDiv),this.cardDiv=new Element("div.cardDiv",{styles:this.css.cardDiv}).inject(this.vux_flexbox_item),this.mark_headerDiv=new Element("div.mark_header",{styles:this.css.mark_header,text:"销售简报"}).inject(this.cardDiv),this.markImg=new Element("img.img_mark",{styles:this.css.img_mark,src:this.path+"default/icons/jianbao.png"}).inject(this.mark_headerDiv),this.vux_flex_rowDiv=new Element("div.vux_flex_row",{styles:this.css.vux_flex_row}).inject(this.cardDiv),this.vux_flexbox_item_right=new Element("div.vux_flexbox_item_right",{id:"fenbu",styles:this.css.vux_flexbox_item_right}).inject(this.contentListInDiv),this.cardDiv=new Element("div.cardDiv",{styles:this.css.cardDiv}).inject(this.vux_flexbox_item_right),this.mark_headerDiv=new Element("div.mark_header",{styles:this.css.mark_header,text:"客户分布"}).inject(this.cardDiv),this.markImg=new Element("img.img_mark",{styles:this.css.img_mark,src:this.path+"default/icons/fenbu.png"}).inject(this.mark_headerDiv),this.vux_flex_rowDiv=new Element("div.vux_flex_row",{id:"cityMap",styles:this.css.vux_flex_rowDiv}).inject(this.cardDiv),this.vux_flexbox_item2=new Element("div.vux_flexbox_item",{id:"loudou",styles:this.css.vux_flexbox_item}).inject(this.contentListInDiv),this.cardDiv3=new Element("div.cardDiv",{styles:this.css.cardDiv}).inject(this.vux_flexbox_item2),this.mark_headerDiv=new Element("div.mark_header",{styles:this.css.mark_header,text:"客户总量"}).inject(this.cardDiv3),this.markImg=new Element("img.img_mark",{styles:this.css.img_mark,src:this.path+"default/icons/loudou.png"}).inject(this.mark_headerDiv),this.vux_flex_rowDiv=new Element("div.vux_flex_row",{styles:this.css.vux_flex_rowDiv,id:"costomerCount"}).inject(this.cardDiv3),this.vux_flexbox_item_right2=new Element("div.vux_flexbox_item_right",{id:"qushi",styles:this.css.vux_flexbox_item_right}).inject(this.contentListInDiv),this.cardDiv=new Element("div.cardDiv",{styles:this.css.cardDiv}).inject(this.vux_flexbox_item_right2),this.mark_headerDiv=new Element("div.mark_header",{styles:this.css.mark_header,text:"客户行业"}).inject(this.cardDiv),this.markImg=new Element("img.img_mark",{styles:this.css.img_mark,src:this.path+"default/icons/qushi.png"}).inject(this.mark_headerDiv),this.vux_flex_rowDiv=new Element("div.vux_flex_row",{styles:this.css.vux_flex_rowDiv,id:"costomerIndustryCount"}).inject(this.cardDiv);var e=[],t=[];jQuery("#selectheadName").prev()&&-1<jQuery("#selectheadName").prev().text().indexOf("个员工")&&(e=""==jQuery("#selectheadId").attr("personList")?[]:jQuery("#selectheadId").attr("personList").split(",")),jQuery("#selectheadName").prev()&&-1<jQuery("#selectheadName").prev().text().indexOf("个部门")&&(t=""==jQuery("#selectheadId").attr("departList")?[]:jQuery("#selectheadId").attr("departList").split(","));var i,n=this.getDateList(jQuery(_self.rightContentDiv).find(".se-select-name").text()).split(",");i={begintime:n[0]+" 00:00:00",endtime:n[1]+" 23:59:59",key:"",personNameList:e,unitList:t},this.getJianbaoList(i),this.getFenBuMap(i),this.getCustomerCount(i),this.getCustomerByIndustry(i)},openNew:function(e){_self=this,"clue"==e&&MWF.xDesktop.requireApp("CRM","ClueEdit",function(){_self.clueModule=new MWF.xApplication.CRM.ClueEdit(_self,_self.actions,{},{isEdited:!0,isNew:!0,onReloadView:function(){}.bind(_self)}),_self.clueModule.load()}.bind(_self)),"customer"==e&&MWF.xDesktop.requireApp("CRM","CustomerEdit",function(){_self.customerModule=new MWF.xApplication.CRM.CustomerEdit(_self,_self.actions,{},{isEdited:!0,isNew:!0,onReloadView:function(){}.bind(_self)}),_self.customerModule.load()}.bind(_self)),"contact"==e&&MWF.xDesktop.requireApp("CRM","ContactsEdit",function(){_self.contactModule=new MWF.xApplication.CRM.ContactsEdit(_self,_self.actions,{},{isEdited:!0,isNew:!0,onReloadView:function(){}.bind(_self)}),_self.contactModule.load()}.bind(_self)),"chance"==e&&MWF.xDesktop.requireApp("CRM","ChanceEdit",function(){new MWF.xApplication.CRM.ChanceEdit(null,{},null,{app:_self.app,container:_self.app.content,lp:_self.app.lp.chance,actions:_self.actions,css:{},callback:function(){}}).create()}.bind(_self))},getJianbaoList:function(i){_self=this,jQuery("#jianbao").find(".vux_flex_row").empty(),_self.actions.countLike(i,function(e){if("success"==e.type){var s="";e.data.each(function(e){var t=e.moduleId,i=e.count,n="";switch(t){case"customer":n="新增客户";break;case"contacts":n="新增联系人";break;case"opportunity":n="新增商机";break;case"record":n="跟进记录"}"新增商机"!=n&&(s=s+'<div class="vux-flexbox-item" id="'+t+'"><div class="vux-flexbox jianbao-icon-content" style="cursor: pointer;"><img src="/x_component_CRM/$Index/default/icons/'+t+'.png" class="jianbao-icon"><div class="jianbao-title">'+n+'</div><div class="jianbao-value">'+i+"</div></div></div>")}.bind(this)),""!=s&&jQuery("#jianbao").find(".vux_flex_row").append(s),jQuery("#jianbao").find(".vux-flexbox-item").each(function(e,t){jQuery(this).click(function(){var e=jQuery(this).attr("id");switch(0<jQuery(".openDiv").length&&jQuery(".openDiv").empty(),e){case"customer":_self.index_customerView&&delete _self.index_customerView,_self.index_customerView=new MWF.xApplication.CRM.Index.View(jQuery(".openDiv")[0],_self.app,_self.app,_self,{templateUrl:"/x_component_CRM/$Customer/customerView.json",filterData:{}},{lp:_self.app.lp.customerView,isAdmin:_self.options.isAdmin}),_self.index_customerView.load(),jQuery(".openDiv").show();break;case"contacts":_self.index_contactsView&&delete _self.index_contactsView,_self.index_contactsView=new MWF.xApplication.CRM.Index.ContactsView(jQuery(".openDiv")[0],_self.app,_self.app,_self,{templateUrl:"/x_component_CRM/$Contacts/contactsView.json",filterData:{}},{lp:_self.app.lp.contactsView,isAdmin:_self.options.isAdmin}),_self.index_contactsView.load(),jQuery(".openDiv").show();break;case"opportunity":_self.index_opportunityView&&delete _self.index_opportunityView,_self.index_opportunityView=new MWF.xApplication.CRM.Index.ChanceView(jQuery(".openDiv")[0],{},_self.app,_self,{templateUrl:"/x_component_CRM/$Chance/chanceView.json",filterData:{}},{lp:_self.app.lp.chance,isAdmin:_self.options.isAdmin}),_self.index_opportunityView.load(),jQuery(".openDiv").show();break;case"record":_self.getRecordCount(i)}})})}}.bind(_self))},getFenBuMap:function(e){var t=echarts.init(document.getElementById("cityMap")),i=["上海","河北","山西","内蒙古","辽宁","吉林","黑龙江","江苏","浙江","安徽","福建","江西","山东","河南","湖北","湖南","广东","广西","海南","四川","贵州","云南","西藏","陕西","甘肃","青海","宁夏","新疆","北京","天津","重庆","香港","澳门"],n=[];this.actions.countCustomerByProvince(e,function(e){"success"==e.type&&(n=e.data)});for(var s=[],a=0;a<i.length;a++){for(var o=i[a],l=0,r=0;r<n.length;r++){var c="";n[r].provinceName&&(c=n[r].provinceName),-1<c.indexOf("#")&&o==(c=c.substring(0,c.indexOf("#"))).replaceAll("","").replaceAll("","").replaceAll("自治区","").replaceAll("回族","").replaceAll("维吾尔族","").replaceAll("特别行政区","")&&(l=n[r].count)}s[a]={},s[a].name=o,s[a].value=l}var d=Math.max.apply(Math,s.map(function(e){return e.value})),p="china",h=s,u={tooltip:{trigger:"item",formatter:function(e){for(var t="",i=0;i<h.length;i++)e.name==h[i].name&&(t+=h[i].name+"<br>客户数:"+h[i].value);return t}},visualMap:{show:!0,min:0,max:d,left:"5%",top:"70%",inverse:!0,text:["",""],calculable:!1,seriesIndex:1,orient:"horizontal",inRange:{color:["#dbfefe","#1066d5"]}},geo:{show:!0,map:p,roam:!1,top:"0%",label:{normal:{show:!1},emphasis:{show:!1}},itemStyle:{normal:{areaColor:"#f5f7fa",borderColor:"#097bba"},emphasis:{areaColor:"#fbd456"}}},series:[{name:"散点",type:"scatter",coordinateSystem:"geo",data:s,symbolSize:"1",label:{normal:{show:!0,formatter:"{b}",position:"right"},emphasis:{show:!0}},itemStyle:{normal:{color:"#895139"}}},{name:"中国",type:"map",mapType:p,roam:!1,data:s,top:"0%",selectedMode:"single",label:{normal:{show:!0,textStyle:{color:"#895139"}},emphasis:{show:!0,textStyle:{color:"#323232"}}},itemStyle:{normal:{borderWidth:.5,borderColor:"#0550c3",areaColor:"#0b7e9e"},emphasis:{borderWidth:.5,borderColor:"#4b0082",areaColor:"#ece39e"}}}]};t.setOption(u),jQuery(window).resize(function(){t.resize()}),t.off("click")},getCustomerCount:function(e){_self=this;var n=[],s=[];_self.actions.countCustomerByMonth(e,function(e){"success"==e.type&&e.data.each(function(e){n.push(e.month),s.push(e.count);var t=echarts.init(jQuery("#costomerCount")[0]),i={calculable:!0,grid:{y:115,y2:115},xAxis:{show:!0,position:"bottom",offset:0,type:"category",nameLocation:"end",nameTextStyle:{color:"#333",padding:[5,0,0,-5]},nameGap:5,nameRotate:0,axisLine:{show:!0,lineStyle:{color:"#333",width:1,type:"solid"}},axisTick:{show:!1,inside:!0,length:3,lineStyle:{color:"#333",width:1,type:"solid"}},axisLabel:{show:!0,inside:!1,rotate:0,margin:5,color:"#333"},splitLine:{show:!1,lineStyle:{}},splitArea:{show:!1},data:n},yAxis:{show:!0,position:"left",offset:0,type:"value",name:"客户数",nameLocation:"end",nameTextStyle:{color:"#333",padding:[5,0,0,5]},nameGap:15,nameRotate:360,axisLine:{show:!0,lineStyle:{color:"#333",width:1,type:"solid"}},axisTick:{show:!1,inside:!0,length:3,lineStyle:{color:"#333",width:1,type:"solid"}},axisLabel:{show:!0,inside:!1,rotate:0,margin:8,color:"#333"},splitLine:{show:!1,lineStyle:{color:"#666",width:1,type:"dashed"}},splitArea:{show:!1}},series:[{name:"客户数",type:"bar",legendHoverLink:!0,label:{show:!1,position:"insideTop",rotate:0,color:"#eee"},itemStyle:{color:"#A3C7F7",barBorderRadius:[0,0,0,0]},barWidth:20,barCategoryGap:"20%",data:s}]};t.setOption(i)})})},getCustomerByIndustry:function(e){_self=this;var i=[],n=[],s=this.app.lp.customer.industry.value.split(","),a=0;_self.actions.countCustomerByIndustry(e,function(e){"success"==e.type&&(e.data.each(function(e){var t=e.industry;s.contains(t)?(i.push(t),n.push({value:e.count,name:t})):a+=e.count.toInt()}),0<a&&(i.push("未知"),n.push({value:a,name:"未知"})))});var t=echarts.init(jQuery("#costomerIndustryCount")[0]),o={tooltip:{trigger:"item",formatter:"{b} : {c}"},color:["#48cda6","#ffa500","#11abff","#ffdf6f","#968ade","#C9C9C9","#7CFC00","#BF600D","#96E2F5"],legend:{orient:"horizontal",width:40,x:"right",y:"center",itemWidth:10,itemHeight:10,data:i,textStyle:{color:"#333",fontSize:12}},series:[{name:"设备状态",type:"pie",center:["35%","45%"],radius:["40%","55%"],itemStyle:{normal:{label:{show:!0,textStyle:{color:"#3c4858",fontSize:"18"},formatter:function(e){return"{b|"+e.name+"}"},rich:{b:{fontSize:15}}},labelLine:{show:!0}},emphasis:{label:{show:!0,position:"center",textStyle:{fontSize:"10",fontWeight:"bold"}}}},data:n}]};t.setOption(o)},getDateList:function(e){_self=this;var t="";switch(e){case"今天":t=this.formatDate(this.now)+","+this.formatDate(this.now);break;case"本周":t=this.getWeekStartDate()+","+this.getWeekEndDate();break;case"本月":t=this.getMonthStartDate()+","+this.getMonthEndDate();break;case"本季度":t=this.getQuarterStartDate()+","+this.getQuarterEndDate();break;case"本年":t=this.nowYear+"-01-01,"+this.nowYear+"-12-31";break;default:t=jQuery(_self.rightContentDiv).find(".se-select-name").text().replace("--",",")}return t},formatDate:function(e){var t=e.getFullYear(),i=e.getMonth()+1,n=e.getDate();return i<10&&(i="0"+i),n<10&&(n="0"+n),t+"-"+i+"-"+n},getMonthDays:function(e){var t=new Date(this.nowYear,e,1);return(new Date(this.nowYear,e+1,1)-t)/864e5},getQuarterStartMonth:function(){var e=0;return this.nowMonth<3&&(e=0),2<this.nowMonth&&this.nowMonth<6&&(e=3),5<this.nowMonth&&this.nowMonth<9&&(e=6),8<this.nowMonth&&(e=9),e},getWeekStartDate:function(){var e=new Date(this.nowYear,this.nowMonth,this.nowDay-this.nowDayOfWeek+1);return this.formatDate(e)},getWeekEndDate:function(){var e=new Date(this.nowYear,this.nowMonth,this.nowDay+(7-this.nowDayOfWeek));return this.formatDate(e)},getMonthStartDate:function(){var e=new Date(this.nowYear,this.nowMonth,1);return this.formatDate(e)},getMonthEndDate:function(){var e=new Date(this.nowYear,this.nowMonth,this.getMonthDays(this.nowMonth));return this.formatDate(e)},getQuarterStartDate:function(){var e=new Date(this.nowYear,this.getQuarterStartMonth(),1);return this.formatDate(e)},getQuarterEndDate:function(){var e=this.getQuarterStartMonth()+2,t=new Date(this.nowYear,e,this.getMonthDays(e));return this.formatDate(t)},loadTimeContainer:function(e){jQuery("#"+e).ymdateplugin({showTimePanel:!1})},selectPerson:function(e,l,r,t){var i={type:"",types:["person","unit"],values:this.configData,count:t,zIndex:5e4,onComplete:function(o){MWF.require("MWF.widget.O2Identity",function(){var i=[],n=[];if(this.configData=[],this.process=null,o.each(function(e){if("i"==e.data.distinguishedName.split("@").getLast().toLowerCase()){new MWF.widget.O2Identity(e.data,it.form.getItem("invitePersonList").container,{style:"room"});i.push(e.data.distinguishedName)}else{i.push(e.data.name),n.push(e.data.distinguishedName);var t={name:e.data.name,distinguishedName:e.data.distinguishedName,employee:e.data.employee};this.configData.push(t)}}.bind(this)),0==o.length)"本人及下属"!=jQuery(".headTitleinDiv").text()&&(document.getElementById(l).innerHTML="",document.getElementById(r).innerHTML="",jQuery(".headTitleinDiv").text("本人及下属"),_self.loadDataContent());else if(document.getElementById(l).innerHTML=i.join(","),""!=r){document.getElementById(r).innerHTML=n.join(",");for(var e=[],t=[],s="",a=0;a<n.length;a++)n[a].contains("@P")&&e.push(n[a]),n[a].contains("@U")&&t.push(n[a]);0<e.length&&(s=e.length+"个员工",jQuery("#"+r).attr("personList",e.join(","))),0<t.length&&(s=0<e.length?s+","+t.length+"个部门":t.length+"个部门",jQuery("#"+r).attr("departList",t.join(","))),""!=s&&(jQuery(".headTitleinDiv").text(s),_self.loadDataContent(),_self.dropdown&&_self.dropdown.setStyles({top:jQuery(".user_change").offset().top+52+"px",left:jQuery(".user_change").offset().left+2}))}}.bind(this))}.bind(this)};new MWF.O2Selector(e,i)},getRecordCount:function(t){_self=this,jQuery(".openDiv").show(),jQuery(".openDiv").append('<div class="headNode"><span class="title">销售简报-新增跟进记录</span><img class="close" src="/x_component_CRM/$Template/close.png"></div>');jQuery(".openDiv").append('<div class="lsitBody"><table class="el-table__bd" style="width:100%;border-collapse: collapse;"><tbody><tr class="el-table__row current-row"><td class="firstCol"><div class="cell">模块</div></td><td><div class="cell">新增跟进记录</div></td></tr></tbody></table></div>');var i="";_self.actions.countGroupByTypes(t,function(e){"success"==e.type&&e.data.each(function(e){var t=e.typesname;""!=t&&(i=i+'<tr class="el-table__row"><td class="firstCol"><div class="cell">'+t+'</div></td><td mid="'+e.types+'"><div class="cell el-tooltip">'+e.count+"</div></td></tr>")})}),jQuery(".lsitBody").find("tbody").append(i),jQuery(".headNode").find(".close").click(function(){jQuery(".openDiv").empty(),jQuery(".openDiv").hide()}),jQuery("td[mid]").css("cursor","pointer"),jQuery("td[mid]").click(function(){var e=jQuery(this).attr("mid");0<jQuery(".notify").length&&jQuery(".notify").remove(),MWF.xDesktop.requireApp("CRM","Record",function(){_self.explorer=new MWF.xApplication.CRM.Record(_self,_self.actions,{},{openId:e,openName:"跟进记录",filter:t,onReloadView:function(){}.bind(_self)}),_self.explorer.load()}.bind(_self))})},resizeWindow:function(){this.rightContentDiv.getSize()}}),MWF.xApplication.CRM.Index.View=new Class({Extends:MWF.xApplication.CRM.Template.ComplexViewOpen,_getCurrentPageData:function(t,e,i,n,s){e||(e=15),i||(i=1);this.items.length&&this.items[this.items.length-1].data.id;var a=this.options.filterData;a={key:n?n.trim():"",orderFieldName:"updateTime",orderType:"desc"},s||(s="全部客户"),this.isAdmin?this.actions.getCustomerListPage(i,e,a,function(e){t&&t(e)}.bind(this)):("我负责的客户"==s&&this.actions.ListMyDuty_customer(i,e,a,function(e){t&&t(e)}.bind(this)),"下属负责的客户"==s&&this.actions.ListNestedSubPerson_customer(i,e,a,function(e){t&&t(e)}.bind(this)),"我参与的客户"==s&&this.actions.ListMyParticipate_customer(i,e,a,function(e){t&&t(e)}.bind(this)),"全部客户"==s&&this.actions.ListAllMy_customer(i,e,a,function(e){t&&t(e)}.bind(this)))},_create:function(){},_openDocument:function(e,t){MWF.xDesktop.requireApp("CRM","CustomerOpen",function(){this.explorer=new MWF.xApplication.CRM.CustomerOpen(this,this.actions,{},{openId:e,openName:t,onReloadView:function(){this.reload()}.bind(this)}),this.explorer.load()}.bind(this))},_queryCreateViewNode:function(){},_postCreateViewNode:function(e){},_queryCreateViewHead:function(){},_postCreateViewHead:function(e){}}),MWF.xApplication.CRM.Index.ContactsView=new Class({Extends:MWF.xApplication.CRM.Template.ComplexViewOpen,_createDocument:function(e){return new MWF.xApplication.CRM.Clue.Document(this.viewNode,e,this.explorer,this)},_getCurrentPageData:function(t,e,i,n){this.category=this.options.category;e||(e=15),i||(i=1);this.items.length&&this.items[this.items.length-1].data.id;var s=this.options.filterData||{};n&&(s={key:n}),this.actions.getContactsListPage(i,e,s,function(e){t&&t(e)}.bind(this))},_create:function(){},_openDocument:function(e,t){MWF.xDesktop.requireApp("CRM","ContactsOpen",function(){this.explorer=new MWF.xApplication.CRM.ContactsOpen(this,this.actions,{},{openId:e,openName:t,onReloadView:function(){this.reload()}.bind(this)}),this.explorer.load()}.bind(this))},_openOtherDocument:function(e,t){MWF.xDesktop.requireApp("CRM","CustomerOpen",function(){this.explorer=new MWF.xApplication.CRM.CustomerOpen(this,this.actions,{},{openId:e,openName:t,onReloadView:function(){this.reload()}.bind(this)}),this.explorer.load()}.bind(this))},_queryCreateViewNode:function(){},_postCreateViewNode:function(e){},_queryCreateViewHead:function(){},_postCreateViewHead:function(e){}}),MWF.xApplication.CRM.Index.ChanceView=new Class({Extends:MWF.xApplication.CRM.Template.ComplexViewOpen,initialize:function(e,t,i,n,s,a){this.container=e,this.data=t||{},this.explorer=n,this.actions=a?(this.app=i||a.app||this.explorer.app,this.lp=a.lp||this.explorer.lp||this.app.lp,this.css=a.css||this.explorer.css||this.app.css,a.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),s.templateUrl?-1==s.templateUrl.indexOf("/")&&(s.templateUrl=this.explorer.path+s.templateUrl):s.templateUrl=this.explorer.path+"listItem.json",this.setOptions(s)},_createDocument:function(e){return new MWF.xApplication.CRM.Chance.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,n){this.category=this.options.category;e||(e=10),i||(i=1);this.items.length&&this.items[this.items.length-1].data.id;var s=this.options.filterData||{};n&&(s={key:n}),this.actions.getChanceByPage(i,e,s,function(e){t&&t(e)}.bind(this))},useTablePlugins:function(a,e){console.log("this is useTablePlugins page:"+a+";;;;text:"+e),0<jQuery(".laytable-box").length&&jQuery(".laytable-box").remove();var o,l,r,c=this,d=[],t=this.template;l=t.sortField,r=t.sortType,a||(a=1),o=t.field,this._getCurrentPageData(function(s){d=s.data,layui.config({base:"/x_component_CRM/$Template/plugins/table2/"}).use(["table2","table2"],function(){var e=layui.table2;console.log(o);e.render({elem:"#contentTable",data:d,height:600,width:"100%",page:{align:"right",groups:5,curr:1,count:s.count,limit:10,limits:[10,20,30,40,50,60,70,80,90]},initSort:{sortField:l,sortType:r},cols:[o]});c.container.getElements(".chanceId").forEach(function(e,t){e.addEvent("click",function(){console.log(this),c._openDocument(this.get("id"),this.text)}.bind(e))}),c.container.getElements(".customerId").forEach(function(e,t){e.addEvent("click",function(){console.log(this),c._openCustomer(this.get("id"),this.text)}.bind(e))}),jQuery(".laytable-page-pagination").find("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?c.useTablePlugins(e,t):c.useTablePlugins(e)}})}),jQuery(".laytable-page-btnok").on("click",function(){var e=parseInt(jQuery(".laytable-page-input").val()),t=jQuery(".headSearchInput").val();""!=t?c.useTablePlugins(e,t):c.useTablePlugins(e)}),jQuery(".page-item").each(function(e,t){jQuery(t).attr("value")==a+""?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 t=jQuery(".page-active").attr("value"),i=jQuery(".page-prev").parent().next().find("a")[0],n=jQuery(".page-last").parent().prev().find("a")[0];parseInt(t)>parseInt(jQuery(i).attr("value"))?jQuery(".page-prev").attr("class","page-item page-prev"):jQuery(".page-prev").attr("class","page-item page-prev rayui-disabled"),parseInt(t)==parseInt(jQuery(n).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",a+"")})}.bind(this),10,a,e)},_openDocument:function(e,t){MWF.xDesktop.requireApp("CRM","ChanceOpen",function(){this.explorer=new MWF.xApplication.CRM.ChanceOpen(this,this.actions,{},{openId:e,openName:t,lp:this.lp,onReloadView:function(){this.reload()}.bind(this)}),this.explorer.load()}.bind(this))},_openCustomer:function(e,t){MWF.xDesktop.requireApp("CRM","CustomerOpen",function(){this.explorer=new MWF.xApplication.CRM.CustomerOpen(this,this.actions,{},{openId:e,openName:t,onReloadView:function(){this.reload()}.bind(this)}),this.explorer.load()}.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

搜索帮助