Ai
2 Star 14 Fork 48

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

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
CustomerEdit.min.js 9.36 KB
一键复制 编辑 原始数据 按行查看 历史
鲸歌 提交于 2021-01-13 14:15 +08:00 . crm初始上传
MWF.xApplication.CRM.AddressExplorer=null,MWF.xApplication.CRM.CustomerEdit=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(e,t,i,n){this.setOptions(n),this.explorer=e,this.app=e.app,this.lp=this.app.lp.customer.customerEdit,this.path="/x_component_CRM/$CustomerEdit/",this.cssPath=this.path+this.options.style+"/css.wcss",this._loadCss(),this.options.title=this.lp.title,this.data=i||{},this.province=null,this.actions=t},load:function(){this.loadResource(function(){this.appArea=jQuery("body").children(":first"),this.createForm()}.bind(this))},loadResource:function(e){e&&e()},createForm:function(){_self=this,jQuery(_self.appArea).next().attr("style",""),jQuery(_self.appArea).next().attr("class","mask");var o=_self.lp,e='<div class="section-conent">';for(i in o){var t=o[i].type,n=o[i].notEmpty?o[i].notEmpty:"false";r="datetime"==t?'<input type="text" class="inline-input" readonly="readonly" name="'+i+'" id="'+i+'" notEmpty="'+n+'" stype="'+t+'">':'<input type="text" class="inline-input" name="'+i+'" id="'+i+'" notEmpty="'+n+'" stype="'+t+'">',"textarea"==t&&(r='<textarea rows="6" class="el-textarea__inner" id="'+i+'" notEmpty="'+n+'" stype="'+t+'" style="resize: none; min-height: 30.6px;"></textarea>'),"select"!=t&&"hide"!=t||(r='<div class="inline-input" style="display: inline-block;cursor:pointer;" id="'+i+'" notEmpty="'+n+'" stype="'+t+'" ></div><div class="el-icon-arrow-down el-icon--right" style="margin-left: -20px; display: inline-block;"><img src="/x_component_CRM/$Clue/default/icons/arrow.png"></div>'),"map"==t&&(r='<div class="setMap" id="setMap" stype="'+t+'"></div>'),e=e+'<div class="conent-inline"><div class="conent-title" lable="'+i+'">'+o[i].text+'</div><div class="conent-value">'+r+"</div></div>"}var l='<div class="section-header"><div class="section-mark" style="border-left-color: rgb(70, 205, 207);"></div> <div data-v-ec8f8850="" class="section-title">基本信息</div></div>'+(e+="</div>")+'<div class="section_button"><div><button class="el-button handle-button el-button-cancle"><span>取消</span></button><button class="el-button handle-button el-button-primary"><span>保存</span></button></div></div>';jQuery(".headMoreImg").notifyMe("left","default","新建客户","","",l,"notifyEdit",50),jQuery(".conent-value").each(function(e,t){var i=jQuery(t).children().eq(0),n=jQuery(i).attr("stype");if("datetime"==n&&_self.loadTimeContainer(jQuery(i).attr("id")),"select"==n||"hide"==n){var r=_self.app.lp.customer;for(j in r)if(j==jQuery(i).attr("id")){var l=o[j].value.split(",");if(0<l.length){for(var a='<ul class="el-dropdown-type" style="display: none;" tid="'+jQuery(i).attr("id")+'">',s=0;s<l.length;s++)a=a+'<li class="el-dropdown-menu__item">'+l[s]+"</li>";jQuery(".notify-content").append(a+'<div class="popper__arrow"></div></ul>'),jQuery(i).click(function(){jQuery("[tid='"+jQuery(i).attr("id")+"']").css({left:jQuery(i).offset().left-50,top:jQuery(i).offset().top+30,width:282}),jQuery("[tid='"+jQuery(i).attr("id")+"']").toggle(100)}),jQuery("[tid='"+jQuery(i).attr("id")+"']").children().click(function(){jQuery(i).text(jQuery(this).text()),jQuery("[tid='"+jQuery(i).attr("id")+"']").toggle(100)})}}}}),jQuery(".el-button-cancle").click(function(){setTimeout(function(){jQuery("#notifyEdit").remove(),0<jQuery(".mask").length&&(jQuery(".mask").attr("style","left: 0px; top: 0px; width: 100%; overflow: hidden; position: absolute; z-index: 500000; background-color: rgb(255, 255, 255)"),jQuery(".mask").attr("class",""))},200)}),jQuery(".el-button-primary").click(function(){var n=!0;if(jQuery(".inline-input[notempty='true']").each(function(e,t){if(""==jQuery(t).val()&&""==jQuery(t).text()){n=!1;var i=jQuery(t).parent().prev().text()+"不能为空";0<jQuery(t).nextAll(".empError").length&&jQuery(t).nextAll(".empError").remove(),jQuery(t).parent().append('<div class="empError" style="color:#f56c6c;padding: 0;line-height: 1;">'+i+"</div>")}else 0<jQuery(t).nextAll(".empError").length&&jQuery(t).nextAll(".empError").remove()}),n){var e,t=jQuery("[name='province']").val()+"#"+jQuery("[name='city']").val()+"#"+jQuery("[name='district']").val();e={customername:jQuery('div[lable="customername"]').next().children().eq(0).val(),level:jQuery('div[lable="level"]').next().children().eq(0).text(),industry:jQuery('div[lable="industry"]').next().children().eq(0).text(),source:jQuery('div[lable="source"]').next().children().eq(0).text(),dealstatus:jQuery('div[lable="dealstatus"]').next().children().eq(0).text(),telephone:jQuery('div[lable="telephone"]').next().children().eq(0).val(),cellphone:jQuery('div[lable="cellphone"]').next().children().eq(0).val(),website:jQuery('div[lable="website"]').next().children().eq(0).val(),location:jQuery('div[lable="detailaddress"]').next().children().eq(0).attr("location"),detailaddress:jQuery('div[lable="detailaddress"]').next().children().eq(0).val(),lng:jQuery('div[lable="detailaddress"]').next().children().eq(0).attr("lng"),lat:jQuery('div[lable="detailaddress"]').next().children().eq(0).attr("lat"),province:-1<t.indexOf("0")?"":t,city:jQuery('div[lable="detailaddress"]').next().children().eq(0).attr("city"),nexttime:jQuery('div[lable="nexttime"]').next().children().eq(0).val(),remark:jQuery('div[lable="remark"]').next().children().eq(0).val()},_self.actions.saveCustomer(e,function(e){"success"==e.type&&Showbo.Msg.alert("保存成功!",jQuery("#customer").click()),setTimeout(function(){jQuery("#notifyEdit").remove(),0<jQuery(".mask").length&&(jQuery(".mask").attr("style","left: 0px; top: 0px; width: 100%; overflow: hidden; position: absolute; z-index: 500000; background-color: rgb(255, 255, 255)"),jQuery(".mask").attr("class",""))},200)}.bind(_self))}}),jQuery(".notify-content").click(function(e){jQuery(e.target).closest(".inline-input[notempty='true']").length<1&&"取消"!=jQuery(e.target)[0].innerText&&jQuery(".inline-input[notempty='true']").each(function(e,t){if(""==jQuery(t).val()&&""==jQuery(t).text()){var i=jQuery(t).parent().prev().text()+"不能为空";0<jQuery(t).nextAll(".empError").length&&jQuery(t).nextAll(".empError").remove(),jQuery(t).parent().append('<div class="empError" style="color:#f56c6c;padding: 0;line-height: 1;">'+i+"</div>")}else 0<jQuery(t).nextAll(".empError").length&&jQuery(t).nextAll(".empError").remove()})}),_self.getAddress()},getAddress:function(){var e=this,t=[];o2.Actions.get("x_general_assemble_control").listProvince(function(e){e.data.each(function(e){t.push(e.name)}.bind(this))}.bind(this),null,!1);for(var i="",n=0;n<t.length;n++)i=i+'<option value="'+t[n]+'">'+t[n]+"</option>";var r='<select name="province" class="select-address"><option value="0">所在省</option>'+i+'</select><select name="city" class="select-address city-address"> <option value="0">所在市</option></select> <select class="select-address" name="district"><option value="0">所在区</option></select>';if(jQuery("#province").parent().append(r),jQuery("#province").remove(),null!=e.province){var l=e.province.split("#");1<l.length&&(jQuery("[name='province']").append(new Option(l[0],l[0])),jQuery("[name='province']").val(l[0]),jQuery("[name='city']").append(new Option(l[1],l[1])),jQuery("[name='city']").val(l[1]),jQuery("[name='district']").append(new Option(l[2],l[2])),jQuery("[name='district']").val(l[2]))}jQuery("[name='province']").change(function(){e.getCity(this.value)}),jQuery("[name='city']").change(function(){e.getDistrict(jQuery("[name='province']").val(),this.value)})},getCity:function(e){jQuery("[name='city']").find("option[value!='0']").remove(),jQuery("[name='district']").find("option[value!='0']").remove();var t=jQuery("[name='city']");"所在省"!=e&&o2.Actions.get("x_general_assemble_control").listCity(e,function(e){e.data.each(function(e){jQuery(t).append(new Option(e.name,e.name))})}.bind(this),null,!1)},getDistrict:function(e,t){jQuery("[name='district']").find("option[value!='0']").remove();var i=jQuery("[name='district']");o2.Actions.get("x_general_assemble_control").listDistrict(e,t,function(e){e.data.each(function(e){jQuery(i).append(new Option(e.name,e.name))})},null,!1)},loadTimeContainer:function(e){jQuery("#"+e).ymdateplugin({showTimePanel:!0})},loadMap:function(){(_self=this).mapDiv=jQuery("#setMap")[0],jQuery(".section-conent").css("height",screen.height-400+"px"),this.mapDiv&&this.mapDiv.empty(),this.addressModule&&delete this.addressModule,MWF.xDesktop.requireApp("CRM","AddressExplorer",function(){this.addressModule=new MWF.xApplication.CRM.AddressExplorer(this.mapDiv,this,this.actions,{}),this.addressModule.load()}.bind(this))},getItemTemplate:function(e){return _self=this,{customername:{text:e.customername,type:"text",notEmpty:!0,value:this.customerData&&this.customerData.customername?this.customerData.customername:""},level:{type:"select",notEmpty:!0,text:e.level,value:this.app.lp.customer.level.value},industry:{type:"select",notEmpty:!0,text:e.industry,value:this.app.lp.customer.industry.value},source:{type:"select",notEmpty:!0,text:e.source,value:this.app.lp.customer.source.value},telephone:{type:"text",notEmpty:!0,text:e.telephone,value:this.app.lp.clue.level.value},website:{text:e.website,type:"text"},nexttime:{text:e.nexttime,notEmpty:!0,attr:{id:"nexttime"},type:"datetime"},cellphone:{text:e.cellphone,type:"text"},detailaddress:{text:e.detailaddress,type:"text"},remark:{text:e.remark,type:"textarea"},location:{text:e.location,type:"map"}}}});
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/o2oa/o2oa-crm.git
git@gitee.com:o2oa/o2oa-crm.git
o2oa
o2oa-crm
o2oa-crm
master

搜索帮助