Ai
2 Star 14 Fork 48

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

Create your Gitee Account
Explore and code with more than 13.5 million developers,Free private repositories !:)
Sign up
文件
This repository doesn't specify license. Please pay attention to the specific project description and its upstream code dependency when using it.
Clone or Download
Message.js 16.87 KB
Copy Edit Raw Blame History
鲸歌 authored 2021-01-13 14:15 +08:00 . crm初始上传
MWF.xApplication.CRM = MWF.xApplication.CRM || {};
MWF.xDesktop.requireApp("Template", "MForm", null, false);
MWF.xDesktop.requireApp("CRM", "Template", null,false);
MWF.xDesktop.requireApp("Template", "Explorer", null,false);
MWF.require("MWF.widget.Identity", null,false);
MWF.xApplication.CRM.Message = new Class({
Extends: MWF.widget.Common,
Implements: [Options, Events],
options: {
"style": "default"
},
initialize: function (node, app, actions, options) {
this.setOptions(options);
this.app = app;
this.lp = app.lp.customer;
this.path = "/x_component_CRM/$Message/";
this.loadCss();
this.actions = actions;
this.node = $(node);
debugger
},
loadCss: function () {
this.cssPath = "/x_component_CRM/$Message/" + this.options.style + "/css.wcss";
this._loadCss();
},
load: function () {
if(this.formContentArr)this.formContentArr.empty();
this.formContentArr = [];
if(this.formMarkArr)this.formMarkArr.empty();
this.formMarkArr = [];
this.rightContentDiv = this.app.rightContentDiv;
this.createHeadContent();
this.createCustomerContent();
this.resizeWindow();
this.app.addEvent("resize", function(){
this.resizeWindow();
}.bind(this));
},
reload:function(){
this.createCustomerContent();
this.resizeWindow();
},
createHeadContent:function(){
debugger
if(this.headContentDiv) this.headContentDiv.destroy();
this.headContentDiv = new Element("div.headContentDiv",{"styles":this.css.headContentDiv}).inject(this.rightContentDiv);
this.headTitleDiv = new Element("div.headTitleDiv",{
"styles":this.css.headTitleDiv,
"text":"待办信息"
}).inject(this.headContentDiv);
},
createToolBarContent:function(){
},
createCustomerContent:function(){
_self = this;
if(this.contentListDiv) this.contentListDiv.destroy();
this.contentListDiv = new Element("div.contentListDiv",{"styles":this.css.contentListDiv}).inject(this.rightContentDiv);
if(this.contentLeftDiv) this.contentLeftDiv.destroy();
this.contentLeftDiv = new Element("div.contentLeftDiv",{"styles":this.css.contentLeftDiv}).inject(this.contentListDiv);
if(this.contentLeftInDiv) this.contentLeftInDiv.destroy();
this.contentLeftInDiv = new Element("div.contentLeftInDiv",{
"styles":this.css.contentLeftInDiv
}).inject(this.contentLeftDiv);
if(this.contentLeftItemDiv) this.contentLeftItemDiv.destroy();
this.contentLeftItemDiv = new Element("div.contentLeftItemDiv",{
"styles":this.css.contentLeftInDiv,
"text":"今日需联系客户"
}).inject(this.contentLeftInDiv);
if(this.contentLeftItemDiv2) this.contentLeftItemDiv2.destroy();
this.contentLeftItemDiv2 = new Element("div.contentLeftItemDiv",{
"styles":this.css.contentLeftInDiv,
"text":"分配给我的线索"
}).inject(this.contentLeftInDiv);
if(this.contentLeftItemDiv3) this.contentLeftItemDiv3.destroy();
this.contentLeftItemDiv3 = new Element("div.contentLeftItemDiv",{
"styles":this.css.contentLeftInDiv,
"text":"分配给我的客户"
}).inject(this.contentLeftInDiv);
if(this.contentLeftItemDiv4) this.contentLeftItemDiv4.destroy();
this.contentLeftItemDiv4 = new Element("div.contentLeftItemDiv",{
"styles":this.css.contentLeftInDiv,
"text":"待进入公海的客户"
}).inject(this.contentLeftInDiv);
if(this.contentListInDiv) this.contentListInDiv.destroy();
this.contentListInDiv = new Element("div.contentListInDiv",{"styles":this.css.contentListInDiv}).inject(this.contentListDiv);
var size = this.rightContentDiv.getSize();
if(this.contentListDiv)this.contentListDiv.setStyles({"height":(size.y-this.headContentDiv.getHeight()-8)+"px"});
if(this.contentListInDiv)this.contentListInDiv.setStyles({"height":(this.contentListDiv.getHeight())+"px"});
if(this.contentLeftDiv)this.contentLeftDiv.setStyles({"height":(this.contentListDiv.getHeight()-80)+"px"});
//jQuery(that.contentLeftInDiv).children(":first").attr("class","contentLeftItemSelectd");
jQuery(_self.contentLeftInDiv).find("div").click(function(){
jQuery(this).attr("class","contentLeftItemSelectd");
var category = jQuery(this).text();
jQuery(this).siblings().attr("class","contentLeftItemDiv");
var templateUrl = _self.path+"messageView.json";
var filter = {};
switch (category) {
case "今日需联系客户":
if(_self.customerView) delete _self.customerView;
jQuery(".contentListInDiv").empty();
_self.customerView = new MWF.xApplication.CRM.Message.CustomerView(
_self.contentListInDiv,
_self.openDiv,
_self.app,
_self,
{ templateUrl : templateUrl,filterData:filter},
{
lp:_self.app.lp.customerView,
isAdmin:_self.options.isAdmin
}
);
_self.customerView.load();
break;
case "分配给我的线索":
if(_self.allotClueView) delete _self.allotClueView;
_self.allotClueView = new MWF.xApplication.CRM.Message.AllotClueView(
_self.contentListInDiv,
_self.openDiv,
_self.app,
_self,
{ templateUrl : templateUrl,filterData:filter},
{
lp:_self.app.lp.clueView,
isAdmin:_self.options.isAdmin
}
);
_self.allotClueView.load();
break;
case "分配给我的客户":
if(_self.allotCustomerView) delete _self.allotCustomerView;
jQuery(".contentListInDiv").empty();
_self.allotCustomerView = new MWF.xApplication.CRM.Message.AllotCustomerView(
_self.contentListInDiv,
_self.openDiv,
_self.app,
_self,
{ templateUrl : templateUrl,filterData:filter},
{
lp:_self.app.lp.customerView,
isAdmin:_self.options.isAdmin
}
);
_self.allotCustomerView.load();
break;
case "待进入公海的客户":
if(_self.seaCustomerView) delete _self.seaCustomerView;
jQuery(".contentListInDiv").empty();
_self.seaCustomerView = new MWF.xApplication.CRM.Message.SeaCustomerView(
_self.contentListInDiv,
_self.openDiv,
_self.app,
_self,
{ templateUrl : templateUrl,filterData:filter},
{
lp:_self.app.lp.customerView,
isAdmin:_self.options.isAdmin
}
);
_self.seaCustomerView.load();
break;
}
});
jQuery(_self.contentLeftInDiv).children(":first").click();
},
resizeWindow:function(){
var size = this.rightContentDiv.getSize();
if(this.contentListDiv)this.contentListDiv.setStyles({"height":(size.y-this.headContentDiv.getHeight()-8)+"px"});
if(this.contentListInDiv)this.contentListInDiv.setStyles({"height":(this.contentListDiv.getHeight())+"px"});
if(this.contentLeftDiv)this.contentLeftDiv.setStyles({"height":(this.contentListDiv.getHeight()-80)+"px"});
}
});
MWF.xApplication.CRM.Message.CustomerView = new Class({
Extends: MWF.xApplication.CRM.Template.ComplexView,
_createDocument: function(data){
return new MWF.xApplication.CRM.Clue.Document(this.viewNode, data, this.explorer, this);
},
_getCurrentPageData: function(callback, count, page, searchText,searchType){
if (!count)count = 15;
if (!page)page = 1;
//var id = (this.items.length) ? this.items[this.items.length - 1].data.id : "(0)";
var dt = this.formatDate(new Date());
var filter = this.options.filterData || {};
filter = {
begintime:dt+" 00:00:00",
endtime:dt+" 23:59:59"
};
debugger
this.actions.listNextTimePaginLike(page, count, filter, function (json) {
if (callback)callback(json);
}.bind(this));
},
_create: function(){
},
_openDocument: function(openId ,openName){
MWF.xDesktop.requireApp("CRM", "CustomerOpen", function(){
this.explorer = new MWF.xApplication.CRM.CustomerOpen(this, this.actions,{},{
"openId":openId,
"openName":openName,
"openType":"single",
"onReloadView" : function( ){
//alert(JSON.stringify(data))
this.reload();
}.bind(this)
});
this.explorer.load();
}.bind(this))
},
_queryCreateViewNode: function(){
},
_postCreateViewNode: function( viewNode ){
},
_queryCreateViewHead:function(){
},
_postCreateViewHead: function( headNode ){
}
});
MWF.xApplication.CRM.Message.AllotClueView = new Class({
Extends: MWF.xApplication.CRM.Template.ComplexView,
_createDocument: function(data){
return new MWF.xApplication.CRM.Clue.Document(this.viewNode, data, this.explorer, this);
},
_getCurrentPageData: function(callback, count, page, searchText){
var category = this.category = this.options.category;
if (!count)count = 15;
if (!page)page = 1;
var id = (this.items.length) ? this.items[this.items.length - 1].data.id : "(0)";
//if(id=="(0)")this.app.createShade();
var filter = this.options.filterData || {};
if(searchText){
filter = {
key:searchText
};
}
debugger;
/*this.actions.getClueListPage(page, count, filter, function (json) {
debugger
if (callback)callback(json);
}.bind(this));*/
this.actions.ListMyDuty(page, count, filter, function (json) {
if (callback)callback(json);
}.bind(this));
},
_create: function(){
},
_openDocument: function(openId ,openName){
MWF.xDesktop.requireApp("CRM", "ClueOpen", function(){
this.explorer = new MWF.xApplication.CRM.ClueOpen(this, this.actions,{},{
"clueId":openId,
"clueName":openName,
"openType":"single",
"onReloadView" : function( ){
//alert(JSON.stringify(data))
this.reload();
}.bind(this)
});
this.explorer.load();
}.bind(this))
},
/*_openOtherDocument: function(openId ,openName){
MWF.xDesktop.requireApp("CRM", "CustomerOpen", function(){
this.explorer = new MWF.xApplication.CRM.CustomerOpen(this, this.actions,{},{
"openId":openId,
"openName":openName,
"onReloadView" : function( ){
//alert(JSON.stringify(data))
this.reload();
}.bind(this)
});
this.explorer.load();
}.bind(this))
},*/
_queryCreateViewNode: function(){
},
_postCreateViewNode: function( viewNode ){
},
_queryCreateViewHead:function(){
},
_postCreateViewHead: function( headNode ){
}
});
MWF.xApplication.CRM.Message.AllotCustomerView = new Class({
Extends: MWF.xApplication.CRM.Template.ComplexView,
_createDocument: function(data){
return new MWF.xApplication.CRM.Clue.Document(this.viewNode, data, this.explorer, this);
},
_getCurrentPageData: function(callback, count, page, searchText,searchType){
if (!count)count = 15;
if (!page)page = 1;
var id = (this.items.length) ? this.items[this.items.length - 1].data.id : "(0)";
//if(id=="(0)")this.app.createShade();
var filter = this.options.filterData || {};
filter={key: searchText?searchText.trim():"",
orderFieldName: "updateTime",
orderType: "desc"
};
/*this.actions.getCustomerListPage(page, count, filter, function (json) {
if (callback)callback(json);
}.bind(this));*/
this.actions.ListMyDuty_customer(page, count, filter, function (json) {
if (callback)callback(json);
}.bind(this));
},
_create: function(){
},
_openDocument: function(openId ,openName){
MWF.xDesktop.requireApp("CRM", "CustomerOpen", function(){
this.explorer = new MWF.xApplication.CRM.CustomerOpen(this, this.actions,{},{
"openId":openId,
"openName":openName,
"openType":"single",
"onReloadView" : function( ){
//alert(JSON.stringify(data))
this.reload();
}.bind(this)
});
this.explorer.load();
}.bind(this))
},
_queryCreateViewNode: function(){
},
_postCreateViewNode: function( viewNode ){
},
_queryCreateViewHead:function(){
},
_postCreateViewHead: function( headNode ){
}
});
MWF.xApplication.CRM.Message.SeaCustomerView = new Class({
Extends: MWF.xApplication.CRM.Template.ComplexView,
_createDocument: function(data){
return new MWF.xApplication.CRM.Clue.Document(this.viewNode, data, this.explorer, this);
},
_getCurrentPageData: function(callback, count, page, searchText,searchType){
if (!count)count = 15;
if (!page)page = 1;
var id = (this.items.length) ? this.items[this.items.length - 1].data.id : "(0)";
//if(id=="(0)")this.app.createShade();
var filter = this.options.filterData || {};
filter={key: searchText?searchText.trim():"",
orderFieldName: "updateTime",
orderType: "desc"
};
/*this.actions.getCustomerListPage(page, count, filter, function (json) {
if (callback)callback(json);
}.bind(this));*/
this.actions.getCustomerListPageToPool(page, count, filter, function (json) {
if (callback)callback(json);
}.bind(this));
},
_create: function(){
},
_openDocument: function(openId ,openName){
MWF.xDesktop.requireApp("CRM", "CustomerOpen", function(){
this.explorer = new MWF.xApplication.CRM.CustomerOpen(this, this.actions,{},{
"openId":openId,
"openName":openName,
"openType":"single",
"readOnly":"yes",
"onReloadView" : function( ){
//alert(JSON.stringify(data))
this.reload();
}.bind(this)
});
this.explorer.load();
}.bind(this))
},
_queryCreateViewNode: function(){
},
_postCreateViewNode: function( viewNode ){
},
_queryCreateViewHead:function(){
},
_postCreateViewHead: function( headNode ){
}
});
MWF.xApplication.CRM.Customer.Document = new Class({
Extends: MWF.xApplication.Template.Explorer.ComplexDocument,
_queryCreateDocumentNode:function( itemData ){
},
_postCreateDocumentNode: function( itemNode, itemData ){
this.view.template.items.each(function (item,i) {
if(item.head.width){
itemNode.getElements("td")[i].set("width",item.head.width);
}
if(i == itemNode.getElements("td").length-1){
itemNode.getElements("td")[i].set("width",this.view.lastTdWidth);
}
}.bind(this));
},
open: function (e) {
this.view._openDocument(this.data, this.index);
},
edit : function(){
var appId = "ForumDocument"+this.data.id;
if (this.app.desktop.apps[appId]){
this.app.desktop.apps[appId].setCurrent();
}else {
this.app.desktop.openApplication(null, "ForumDocument", {
"sectionId" : this.data.sectionId,
"id" : this.data.id,
"appId": appId,
"isEdited" : true,
"isNew" : false,
"index" : this.index
});
}
}
})
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/o2oa/o2oa-crm.git
git@gitee.com:o2oa/o2oa-crm.git
o2oa
o2oa-crm
o2oa-crm
master

Search