提交 5e8e3420 编写于 作者: ibizdev's avatar ibizdev

chitanda 发布系统代码

上级 04c40a22
......@@ -62,21 +62,6 @@ export default class CampaignServiceBase extends EntityService {
*/
public async Create(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
let masterData:any = {};
let campaigncampaignsData:any = [];
if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_campaigncampaigns'),'undefined')){
campaigncampaignsData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_campaigncampaigns') as any);
if(campaigncampaignsData && campaigncampaignsData.length && campaigncampaignsData.length > 0){
campaigncampaignsData.forEach((item:any) => {
if(item.srffrontuf){
if(Object.is(item.srffrontuf,"0")){
item.relationshipsid = null;
}
delete item.srffrontuf;
}
});
}
}
masterData.campaigncampaigns = campaigncampaignsData;
let leadsData:any = [];
if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_leads'),'undefined')){
leadsData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_leads') as any);
......@@ -107,6 +92,21 @@ export default class CampaignServiceBase extends EntityService {
}
}
masterData.campaignlists = campaignlistsData;
let campaigncampaignsData:any = [];
if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_campaigncampaigns'),'undefined')){
campaigncampaignsData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_campaigncampaigns') as any);
if(campaigncampaignsData && campaigncampaignsData.length && campaigncampaignsData.length > 0){
campaigncampaignsData.forEach((item:any) => {
if(item.srffrontuf){
if(Object.is(item.srffrontuf,"0")){
item.relationshipsid = null;
}
delete item.srffrontuf;
}
});
}
}
masterData.campaigncampaigns = campaigncampaignsData;
Object.assign(data,masterData);
if(!data.srffrontuf || data.srffrontuf !== "1"){
data[this.APPDEKEY] = null;
......@@ -116,9 +116,9 @@ export default class CampaignServiceBase extends EntityService {
}
let tempContext:any = JSON.parse(JSON.stringify(context));
let res:any = await Http.getInstance().post(`/campaigns`,data,isloading);
this.tempStorage.setItem(tempContext.srfsessionkey+'_campaigncampaigns',JSON.stringify(res.data.campaigncampaigns));
this.tempStorage.setItem(tempContext.srfsessionkey+'_leads',JSON.stringify(res.data.leads));
this.tempStorage.setItem(tempContext.srfsessionkey+'_campaignlists',JSON.stringify(res.data.campaignlists));
this.tempStorage.setItem(tempContext.srfsessionkey+'_campaigncampaigns',JSON.stringify(res.data.campaigncampaigns));
return res;
}
......@@ -133,21 +133,6 @@ export default class CampaignServiceBase extends EntityService {
*/
public async Update(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
let masterData:any = {};
let campaigncampaignsData:any = [];
if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_campaigncampaigns'),'undefined')){
campaigncampaignsData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_campaigncampaigns') as any);
if(campaigncampaignsData && campaigncampaignsData.length && campaigncampaignsData.length > 0){
campaigncampaignsData.forEach((item:any) => {
if(item.srffrontuf){
if(Object.is(item.srffrontuf,"0")){
item.relationshipsid = null;
}
delete item.srffrontuf;
}
});
}
}
masterData.campaigncampaigns = campaigncampaignsData;
let leadsData:any = [];
if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_leads'),'undefined')){
leadsData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_leads') as any);
......@@ -178,11 +163,26 @@ export default class CampaignServiceBase extends EntityService {
}
}
masterData.campaignlists = campaignlistsData;
let campaigncampaignsData:any = [];
if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_campaigncampaigns'),'undefined')){
campaigncampaignsData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_campaigncampaigns') as any);
if(campaigncampaignsData && campaigncampaignsData.length && campaigncampaignsData.length > 0){
campaigncampaignsData.forEach((item:any) => {
if(item.srffrontuf){
if(Object.is(item.srffrontuf,"0")){
item.relationshipsid = null;
}
delete item.srffrontuf;
}
});
}
}
masterData.campaigncampaigns = campaigncampaignsData;
Object.assign(data,masterData);
let res:any = await Http.getInstance().put(`/campaigns/${context.campaign}`,data,isloading);
this.tempStorage.setItem(context.srfsessionkey+'_campaigncampaigns',JSON.stringify(res.data.campaigncampaigns));
this.tempStorage.setItem(context.srfsessionkey+'_leads',JSON.stringify(res.data.leads));
this.tempStorage.setItem(context.srfsessionkey+'_campaignlists',JSON.stringify(res.data.campaignlists));
this.tempStorage.setItem(context.srfsessionkey+'_campaigncampaigns',JSON.stringify(res.data.campaigncampaigns));
return res;
}
......@@ -210,9 +210,9 @@ export default class CampaignServiceBase extends EntityService {
*/
public async Get(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
let res:any = await Http.getInstance().get(`/campaigns/${context.campaign}`,isloading);
this.tempStorage.setItem(context.srfsessionkey+'_campaigncampaigns',JSON.stringify(res.data.campaigncampaigns));
this.tempStorage.setItem(context.srfsessionkey+'_leads',JSON.stringify(res.data.leads));
this.tempStorage.setItem(context.srfsessionkey+'_campaignlists',JSON.stringify(res.data.campaignlists));
this.tempStorage.setItem(context.srfsessionkey+'_campaigncampaigns',JSON.stringify(res.data.campaigncampaigns));
return res;
}
......@@ -228,9 +228,9 @@ export default class CampaignServiceBase extends EntityService {
public async GetDraft(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
let res:any = await Http.getInstance().get(`/campaigns/getdraft`,isloading);
res.data.campaign = data.campaign;
this.tempStorage.setItem(context.srfsessionkey+'_campaigncampaigns',JSON.stringify(res.data.campaigncampaigns));
this.tempStorage.setItem(context.srfsessionkey+'_leads',JSON.stringify(res.data.leads));
this.tempStorage.setItem(context.srfsessionkey+'_campaignlists',JSON.stringify(res.data.campaignlists));
this.tempStorage.setItem(context.srfsessionkey+'_campaigncampaigns',JSON.stringify(res.data.campaigncampaigns));
return res;
}
......@@ -258,21 +258,6 @@ export default class CampaignServiceBase extends EntityService {
*/
public async Save(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
let masterData:any = {};
let campaigncampaignsData:any = [];
if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_campaigncampaigns'),'undefined')){
campaigncampaignsData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_campaigncampaigns') as any);
if(campaigncampaignsData && campaigncampaignsData.length && campaigncampaignsData.length > 0){
campaigncampaignsData.forEach((item:any) => {
if(item.srffrontuf){
if(Object.is(item.srffrontuf,"0")){
item.relationshipsid = null;
}
delete item.srffrontuf;
}
});
}
}
masterData.campaigncampaigns = campaigncampaignsData;
let leadsData:any = [];
if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_leads'),'undefined')){
leadsData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_leads') as any);
......@@ -303,11 +288,26 @@ export default class CampaignServiceBase extends EntityService {
}
}
masterData.campaignlists = campaignlistsData;
let campaigncampaignsData:any = [];
if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_campaigncampaigns'),'undefined')){
campaigncampaignsData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_campaigncampaigns') as any);
if(campaigncampaignsData && campaigncampaignsData.length && campaigncampaignsData.length > 0){
campaigncampaignsData.forEach((item:any) => {
if(item.srffrontuf){
if(Object.is(item.srffrontuf,"0")){
item.relationshipsid = null;
}
delete item.srffrontuf;
}
});
}
}
masterData.campaigncampaigns = campaigncampaignsData;
Object.assign(data,masterData);
let res:any = await Http.getInstance().post(`/campaigns/${context.campaign}/save`,data,isloading);
this.tempStorage.setItem(context.srfsessionkey+'_campaigncampaigns',JSON.stringify(res.data.campaigncampaigns));
this.tempStorage.setItem(context.srfsessionkey+'_leads',JSON.stringify(res.data.leads));
this.tempStorage.setItem(context.srfsessionkey+'_campaignlists',JSON.stringify(res.data.campaignlists));
this.tempStorage.setItem(context.srfsessionkey+'_campaigncampaigns',JSON.stringify(res.data.campaigncampaigns));
return res;
}
......
......@@ -66,21 +66,6 @@ export default class ContactServiceBase extends EntityService {
public async Create(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
if(context.account && true){
let masterData:any = {};
let listcontactsData:any = [];
if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_listcontacts'),'undefined')){
listcontactsData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_listcontacts') as any);
if(listcontactsData && listcontactsData.length && listcontactsData.length > 0){
listcontactsData.forEach((item:any) => {
if(item.srffrontuf){
if(Object.is(item.srffrontuf,"0")){
item.relationshipsid = null;
}
delete item.srffrontuf;
}
});
}
}
masterData.listcontacts = listcontactsData;
let leadsData:any = [];
if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_leads'),'undefined')){
leadsData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_leads') as any);
......@@ -111,21 +96,6 @@ export default class ContactServiceBase extends EntityService {
}
}
masterData.opportunities = opportunitiesData;
Object.assign(data,masterData);
if(!data.srffrontuf || data.srffrontuf !== "1"){
data[this.APPDEKEY] = null;
}
if(data.srffrontuf){
delete data.srffrontuf;
}
let tempContext:any = JSON.parse(JSON.stringify(context));
let res:any = await Http.getInstance().post(`/accounts/${context.account}/contacts`,data,isloading);
this.tempStorage.setItem(tempContext.srfsessionkey+'_listcontacts',JSON.stringify(res.data.listcontacts));
this.tempStorage.setItem(tempContext.srfsessionkey+'_leads',JSON.stringify(res.data.leads));
this.tempStorage.setItem(tempContext.srfsessionkey+'_opportunities',JSON.stringify(res.data.opportunities));
return res;
}
let masterData:any = {};
let listcontactsData:any = [];
if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_listcontacts'),'undefined')){
listcontactsData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_listcontacts') as any);
......@@ -141,6 +111,21 @@ export default class ContactServiceBase extends EntityService {
}
}
masterData.listcontacts = listcontactsData;
Object.assign(data,masterData);
if(!data.srffrontuf || data.srffrontuf !== "1"){
data[this.APPDEKEY] = null;
}
if(data.srffrontuf){
delete data.srffrontuf;
}
let tempContext:any = JSON.parse(JSON.stringify(context));
let res:any = await Http.getInstance().post(`/accounts/${context.account}/contacts`,data,isloading);
this.tempStorage.setItem(tempContext.srfsessionkey+'_leads',JSON.stringify(res.data.leads));
this.tempStorage.setItem(tempContext.srfsessionkey+'_opportunities',JSON.stringify(res.data.opportunities));
this.tempStorage.setItem(tempContext.srfsessionkey+'_listcontacts',JSON.stringify(res.data.listcontacts));
return res;
}
let masterData:any = {};
let leadsData:any = [];
if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_leads'),'undefined')){
leadsData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_leads') as any);
......@@ -171,6 +156,21 @@ export default class ContactServiceBase extends EntityService {
}
}
masterData.opportunities = opportunitiesData;
let listcontactsData:any = [];
if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_listcontacts'),'undefined')){
listcontactsData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_listcontacts') as any);
if(listcontactsData && listcontactsData.length && listcontactsData.length > 0){
listcontactsData.forEach((item:any) => {
if(item.srffrontuf){
if(Object.is(item.srffrontuf,"0")){
item.relationshipsid = null;
}
delete item.srffrontuf;
}
});
}
}
masterData.listcontacts = listcontactsData;
Object.assign(data,masterData);
if(!data.srffrontuf || data.srffrontuf !== "1"){
data[this.APPDEKEY] = null;
......@@ -180,9 +180,9 @@ export default class ContactServiceBase extends EntityService {
}
let tempContext:any = JSON.parse(JSON.stringify(context));
let res:any = await Http.getInstance().post(`/contacts`,data,isloading);
this.tempStorage.setItem(tempContext.srfsessionkey+'_listcontacts',JSON.stringify(res.data.listcontacts));
this.tempStorage.setItem(tempContext.srfsessionkey+'_leads',JSON.stringify(res.data.leads));
this.tempStorage.setItem(tempContext.srfsessionkey+'_opportunities',JSON.stringify(res.data.opportunities));
this.tempStorage.setItem(tempContext.srfsessionkey+'_listcontacts',JSON.stringify(res.data.listcontacts));
return res;
}
......@@ -198,21 +198,6 @@ export default class ContactServiceBase extends EntityService {
public async Update(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
if(context.account && context.contact){
let masterData:any = {};
let listcontactsData:any = [];
if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_listcontacts'),'undefined')){
listcontactsData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_listcontacts') as any);
if(listcontactsData && listcontactsData.length && listcontactsData.length > 0){
listcontactsData.forEach((item:any) => {
if(item.srffrontuf){
if(Object.is(item.srffrontuf,"0")){
item.relationshipsid = null;
}
delete item.srffrontuf;
}
});
}
}
masterData.listcontacts = listcontactsData;
let leadsData:any = [];
if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_leads'),'undefined')){
leadsData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_leads') as any);
......@@ -243,14 +228,6 @@ export default class ContactServiceBase extends EntityService {
}
}
masterData.opportunities = opportunitiesData;
Object.assign(data,masterData);
let res:any = await Http.getInstance().put(`/accounts/${context.account}/contacts/${context.contact}`,data,isloading);
this.tempStorage.setItem(context.srfsessionkey+'_listcontacts',JSON.stringify(res.data.listcontacts));
this.tempStorage.setItem(context.srfsessionkey+'_leads',JSON.stringify(res.data.leads));
this.tempStorage.setItem(context.srfsessionkey+'_opportunities',JSON.stringify(res.data.opportunities));
return res;
}
let masterData:any = {};
let listcontactsData:any = [];
if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_listcontacts'),'undefined')){
listcontactsData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_listcontacts') as any);
......@@ -266,6 +243,14 @@ export default class ContactServiceBase extends EntityService {
}
}
masterData.listcontacts = listcontactsData;
Object.assign(data,masterData);
let res:any = await Http.getInstance().put(`/accounts/${context.account}/contacts/${context.contact}`,data,isloading);
this.tempStorage.setItem(context.srfsessionkey+'_leads',JSON.stringify(res.data.leads));
this.tempStorage.setItem(context.srfsessionkey+'_opportunities',JSON.stringify(res.data.opportunities));
this.tempStorage.setItem(context.srfsessionkey+'_listcontacts',JSON.stringify(res.data.listcontacts));
return res;
}
let masterData:any = {};
let leadsData:any = [];
if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_leads'),'undefined')){
leadsData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_leads') as any);
......@@ -296,11 +281,26 @@ export default class ContactServiceBase extends EntityService {
}
}
masterData.opportunities = opportunitiesData;
let listcontactsData:any = [];
if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_listcontacts'),'undefined')){
listcontactsData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_listcontacts') as any);
if(listcontactsData && listcontactsData.length && listcontactsData.length > 0){
listcontactsData.forEach((item:any) => {
if(item.srffrontuf){
if(Object.is(item.srffrontuf,"0")){
item.relationshipsid = null;
}
delete item.srffrontuf;
}
});
}
}
masterData.listcontacts = listcontactsData;
Object.assign(data,masterData);
let res:any = await Http.getInstance().put(`/contacts/${context.contact}`,data,isloading);
this.tempStorage.setItem(context.srfsessionkey+'_listcontacts',JSON.stringify(res.data.listcontacts));
this.tempStorage.setItem(context.srfsessionkey+'_leads',JSON.stringify(res.data.leads));
this.tempStorage.setItem(context.srfsessionkey+'_opportunities',JSON.stringify(res.data.opportunities));
this.tempStorage.setItem(context.srfsessionkey+'_listcontacts',JSON.stringify(res.data.listcontacts));
return res;
}
......@@ -332,15 +332,15 @@ export default class ContactServiceBase extends EntityService {
public async Get(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
if(context.account && context.contact){
let res:any = await Http.getInstance().get(`/accounts/${context.account}/contacts/${context.contact}`,isloading);
this.tempStorage.setItem(context.srfsessionkey+'_listcontacts',JSON.stringify(res.data.listcontacts));
this.tempStorage.setItem(context.srfsessionkey+'_leads',JSON.stringify(res.data.leads));
this.tempStorage.setItem(context.srfsessionkey+'_opportunities',JSON.stringify(res.data.opportunities));
this.tempStorage.setItem(context.srfsessionkey+'_listcontacts',JSON.stringify(res.data.listcontacts));
return res;
}
let res:any = await Http.getInstance().get(`/contacts/${context.contact}`,isloading);
this.tempStorage.setItem(context.srfsessionkey+'_listcontacts',JSON.stringify(res.data.listcontacts));
this.tempStorage.setItem(context.srfsessionkey+'_leads',JSON.stringify(res.data.leads));
this.tempStorage.setItem(context.srfsessionkey+'_opportunities',JSON.stringify(res.data.opportunities));
this.tempStorage.setItem(context.srfsessionkey+'_listcontacts',JSON.stringify(res.data.listcontacts));
return res;
}
......@@ -357,16 +357,16 @@ export default class ContactServiceBase extends EntityService {
if(context.account && true){
let res:any = await Http.getInstance().get(`/accounts/${context.account}/contacts/getdraft`,isloading);
res.data.contact = data.contact;
this.tempStorage.setItem(context.srfsessionkey+'_listcontacts',JSON.stringify(res.data.listcontacts));
this.tempStorage.setItem(context.srfsessionkey+'_leads',JSON.stringify(res.data.leads));
this.tempStorage.setItem(context.srfsessionkey+'_opportunities',JSON.stringify(res.data.opportunities));
this.tempStorage.setItem(context.srfsessionkey+'_listcontacts',JSON.stringify(res.data.listcontacts));
return res;
}
let res:any = await Http.getInstance().get(`/contacts/getdraft`,isloading);
res.data.contact = data.contact;
this.tempStorage.setItem(context.srfsessionkey+'_listcontacts',JSON.stringify(res.data.listcontacts));
this.tempStorage.setItem(context.srfsessionkey+'_leads',JSON.stringify(res.data.leads));
this.tempStorage.setItem(context.srfsessionkey+'_opportunities',JSON.stringify(res.data.opportunities));
this.tempStorage.setItem(context.srfsessionkey+'_listcontacts',JSON.stringify(res.data.listcontacts));
return res;
}
......@@ -382,21 +382,6 @@ export default class ContactServiceBase extends EntityService {
public async Active(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
if(context.account && context.contact){
let masterData:any = {};
let listcontactsData:any = [];
if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_listcontacts'),'undefined')){
listcontactsData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_listcontacts') as any);
if(listcontactsData && listcontactsData.length && listcontactsData.length > 0){
listcontactsData.forEach((item:any) => {
if(item.srffrontuf){
if(Object.is(item.srffrontuf,"0")){
item.relationshipsid = null;
}
delete item.srffrontuf;
}
});
}
}
masterData.listcontacts = listcontactsData;
let leadsData:any = [];
if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_leads'),'undefined')){
leadsData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_leads') as any);
......@@ -427,11 +412,26 @@ export default class ContactServiceBase extends EntityService {
}
}
masterData.opportunities = opportunitiesData;
let listcontactsData:any = [];
if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_listcontacts'),'undefined')){
listcontactsData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_listcontacts') as any);
if(listcontactsData && listcontactsData.length && listcontactsData.length > 0){
listcontactsData.forEach((item:any) => {
if(item.srffrontuf){
if(Object.is(item.srffrontuf,"0")){
item.relationshipsid = null;
}
delete item.srffrontuf;
}
});
}
}
masterData.listcontacts = listcontactsData;
Object.assign(data,masterData);
let res:any = await Http.getInstance().post(`/accounts/${context.account}/contacts/${context.contact}/active`,data,isloading);
this.tempStorage.setItem(context.srfsessionkey+'_listcontacts',JSON.stringify(res.data.listcontacts));
this.tempStorage.setItem(context.srfsessionkey+'_leads',JSON.stringify(res.data.leads));
this.tempStorage.setItem(context.srfsessionkey+'_opportunities',JSON.stringify(res.data.opportunities));
this.tempStorage.setItem(context.srfsessionkey+'_listcontacts',JSON.stringify(res.data.listcontacts));
return res;
}
return Http.getInstance().post(`/contacts/${context.contact}/active`,data,isloading);
......@@ -449,21 +449,6 @@ export default class ContactServiceBase extends EntityService {
public async CheckKey(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
if(context.account && context.contact){
let masterData:any = {};
let listcontactsData:any = [];
if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_listcontacts'),'undefined')){
listcontactsData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_listcontacts') as any);
if(listcontactsData && listcontactsData.length && listcontactsData.length > 0){
listcontactsData.forEach((item:any) => {
if(item.srffrontuf){
if(Object.is(item.srffrontuf,"0")){
item.relationshipsid = null;
}
delete item.srffrontuf;
}
});
}
}
masterData.listcontacts = listcontactsData;
let leadsData:any = [];
if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_leads'),'undefined')){
leadsData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_leads') as any);
......@@ -494,11 +479,26 @@ export default class ContactServiceBase extends EntityService {
}
}
masterData.opportunities = opportunitiesData;
let listcontactsData:any = [];
if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_listcontacts'),'undefined')){
listcontactsData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_listcontacts') as any);
if(listcontactsData && listcontactsData.length && listcontactsData.length > 0){
listcontactsData.forEach((item:any) => {
if(item.srffrontuf){
if(Object.is(item.srffrontuf,"0")){
item.relationshipsid = null;
}
delete item.srffrontuf;
}
});
}
}
masterData.listcontacts = listcontactsData;
Object.assign(data,masterData);
let res:any = await Http.getInstance().post(`/accounts/${context.account}/contacts/${context.contact}/checkkey`,data,isloading);
this.tempStorage.setItem(context.srfsessionkey+'_listcontacts',JSON.stringify(res.data.listcontacts));
this.tempStorage.setItem(context.srfsessionkey+'_leads',JSON.stringify(res.data.leads));
this.tempStorage.setItem(context.srfsessionkey+'_opportunities',JSON.stringify(res.data.opportunities));
this.tempStorage.setItem(context.srfsessionkey+'_listcontacts',JSON.stringify(res.data.listcontacts));
return res;
}
return Http.getInstance().post(`/contacts/${context.contact}/checkkey`,data,isloading);
......@@ -516,21 +516,6 @@ export default class ContactServiceBase extends EntityService {
public async Inactive(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
if(context.account && context.contact){
let masterData:any = {};
let listcontactsData:any = [];
if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_listcontacts'),'undefined')){
listcontactsData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_listcontacts') as any);
if(listcontactsData && listcontactsData.length && listcontactsData.length > 0){
listcontactsData.forEach((item:any) => {
if(item.srffrontuf){
if(Object.is(item.srffrontuf,"0")){
item.relationshipsid = null;
}
delete item.srffrontuf;
}
});
}
}
masterData.listcontacts = listcontactsData;
let leadsData:any = [];
if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_leads'),'undefined')){
leadsData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_leads') as any);
......@@ -561,11 +546,26 @@ export default class ContactServiceBase extends EntityService {
}
}
masterData.opportunities = opportunitiesData;
let listcontactsData:any = [];
if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_listcontacts'),'undefined')){
listcontactsData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_listcontacts') as any);
if(listcontactsData && listcontactsData.length && listcontactsData.length > 0){
listcontactsData.forEach((item:any) => {
if(item.srffrontuf){
if(Object.is(item.srffrontuf,"0")){
item.relationshipsid = null;
}
delete item.srffrontuf;
}
});
}
}
masterData.listcontacts = listcontactsData;
Object.assign(data,masterData);
let res:any = await Http.getInstance().post(`/accounts/${context.account}/contacts/${context.contact}/inactive`,data,isloading);
this.tempStorage.setItem(context.srfsessionkey+'_listcontacts',JSON.stringify(res.data.listcontacts));
this.tempStorage.setItem(context.srfsessionkey+'_leads',JSON.stringify(res.data.leads));
this.tempStorage.setItem(context.srfsessionkey+'_opportunities',JSON.stringify(res.data.opportunities));
this.tempStorage.setItem(context.srfsessionkey+'_listcontacts',JSON.stringify(res.data.listcontacts));
return res;
}
return Http.getInstance().post(`/contacts/${context.contact}/inactive`,data,isloading);
......@@ -583,21 +583,6 @@ export default class ContactServiceBase extends EntityService {
public async Save(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
if(context.account && context.contact){
let masterData:any = {};
let listcontactsData:any = [];
if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_listcontacts'),'undefined')){
listcontactsData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_listcontacts') as any);
if(listcontactsData && listcontactsData.length && listcontactsData.length > 0){
listcontactsData.forEach((item:any) => {
if(item.srffrontuf){
if(Object.is(item.srffrontuf,"0")){
item.relationshipsid = null;
}
delete item.srffrontuf;
}
});
}
}
masterData.listcontacts = listcontactsData;
let leadsData:any = [];
if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_leads'),'undefined')){
leadsData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_leads') as any);
......@@ -628,14 +613,6 @@ export default class ContactServiceBase extends EntityService {
}
}
masterData.opportunities = opportunitiesData;
Object.assign(data,masterData);
let res:any = await Http.getInstance().post(`/accounts/${context.account}/contacts/${context.contact}/save`,data,isloading);
this.tempStorage.setItem(context.srfsessionkey+'_listcontacts',JSON.stringify(res.data.listcontacts));
this.tempStorage.setItem(context.srfsessionkey+'_leads',JSON.stringify(res.data.leads));
this.tempStorage.setItem(context.srfsessionkey+'_opportunities',JSON.stringify(res.data.opportunities));
return res;
}
let masterData:any = {};
let listcontactsData:any = [];
if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_listcontacts'),'undefined')){
listcontactsData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_listcontacts') as any);
......@@ -651,6 +628,14 @@ export default class ContactServiceBase extends EntityService {
}
}
masterData.listcontacts = listcontactsData;
Object.assign(data,masterData);
let res:any = await Http.getInstance().post(`/accounts/${context.account}/contacts/${context.contact}/save`,data,isloading);
this.tempStorage.setItem(context.srfsessionkey+'_leads',JSON.stringify(res.data.leads));
this.tempStorage.setItem(context.srfsessionkey+'_opportunities',JSON.stringify(res.data.opportunities));
this.tempStorage.setItem(context.srfsessionkey+'_listcontacts',JSON.stringify(res.data.listcontacts));
return res;
}
let masterData:any = {};
let leadsData:any = [];
if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_leads'),'undefined')){
leadsData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_leads') as any);
......@@ -681,11 +666,26 @@ export default class ContactServiceBase extends EntityService {
}
}
masterData.opportunities = opportunitiesData;
let listcontactsData:any = [];
if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_listcontacts'),'undefined')){
listcontactsData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_listcontacts') as any);
if(listcontactsData && listcontactsData.length && listcontactsData.length > 0){
listcontactsData.forEach((item:any) => {
if(item.srffrontuf){
if(Object.is(item.srffrontuf,"0")){
item.relationshipsid = null;
}
delete item.srffrontuf;
}
});
}
}
masterData.listcontacts = listcontactsData;
Object.assign(data,masterData);
let res:any = await Http.getInstance().post(`/contacts/${context.contact}/save`,data,isloading);
this.tempStorage.setItem(context.srfsessionkey+'_listcontacts',JSON.stringify(res.data.listcontacts));
this.tempStorage.setItem(context.srfsessionkey+'_leads',JSON.stringify(res.data.leads));
this.tempStorage.setItem(context.srfsessionkey+'_opportunities',JSON.stringify(res.data.opportunities));
this.tempStorage.setItem(context.srfsessionkey+'_listcontacts',JSON.stringify(res.data.listcontacts));
return res;
}
......@@ -701,21 +701,6 @@ export default class ContactServiceBase extends EntityService {
public async SetPrimary(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
if(context.account && context.contact){
let masterData:any = {};
let listcontactsData:any = [];
if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_listcontacts'),'undefined')){
listcontactsData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_listcontacts') as any);
if(listcontactsData && listcontactsData.length && listcontactsData.length > 0){
listcontactsData.forEach((item:any) => {
if(item.srffrontuf){
if(Object.is(item.srffrontuf,"0")){
item.relationshipsid = null;
}
delete item.srffrontuf;
}
});
}
}
masterData.listcontacts = listcontactsData;
let leadsData:any = [];
if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_leads'),'undefined')){
leadsData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_leads') as any);
......@@ -746,11 +731,26 @@ export default class ContactServiceBase extends EntityService {
}
}
masterData.opportunities = opportunitiesData;
let listcontactsData:any = [];
if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_listcontacts'),'undefined')){
listcontactsData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_listcontacts') as any);
if(listcontactsData && listcontactsData.length && listcontactsData.length > 0){
listcontactsData.forEach((item:any) => {
if(item.srffrontuf){
if(Object.is(item.srffrontuf,"0")){
item.relationshipsid = null;
}
delete item.srffrontuf;
}
});
}
}
masterData.listcontacts = listcontactsData;
Object.assign(data,masterData);
let res:any = await Http.getInstance().post(`/accounts/${context.account}/contacts/${context.contact}/setprimary`,data,isloading);
this.tempStorage.setItem(context.srfsessionkey+'_listcontacts',JSON.stringify(res.data.listcontacts));
this.tempStorage.setItem(context.srfsessionkey+'_leads',JSON.stringify(res.data.leads));
this.tempStorage.setItem(context.srfsessionkey+'_opportunities',JSON.stringify(res.data.opportunities));
this.tempStorage.setItem(context.srfsessionkey+'_listcontacts',JSON.stringify(res.data.listcontacts));
return res;
}
return Http.getInstance().post(`/contacts/${context.contact}/setprimary`,data,isloading);
......
......@@ -62,6 +62,21 @@ export default class IBizListServiceBase extends EntityService {
*/
public async Create(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
let masterData:any = {};
let listcontactsData:any = [];
if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_listcontacts'),'undefined')){
listcontactsData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_listcontacts') as any);
if(listcontactsData && listcontactsData.length && listcontactsData.length > 0){
listcontactsData.forEach((item:any) => {
if(item.srffrontuf){
if(Object.is(item.srffrontuf,"0")){
item.relationshipsid = null;
}
delete item.srffrontuf;
}
});
}
}
masterData.listcontacts = listcontactsData;
let listaccountsData:any = [];
if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_listaccounts'),'undefined')){
listaccountsData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_listaccounts') as any);
......@@ -92,21 +107,6 @@ export default class IBizListServiceBase extends EntityService {
}
}
masterData.listleads = listleadsData;
let listcontactsData:any = [];
if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_listcontacts'),'undefined')){
listcontactsData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_listcontacts') as any);
if(listcontactsData && listcontactsData.length && listcontactsData.length > 0){
listcontactsData.forEach((item:any) => {
if(item.srffrontuf){
if(Object.is(item.srffrontuf,"0")){
item.relationshipsid = null;
}
delete item.srffrontuf;
}
});
}
}
masterData.listcontacts = listcontactsData;
let campaignlistsData:any = [];
if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_campaignlists'),'undefined')){
campaignlistsData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_campaignlists') as any);
......@@ -131,9 +131,9 @@ export default class IBizListServiceBase extends EntityService {
}
let tempContext:any = JSON.parse(JSON.stringify(context));
let res:any = await Http.getInstance().post(`/ibizlists`,data,isloading);
this.tempStorage.setItem(tempContext.srfsessionkey+'_listcontacts',JSON.stringify(res.data.listcontacts));
this.tempStorage.setItem(tempContext.srfsessionkey+'_listaccounts',JSON.stringify(res.data.listaccounts));
this.tempStorage.setItem(tempContext.srfsessionkey+'_listleads',JSON.stringify(res.data.listleads));
this.tempStorage.setItem(tempContext.srfsessionkey+'_listcontacts',JSON.stringify(res.data.listcontacts));
this.tempStorage.setItem(tempContext.srfsessionkey+'_campaignlists',JSON.stringify(res.data.campaignlists));
return res;
}
......@@ -149,6 +149,21 @@ export default class IBizListServiceBase extends EntityService {
*/
public async Update(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
let masterData:any = {};
let listcontactsData:any = [];
if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_listcontacts'),'undefined')){
listcontactsData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_listcontacts') as any);
if(listcontactsData && listcontactsData.length && listcontactsData.length > 0){
listcontactsData.forEach((item:any) => {
if(item.srffrontuf){
if(Object.is(item.srffrontuf,"0")){
item.relationshipsid = null;
}
delete item.srffrontuf;
}
});
}
}
masterData.listcontacts = listcontactsData;
let listaccountsData:any = [];
if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_listaccounts'),'undefined')){
listaccountsData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_listaccounts') as any);
......@@ -179,21 +194,6 @@ export default class IBizListServiceBase extends EntityService {
}
}
masterData.listleads = listleadsData;
let listcontactsData:any = [];
if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_listcontacts'),'undefined')){
listcontactsData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_listcontacts') as any);
if(listcontactsData && listcontactsData.length && listcontactsData.length > 0){
listcontactsData.forEach((item:any) => {
if(item.srffrontuf){
if(Object.is(item.srffrontuf,"0")){
item.relationshipsid = null;
}
delete item.srffrontuf;
}
});
}
}
masterData.listcontacts = listcontactsData;
let campaignlistsData:any = [];
if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_campaignlists'),'undefined')){
campaignlistsData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_campaignlists') as any);
......@@ -211,9 +211,9 @@ export default class IBizListServiceBase extends EntityService {
masterData.campaignlists = campaignlistsData;
Object.assign(data,masterData);
let res:any = await Http.getInstance().put(`/ibizlists/${context.ibizlist}`,data,isloading);
this.tempStorage.setItem(context.srfsessionkey+'_listcontacts',JSON.stringify(res.data.listcontacts));
this.tempStorage.setItem(context.srfsessionkey+'_listaccounts',JSON.stringify(res.data.listaccounts));
this.tempStorage.setItem(context.srfsessionkey+'_listleads',JSON.stringify(res.data.listleads));
this.tempStorage.setItem(context.srfsessionkey+'_listcontacts',JSON.stringify(res.data.listcontacts));
this.tempStorage.setItem(context.srfsessionkey+'_campaignlists',JSON.stringify(res.data.campaignlists));
return res;
}
......@@ -242,9 +242,9 @@ export default class IBizListServiceBase extends EntityService {
*/
public async Get(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
let res:any = await Http.getInstance().get(`/ibizlists/${context.ibizlist}`,isloading);
this.tempStorage.setItem(context.srfsessionkey+'_listcontacts',JSON.stringify(res.data.listcontacts));
this.tempStorage.setItem(context.srfsessionkey+'_listaccounts',JSON.stringify(res.data.listaccounts));
this.tempStorage.setItem(context.srfsessionkey+'_listleads',JSON.stringify(res.data.listleads));
this.tempStorage.setItem(context.srfsessionkey+'_listcontacts',JSON.stringify(res.data.listcontacts));
this.tempStorage.setItem(context.srfsessionkey+'_campaignlists',JSON.stringify(res.data.campaignlists));
return res;
}
......@@ -261,9 +261,9 @@ export default class IBizListServiceBase extends EntityService {
public async GetDraft(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
let res:any = await Http.getInstance().get(`/ibizlists/getdraft`,isloading);
res.data.ibizlist = data.ibizlist;
this.tempStorage.setItem(context.srfsessionkey+'_listcontacts',JSON.stringify(res.data.listcontacts));
this.tempStorage.setItem(context.srfsessionkey+'_listaccounts',JSON.stringify(res.data.listaccounts));
this.tempStorage.setItem(context.srfsessionkey+'_listleads',JSON.stringify(res.data.listleads));
this.tempStorage.setItem(context.srfsessionkey+'_listcontacts',JSON.stringify(res.data.listcontacts));
this.tempStorage.setItem(context.srfsessionkey+'_campaignlists',JSON.stringify(res.data.campaignlists));
return res;
}
......@@ -292,6 +292,21 @@ export default class IBizListServiceBase extends EntityService {
*/
public async Save(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
let masterData:any = {};
let listcontactsData:any = [];
if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_listcontacts'),'undefined')){
listcontactsData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_listcontacts') as any);
if(listcontactsData && listcontactsData.length && listcontactsData.length > 0){
listcontactsData.forEach((item:any) => {
if(item.srffrontuf){
if(Object.is(item.srffrontuf,"0")){
item.relationshipsid = null;
}
delete item.srffrontuf;
}
});
}
}
masterData.listcontacts = listcontactsData;
let listaccountsData:any = [];
if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_listaccounts'),'undefined')){
listaccountsData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_listaccounts') as any);
......@@ -322,21 +337,6 @@ export default class IBizListServiceBase extends EntityService {
}
}
masterData.listleads = listleadsData;
let listcontactsData:any = [];
if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_listcontacts'),'undefined')){
listcontactsData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_listcontacts') as any);
if(listcontactsData && listcontactsData.length && listcontactsData.length > 0){
listcontactsData.forEach((item:any) => {
if(item.srffrontuf){
if(Object.is(item.srffrontuf,"0")){
item.relationshipsid = null;
}
delete item.srffrontuf;
}
});
}
}
masterData.listcontacts = listcontactsData;
let campaignlistsData:any = [];
if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_campaignlists'),'undefined')){
campaignlistsData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_campaignlists') as any);
......@@ -354,9 +354,9 @@ export default class IBizListServiceBase extends EntityService {
masterData.campaignlists = campaignlistsData;
Object.assign(data,masterData);
let res:any = await Http.getInstance().post(`/ibizlists/${context.ibizlist}/save`,data,isloading);
this.tempStorage.setItem(context.srfsessionkey+'_listcontacts',JSON.stringify(res.data.listcontacts));
this.tempStorage.setItem(context.srfsessionkey+'_listaccounts',JSON.stringify(res.data.listaccounts));
this.tempStorage.setItem(context.srfsessionkey+'_listleads',JSON.stringify(res.data.listleads));
this.tempStorage.setItem(context.srfsessionkey+'_listcontacts',JSON.stringify(res.data.listcontacts));
this.tempStorage.setItem(context.srfsessionkey+'_campaignlists',JSON.stringify(res.data.campaignlists));
return res;
}
......
......@@ -62,36 +62,36 @@ export default class ProductServiceBase extends EntityService {
*/
public async Create(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
let masterData:any = {};
let productsubstitutesData:any = [];
if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_productsubstitutes'),'undefined')){
productsubstitutesData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_productsubstitutes') as any);
if(productsubstitutesData && productsubstitutesData.length && productsubstitutesData.length > 0){
productsubstitutesData.forEach((item:any) => {
let productassociationsData:any = [];
if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_productassociations'),'undefined')){
productassociationsData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_productassociations') as any);
if(productassociationsData && productassociationsData.length && productassociationsData.length > 0){
productassociationsData.forEach((item:any) => {
if(item.srffrontuf){
if(Object.is(item.srffrontuf,"0")){
item.productsubstituteid = null;
item.productassociationid = null;
}
delete item.srffrontuf;
}
});
}
}
masterData.productsubstitutes = productsubstitutesData;
let productassociationsData:any = [];
if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_productassociations'),'undefined')){
productassociationsData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_productassociations') as any);
if(productassociationsData && productassociationsData.length && productassociationsData.length > 0){
productassociationsData.forEach((item:any) => {
masterData.productassociations = productassociationsData;
let productsubstitutesData:any = [];
if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_productsubstitutes'),'undefined')){
productsubstitutesData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_productsubstitutes') as any);
if(productsubstitutesData && productsubstitutesData.length && productsubstitutesData.length > 0){
productsubstitutesData.forEach((item:any) => {
if(item.srffrontuf){
if(Object.is(item.srffrontuf,"0")){
item.productassociationid = null;
item.productsubstituteid = null;
}
delete item.srffrontuf;
}
});
}
}
masterData.productassociations = productassociationsData;
masterData.productsubstitutes = productsubstitutesData;
let productpricelevelsData:any = [];
if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_productpricelevels'),'undefined')){
productpricelevelsData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_productpricelevels') as any);
......@@ -116,8 +116,8 @@ export default class ProductServiceBase extends EntityService {
}
let tempContext:any = JSON.parse(JSON.stringify(context));
let res:any = await Http.getInstance().post(`/products`,data,isloading);
this.tempStorage.setItem(tempContext.srfsessionkey+'_productsubstitutes',JSON.stringify(res.data.productsubstitutes));
this.tempStorage.setItem(tempContext.srfsessionkey+'_productassociations',JSON.stringify(res.data.productassociations));
this.tempStorage.setItem(tempContext.srfsessionkey+'_productsubstitutes',JSON.stringify(res.data.productsubstitutes));
this.tempStorage.setItem(tempContext.srfsessionkey+'_productpricelevels',JSON.stringify(res.data.productpricelevels));
return res;
}
......@@ -133,36 +133,36 @@ export default class ProductServiceBase extends EntityService {
*/
public async Update(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
let masterData:any = {};
let productsubstitutesData:any = [];
if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_productsubstitutes'),'undefined')){
productsubstitutesData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_productsubstitutes') as any);
if(productsubstitutesData && productsubstitutesData.length && productsubstitutesData.length > 0){
productsubstitutesData.forEach((item:any) => {
let productassociationsData:any = [];
if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_productassociations'),'undefined')){
productassociationsData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_productassociations') as any);
if(productassociationsData && productassociationsData.length && productassociationsData.length > 0){
productassociationsData.forEach((item:any) => {
if(item.srffrontuf){
if(Object.is(item.srffrontuf,"0")){
item.productsubstituteid = null;
item.productassociationid = null;
}
delete item.srffrontuf;
}
});
}
}
masterData.productsubstitutes = productsubstitutesData;
let productassociationsData:any = [];
if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_productassociations'),'undefined')){
productassociationsData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_productassociations') as any);
if(productassociationsData && productassociationsData.length && productassociationsData.length > 0){
productassociationsData.forEach((item:any) => {
masterData.productassociations = productassociationsData;
let productsubstitutesData:any = [];
if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_productsubstitutes'),'undefined')){
productsubstitutesData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_productsubstitutes') as any);
if(productsubstitutesData && productsubstitutesData.length && productsubstitutesData.length > 0){
productsubstitutesData.forEach((item:any) => {
if(item.srffrontuf){
if(Object.is(item.srffrontuf,"0")){
item.productassociationid = null;
item.productsubstituteid = null;
}
delete item.srffrontuf;
}
});
}
}
masterData.productassociations = productassociationsData;
masterData.productsubstitutes = productsubstitutesData;
let productpricelevelsData:any = [];
if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_productpricelevels'),'undefined')){
productpricelevelsData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_productpricelevels') as any);
......@@ -180,8 +180,8 @@ export default class ProductServiceBase extends EntityService {
masterData.productpricelevels = productpricelevelsData;
Object.assign(data,masterData);
let res:any = await Http.getInstance().put(`/products/${context.product}`,data,isloading);
this.tempStorage.setItem(context.srfsessionkey+'_productsubstitutes',JSON.stringify(res.data.productsubstitutes));
this.tempStorage.setItem(context.srfsessionkey+'_productassociations',JSON.stringify(res.data.productassociations));
this.tempStorage.setItem(context.srfsessionkey+'_productsubstitutes',JSON.stringify(res.data.productsubstitutes));
this.tempStorage.setItem(context.srfsessionkey+'_productpricelevels',JSON.stringify(res.data.productpricelevels));
return res;
}
......@@ -210,8 +210,8 @@ export default class ProductServiceBase extends EntityService {
*/
public async Get(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
let res:any = await Http.getInstance().get(`/products/${context.product}`,isloading);
this.tempStorage.setItem(context.srfsessionkey+'_productsubstitutes',JSON.stringify(res.data.productsubstitutes));
this.tempStorage.setItem(context.srfsessionkey+'_productassociations',JSON.stringify(res.data.productassociations));
this.tempStorage.setItem(context.srfsessionkey+'_productsubstitutes',JSON.stringify(res.data.productsubstitutes));
this.tempStorage.setItem(context.srfsessionkey+'_productpricelevels',JSON.stringify(res.data.productpricelevels));
return res;
}
......@@ -228,8 +228,8 @@ export default class ProductServiceBase extends EntityService {
public async GetDraft(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
let res:any = await Http.getInstance().get(`/products/getdraft`,isloading);
res.data.product = data.product;
this.tempStorage.setItem(context.srfsessionkey+'_productsubstitutes',JSON.stringify(res.data.productsubstitutes));
this.tempStorage.setItem(context.srfsessionkey+'_productassociations',JSON.stringify(res.data.productassociations));
this.tempStorage.setItem(context.srfsessionkey+'_productsubstitutes',JSON.stringify(res.data.productsubstitutes));
this.tempStorage.setItem(context.srfsessionkey+'_productpricelevels',JSON.stringify(res.data.productpricelevels));
return res;
}
......@@ -258,36 +258,36 @@ export default class ProductServiceBase extends EntityService {
*/
public async Save(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
let masterData:any = {};
let productsubstitutesData:any = [];
if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_productsubstitutes'),'undefined')){
productsubstitutesData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_productsubstitutes') as any);
if(productsubstitutesData && productsubstitutesData.length && productsubstitutesData.length > 0){
productsubstitutesData.forEach((item:any) => {
let productassociationsData:any = [];
if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_productassociations'),'undefined')){
productassociationsData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_productassociations') as any);
if(productassociationsData && productassociationsData.length && productassociationsData.length > 0){
productassociationsData.forEach((item:any) => {
if(item.srffrontuf){
if(Object.is(item.srffrontuf,"0")){
item.productsubstituteid = null;
item.productassociationid = null;
}
delete item.srffrontuf;
}
});
}
}
masterData.productsubstitutes = productsubstitutesData;
let productassociationsData:any = [];
if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_productassociations'),'undefined')){
productassociationsData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_productassociations') as any);
if(productassociationsData && productassociationsData.length && productassociationsData.length > 0){
productassociationsData.forEach((item:any) => {
masterData.productassociations = productassociationsData;
let productsubstitutesData:any = [];
if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_productsubstitutes'),'undefined')){
productsubstitutesData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_productsubstitutes') as any);
if(productsubstitutesData && productsubstitutesData.length && productsubstitutesData.length > 0){
productsubstitutesData.forEach((item:any) => {
if(item.srffrontuf){
if(Object.is(item.srffrontuf,"0")){
item.productassociationid = null;
item.productsubstituteid = null;
}
delete item.srffrontuf;
}
});
}
}
masterData.productassociations = productassociationsData;
masterData.productsubstitutes = productsubstitutesData;
let productpricelevelsData:any = [];
if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_productpricelevels'),'undefined')){
productpricelevelsData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_productpricelevels') as any);
......@@ -305,8 +305,8 @@ export default class ProductServiceBase extends EntityService {
masterData.productpricelevels = productpricelevelsData;
Object.assign(data,masterData);
let res:any = await Http.getInstance().post(`/products/${context.product}/save`,data,isloading);
this.tempStorage.setItem(context.srfsessionkey+'_productsubstitutes',JSON.stringify(res.data.productsubstitutes));
this.tempStorage.setItem(context.srfsessionkey+'_productassociations',JSON.stringify(res.data.productassociations));
this.tempStorage.setItem(context.srfsessionkey+'_productsubstitutes',JSON.stringify(res.data.productsubstitutes));
this.tempStorage.setItem(context.srfsessionkey+'_productpricelevels',JSON.stringify(res.data.productpricelevels));
return res;
}
......
......@@ -62,21 +62,6 @@ export default class SalesLiteratureServiceBase extends EntityService {
*/
public async Create(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
let masterData:any = {};
let salesliteratureitemsData:any = [];
if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_salesliteratureitems'),'undefined')){
salesliteratureitemsData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_salesliteratureitems') as any);
if(salesliteratureitemsData && salesliteratureitemsData.length && salesliteratureitemsData.length > 0){
salesliteratureitemsData.forEach((item:any) => {
if(item.srffrontuf){
if(Object.is(item.srffrontuf,"0")){
item.salesliteratureitemid = null;
}
delete item.srffrontuf;
}
});
}
}
masterData.salesliteratureitems = salesliteratureitemsData;
let competitorsalesliteraturesData:any = [];
if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_competitorsalesliteratures'),'undefined')){
competitorsalesliteraturesData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_competitorsalesliteratures') as any);
......@@ -107,6 +92,21 @@ export default class SalesLiteratureServiceBase extends EntityService {
}
}
masterData.productsalesliteratures = productsalesliteraturesData;
let salesliteratureitemsData:any = [];
if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_salesliteratureitems'),'undefined')){
salesliteratureitemsData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_salesliteratureitems') as any);
if(salesliteratureitemsData && salesliteratureitemsData.length && salesliteratureitemsData.length > 0){
salesliteratureitemsData.forEach((item:any) => {
if(item.srffrontuf){
if(Object.is(item.srffrontuf,"0")){
item.salesliteratureitemid = null;
}
delete item.srffrontuf;
}
});
}
}
masterData.salesliteratureitems = salesliteratureitemsData;
Object.assign(data,masterData);
if(!data.srffrontuf || data.srffrontuf !== "1"){
data[this.APPDEKEY] = null;
......@@ -116,9 +116,9 @@ export default class SalesLiteratureServiceBase extends EntityService {
}
let tempContext:any = JSON.parse(JSON.stringify(context));
let res:any = await Http.getInstance().post(`/salesliteratures`,data,isloading);
this.tempStorage.setItem(tempContext.srfsessionkey+'_salesliteratureitems',JSON.stringify(res.data.salesliteratureitems));
this.tempStorage.setItem(tempContext.srfsessionkey+'_competitorsalesliteratures',JSON.stringify(res.data.competitorsalesliteratures));
this.tempStorage.setItem(tempContext.srfsessionkey+'_productsalesliteratures',JSON.stringify(res.data.productsalesliteratures));
this.tempStorage.setItem(tempContext.srfsessionkey+'_salesliteratureitems',JSON.stringify(res.data.salesliteratureitems));
return res;
}
......@@ -133,21 +133,6 @@ export default class SalesLiteratureServiceBase extends EntityService {
*/
public async Update(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
let masterData:any = {};
let salesliteratureitemsData:any = [];
if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_salesliteratureitems'),'undefined')){
salesliteratureitemsData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_salesliteratureitems') as any);
if(salesliteratureitemsData && salesliteratureitemsData.length && salesliteratureitemsData.length > 0){
salesliteratureitemsData.forEach((item:any) => {
if(item.srffrontuf){
if(Object.is(item.srffrontuf,"0")){
item.salesliteratureitemid = null;
}
delete item.srffrontuf;
}
});
}
}
masterData.salesliteratureitems = salesliteratureitemsData;
let competitorsalesliteraturesData:any = [];
if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_competitorsalesliteratures'),'undefined')){
competitorsalesliteraturesData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_competitorsalesliteratures') as any);
......@@ -178,11 +163,26 @@ export default class SalesLiteratureServiceBase extends EntityService {
}
}
masterData.productsalesliteratures = productsalesliteraturesData;
let salesliteratureitemsData:any = [];
if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_salesliteratureitems'),'undefined')){
salesliteratureitemsData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_salesliteratureitems') as any);
if(salesliteratureitemsData && salesliteratureitemsData.length && salesliteratureitemsData.length > 0){
salesliteratureitemsData.forEach((item:any) => {
if(item.srffrontuf){
if(Object.is(item.srffrontuf,"0")){
item.salesliteratureitemid = null;
}
delete item.srffrontuf;
}
});
}
}
masterData.salesliteratureitems = salesliteratureitemsData;
Object.assign(data,masterData);
let res:any = await Http.getInstance().put(`/salesliteratures/${context.salesliterature}`,data,isloading);
this.tempStorage.setItem(context.srfsessionkey+'_salesliteratureitems',JSON.stringify(res.data.salesliteratureitems));
this.tempStorage.setItem(context.srfsessionkey+'_competitorsalesliteratures',JSON.stringify(res.data.competitorsalesliteratures));
this.tempStorage.setItem(context.srfsessionkey+'_productsalesliteratures',JSON.stringify(res.data.productsalesliteratures));
this.tempStorage.setItem(context.srfsessionkey+'_salesliteratureitems',JSON.stringify(res.data.salesliteratureitems));
return res;
}
......@@ -210,9 +210,9 @@ export default class SalesLiteratureServiceBase extends EntityService {
*/
public async Get(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
let res:any = await Http.getInstance().get(`/salesliteratures/${context.salesliterature}`,isloading);
this.tempStorage.setItem(context.srfsessionkey+'_salesliteratureitems',JSON.stringify(res.data.salesliteratureitems));
this.tempStorage.setItem(context.srfsessionkey+'_competitorsalesliteratures',JSON.stringify(res.data.competitorsalesliteratures));
this.tempStorage.setItem(context.srfsessionkey+'_productsalesliteratures',JSON.stringify(res.data.productsalesliteratures));
this.tempStorage.setItem(context.srfsessionkey+'_salesliteratureitems',JSON.stringify(res.data.salesliteratureitems));
return res;
}
......@@ -228,9 +228,9 @@ export default class SalesLiteratureServiceBase extends EntityService {
public async GetDraft(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
let res:any = await Http.getInstance().get(`/salesliteratures/getdraft`,isloading);
res.data.salesliterature = data.salesliterature;
this.tempStorage.setItem(context.srfsessionkey+'_salesliteratureitems',JSON.stringify(res.data.salesliteratureitems));
this.tempStorage.setItem(context.srfsessionkey+'_competitorsalesliteratures',JSON.stringify(res.data.competitorsalesliteratures));
this.tempStorage.setItem(context.srfsessionkey+'_productsalesliteratures',JSON.stringify(res.data.productsalesliteratures));
this.tempStorage.setItem(context.srfsessionkey+'_salesliteratureitems',JSON.stringify(res.data.salesliteratureitems));
return res;
}
......@@ -258,21 +258,6 @@ export default class SalesLiteratureServiceBase extends EntityService {
*/
public async Save(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
let masterData:any = {};
let salesliteratureitemsData:any = [];
if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_salesliteratureitems'),'undefined')){
salesliteratureitemsData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_salesliteratureitems') as any);
if(salesliteratureitemsData && salesliteratureitemsData.length && salesliteratureitemsData.length > 0){
salesliteratureitemsData.forEach((item:any) => {
if(item.srffrontuf){
if(Object.is(item.srffrontuf,"0")){
item.salesliteratureitemid = null;
}
delete item.srffrontuf;
}
});
}
}
masterData.salesliteratureitems = salesliteratureitemsData;
let competitorsalesliteraturesData:any = [];
if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_competitorsalesliteratures'),'undefined')){
competitorsalesliteraturesData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_competitorsalesliteratures') as any);
......@@ -303,11 +288,26 @@ export default class SalesLiteratureServiceBase extends EntityService {
}
}
masterData.productsalesliteratures = productsalesliteraturesData;
let salesliteratureitemsData:any = [];
if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_salesliteratureitems'),'undefined')){
salesliteratureitemsData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_salesliteratureitems') as any);
if(salesliteratureitemsData && salesliteratureitemsData.length && salesliteratureitemsData.length > 0){
salesliteratureitemsData.forEach((item:any) => {
if(item.srffrontuf){
if(Object.is(item.srffrontuf,"0")){
item.salesliteratureitemid = null;
}
delete item.srffrontuf;
}
});
}
}
masterData.salesliteratureitems = salesliteratureitemsData;
Object.assign(data,masterData);
let res:any = await Http.getInstance().post(`/salesliteratures/${context.salesliterature}/save`,data,isloading);
this.tempStorage.setItem(context.srfsessionkey+'_salesliteratureitems',JSON.stringify(res.data.salesliteratureitems));
this.tempStorage.setItem(context.srfsessionkey+'_competitorsalesliteratures',JSON.stringify(res.data.competitorsalesliteratures));
this.tempStorage.setItem(context.srfsessionkey+'_productsalesliteratures',JSON.stringify(res.data.productsalesliteratures));
this.tempStorage.setItem(context.srfsessionkey+'_salesliteratureitems',JSON.stringify(res.data.salesliteratureitems));
return res;
}
......
......@@ -11,6 +11,51 @@
.separator {
padding: 0px 6px;
}
.select {
.ivu-select {
width: auto;
color: var(--app-header-color);
.ivu-select-selection {
height: 20px;
background-color: transparent;
border: 0;
.ivu-select-selected-value {
padding-left: 0;
padding-right: 12px;
height: 18px;
line-height: 18px;
}
.ivu-select-arrow {
right: 0;
}
}
.ivu-select-dropdown {
background-color: var(--app-header-background-color);
.ivu-select-dropdown-list {
.ivu-select-item {
padding: 5px 10px;
color: var(--app-header-color);
}
.ivu-select-item:hover, .ivu-select-item.ivu-select-item-focus {
background: var(--app-header-background-color-active);
}
.ivu-select-item.ivu-select-item-selected {
color: var(--app-header-font-color-active);
}
}
}
}
}
}
.app-breadcrumb-item:hover {
......
import { Vue, Component } from 'vue-property-decorator';
import qs from 'qs';
import { AppService } from '@/studio-core/service/app-service/AppService';
import { HistoryItem } from '@/studio-core/service/app-nav-history/AppNavHistoryBase';
import './app-breadcrumb.less';
/**
......@@ -54,6 +56,43 @@ export class AppBreadcrumb extends Vue {
location.reload();
}
/**
* 根据下标从父导航查询是否有列表数据
*
* @protected
* @param {number} i
* @memberof AppBreadcrumb
*/
protected getItems(i: number): any[] | null {
if (i > 0) {
const item = this.$appService.navHistory.historyList[i - 1];
const c = item.context;
const data = c[c.srfdatakey];
if (data && data.items) {
return data.items;
}
}
return null;
}
protected itemChange(c: any, history: HistoryItem, val: any): void {
const to = history.to;
to.params[c.srfappdename] = val;
let path = '';
history.meta.parameters.forEach((item: any) => {
const pam = to.params[item.parameterName];
path += (`/${item.pathName}` + (pam ? `/${pam}` : ''));
});
if (to.query && Object.keys(to.query).length > 0) {
path += ('?' + qs.stringify(to.query));
}
this.$router.push(path);
if (to.fullPath !== path) {
this.$appService.navHistory.pop();
}
this.$forceUpdate();
}
/**
* 绘制面包屑
*
......@@ -70,9 +109,20 @@ export class AppBreadcrumb extends Vue {
}
const arr = this.appService.navHistory.historyList;
arr.forEach((item, i) => {
const list = this.getItems(i);
let dropdown: any = null;
if (list && list.length > 0) {
const c = item.context;
dropdown = <i-select v-model={c[c.srfappdename]} on-on-change={(val: any) => this.itemChange(c, item, val)} size="small">
{list.map((item: any) => {
return <i-option value={item.srfkey} key={item.srfkey}>{item.srfmajortext}</i-option>;
})}
</i-select>;
}
items.push(<span class={{ 'app-breadcrumb-item': true, 'last': i === (arr.length - 1) }}>
{(!indexMeta && i === 0) ? null : <span class="separator">/</span>}
<span class="content" on-click={() => this.click(item.to)}>{this.$t(item.meta?.caption)}{(item.meta?.info && item.meta?.info !== '') ? ` - ${item.meta?.info}` : ''}</span>
<span class="content" on-click={() => this.click(item.to)}>{this.$t(item.meta?.caption)}{dropdown ? null : (item.meta?.info && item.meta?.info !== '') ? ` - ${item.meta?.info}` : ''}</span>
{dropdown ? <span class="select"> - {dropdown}</span> : null}
</span>);
});
return <div class="app-breadcrumb">{items}</div>;
......
......@@ -141,7 +141,9 @@ export class AppNavHistoryBase {
}
this.historyList.push({
to,
meta: Util.deepCopy(to.meta)
meta: Util.deepCopy(to.meta),
tag: '',
context: {}
});
}
}
......
......@@ -72,7 +72,7 @@ export class ViewBase extends Vue {
* @type {*}
* @memberof ViewBase
*/
public context: any = {};
public readonly context: any = {};
/**
* 视图参数
......
......@@ -188,6 +188,7 @@ export class ControlBase extends Vue {
* @memberof ControlBase
*/
public mounted(): void {
this.context.srfappdename = this.appDeName;
this.ctrlMounted();
}
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册