Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
提交反馈
为 GitLab 提交贡献
登录
切换导航
I
iBiz企业中心
项目
项目
详情
动态
版本
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
iBiz企业套件
iBiz企业中心
提交
45d495c5
提交
45d495c5
编写于
7月 03, 2020
作者:
ibizdev
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
chitanda 发布系统代码
上级
a379a9e3
变更
9
隐藏空白字符变更
内嵌
并排
正在显示
9 个修改的文件
包含
621 行增加
和
626 行删除
+621
-626
package.json
app_CRM/package.json
+1
-1
account-service-base.ts
app_CRM/src/service/account/account-service-base.ts
+47
-47
campaign-service-base.ts
app_CRM/src/service/campaign/campaign-service-base.ts
+52
-52
contact-service-base.ts
app_CRM/src/service/contact/contact-service-base.ts
+136
-136
ibiz-list-service-base.ts
app_CRM/src/service/ibiz-list/ibiz-list-service-base.ts
+82
-82
opportunity-service-base.ts
app_CRM/src/service/opportunity/opportunity-service-base.ts
+194
-194
product-service-base.ts
app_CRM/src/service/product/product-service-base.ts
+52
-52
sales-literature-service-base.ts
...service/sales-literature/sales-literature-service-base.ts
+50
-50
yarn.lock
app_CRM/yarn.lock
+7
-12
未找到文件。
app_CRM/package.json
浏览文件 @
45d495c5
...
...
@@ -35,7 +35,7 @@
"qs"
:
"^6.9.1"
,
"rxjs"
:
"^6.5.4"
,
"tinymce"
:
"4.8.5"
,
"view-design"
:
"^4.
2
.0"
,
"view-design"
:
"^4.
3
.0"
,
"vue"
:
"^2.6.11"
,
"vue-class-component"
:
"^7.0.2"
,
"vue-grid-layout"
:
"^2.3.7"
,
...
...
app_CRM/src/service/account/account-service-base.ts
浏览文件 @
45d495c5
...
...
@@ -62,36 +62,36 @@ export default class AccountServiceBase extends EntityService {
*/
public
async
Create
(
context
:
any
=
{},
data
:
any
=
{},
isloading
?:
boolean
):
Promise
<
any
>
{
let
masterData
:
any
=
{};
let
contac
tsData
:
any
=
[];
if
(
!
Object
.
is
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_
contac
ts'
),
'undefined'
)){
contactsData
=
JSON
.
parse
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_contac
ts'
)
as
any
);
if
(
contactsData
&&
contactsData
.
length
&&
contac
tsData
.
length
>
0
){
contac
tsData
.
forEach
((
item
:
any
)
=>
{
let
listaccoun
tsData
:
any
=
[];
if
(
!
Object
.
is
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_
listaccoun
ts'
),
'undefined'
)){
listaccountsData
=
JSON
.
parse
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_listaccoun
ts'
)
as
any
);
if
(
listaccountsData
&&
listaccountsData
.
length
&&
listaccoun
tsData
.
length
>
0
){
listaccoun
tsData
.
forEach
((
item
:
any
)
=>
{
if
(
item
.
srffrontuf
){
if
(
Object
.
is
(
item
.
srffrontuf
,
"0"
)){
item
.
contact
id
=
null
;
item
.
relationships
id
=
null
;
}
delete
item
.
srffrontuf
;
}
});
}
}
masterData
.
contacts
=
contac
tsData
;
let
listaccoun
tsData
:
any
=
[];
if
(
!
Object
.
is
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_
listaccoun
ts'
),
'undefined'
)){
listaccountsData
=
JSON
.
parse
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_listaccoun
ts'
)
as
any
);
if
(
listaccountsData
&&
listaccountsData
.
length
&&
listaccoun
tsData
.
length
>
0
){
listaccoun
tsData
.
forEach
((
item
:
any
)
=>
{
masterData
.
listaccounts
=
listaccoun
tsData
;
let
contac
tsData
:
any
=
[];
if
(
!
Object
.
is
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_
contac
ts'
),
'undefined'
)){
contactsData
=
JSON
.
parse
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_contac
ts'
)
as
any
);
if
(
contactsData
&&
contactsData
.
length
&&
contac
tsData
.
length
>
0
){
contac
tsData
.
forEach
((
item
:
any
)
=>
{
if
(
item
.
srffrontuf
){
if
(
Object
.
is
(
item
.
srffrontuf
,
"0"
)){
item
.
relationships
id
=
null
;
item
.
contact
id
=
null
;
}
delete
item
.
srffrontuf
;
}
});
}
}
masterData
.
listaccounts
=
listaccoun
tsData
;
masterData
.
contacts
=
contac
tsData
;
Object
.
assign
(
data
,
masterData
);
if
(
!
data
.
srffrontuf
||
data
.
srffrontuf
!==
"1"
){
data
[
this
.
APPDEKEY
]
=
null
;
...
...
@@ -101,8 +101,8 @@ export default class AccountServiceBase extends EntityService {
}
let
tempContext
:
any
=
JSON
.
parse
(
JSON
.
stringify
(
context
));
let
res
:
any
=
await
Http
.
getInstance
().
post
(
`/accounts`
,
data
,
isloading
);
this
.
tempStorage
.
setItem
(
tempContext
.
srfsessionkey
+
'_contacts'
,
JSON
.
stringify
(
res
.
data
.
contacts
));
this
.
tempStorage
.
setItem
(
tempContext
.
srfsessionkey
+
'_listaccounts'
,
JSON
.
stringify
(
res
.
data
.
listaccounts
));
this
.
tempStorage
.
setItem
(
tempContext
.
srfsessionkey
+
'_contacts'
,
JSON
.
stringify
(
res
.
data
.
contacts
));
return
res
;
}
...
...
@@ -117,40 +117,40 @@ export default class AccountServiceBase extends EntityService {
*/
public
async
Update
(
context
:
any
=
{},
data
:
any
=
{},
isloading
?:
boolean
):
Promise
<
any
>
{
let
masterData
:
any
=
{};
let
contac
tsData
:
any
=
[];
if
(
!
Object
.
is
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_
contac
ts'
),
'undefined'
)){
contactsData
=
JSON
.
parse
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_contac
ts'
)
as
any
);
if
(
contactsData
&&
contactsData
.
length
&&
contac
tsData
.
length
>
0
){
contac
tsData
.
forEach
((
item
:
any
)
=>
{
let
listaccoun
tsData
:
any
=
[];
if
(
!
Object
.
is
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_
listaccoun
ts'
),
'undefined'
)){
listaccountsData
=
JSON
.
parse
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_listaccoun
ts'
)
as
any
);
if
(
listaccountsData
&&
listaccountsData
.
length
&&
listaccoun
tsData
.
length
>
0
){
listaccoun
tsData
.
forEach
((
item
:
any
)
=>
{
if
(
item
.
srffrontuf
){
if
(
Object
.
is
(
item
.
srffrontuf
,
"0"
)){
item
.
contact
id
=
null
;
item
.
relationships
id
=
null
;
}
delete
item
.
srffrontuf
;
}
});
}
}
masterData
.
contacts
=
contac
tsData
;
let
listaccoun
tsData
:
any
=
[];
if
(
!
Object
.
is
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_
listaccoun
ts'
),
'undefined'
)){
listaccountsData
=
JSON
.
parse
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_listaccoun
ts'
)
as
any
);
if
(
listaccountsData
&&
listaccountsData
.
length
&&
listaccoun
tsData
.
length
>
0
){
listaccoun
tsData
.
forEach
((
item
:
any
)
=>
{
masterData
.
listaccounts
=
listaccoun
tsData
;
let
contac
tsData
:
any
=
[];
if
(
!
Object
.
is
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_
contac
ts'
),
'undefined'
)){
contactsData
=
JSON
.
parse
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_contac
ts'
)
as
any
);
if
(
contactsData
&&
contactsData
.
length
&&
contac
tsData
.
length
>
0
){
contac
tsData
.
forEach
((
item
:
any
)
=>
{
if
(
item
.
srffrontuf
){
if
(
Object
.
is
(
item
.
srffrontuf
,
"0"
)){
item
.
relationships
id
=
null
;
item
.
contact
id
=
null
;
}
delete
item
.
srffrontuf
;
}
});
}
}
masterData
.
listaccounts
=
listaccoun
tsData
;
masterData
.
contacts
=
contac
tsData
;
Object
.
assign
(
data
,
masterData
);
let
res
:
any
=
await
Http
.
getInstance
().
put
(
`/accounts/
${
context
.
account
}
`
,
data
,
isloading
);
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_contacts'
,
JSON
.
stringify
(
res
.
data
.
contacts
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_listaccounts'
,
JSON
.
stringify
(
res
.
data
.
listaccounts
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_contacts'
,
JSON
.
stringify
(
res
.
data
.
contacts
));
return
res
;
}
...
...
@@ -178,8 +178,8 @@ export default class AccountServiceBase extends EntityService {
*/
public
async
Get
(
context
:
any
=
{},
data
:
any
=
{},
isloading
?:
boolean
):
Promise
<
any
>
{
let
res
:
any
=
await
Http
.
getInstance
().
get
(
`/accounts/
${
context
.
account
}
`
,
isloading
);
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_contacts'
,
JSON
.
stringify
(
res
.
data
.
contacts
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_listaccounts'
,
JSON
.
stringify
(
res
.
data
.
listaccounts
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_contacts'
,
JSON
.
stringify
(
res
.
data
.
contacts
));
return
res
;
}
...
...
@@ -195,8 +195,8 @@ export default class AccountServiceBase extends EntityService {
public
async
GetDraft
(
context
:
any
=
{},
data
:
any
=
{},
isloading
?:
boolean
):
Promise
<
any
>
{
let
res
:
any
=
await
Http
.
getInstance
().
get
(
`/accounts/getdraft`
,
isloading
);
res
.
data
.
account
=
data
.
account
;
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_contacts'
,
JSON
.
stringify
(
res
.
data
.
contacts
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_listaccounts'
,
JSON
.
stringify
(
res
.
data
.
listaccounts
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_contacts'
,
JSON
.
stringify
(
res
.
data
.
contacts
));
return
res
;
}
...
...
@@ -224,40 +224,40 @@ export default class AccountServiceBase extends EntityService {
*/
public
async
Save
(
context
:
any
=
{},
data
:
any
=
{},
isloading
?:
boolean
):
Promise
<
any
>
{
let
masterData
:
any
=
{};
let
contac
tsData
:
any
=
[];
if
(
!
Object
.
is
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_
contac
ts'
),
'undefined'
)){
contactsData
=
JSON
.
parse
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_contac
ts'
)
as
any
);
if
(
contactsData
&&
contactsData
.
length
&&
contac
tsData
.
length
>
0
){
contac
tsData
.
forEach
((
item
:
any
)
=>
{
let
listaccoun
tsData
:
any
=
[];
if
(
!
Object
.
is
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_
listaccoun
ts'
),
'undefined'
)){
listaccountsData
=
JSON
.
parse
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_listaccoun
ts'
)
as
any
);
if
(
listaccountsData
&&
listaccountsData
.
length
&&
listaccoun
tsData
.
length
>
0
){
listaccoun
tsData
.
forEach
((
item
:
any
)
=>
{
if
(
item
.
srffrontuf
){
if
(
Object
.
is
(
item
.
srffrontuf
,
"0"
)){
item
.
contact
id
=
null
;
item
.
relationships
id
=
null
;
}
delete
item
.
srffrontuf
;
}
});
}
}
masterData
.
contacts
=
contac
tsData
;
let
listaccoun
tsData
:
any
=
[];
if
(
!
Object
.
is
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_
listaccoun
ts'
),
'undefined'
)){
listaccountsData
=
JSON
.
parse
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_listaccoun
ts'
)
as
any
);
if
(
listaccountsData
&&
listaccountsData
.
length
&&
listaccoun
tsData
.
length
>
0
){
listaccoun
tsData
.
forEach
((
item
:
any
)
=>
{
masterData
.
listaccounts
=
listaccoun
tsData
;
let
contac
tsData
:
any
=
[];
if
(
!
Object
.
is
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_
contac
ts'
),
'undefined'
)){
contactsData
=
JSON
.
parse
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_contac
ts'
)
as
any
);
if
(
contactsData
&&
contactsData
.
length
&&
contac
tsData
.
length
>
0
){
contac
tsData
.
forEach
((
item
:
any
)
=>
{
if
(
item
.
srffrontuf
){
if
(
Object
.
is
(
item
.
srffrontuf
,
"0"
)){
item
.
relationships
id
=
null
;
item
.
contact
id
=
null
;
}
delete
item
.
srffrontuf
;
}
});
}
}
masterData
.
listaccounts
=
listaccoun
tsData
;
masterData
.
contacts
=
contac
tsData
;
Object
.
assign
(
data
,
masterData
);
let
res
:
any
=
await
Http
.
getInstance
().
post
(
`/accounts/
${
context
.
account
}
/save`
,
data
,
isloading
);
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_contacts'
,
JSON
.
stringify
(
res
.
data
.
contacts
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_listaccounts'
,
JSON
.
stringify
(
res
.
data
.
listaccounts
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_contacts'
,
JSON
.
stringify
(
res
.
data
.
contacts
));
return
res
;
}
...
...
app_CRM/src/service/campaign/campaign-service-base.ts
浏览文件 @
45d495c5
...
...
@@ -62,21 +62,21 @@ export default class CampaignServiceBase extends EntityService {
*/
public
async
Create
(
context
:
any
=
{},
data
:
any
=
{},
isloading
?:
boolean
):
Promise
<
any
>
{
let
masterData
:
any
=
{};
let
lead
sData
:
any
=
[];
if
(
!
Object
.
is
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_
lead
s'
),
'undefined'
)){
leadsData
=
JSON
.
parse
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_lead
s'
)
as
any
);
if
(
leadsData
&&
leadsData
.
length
&&
lead
sData
.
length
>
0
){
lead
sData
.
forEach
((
item
:
any
)
=>
{
let
campaignlist
sData
:
any
=
[];
if
(
!
Object
.
is
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_
campaignlist
s'
),
'undefined'
)){
campaignlistsData
=
JSON
.
parse
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_campaignlist
s'
)
as
any
);
if
(
campaignlistsData
&&
campaignlistsData
.
length
&&
campaignlist
sData
.
length
>
0
){
campaignlist
sData
.
forEach
((
item
:
any
)
=>
{
if
(
item
.
srffrontuf
){
if
(
Object
.
is
(
item
.
srffrontuf
,
"0"
)){
item
.
lead
id
=
null
;
item
.
relationships
id
=
null
;
}
delete
item
.
srffrontuf
;
}
});
}
}
masterData
.
leads
=
lead
sData
;
masterData
.
campaignlists
=
campaignlist
sData
;
let
campaigncampaignsData
:
any
=
[];
if
(
!
Object
.
is
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_campaigncampaigns'
),
'undefined'
)){
campaigncampaignsData
=
JSON
.
parse
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_campaigncampaigns'
)
as
any
);
...
...
@@ -92,21 +92,21 @@ export default class CampaignServiceBase extends EntityService {
}
}
masterData
.
campaigncampaigns
=
campaigncampaignsData
;
let
campaignlist
sData
:
any
=
[];
if
(
!
Object
.
is
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_
campaignlist
s'
),
'undefined'
)){
campaignlistsData
=
JSON
.
parse
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_campaignlist
s'
)
as
any
);
if
(
campaignlistsData
&&
campaignlistsData
.
length
&&
campaignlist
sData
.
length
>
0
){
campaignlist
sData
.
forEach
((
item
:
any
)
=>
{
let
lead
sData
:
any
=
[];
if
(
!
Object
.
is
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_
lead
s'
),
'undefined'
)){
leadsData
=
JSON
.
parse
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_lead
s'
)
as
any
);
if
(
leadsData
&&
leadsData
.
length
&&
lead
sData
.
length
>
0
){
lead
sData
.
forEach
((
item
:
any
)
=>
{
if
(
item
.
srffrontuf
){
if
(
Object
.
is
(
item
.
srffrontuf
,
"0"
)){
item
.
relationships
id
=
null
;
item
.
lead
id
=
null
;
}
delete
item
.
srffrontuf
;
}
});
}
}
masterData
.
campaignlists
=
campaignlist
sData
;
masterData
.
leads
=
lead
sData
;
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
+
'_leads'
,
JSON
.
stringify
(
res
.
data
.
leads
));
this
.
tempStorage
.
setItem
(
tempContext
.
srfsessionkey
+
'_campaigncampaigns'
,
JSON
.
stringify
(
res
.
data
.
campaigncampaigns
));
this
.
tempStorage
.
setItem
(
tempContext
.
srfsessionkey
+
'_campaignlists'
,
JSON
.
stringify
(
res
.
data
.
campaignlists
));
this
.
tempStorage
.
setItem
(
tempContext
.
srfsessionkey
+
'_campaigncampaigns'
,
JSON
.
stringify
(
res
.
data
.
campaigncampaigns
));
this
.
tempStorage
.
setItem
(
tempContext
.
srfsessionkey
+
'_leads'
,
JSON
.
stringify
(
res
.
data
.
leads
));
return
res
;
}
...
...
@@ -133,21 +133,21 @@ export default class CampaignServiceBase extends EntityService {
*/
public
async
Update
(
context
:
any
=
{},
data
:
any
=
{},
isloading
?:
boolean
):
Promise
<
any
>
{
let
masterData
:
any
=
{};
let
lead
sData
:
any
=
[];
if
(
!
Object
.
is
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_
lead
s'
),
'undefined'
)){
leadsData
=
JSON
.
parse
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_lead
s'
)
as
any
);
if
(
leadsData
&&
leadsData
.
length
&&
lead
sData
.
length
>
0
){
lead
sData
.
forEach
((
item
:
any
)
=>
{
let
campaignlist
sData
:
any
=
[];
if
(
!
Object
.
is
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_
campaignlist
s'
),
'undefined'
)){
campaignlistsData
=
JSON
.
parse
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_campaignlist
s'
)
as
any
);
if
(
campaignlistsData
&&
campaignlistsData
.
length
&&
campaignlist
sData
.
length
>
0
){
campaignlist
sData
.
forEach
((
item
:
any
)
=>
{
if
(
item
.
srffrontuf
){
if
(
Object
.
is
(
item
.
srffrontuf
,
"0"
)){
item
.
lead
id
=
null
;
item
.
relationships
id
=
null
;
}
delete
item
.
srffrontuf
;
}
});
}
}
masterData
.
leads
=
lead
sData
;
masterData
.
campaignlists
=
campaignlist
sData
;
let
campaigncampaignsData
:
any
=
[];
if
(
!
Object
.
is
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_campaigncampaigns'
),
'undefined'
)){
campaigncampaignsData
=
JSON
.
parse
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_campaigncampaigns'
)
as
any
);
...
...
@@ -163,26 +163,26 @@ export default class CampaignServiceBase extends EntityService {
}
}
masterData
.
campaigncampaigns
=
campaigncampaignsData
;
let
campaignlist
sData
:
any
=
[];
if
(
!
Object
.
is
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_
campaignlist
s'
),
'undefined'
)){
campaignlistsData
=
JSON
.
parse
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_campaignlist
s'
)
as
any
);
if
(
campaignlistsData
&&
campaignlistsData
.
length
&&
campaignlist
sData
.
length
>
0
){
campaignlist
sData
.
forEach
((
item
:
any
)
=>
{
let
lead
sData
:
any
=
[];
if
(
!
Object
.
is
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_
lead
s'
),
'undefined'
)){
leadsData
=
JSON
.
parse
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_lead
s'
)
as
any
);
if
(
leadsData
&&
leadsData
.
length
&&
lead
sData
.
length
>
0
){
lead
sData
.
forEach
((
item
:
any
)
=>
{
if
(
item
.
srffrontuf
){
if
(
Object
.
is
(
item
.
srffrontuf
,
"0"
)){
item
.
relationships
id
=
null
;
item
.
lead
id
=
null
;
}
delete
item
.
srffrontuf
;
}
});
}
}
masterData
.
campaignlists
=
campaignlist
sData
;
masterData
.
leads
=
lead
sData
;
Object
.
assign
(
data
,
masterData
);
let
res
:
any
=
await
Http
.
getInstance
().
put
(
`/campaigns/
${
context
.
campaign
}
`
,
data
,
isloading
);
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_leads'
,
JSON
.
stringify
(
res
.
data
.
leads
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_campaigncampaigns'
,
JSON
.
stringify
(
res
.
data
.
campaigncampaigns
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_campaignlists'
,
JSON
.
stringify
(
res
.
data
.
campaignlists
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_campaigncampaigns'
,
JSON
.
stringify
(
res
.
data
.
campaigncampaigns
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_leads'
,
JSON
.
stringify
(
res
.
data
.
leads
));
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
+
'_leads'
,
JSON
.
stringify
(
res
.
data
.
leads
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_campaigncampaigns'
,
JSON
.
stringify
(
res
.
data
.
campaigncampaigns
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_campaignlists'
,
JSON
.
stringify
(
res
.
data
.
campaignlists
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_campaigncampaigns'
,
JSON
.
stringify
(
res
.
data
.
campaigncampaigns
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_leads'
,
JSON
.
stringify
(
res
.
data
.
leads
));
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
+
'_leads'
,
JSON
.
stringify
(
res
.
data
.
leads
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_campaigncampaigns'
,
JSON
.
stringify
(
res
.
data
.
campaigncampaigns
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_campaignlists'
,
JSON
.
stringify
(
res
.
data
.
campaignlists
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_campaigncampaigns'
,
JSON
.
stringify
(
res
.
data
.
campaigncampaigns
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_leads'
,
JSON
.
stringify
(
res
.
data
.
leads
));
return
res
;
}
...
...
@@ -258,21 +258,21 @@ export default class CampaignServiceBase extends EntityService {
*/
public
async
Save
(
context
:
any
=
{},
data
:
any
=
{},
isloading
?:
boolean
):
Promise
<
any
>
{
let
masterData
:
any
=
{};
let
lead
sData
:
any
=
[];
if
(
!
Object
.
is
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_
lead
s'
),
'undefined'
)){
leadsData
=
JSON
.
parse
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_lead
s'
)
as
any
);
if
(
leadsData
&&
leadsData
.
length
&&
lead
sData
.
length
>
0
){
lead
sData
.
forEach
((
item
:
any
)
=>
{
let
campaignlist
sData
:
any
=
[];
if
(
!
Object
.
is
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_
campaignlist
s'
),
'undefined'
)){
campaignlistsData
=
JSON
.
parse
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_campaignlist
s'
)
as
any
);
if
(
campaignlistsData
&&
campaignlistsData
.
length
&&
campaignlist
sData
.
length
>
0
){
campaignlist
sData
.
forEach
((
item
:
any
)
=>
{
if
(
item
.
srffrontuf
){
if
(
Object
.
is
(
item
.
srffrontuf
,
"0"
)){
item
.
lead
id
=
null
;
item
.
relationships
id
=
null
;
}
delete
item
.
srffrontuf
;
}
});
}
}
masterData
.
leads
=
lead
sData
;
masterData
.
campaignlists
=
campaignlist
sData
;
let
campaigncampaignsData
:
any
=
[];
if
(
!
Object
.
is
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_campaigncampaigns'
),
'undefined'
)){
campaigncampaignsData
=
JSON
.
parse
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_campaigncampaigns'
)
as
any
);
...
...
@@ -288,26 +288,26 @@ export default class CampaignServiceBase extends EntityService {
}
}
masterData
.
campaigncampaigns
=
campaigncampaignsData
;
let
campaignlist
sData
:
any
=
[];
if
(
!
Object
.
is
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_
campaignlist
s'
),
'undefined'
)){
campaignlistsData
=
JSON
.
parse
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_campaignlist
s'
)
as
any
);
if
(
campaignlistsData
&&
campaignlistsData
.
length
&&
campaignlist
sData
.
length
>
0
){
campaignlist
sData
.
forEach
((
item
:
any
)
=>
{
let
lead
sData
:
any
=
[];
if
(
!
Object
.
is
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_
lead
s'
),
'undefined'
)){
leadsData
=
JSON
.
parse
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_lead
s'
)
as
any
);
if
(
leadsData
&&
leadsData
.
length
&&
lead
sData
.
length
>
0
){
lead
sData
.
forEach
((
item
:
any
)
=>
{
if
(
item
.
srffrontuf
){
if
(
Object
.
is
(
item
.
srffrontuf
,
"0"
)){
item
.
relationships
id
=
null
;
item
.
lead
id
=
null
;
}
delete
item
.
srffrontuf
;
}
});
}
}
masterData
.
campaignlists
=
campaignlist
sData
;
masterData
.
leads
=
lead
sData
;
Object
.
assign
(
data
,
masterData
);
let
res
:
any
=
await
Http
.
getInstance
().
post
(
`/campaigns/
${
context
.
campaign
}
/save`
,
data
,
isloading
);
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_leads'
,
JSON
.
stringify
(
res
.
data
.
leads
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_campaigncampaigns'
,
JSON
.
stringify
(
res
.
data
.
campaigncampaigns
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_campaignlists'
,
JSON
.
stringify
(
res
.
data
.
campaignlists
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_campaigncampaigns'
,
JSON
.
stringify
(
res
.
data
.
campaigncampaigns
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_leads'
,
JSON
.
stringify
(
res
.
data
.
leads
));
return
res
;
}
...
...
app_CRM/src/service/contact/contact-service-base.ts
浏览文件 @
45d495c5
...
...
@@ -66,21 +66,21 @@ 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
lead
sData
:
any
=
[];
if
(
!
Object
.
is
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_
lead
s'
),
'undefined'
)){
leadsData
=
JSON
.
parse
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_lead
s'
)
as
any
);
if
(
leadsData
&&
leadsData
.
length
&&
lead
sData
.
length
>
0
){
lead
sData
.
forEach
((
item
:
any
)
=>
{
let
opportunitie
sData
:
any
=
[];
if
(
!
Object
.
is
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_
opportunitie
s'
),
'undefined'
)){
opportunitiesData
=
JSON
.
parse
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_opportunitie
s'
)
as
any
);
if
(
opportunitiesData
&&
opportunitiesData
.
length
&&
opportunitie
sData
.
length
>
0
){
opportunitie
sData
.
forEach
((
item
:
any
)
=>
{
if
(
item
.
srffrontuf
){
if
(
Object
.
is
(
item
.
srffrontuf
,
"0"
)){
item
.
lead
id
=
null
;
item
.
opportunity
id
=
null
;
}
delete
item
.
srffrontuf
;
}
});
}
}
masterData
.
leads
=
lead
sData
;
masterData
.
opportunities
=
opportunitie
sData
;
let
listcontactsData
:
any
=
[];
if
(
!
Object
.
is
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_listcontacts'
),
'undefined'
)){
listcontactsData
=
JSON
.
parse
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_listcontacts'
)
as
any
);
...
...
@@ -96,21 +96,21 @@ export default class ContactServiceBase extends EntityService {
}
}
masterData
.
listcontacts
=
listcontactsData
;
let
opportunitie
sData
:
any
=
[];
if
(
!
Object
.
is
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_
opportunitie
s'
),
'undefined'
)){
opportunitiesData
=
JSON
.
parse
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_opportunitie
s'
)
as
any
);
if
(
opportunitiesData
&&
opportunitiesData
.
length
&&
opportunitie
sData
.
length
>
0
){
opportunitie
sData
.
forEach
((
item
:
any
)
=>
{
let
lead
sData
:
any
=
[];
if
(
!
Object
.
is
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_
lead
s'
),
'undefined'
)){
leadsData
=
JSON
.
parse
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_lead
s'
)
as
any
);
if
(
leadsData
&&
leadsData
.
length
&&
lead
sData
.
length
>
0
){
lead
sData
.
forEach
((
item
:
any
)
=>
{
if
(
item
.
srffrontuf
){
if
(
Object
.
is
(
item
.
srffrontuf
,
"0"
)){
item
.
opportunity
id
=
null
;
item
.
lead
id
=
null
;
}
delete
item
.
srffrontuf
;
}
});
}
}
masterData
.
opportunities
=
opportunitie
sData
;
masterData
.
leads
=
lead
sData
;
Object
.
assign
(
data
,
masterData
);
if
(
!
data
.
srffrontuf
||
data
.
srffrontuf
!==
"1"
){
data
[
this
.
APPDEKEY
]
=
null
;
...
...
@@ -120,27 +120,27 @@ export default class ContactServiceBase extends EntityService {
}
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
+
'_listcontacts'
,
JSON
.
stringify
(
res
.
data
.
listcontacts
));
this
.
tempStorage
.
setItem
(
tempContext
.
srfsessionkey
+
'_opportunities'
,
JSON
.
stringify
(
res
.
data
.
opportunities
));
this
.
tempStorage
.
setItem
(
tempContext
.
srfsessionkey
+
'_listcontacts'
,
JSON
.
stringify
(
res
.
data
.
listcontacts
));
this
.
tempStorage
.
setItem
(
tempContext
.
srfsessionkey
+
'_leads'
,
JSON
.
stringify
(
res
.
data
.
leads
));
return
res
;
}
let
masterData
:
any
=
{};
let
lead
sData
:
any
=
[];
if
(
!
Object
.
is
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_
lead
s'
),
'undefined'
)){
leadsData
=
JSON
.
parse
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_lead
s'
)
as
any
);
if
(
leadsData
&&
leadsData
.
length
&&
lead
sData
.
length
>
0
){
lead
sData
.
forEach
((
item
:
any
)
=>
{
let
opportunitie
sData
:
any
=
[];
if
(
!
Object
.
is
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_
opportunitie
s'
),
'undefined'
)){
opportunitiesData
=
JSON
.
parse
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_opportunitie
s'
)
as
any
);
if
(
opportunitiesData
&&
opportunitiesData
.
length
&&
opportunitie
sData
.
length
>
0
){
opportunitie
sData
.
forEach
((
item
:
any
)
=>
{
if
(
item
.
srffrontuf
){
if
(
Object
.
is
(
item
.
srffrontuf
,
"0"
)){
item
.
lead
id
=
null
;
item
.
opportunity
id
=
null
;
}
delete
item
.
srffrontuf
;
}
});
}
}
masterData
.
leads
=
lead
sData
;
masterData
.
opportunities
=
opportunitie
sData
;
let
listcontactsData
:
any
=
[];
if
(
!
Object
.
is
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_listcontacts'
),
'undefined'
)){
listcontactsData
=
JSON
.
parse
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_listcontacts'
)
as
any
);
...
...
@@ -156,21 +156,21 @@ export default class ContactServiceBase extends EntityService {
}
}
masterData
.
listcontacts
=
listcontactsData
;
let
opportunitie
sData
:
any
=
[];
if
(
!
Object
.
is
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_
opportunitie
s'
),
'undefined'
)){
opportunitiesData
=
JSON
.
parse
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_opportunitie
s'
)
as
any
);
if
(
opportunitiesData
&&
opportunitiesData
.
length
&&
opportunitie
sData
.
length
>
0
){
opportunitie
sData
.
forEach
((
item
:
any
)
=>
{
let
lead
sData
:
any
=
[];
if
(
!
Object
.
is
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_
lead
s'
),
'undefined'
)){
leadsData
=
JSON
.
parse
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_lead
s'
)
as
any
);
if
(
leadsData
&&
leadsData
.
length
&&
lead
sData
.
length
>
0
){
lead
sData
.
forEach
((
item
:
any
)
=>
{
if
(
item
.
srffrontuf
){
if
(
Object
.
is
(
item
.
srffrontuf
,
"0"
)){
item
.
opportunity
id
=
null
;
item
.
lead
id
=
null
;
}
delete
item
.
srffrontuf
;
}
});
}
}
masterData
.
opportunities
=
opportunitie
sData
;
masterData
.
leads
=
lead
sData
;
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
+
'_leads'
,
JSON
.
stringify
(
res
.
data
.
leads
));
this
.
tempStorage
.
setItem
(
tempContext
.
srfsessionkey
+
'_listcontacts'
,
JSON
.
stringify
(
res
.
data
.
listcontacts
));
this
.
tempStorage
.
setItem
(
tempContext
.
srfsessionkey
+
'_opportunities'
,
JSON
.
stringify
(
res
.
data
.
opportunities
));
this
.
tempStorage
.
setItem
(
tempContext
.
srfsessionkey
+
'_listcontacts'
,
JSON
.
stringify
(
res
.
data
.
listcontacts
));
this
.
tempStorage
.
setItem
(
tempContext
.
srfsessionkey
+
'_leads'
,
JSON
.
stringify
(
res
.
data
.
leads
));
return
res
;
}
...
...
@@ -198,21 +198,21 @@ 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
lead
sData
:
any
=
[];
if
(
!
Object
.
is
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_
lead
s'
),
'undefined'
)){
leadsData
=
JSON
.
parse
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_lead
s'
)
as
any
);
if
(
leadsData
&&
leadsData
.
length
&&
lead
sData
.
length
>
0
){
lead
sData
.
forEach
((
item
:
any
)
=>
{
let
opportunitie
sData
:
any
=
[];
if
(
!
Object
.
is
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_
opportunitie
s'
),
'undefined'
)){
opportunitiesData
=
JSON
.
parse
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_opportunitie
s'
)
as
any
);
if
(
opportunitiesData
&&
opportunitiesData
.
length
&&
opportunitie
sData
.
length
>
0
){
opportunitie
sData
.
forEach
((
item
:
any
)
=>
{
if
(
item
.
srffrontuf
){
if
(
Object
.
is
(
item
.
srffrontuf
,
"0"
)){
item
.
lead
id
=
null
;
item
.
opportunity
id
=
null
;
}
delete
item
.
srffrontuf
;
}
});
}
}
masterData
.
leads
=
lead
sData
;
masterData
.
opportunities
=
opportunitie
sData
;
let
listcontactsData
:
any
=
[];
if
(
!
Object
.
is
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_listcontacts'
),
'undefined'
)){
listcontactsData
=
JSON
.
parse
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_listcontacts'
)
as
any
);
...
...
@@ -228,44 +228,44 @@ export default class ContactServiceBase extends EntityService {
}
}
masterData
.
listcontacts
=
listcontactsData
;
let
opportunitie
sData
:
any
=
[];
if
(
!
Object
.
is
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_
opportunitie
s'
),
'undefined'
)){
opportunitiesData
=
JSON
.
parse
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_opportunitie
s'
)
as
any
);
if
(
opportunitiesData
&&
opportunitiesData
.
length
&&
opportunitie
sData
.
length
>
0
){
opportunitie
sData
.
forEach
((
item
:
any
)
=>
{
let
lead
sData
:
any
=
[];
if
(
!
Object
.
is
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_
lead
s'
),
'undefined'
)){
leadsData
=
JSON
.
parse
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_lead
s'
)
as
any
);
if
(
leadsData
&&
leadsData
.
length
&&
lead
sData
.
length
>
0
){
lead
sData
.
forEach
((
item
:
any
)
=>
{
if
(
item
.
srffrontuf
){
if
(
Object
.
is
(
item
.
srffrontuf
,
"0"
)){
item
.
opportunity
id
=
null
;
item
.
lead
id
=
null
;
}
delete
item
.
srffrontuf
;
}
});
}
}
masterData
.
opportunities
=
opportunitie
sData
;
masterData
.
leads
=
lead
sData
;
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
+
'_listcontacts'
,
JSON
.
stringify
(
res
.
data
.
listcontacts
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_opportunities'
,
JSON
.
stringify
(
res
.
data
.
opportunities
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_listcontacts'
,
JSON
.
stringify
(
res
.
data
.
listcontacts
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_leads'
,
JSON
.
stringify
(
res
.
data
.
leads
));
return
res
;
}
let
masterData
:
any
=
{};
let
lead
sData
:
any
=
[];
if
(
!
Object
.
is
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_
lead
s'
),
'undefined'
)){
leadsData
=
JSON
.
parse
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_lead
s'
)
as
any
);
if
(
leadsData
&&
leadsData
.
length
&&
lead
sData
.
length
>
0
){
lead
sData
.
forEach
((
item
:
any
)
=>
{
let
opportunitie
sData
:
any
=
[];
if
(
!
Object
.
is
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_
opportunitie
s'
),
'undefined'
)){
opportunitiesData
=
JSON
.
parse
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_opportunitie
s'
)
as
any
);
if
(
opportunitiesData
&&
opportunitiesData
.
length
&&
opportunitie
sData
.
length
>
0
){
opportunitie
sData
.
forEach
((
item
:
any
)
=>
{
if
(
item
.
srffrontuf
){
if
(
Object
.
is
(
item
.
srffrontuf
,
"0"
)){
item
.
lead
id
=
null
;
item
.
opportunity
id
=
null
;
}
delete
item
.
srffrontuf
;
}
});
}
}
masterData
.
leads
=
lead
sData
;
masterData
.
opportunities
=
opportunitie
sData
;
let
listcontactsData
:
any
=
[];
if
(
!
Object
.
is
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_listcontacts'
),
'undefined'
)){
listcontactsData
=
JSON
.
parse
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_listcontacts'
)
as
any
);
...
...
@@ -281,26 +281,26 @@ export default class ContactServiceBase extends EntityService {
}
}
masterData
.
listcontacts
=
listcontactsData
;
let
opportunitie
sData
:
any
=
[];
if
(
!
Object
.
is
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_
opportunitie
s'
),
'undefined'
)){
opportunitiesData
=
JSON
.
parse
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_opportunitie
s'
)
as
any
);
if
(
opportunitiesData
&&
opportunitiesData
.
length
&&
opportunitie
sData
.
length
>
0
){
opportunitie
sData
.
forEach
((
item
:
any
)
=>
{
let
lead
sData
:
any
=
[];
if
(
!
Object
.
is
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_
lead
s'
),
'undefined'
)){
leadsData
=
JSON
.
parse
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_lead
s'
)
as
any
);
if
(
leadsData
&&
leadsData
.
length
&&
lead
sData
.
length
>
0
){
lead
sData
.
forEach
((
item
:
any
)
=>
{
if
(
item
.
srffrontuf
){
if
(
Object
.
is
(
item
.
srffrontuf
,
"0"
)){
item
.
opportunity
id
=
null
;
item
.
lead
id
=
null
;
}
delete
item
.
srffrontuf
;
}
});
}
}
masterData
.
opportunities
=
opportunitie
sData
;
masterData
.
leads
=
lead
sData
;
Object
.
assign
(
data
,
masterData
);
let
res
:
any
=
await
Http
.
getInstance
().
put
(
`/contacts/
${
context
.
contact
}
`
,
data
,
isloading
);
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_leads'
,
JSON
.
stringify
(
res
.
data
.
leads
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_listcontacts'
,
JSON
.
stringify
(
res
.
data
.
listcontacts
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_opportunities'
,
JSON
.
stringify
(
res
.
data
.
opportunities
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_listcontacts'
,
JSON
.
stringify
(
res
.
data
.
listcontacts
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_leads'
,
JSON
.
stringify
(
res
.
data
.
leads
));
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
+
'_leads'
,
JSON
.
stringify
(
res
.
data
.
leads
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_listcontacts'
,
JSON
.
stringify
(
res
.
data
.
listcontacts
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_opportunities'
,
JSON
.
stringify
(
res
.
data
.
opportunities
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_listcontacts'
,
JSON
.
stringify
(
res
.
data
.
listcontacts
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_leads'
,
JSON
.
stringify
(
res
.
data
.
leads
));
return
res
;
}
let
res
:
any
=
await
Http
.
getInstance
().
get
(
`/contacts/
${
context
.
contact
}
`
,
isloading
);
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_leads'
,
JSON
.
stringify
(
res
.
data
.
leads
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_listcontacts'
,
JSON
.
stringify
(
res
.
data
.
listcontacts
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_opportunities'
,
JSON
.
stringify
(
res
.
data
.
opportunities
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_listcontacts'
,
JSON
.
stringify
(
res
.
data
.
listcontacts
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_leads'
,
JSON
.
stringify
(
res
.
data
.
leads
));
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
+
'_leads'
,
JSON
.
stringify
(
res
.
data
.
leads
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_listcontacts'
,
JSON
.
stringify
(
res
.
data
.
listcontacts
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_opportunities'
,
JSON
.
stringify
(
res
.
data
.
opportunities
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_listcontacts'
,
JSON
.
stringify
(
res
.
data
.
listcontacts
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_leads'
,
JSON
.
stringify
(
res
.
data
.
leads
));
return
res
;
}
let
res
:
any
=
await
Http
.
getInstance
().
get
(
`/contacts/getdraft`
,
isloading
);
res
.
data
.
contact
=
data
.
contact
;
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_leads'
,
JSON
.
stringify
(
res
.
data
.
leads
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_listcontacts'
,
JSON
.
stringify
(
res
.
data
.
listcontacts
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_opportunities'
,
JSON
.
stringify
(
res
.
data
.
opportunities
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_listcontacts'
,
JSON
.
stringify
(
res
.
data
.
listcontacts
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_leads'
,
JSON
.
stringify
(
res
.
data
.
leads
));
return
res
;
}
...
...
@@ -382,21 +382,21 @@ 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
lead
sData
:
any
=
[];
if
(
!
Object
.
is
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_
lead
s'
),
'undefined'
)){
leadsData
=
JSON
.
parse
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_lead
s'
)
as
any
);
if
(
leadsData
&&
leadsData
.
length
&&
lead
sData
.
length
>
0
){
lead
sData
.
forEach
((
item
:
any
)
=>
{
let
opportunitie
sData
:
any
=
[];
if
(
!
Object
.
is
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_
opportunitie
s'
),
'undefined'
)){
opportunitiesData
=
JSON
.
parse
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_opportunitie
s'
)
as
any
);
if
(
opportunitiesData
&&
opportunitiesData
.
length
&&
opportunitie
sData
.
length
>
0
){
opportunitie
sData
.
forEach
((
item
:
any
)
=>
{
if
(
item
.
srffrontuf
){
if
(
Object
.
is
(
item
.
srffrontuf
,
"0"
)){
item
.
lead
id
=
null
;
item
.
opportunity
id
=
null
;
}
delete
item
.
srffrontuf
;
}
});
}
}
masterData
.
leads
=
lead
sData
;
masterData
.
opportunities
=
opportunitie
sData
;
let
listcontactsData
:
any
=
[];
if
(
!
Object
.
is
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_listcontacts'
),
'undefined'
)){
listcontactsData
=
JSON
.
parse
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_listcontacts'
)
as
any
);
...
...
@@ -412,26 +412,26 @@ export default class ContactServiceBase extends EntityService {
}
}
masterData
.
listcontacts
=
listcontactsData
;
let
opportunitie
sData
:
any
=
[];
if
(
!
Object
.
is
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_
opportunitie
s'
),
'undefined'
)){
opportunitiesData
=
JSON
.
parse
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_opportunitie
s'
)
as
any
);
if
(
opportunitiesData
&&
opportunitiesData
.
length
&&
opportunitie
sData
.
length
>
0
){
opportunitie
sData
.
forEach
((
item
:
any
)
=>
{
let
lead
sData
:
any
=
[];
if
(
!
Object
.
is
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_
lead
s'
),
'undefined'
)){
leadsData
=
JSON
.
parse
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_lead
s'
)
as
any
);
if
(
leadsData
&&
leadsData
.
length
&&
lead
sData
.
length
>
0
){
lead
sData
.
forEach
((
item
:
any
)
=>
{
if
(
item
.
srffrontuf
){
if
(
Object
.
is
(
item
.
srffrontuf
,
"0"
)){
item
.
opportunity
id
=
null
;
item
.
lead
id
=
null
;
}
delete
item
.
srffrontuf
;
}
});
}
}
masterData
.
opportunities
=
opportunitie
sData
;
masterData
.
leads
=
lead
sData
;
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
+
'_leads'
,
JSON
.
stringify
(
res
.
data
.
leads
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_listcontacts'
,
JSON
.
stringify
(
res
.
data
.
listcontacts
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_opportunities'
,
JSON
.
stringify
(
res
.
data
.
opportunities
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_listcontacts'
,
JSON
.
stringify
(
res
.
data
.
listcontacts
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_leads'
,
JSON
.
stringify
(
res
.
data
.
leads
));
return
res
;
}
return
Http
.
getInstance
().
post
(
`/contacts/
${
context
.
contact
}
/checkkey`
,
data
,
isloading
);
...
...
@@ -449,21 +449,21 @@ 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
lead
sData
:
any
=
[];
if
(
!
Object
.
is
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_
lead
s'
),
'undefined'
)){
leadsData
=
JSON
.
parse
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_lead
s'
)
as
any
);
if
(
leadsData
&&
leadsData
.
length
&&
lead
sData
.
length
>
0
){
lead
sData
.
forEach
((
item
:
any
)
=>
{
let
opportunitie
sData
:
any
=
[];
if
(
!
Object
.
is
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_
opportunitie
s'
),
'undefined'
)){
opportunitiesData
=
JSON
.
parse
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_opportunitie
s'
)
as
any
);
if
(
opportunitiesData
&&
opportunitiesData
.
length
&&
opportunitie
sData
.
length
>
0
){
opportunitie
sData
.
forEach
((
item
:
any
)
=>
{
if
(
item
.
srffrontuf
){
if
(
Object
.
is
(
item
.
srffrontuf
,
"0"
)){
item
.
lead
id
=
null
;
item
.
opportunity
id
=
null
;
}
delete
item
.
srffrontuf
;
}
});
}
}
masterData
.
leads
=
lead
sData
;
masterData
.
opportunities
=
opportunitie
sData
;
let
listcontactsData
:
any
=
[];
if
(
!
Object
.
is
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_listcontacts'
),
'undefined'
)){
listcontactsData
=
JSON
.
parse
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_listcontacts'
)
as
any
);
...
...
@@ -479,44 +479,44 @@ export default class ContactServiceBase extends EntityService {
}
}
masterData
.
listcontacts
=
listcontactsData
;
let
opportunitie
sData
:
any
=
[];
if
(
!
Object
.
is
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_
opportunitie
s'
),
'undefined'
)){
opportunitiesData
=
JSON
.
parse
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_opportunitie
s'
)
as
any
);
if
(
opportunitiesData
&&
opportunitiesData
.
length
&&
opportunitie
sData
.
length
>
0
){
opportunitie
sData
.
forEach
((
item
:
any
)
=>
{
let
lead
sData
:
any
=
[];
if
(
!
Object
.
is
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_
lead
s'
),
'undefined'
)){
leadsData
=
JSON
.
parse
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_lead
s'
)
as
any
);
if
(
leadsData
&&
leadsData
.
length
&&
lead
sData
.
length
>
0
){
lead
sData
.
forEach
((
item
:
any
)
=>
{
if
(
item
.
srffrontuf
){
if
(
Object
.
is
(
item
.
srffrontuf
,
"0"
)){
item
.
opportunity
id
=
null
;
item
.
lead
id
=
null
;
}
delete
item
.
srffrontuf
;
}
});
}
}
masterData
.
opportunities
=
opportunitie
sData
;
masterData
.
leads
=
lead
sData
;
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
+
'_listcontacts'
,
JSON
.
stringify
(
res
.
data
.
listcontacts
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_opportunities'
,
JSON
.
stringify
(
res
.
data
.
opportunities
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_listcontacts'
,
JSON
.
stringify
(
res
.
data
.
listcontacts
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_leads'
,
JSON
.
stringify
(
res
.
data
.
leads
));
return
res
;
}
let
masterData
:
any
=
{};
let
lead
sData
:
any
=
[];
if
(
!
Object
.
is
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_
lead
s'
),
'undefined'
)){
leadsData
=
JSON
.
parse
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_lead
s'
)
as
any
);
if
(
leadsData
&&
leadsData
.
length
&&
lead
sData
.
length
>
0
){
lead
sData
.
forEach
((
item
:
any
)
=>
{
let
opportunitie
sData
:
any
=
[];
if
(
!
Object
.
is
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_
opportunitie
s'
),
'undefined'
)){
opportunitiesData
=
JSON
.
parse
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_opportunitie
s'
)
as
any
);
if
(
opportunitiesData
&&
opportunitiesData
.
length
&&
opportunitie
sData
.
length
>
0
){
opportunitie
sData
.
forEach
((
item
:
any
)
=>
{
if
(
item
.
srffrontuf
){
if
(
Object
.
is
(
item
.
srffrontuf
,
"0"
)){
item
.
lead
id
=
null
;
item
.
opportunity
id
=
null
;
}
delete
item
.
srffrontuf
;
}
});
}
}
masterData
.
leads
=
lead
sData
;
masterData
.
opportunities
=
opportunitie
sData
;
let
listcontactsData
:
any
=
[];
if
(
!
Object
.
is
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_listcontacts'
),
'undefined'
)){
listcontactsData
=
JSON
.
parse
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_listcontacts'
)
as
any
);
...
...
@@ -532,26 +532,26 @@ export default class ContactServiceBase extends EntityService {
}
}
masterData
.
listcontacts
=
listcontactsData
;
let
opportunitie
sData
:
any
=
[];
if
(
!
Object
.
is
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_
opportunitie
s'
),
'undefined'
)){
opportunitiesData
=
JSON
.
parse
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_opportunitie
s'
)
as
any
);
if
(
opportunitiesData
&&
opportunitiesData
.
length
&&
opportunitie
sData
.
length
>
0
){
opportunitie
sData
.
forEach
((
item
:
any
)
=>
{
let
lead
sData
:
any
=
[];
if
(
!
Object
.
is
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_
lead
s'
),
'undefined'
)){
leadsData
=
JSON
.
parse
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_lead
s'
)
as
any
);
if
(
leadsData
&&
leadsData
.
length
&&
lead
sData
.
length
>
0
){
lead
sData
.
forEach
((
item
:
any
)
=>
{
if
(
item
.
srffrontuf
){
if
(
Object
.
is
(
item
.
srffrontuf
,
"0"
)){
item
.
opportunity
id
=
null
;
item
.
lead
id
=
null
;
}
delete
item
.
srffrontuf
;
}
});
}
}
masterData
.
opportunities
=
opportunitie
sData
;
masterData
.
leads
=
lead
sData
;
Object
.
assign
(
data
,
masterData
);
let
res
:
any
=
await
Http
.
getInstance
().
post
(
`/contacts/
${
context
.
contact
}
/save`
,
data
,
isloading
);
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_leads'
,
JSON
.
stringify
(
res
.
data
.
leads
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_listcontacts'
,
JSON
.
stringify
(
res
.
data
.
listcontacts
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_opportunities'
,
JSON
.
stringify
(
res
.
data
.
opportunities
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_listcontacts'
,
JSON
.
stringify
(
res
.
data
.
listcontacts
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_leads'
,
JSON
.
stringify
(
res
.
data
.
leads
));
return
res
;
}
...
...
@@ -567,21 +567,21 @@ 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
lead
sData
:
any
=
[];
if
(
!
Object
.
is
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_
lead
s'
),
'undefined'
)){
leadsData
=
JSON
.
parse
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_lead
s'
)
as
any
);
if
(
leadsData
&&
leadsData
.
length
&&
lead
sData
.
length
>
0
){
lead
sData
.
forEach
((
item
:
any
)
=>
{
let
opportunitie
sData
:
any
=
[];
if
(
!
Object
.
is
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_
opportunitie
s'
),
'undefined'
)){
opportunitiesData
=
JSON
.
parse
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_opportunitie
s'
)
as
any
);
if
(
opportunitiesData
&&
opportunitiesData
.
length
&&
opportunitie
sData
.
length
>
0
){
opportunitie
sData
.
forEach
((
item
:
any
)
=>
{
if
(
item
.
srffrontuf
){
if
(
Object
.
is
(
item
.
srffrontuf
,
"0"
)){
item
.
lead
id
=
null
;
item
.
opportunity
id
=
null
;
}
delete
item
.
srffrontuf
;
}
});
}
}
masterData
.
leads
=
lead
sData
;
masterData
.
opportunities
=
opportunitie
sData
;
let
listcontactsData
:
any
=
[];
if
(
!
Object
.
is
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_listcontacts'
),
'undefined'
)){
listcontactsData
=
JSON
.
parse
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_listcontacts'
)
as
any
);
...
...
@@ -597,26 +597,26 @@ export default class ContactServiceBase extends EntityService {
}
}
masterData
.
listcontacts
=
listcontactsData
;
let
opportunitie
sData
:
any
=
[];
if
(
!
Object
.
is
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_
opportunitie
s'
),
'undefined'
)){
opportunitiesData
=
JSON
.
parse
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_opportunitie
s'
)
as
any
);
if
(
opportunitiesData
&&
opportunitiesData
.
length
&&
opportunitie
sData
.
length
>
0
){
opportunitie
sData
.
forEach
((
item
:
any
)
=>
{
let
lead
sData
:
any
=
[];
if
(
!
Object
.
is
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_
lead
s'
),
'undefined'
)){
leadsData
=
JSON
.
parse
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_lead
s'
)
as
any
);
if
(
leadsData
&&
leadsData
.
length
&&
lead
sData
.
length
>
0
){
lead
sData
.
forEach
((
item
:
any
)
=>
{
if
(
item
.
srffrontuf
){
if
(
Object
.
is
(
item
.
srffrontuf
,
"0"
)){
item
.
opportunity
id
=
null
;
item
.
lead
id
=
null
;
}
delete
item
.
srffrontuf
;
}
});
}
}
masterData
.
opportunities
=
opportunitie
sData
;
masterData
.
leads
=
lead
sData
;
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
+
'_leads'
,
JSON
.
stringify
(
res
.
data
.
leads
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_listcontacts'
,
JSON
.
stringify
(
res
.
data
.
listcontacts
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_opportunities'
,
JSON
.
stringify
(
res
.
data
.
opportunities
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_listcontacts'
,
JSON
.
stringify
(
res
.
data
.
listcontacts
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_leads'
,
JSON
.
stringify
(
res
.
data
.
leads
));
return
res
;
}
return
Http
.
getInstance
().
post
(
`/contacts/
${
context
.
contact
}
/setprimary`
,
data
,
isloading
);
...
...
app_CRM/src/service/ibiz-list/ibiz-list-service-base.ts
浏览文件 @
45d495c5
...
...
@@ -62,11 +62,11 @@ export default class IBizListServiceBase extends EntityService {
*/
public
async
Create
(
context
:
any
=
{},
data
:
any
=
{},
isloading
?:
boolean
):
Promise
<
any
>
{
let
masterData
:
any
=
{};
let
list
contac
tsData
:
any
=
[];
if
(
!
Object
.
is
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_list
contac
ts'
),
'undefined'
)){
list
contactsData
=
JSON
.
parse
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_listcontac
ts'
)
as
any
);
if
(
list
contactsData
&&
listcontactsData
.
length
&&
listcontac
tsData
.
length
>
0
){
list
contac
tsData
.
forEach
((
item
:
any
)
=>
{
let
list
accoun
tsData
:
any
=
[];
if
(
!
Object
.
is
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_list
accoun
ts'
),
'undefined'
)){
list
accountsData
=
JSON
.
parse
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_listaccoun
ts'
)
as
any
);
if
(
list
accountsData
&&
listaccountsData
.
length
&&
listaccoun
tsData
.
length
>
0
){
list
accoun
tsData
.
forEach
((
item
:
any
)
=>
{
if
(
item
.
srffrontuf
){
if
(
Object
.
is
(
item
.
srffrontuf
,
"0"
)){
item
.
relationshipsid
=
null
;
...
...
@@ -76,12 +76,12 @@ export default class IBizListServiceBase extends EntityService {
});
}
}
masterData
.
list
contacts
=
listcontac
tsData
;
let
list
account
sData
:
any
=
[];
if
(
!
Object
.
is
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_list
account
s'
),
'undefined'
)){
list
accountsData
=
JSON
.
parse
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_listaccount
s'
)
as
any
);
if
(
list
accountsData
&&
listaccountsData
.
length
&&
listaccount
sData
.
length
>
0
){
list
account
sData
.
forEach
((
item
:
any
)
=>
{
masterData
.
list
accounts
=
listaccoun
tsData
;
let
list
lead
sData
:
any
=
[];
if
(
!
Object
.
is
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_list
lead
s'
),
'undefined'
)){
list
leadsData
=
JSON
.
parse
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_listlead
s'
)
as
any
);
if
(
list
leadsData
&&
listleadsData
.
length
&&
listlead
sData
.
length
>
0
){
list
lead
sData
.
forEach
((
item
:
any
)
=>
{
if
(
item
.
srffrontuf
){
if
(
Object
.
is
(
item
.
srffrontuf
,
"0"
)){
item
.
relationshipsid
=
null
;
...
...
@@ -91,12 +91,12 @@ export default class IBizListServiceBase extends EntityService {
});
}
}
masterData
.
list
accounts
=
listaccount
sData
;
let
campaignlis
tsData
:
any
=
[];
if
(
!
Object
.
is
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_
campaignlis
ts'
),
'undefined'
)){
campaignlistsData
=
JSON
.
parse
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_campaignlis
ts'
)
as
any
);
if
(
campaignlistsData
&&
campaignlistsData
.
length
&&
campaignlis
tsData
.
length
>
0
){
campaignlis
tsData
.
forEach
((
item
:
any
)
=>
{
masterData
.
list
leads
=
listlead
sData
;
let
listcontac
tsData
:
any
=
[];
if
(
!
Object
.
is
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_
listcontac
ts'
),
'undefined'
)){
listcontactsData
=
JSON
.
parse
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_listcontac
ts'
)
as
any
);
if
(
listcontactsData
&&
listcontactsData
.
length
&&
listcontac
tsData
.
length
>
0
){
listcontac
tsData
.
forEach
((
item
:
any
)
=>
{
if
(
item
.
srffrontuf
){
if
(
Object
.
is
(
item
.
srffrontuf
,
"0"
)){
item
.
relationshipsid
=
null
;
...
...
@@ -106,12 +106,12 @@ export default class IBizListServiceBase extends EntityService {
});
}
}
masterData
.
campaignlists
=
campaignlis
tsData
;
let
listlead
sData
:
any
=
[];
if
(
!
Object
.
is
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_
listlead
s'
),
'undefined'
)){
listleadsData
=
JSON
.
parse
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_listlead
s'
)
as
any
);
if
(
listleadsData
&&
listleadsData
.
length
&&
listlead
sData
.
length
>
0
){
listlead
sData
.
forEach
((
item
:
any
)
=>
{
masterData
.
listcontacts
=
listcontac
tsData
;
let
campaignlist
sData
:
any
=
[];
if
(
!
Object
.
is
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_
campaignlist
s'
),
'undefined'
)){
campaignlistsData
=
JSON
.
parse
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_campaignlist
s'
)
as
any
);
if
(
campaignlistsData
&&
campaignlistsData
.
length
&&
campaignlist
sData
.
length
>
0
){
campaignlist
sData
.
forEach
((
item
:
any
)
=>
{
if
(
item
.
srffrontuf
){
if
(
Object
.
is
(
item
.
srffrontuf
,
"0"
)){
item
.
relationshipsid
=
null
;
...
...
@@ -121,7 +121,7 @@ export default class IBizListServiceBase extends EntityService {
});
}
}
masterData
.
listleads
=
listlead
sData
;
masterData
.
campaignlists
=
campaignlist
sData
;
Object
.
assign
(
data
,
masterData
);
if
(
!
data
.
srffrontuf
||
data
.
srffrontuf
!==
"1"
){
data
[
this
.
APPDEKEY
]
=
null
;
...
...
@@ -131,10 +131,10 @@ 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
+
'_campaignlists'
,
JSON
.
stringify
(
res
.
data
.
campaignlists
));
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,11 +149,11 @@ export default class IBizListServiceBase extends EntityService {
*/
public
async
Update
(
context
:
any
=
{},
data
:
any
=
{},
isloading
?:
boolean
):
Promise
<
any
>
{
let
masterData
:
any
=
{};
let
list
contac
tsData
:
any
=
[];
if
(
!
Object
.
is
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_list
contac
ts'
),
'undefined'
)){
list
contactsData
=
JSON
.
parse
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_listcontac
ts'
)
as
any
);
if
(
list
contactsData
&&
listcontactsData
.
length
&&
listcontac
tsData
.
length
>
0
){
list
contac
tsData
.
forEach
((
item
:
any
)
=>
{
let
list
accoun
tsData
:
any
=
[];
if
(
!
Object
.
is
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_list
accoun
ts'
),
'undefined'
)){
list
accountsData
=
JSON
.
parse
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_listaccoun
ts'
)
as
any
);
if
(
list
accountsData
&&
listaccountsData
.
length
&&
listaccoun
tsData
.
length
>
0
){
list
accoun
tsData
.
forEach
((
item
:
any
)
=>
{
if
(
item
.
srffrontuf
){
if
(
Object
.
is
(
item
.
srffrontuf
,
"0"
)){
item
.
relationshipsid
=
null
;
...
...
@@ -163,12 +163,12 @@ export default class IBizListServiceBase extends EntityService {
});
}
}
masterData
.
list
contacts
=
listcontac
tsData
;
let
list
account
sData
:
any
=
[];
if
(
!
Object
.
is
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_list
account
s'
),
'undefined'
)){
list
accountsData
=
JSON
.
parse
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_listaccount
s'
)
as
any
);
if
(
list
accountsData
&&
listaccountsData
.
length
&&
listaccount
sData
.
length
>
0
){
list
account
sData
.
forEach
((
item
:
any
)
=>
{
masterData
.
list
accounts
=
listaccoun
tsData
;
let
list
lead
sData
:
any
=
[];
if
(
!
Object
.
is
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_list
lead
s'
),
'undefined'
)){
list
leadsData
=
JSON
.
parse
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_listlead
s'
)
as
any
);
if
(
list
leadsData
&&
listleadsData
.
length
&&
listlead
sData
.
length
>
0
){
list
lead
sData
.
forEach
((
item
:
any
)
=>
{
if
(
item
.
srffrontuf
){
if
(
Object
.
is
(
item
.
srffrontuf
,
"0"
)){
item
.
relationshipsid
=
null
;
...
...
@@ -178,12 +178,12 @@ export default class IBizListServiceBase extends EntityService {
});
}
}
masterData
.
list
accounts
=
listaccount
sData
;
let
campaignlis
tsData
:
any
=
[];
if
(
!
Object
.
is
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_
campaignlis
ts'
),
'undefined'
)){
campaignlistsData
=
JSON
.
parse
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_campaignlis
ts'
)
as
any
);
if
(
campaignlistsData
&&
campaignlistsData
.
length
&&
campaignlis
tsData
.
length
>
0
){
campaignlis
tsData
.
forEach
((
item
:
any
)
=>
{
masterData
.
list
leads
=
listlead
sData
;
let
listcontac
tsData
:
any
=
[];
if
(
!
Object
.
is
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_
listcontac
ts'
),
'undefined'
)){
listcontactsData
=
JSON
.
parse
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_listcontac
ts'
)
as
any
);
if
(
listcontactsData
&&
listcontactsData
.
length
&&
listcontac
tsData
.
length
>
0
){
listcontac
tsData
.
forEach
((
item
:
any
)
=>
{
if
(
item
.
srffrontuf
){
if
(
Object
.
is
(
item
.
srffrontuf
,
"0"
)){
item
.
relationshipsid
=
null
;
...
...
@@ -193,12 +193,12 @@ export default class IBizListServiceBase extends EntityService {
});
}
}
masterData
.
campaignlists
=
campaignlis
tsData
;
let
listlead
sData
:
any
=
[];
if
(
!
Object
.
is
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_
listlead
s'
),
'undefined'
)){
listleadsData
=
JSON
.
parse
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_listlead
s'
)
as
any
);
if
(
listleadsData
&&
listleadsData
.
length
&&
listlead
sData
.
length
>
0
){
listlead
sData
.
forEach
((
item
:
any
)
=>
{
masterData
.
listcontacts
=
listcontac
tsData
;
let
campaignlist
sData
:
any
=
[];
if
(
!
Object
.
is
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_
campaignlist
s'
),
'undefined'
)){
campaignlistsData
=
JSON
.
parse
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_campaignlist
s'
)
as
any
);
if
(
campaignlistsData
&&
campaignlistsData
.
length
&&
campaignlist
sData
.
length
>
0
){
campaignlist
sData
.
forEach
((
item
:
any
)
=>
{
if
(
item
.
srffrontuf
){
if
(
Object
.
is
(
item
.
srffrontuf
,
"0"
)){
item
.
relationshipsid
=
null
;
...
...
@@ -208,13 +208,13 @@ export default class IBizListServiceBase extends EntityService {
});
}
}
masterData
.
listleads
=
listlead
sData
;
masterData
.
campaignlists
=
campaignlist
sData
;
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
+
'_campaignlists'
,
JSON
.
stringify
(
res
.
data
.
campaignlists
));
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,10 +242,10 @@ 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
+
'_campaignlists'
,
JSON
.
stringify
(
res
.
data
.
campaignlists
));
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,10 +261,10 @@ 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
+
'_campaignlists'
,
JSON
.
stringify
(
res
.
data
.
campaignlists
));
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,11 +292,11 @@ export default class IBizListServiceBase extends EntityService {
*/
public
async
Save
(
context
:
any
=
{},
data
:
any
=
{},
isloading
?:
boolean
):
Promise
<
any
>
{
let
masterData
:
any
=
{};
let
list
contac
tsData
:
any
=
[];
if
(
!
Object
.
is
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_list
contac
ts'
),
'undefined'
)){
list
contactsData
=
JSON
.
parse
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_listcontac
ts'
)
as
any
);
if
(
list
contactsData
&&
listcontactsData
.
length
&&
listcontac
tsData
.
length
>
0
){
list
contac
tsData
.
forEach
((
item
:
any
)
=>
{
let
list
accoun
tsData
:
any
=
[];
if
(
!
Object
.
is
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_list
accoun
ts'
),
'undefined'
)){
list
accountsData
=
JSON
.
parse
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_listaccoun
ts'
)
as
any
);
if
(
list
accountsData
&&
listaccountsData
.
length
&&
listaccoun
tsData
.
length
>
0
){
list
accoun
tsData
.
forEach
((
item
:
any
)
=>
{
if
(
item
.
srffrontuf
){
if
(
Object
.
is
(
item
.
srffrontuf
,
"0"
)){
item
.
relationshipsid
=
null
;
...
...
@@ -306,12 +306,12 @@ export default class IBizListServiceBase extends EntityService {
});
}
}
masterData
.
list
contacts
=
listcontac
tsData
;
let
list
account
sData
:
any
=
[];
if
(
!
Object
.
is
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_list
account
s'
),
'undefined'
)){
list
accountsData
=
JSON
.
parse
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_listaccount
s'
)
as
any
);
if
(
list
accountsData
&&
listaccountsData
.
length
&&
listaccount
sData
.
length
>
0
){
list
account
sData
.
forEach
((
item
:
any
)
=>
{
masterData
.
list
accounts
=
listaccoun
tsData
;
let
list
lead
sData
:
any
=
[];
if
(
!
Object
.
is
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_list
lead
s'
),
'undefined'
)){
list
leadsData
=
JSON
.
parse
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_listlead
s'
)
as
any
);
if
(
list
leadsData
&&
listleadsData
.
length
&&
listlead
sData
.
length
>
0
){
list
lead
sData
.
forEach
((
item
:
any
)
=>
{
if
(
item
.
srffrontuf
){
if
(
Object
.
is
(
item
.
srffrontuf
,
"0"
)){
item
.
relationshipsid
=
null
;
...
...
@@ -321,12 +321,12 @@ export default class IBizListServiceBase extends EntityService {
});
}
}
masterData
.
list
accounts
=
listaccount
sData
;
let
campaignlis
tsData
:
any
=
[];
if
(
!
Object
.
is
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_
campaignlis
ts'
),
'undefined'
)){
campaignlistsData
=
JSON
.
parse
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_campaignlis
ts'
)
as
any
);
if
(
campaignlistsData
&&
campaignlistsData
.
length
&&
campaignlis
tsData
.
length
>
0
){
campaignlis
tsData
.
forEach
((
item
:
any
)
=>
{
masterData
.
list
leads
=
listlead
sData
;
let
listcontac
tsData
:
any
=
[];
if
(
!
Object
.
is
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_
listcontac
ts'
),
'undefined'
)){
listcontactsData
=
JSON
.
parse
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_listcontac
ts'
)
as
any
);
if
(
listcontactsData
&&
listcontactsData
.
length
&&
listcontac
tsData
.
length
>
0
){
listcontac
tsData
.
forEach
((
item
:
any
)
=>
{
if
(
item
.
srffrontuf
){
if
(
Object
.
is
(
item
.
srffrontuf
,
"0"
)){
item
.
relationshipsid
=
null
;
...
...
@@ -336,12 +336,12 @@ export default class IBizListServiceBase extends EntityService {
});
}
}
masterData
.
campaignlists
=
campaignlis
tsData
;
let
listlead
sData
:
any
=
[];
if
(
!
Object
.
is
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_
listlead
s'
),
'undefined'
)){
listleadsData
=
JSON
.
parse
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_listlead
s'
)
as
any
);
if
(
listleadsData
&&
listleadsData
.
length
&&
listlead
sData
.
length
>
0
){
listlead
sData
.
forEach
((
item
:
any
)
=>
{
masterData
.
listcontacts
=
listcontac
tsData
;
let
campaignlist
sData
:
any
=
[];
if
(
!
Object
.
is
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_
campaignlist
s'
),
'undefined'
)){
campaignlistsData
=
JSON
.
parse
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_campaignlist
s'
)
as
any
);
if
(
campaignlistsData
&&
campaignlistsData
.
length
&&
campaignlist
sData
.
length
>
0
){
campaignlist
sData
.
forEach
((
item
:
any
)
=>
{
if
(
item
.
srffrontuf
){
if
(
Object
.
is
(
item
.
srffrontuf
,
"0"
)){
item
.
relationshipsid
=
null
;
...
...
@@ -351,13 +351,13 @@ export default class IBizListServiceBase extends EntityService {
});
}
}
masterData
.
listleads
=
listlead
sData
;
masterData
.
campaignlists
=
campaignlist
sData
;
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
+
'_campaignlists'
,
JSON
.
stringify
(
res
.
data
.
campaignlists
));
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
;
}
...
...
app_CRM/src/service/opportunity/opportunity-service-base.ts
浏览文件 @
45d495c5
...
...
@@ -69,6 +69,21 @@ export default class OpportunityServiceBase extends EntityService {
public
async
Create
(
context
:
any
=
{},
data
:
any
=
{},
isloading
?:
boolean
):
Promise
<
any
>
{
if
(
context
.
account
&&
context
.
contact
&&
true
){
let
masterData
:
any
=
{};
let
opportunityproductsData
:
any
=
[];
if
(
!
Object
.
is
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_opportunityproducts'
),
'undefined'
)){
opportunityproductsData
=
JSON
.
parse
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_opportunityproducts'
)
as
any
);
if
(
opportunityproductsData
&&
opportunityproductsData
.
length
&&
opportunityproductsData
.
length
>
0
){
opportunityproductsData
.
forEach
((
item
:
any
)
=>
{
if
(
item
.
srffrontuf
){
if
(
Object
.
is
(
item
.
srffrontuf
,
"0"
)){
item
.
opportunityproductid
=
null
;
}
delete
item
.
srffrontuf
;
}
});
}
}
masterData
.
opportunityproducts
=
opportunityproductsData
;
let
opportunitycompetitorsData
:
any
=
[];
if
(
!
Object
.
is
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_opportunitycompetitors'
),
'undefined'
)){
opportunitycompetitorsData
=
JSON
.
parse
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_opportunitycompetitors'
)
as
any
);
...
...
@@ -99,21 +114,6 @@ export default class OpportunityServiceBase extends EntityService {
}
}
masterData
.
quotes
=
quotesData
;
let
opportunityproductsData
:
any
=
[];
if
(
!
Object
.
is
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_opportunityproducts'
),
'undefined'
)){
opportunityproductsData
=
JSON
.
parse
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_opportunityproducts'
)
as
any
);
if
(
opportunityproductsData
&&
opportunityproductsData
.
length
&&
opportunityproductsData
.
length
>
0
){
opportunityproductsData
.
forEach
((
item
:
any
)
=>
{
if
(
item
.
srffrontuf
){
if
(
Object
.
is
(
item
.
srffrontuf
,
"0"
)){
item
.
opportunityproductid
=
null
;
}
delete
item
.
srffrontuf
;
}
});
}
}
masterData
.
opportunityproducts
=
opportunityproductsData
;
Object
.
assign
(
data
,
masterData
);
if
(
!
data
.
srffrontuf
||
data
.
srffrontuf
!==
"1"
){
data
[
this
.
APPDEKEY
]
=
null
;
...
...
@@ -123,13 +123,28 @@ export default class OpportunityServiceBase extends EntityService {
}
let
tempContext
:
any
=
JSON
.
parse
(
JSON
.
stringify
(
context
));
let
res
:
any
=
await
Http
.
getInstance
().
post
(
`/accounts/
${
context
.
account
}
/contacts/
${
context
.
contact
}
/opportunities`
,
data
,
isloading
);
this
.
tempStorage
.
setItem
(
tempContext
.
srfsessionkey
+
'_opportunityproducts'
,
JSON
.
stringify
(
res
.
data
.
opportunityproducts
));
this
.
tempStorage
.
setItem
(
tempContext
.
srfsessionkey
+
'_opportunitycompetitors'
,
JSON
.
stringify
(
res
.
data
.
opportunitycompetitors
));
this
.
tempStorage
.
setItem
(
tempContext
.
srfsessionkey
+
'_quotes'
,
JSON
.
stringify
(
res
.
data
.
quotes
));
this
.
tempStorage
.
setItem
(
tempContext
.
srfsessionkey
+
'_opportunityproducts'
,
JSON
.
stringify
(
res
.
data
.
opportunityproducts
));
return
res
;
}
if
(
context
.
contact
&&
true
){
let
masterData
:
any
=
{};
let
opportunityproductsData
:
any
=
[];
if
(
!
Object
.
is
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_opportunityproducts'
),
'undefined'
)){
opportunityproductsData
=
JSON
.
parse
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_opportunityproducts'
)
as
any
);
if
(
opportunityproductsData
&&
opportunityproductsData
.
length
&&
opportunityproductsData
.
length
>
0
){
opportunityproductsData
.
forEach
((
item
:
any
)
=>
{
if
(
item
.
srffrontuf
){
if
(
Object
.
is
(
item
.
srffrontuf
,
"0"
)){
item
.
opportunityproductid
=
null
;
}
delete
item
.
srffrontuf
;
}
});
}
}
masterData
.
opportunityproducts
=
opportunityproductsData
;
let
opportunitycompetitorsData
:
any
=
[];
if
(
!
Object
.
is
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_opportunitycompetitors'
),
'undefined'
)){
opportunitycompetitorsData
=
JSON
.
parse
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_opportunitycompetitors'
)
as
any
);
...
...
@@ -160,6 +175,21 @@ export default class OpportunityServiceBase extends EntityService {
}
}
masterData
.
quotes
=
quotesData
;
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
(
`/contacts/
${
context
.
contact
}
/opportunities`
,
data
,
isloading
);
this
.
tempStorage
.
setItem
(
tempContext
.
srfsessionkey
+
'_opportunityproducts'
,
JSON
.
stringify
(
res
.
data
.
opportunityproducts
));
this
.
tempStorage
.
setItem
(
tempContext
.
srfsessionkey
+
'_opportunitycompetitors'
,
JSON
.
stringify
(
res
.
data
.
opportunitycompetitors
));
this
.
tempStorage
.
setItem
(
tempContext
.
srfsessionkey
+
'_quotes'
,
JSON
.
stringify
(
res
.
data
.
quotes
));
return
res
;
}
let
masterData
:
any
=
{};
let
opportunityproductsData
:
any
=
[];
if
(
!
Object
.
is
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_opportunityproducts'
),
'undefined'
)){
opportunityproductsData
=
JSON
.
parse
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_opportunityproducts'
)
as
any
);
...
...
@@ -175,21 +205,6 @@ export default class OpportunityServiceBase extends EntityService {
}
}
masterData
.
opportunityproducts
=
opportunityproductsData
;
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
(
`/contacts/
${
context
.
contact
}
/opportunities`
,
data
,
isloading
);
this
.
tempStorage
.
setItem
(
tempContext
.
srfsessionkey
+
'_opportunitycompetitors'
,
JSON
.
stringify
(
res
.
data
.
opportunitycompetitors
));
this
.
tempStorage
.
setItem
(
tempContext
.
srfsessionkey
+
'_quotes'
,
JSON
.
stringify
(
res
.
data
.
quotes
));
this
.
tempStorage
.
setItem
(
tempContext
.
srfsessionkey
+
'_opportunityproducts'
,
JSON
.
stringify
(
res
.
data
.
opportunityproducts
));
return
res
;
}
let
masterData
:
any
=
{};
let
opportunitycompetitorsData
:
any
=
[];
if
(
!
Object
.
is
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_opportunitycompetitors'
),
'undefined'
)){
opportunitycompetitorsData
=
JSON
.
parse
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_opportunitycompetitors'
)
as
any
);
...
...
@@ -220,21 +235,6 @@ export default class OpportunityServiceBase extends EntityService {
}
}
masterData
.
quotes
=
quotesData
;
let
opportunityproductsData
:
any
=
[];
if
(
!
Object
.
is
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_opportunityproducts'
),
'undefined'
)){
opportunityproductsData
=
JSON
.
parse
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_opportunityproducts'
)
as
any
);
if
(
opportunityproductsData
&&
opportunityproductsData
.
length
&&
opportunityproductsData
.
length
>
0
){
opportunityproductsData
.
forEach
((
item
:
any
)
=>
{
if
(
item
.
srffrontuf
){
if
(
Object
.
is
(
item
.
srffrontuf
,
"0"
)){
item
.
opportunityproductid
=
null
;
}
delete
item
.
srffrontuf
;
}
});
}
}
masterData
.
opportunityproducts
=
opportunityproductsData
;
Object
.
assign
(
data
,
masterData
);
if
(
!
data
.
srffrontuf
||
data
.
srffrontuf
!==
"1"
){
data
[
this
.
APPDEKEY
]
=
null
;
...
...
@@ -244,9 +244,9 @@ export default class OpportunityServiceBase extends EntityService {
}
let
tempContext
:
any
=
JSON
.
parse
(
JSON
.
stringify
(
context
));
let
res
:
any
=
await
Http
.
getInstance
().
post
(
`/opportunities`
,
data
,
isloading
);
this
.
tempStorage
.
setItem
(
tempContext
.
srfsessionkey
+
'_opportunityproducts'
,
JSON
.
stringify
(
res
.
data
.
opportunityproducts
));
this
.
tempStorage
.
setItem
(
tempContext
.
srfsessionkey
+
'_opportunitycompetitors'
,
JSON
.
stringify
(
res
.
data
.
opportunitycompetitors
));
this
.
tempStorage
.
setItem
(
tempContext
.
srfsessionkey
+
'_quotes'
,
JSON
.
stringify
(
res
.
data
.
quotes
));
this
.
tempStorage
.
setItem
(
tempContext
.
srfsessionkey
+
'_opportunityproducts'
,
JSON
.
stringify
(
res
.
data
.
opportunityproducts
));
return
res
;
}
...
...
@@ -262,6 +262,21 @@ export default class OpportunityServiceBase extends EntityService {
public
async
Update
(
context
:
any
=
{},
data
:
any
=
{},
isloading
?:
boolean
):
Promise
<
any
>
{
if
(
context
.
account
&&
context
.
contact
&&
context
.
opportunity
){
let
masterData
:
any
=
{};
let
opportunityproductsData
:
any
=
[];
if
(
!
Object
.
is
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_opportunityproducts'
),
'undefined'
)){
opportunityproductsData
=
JSON
.
parse
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_opportunityproducts'
)
as
any
);
if
(
opportunityproductsData
&&
opportunityproductsData
.
length
&&
opportunityproductsData
.
length
>
0
){
opportunityproductsData
.
forEach
((
item
:
any
)
=>
{
if
(
item
.
srffrontuf
){
if
(
Object
.
is
(
item
.
srffrontuf
,
"0"
)){
item
.
opportunityproductid
=
null
;
}
delete
item
.
srffrontuf
;
}
});
}
}
masterData
.
opportunityproducts
=
opportunityproductsData
;
let
opportunitycompetitorsData
:
any
=
[];
if
(
!
Object
.
is
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_opportunitycompetitors'
),
'undefined'
)){
opportunitycompetitorsData
=
JSON
.
parse
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_opportunitycompetitors'
)
as
any
);
...
...
@@ -292,6 +307,15 @@ export default class OpportunityServiceBase extends EntityService {
}
}
masterData
.
quotes
=
quotesData
;
Object
.
assign
(
data
,
masterData
);
let
res
:
any
=
await
Http
.
getInstance
().
put
(
`/accounts/
${
context
.
account
}
/contacts/
${
context
.
contact
}
/opportunities/
${
context
.
opportunity
}
`
,
data
,
isloading
);
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_opportunityproducts'
,
JSON
.
stringify
(
res
.
data
.
opportunityproducts
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_opportunitycompetitors'
,
JSON
.
stringify
(
res
.
data
.
opportunitycompetitors
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_quotes'
,
JSON
.
stringify
(
res
.
data
.
quotes
));
return
res
;
}
if
(
context
.
contact
&&
context
.
opportunity
){
let
masterData
:
any
=
{};
let
opportunityproductsData
:
any
=
[];
if
(
!
Object
.
is
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_opportunityproducts'
),
'undefined'
)){
opportunityproductsData
=
JSON
.
parse
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_opportunityproducts'
)
as
any
);
...
...
@@ -307,15 +331,6 @@ export default class OpportunityServiceBase extends EntityService {
}
}
masterData
.
opportunityproducts
=
opportunityproductsData
;
Object
.
assign
(
data
,
masterData
);
let
res
:
any
=
await
Http
.
getInstance
().
put
(
`/accounts/
${
context
.
account
}
/contacts/
${
context
.
contact
}
/opportunities/
${
context
.
opportunity
}
`
,
data
,
isloading
);
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_opportunitycompetitors'
,
JSON
.
stringify
(
res
.
data
.
opportunitycompetitors
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_quotes'
,
JSON
.
stringify
(
res
.
data
.
quotes
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_opportunityproducts'
,
JSON
.
stringify
(
res
.
data
.
opportunityproducts
));
return
res
;
}
if
(
context
.
contact
&&
context
.
opportunity
){
let
masterData
:
any
=
{};
let
opportunitycompetitorsData
:
any
=
[];
if
(
!
Object
.
is
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_opportunitycompetitors'
),
'undefined'
)){
opportunitycompetitorsData
=
JSON
.
parse
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_opportunitycompetitors'
)
as
any
);
...
...
@@ -346,6 +361,14 @@ export default class OpportunityServiceBase extends EntityService {
}
}
masterData
.
quotes
=
quotesData
;
Object
.
assign
(
data
,
masterData
);
let
res
:
any
=
await
Http
.
getInstance
().
put
(
`/contacts/
${
context
.
contact
}
/opportunities/
${
context
.
opportunity
}
`
,
data
,
isloading
);
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_opportunityproducts'
,
JSON
.
stringify
(
res
.
data
.
opportunityproducts
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_opportunitycompetitors'
,
JSON
.
stringify
(
res
.
data
.
opportunitycompetitors
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_quotes'
,
JSON
.
stringify
(
res
.
data
.
quotes
));
return
res
;
}
let
masterData
:
any
=
{};
let
opportunityproductsData
:
any
=
[];
if
(
!
Object
.
is
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_opportunityproducts'
),
'undefined'
)){
opportunityproductsData
=
JSON
.
parse
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_opportunityproducts'
)
as
any
);
...
...
@@ -361,14 +384,6 @@ export default class OpportunityServiceBase extends EntityService {
}
}
masterData
.
opportunityproducts
=
opportunityproductsData
;
Object
.
assign
(
data
,
masterData
);
let
res
:
any
=
await
Http
.
getInstance
().
put
(
`/contacts/
${
context
.
contact
}
/opportunities/
${
context
.
opportunity
}
`
,
data
,
isloading
);
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_opportunitycompetitors'
,
JSON
.
stringify
(
res
.
data
.
opportunitycompetitors
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_quotes'
,
JSON
.
stringify
(
res
.
data
.
quotes
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_opportunityproducts'
,
JSON
.
stringify
(
res
.
data
.
opportunityproducts
));
return
res
;
}
let
masterData
:
any
=
{};
let
opportunitycompetitorsData
:
any
=
[];
if
(
!
Object
.
is
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_opportunitycompetitors'
),
'undefined'
)){
opportunitycompetitorsData
=
JSON
.
parse
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_opportunitycompetitors'
)
as
any
);
...
...
@@ -399,26 +414,11 @@ export default class OpportunityServiceBase extends EntityService {
}
}
masterData
.
quotes
=
quotesData
;
let
opportunityproductsData
:
any
=
[];
if
(
!
Object
.
is
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_opportunityproducts'
),
'undefined'
)){
opportunityproductsData
=
JSON
.
parse
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_opportunityproducts'
)
as
any
);
if
(
opportunityproductsData
&&
opportunityproductsData
.
length
&&
opportunityproductsData
.
length
>
0
){
opportunityproductsData
.
forEach
((
item
:
any
)
=>
{
if
(
item
.
srffrontuf
){
if
(
Object
.
is
(
item
.
srffrontuf
,
"0"
)){
item
.
opportunityproductid
=
null
;
}
delete
item
.
srffrontuf
;
}
});
}
}
masterData
.
opportunityproducts
=
opportunityproductsData
;
Object
.
assign
(
data
,
masterData
);
let
res
:
any
=
await
Http
.
getInstance
().
put
(
`/opportunities/
${
context
.
opportunity
}
`
,
data
,
isloading
);
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_opportunityproducts'
,
JSON
.
stringify
(
res
.
data
.
opportunityproducts
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_opportunitycompetitors'
,
JSON
.
stringify
(
res
.
data
.
opportunitycompetitors
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_quotes'
,
JSON
.
stringify
(
res
.
data
.
quotes
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_opportunityproducts'
,
JSON
.
stringify
(
res
.
data
.
opportunityproducts
));
return
res
;
}
...
...
@@ -453,22 +453,22 @@ export default class OpportunityServiceBase extends EntityService {
public
async
Get
(
context
:
any
=
{},
data
:
any
=
{},
isloading
?:
boolean
):
Promise
<
any
>
{
if
(
context
.
account
&&
context
.
contact
&&
context
.
opportunity
){
let
res
:
any
=
await
Http
.
getInstance
().
get
(
`/accounts/
${
context
.
account
}
/contacts/
${
context
.
contact
}
/opportunities/
${
context
.
opportunity
}
`
,
isloading
);
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_opportunityproducts'
,
JSON
.
stringify
(
res
.
data
.
opportunityproducts
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_opportunitycompetitors'
,
JSON
.
stringify
(
res
.
data
.
opportunitycompetitors
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_quotes'
,
JSON
.
stringify
(
res
.
data
.
quotes
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_opportunityproducts'
,
JSON
.
stringify
(
res
.
data
.
opportunityproducts
));
return
res
;
}
if
(
context
.
contact
&&
context
.
opportunity
){
let
res
:
any
=
await
Http
.
getInstance
().
get
(
`/contacts/
${
context
.
contact
}
/opportunities/
${
context
.
opportunity
}
`
,
isloading
);
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_opportunityproducts'
,
JSON
.
stringify
(
res
.
data
.
opportunityproducts
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_opportunitycompetitors'
,
JSON
.
stringify
(
res
.
data
.
opportunitycompetitors
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_quotes'
,
JSON
.
stringify
(
res
.
data
.
quotes
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_opportunityproducts'
,
JSON
.
stringify
(
res
.
data
.
opportunityproducts
));
return
res
;
}
let
res
:
any
=
await
Http
.
getInstance
().
get
(
`/opportunities/
${
context
.
opportunity
}
`
,
isloading
);
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_opportunityproducts'
,
JSON
.
stringify
(
res
.
data
.
opportunityproducts
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_opportunitycompetitors'
,
JSON
.
stringify
(
res
.
data
.
opportunitycompetitors
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_quotes'
,
JSON
.
stringify
(
res
.
data
.
quotes
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_opportunityproducts'
,
JSON
.
stringify
(
res
.
data
.
opportunityproducts
));
return
res
;
}
...
...
@@ -485,24 +485,24 @@ export default class OpportunityServiceBase extends EntityService {
if
(
context
.
account
&&
context
.
contact
&&
true
){
let
res
:
any
=
await
Http
.
getInstance
().
get
(
`/accounts/
${
context
.
account
}
/contacts/
${
context
.
contact
}
/opportunities/getdraft`
,
isloading
);
res
.
data
.
opportunity
=
data
.
opportunity
;
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_opportunityproducts'
,
JSON
.
stringify
(
res
.
data
.
opportunityproducts
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_opportunitycompetitors'
,
JSON
.
stringify
(
res
.
data
.
opportunitycompetitors
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_quotes'
,
JSON
.
stringify
(
res
.
data
.
quotes
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_opportunityproducts'
,
JSON
.
stringify
(
res
.
data
.
opportunityproducts
));
return
res
;
}
if
(
context
.
contact
&&
true
){
let
res
:
any
=
await
Http
.
getInstance
().
get
(
`/contacts/
${
context
.
contact
}
/opportunities/getdraft`
,
isloading
);
res
.
data
.
opportunity
=
data
.
opportunity
;
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_opportunityproducts'
,
JSON
.
stringify
(
res
.
data
.
opportunityproducts
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_opportunitycompetitors'
,
JSON
.
stringify
(
res
.
data
.
opportunitycompetitors
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_quotes'
,
JSON
.
stringify
(
res
.
data
.
quotes
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_opportunityproducts'
,
JSON
.
stringify
(
res
.
data
.
opportunityproducts
));
return
res
;
}
let
res
:
any
=
await
Http
.
getInstance
().
get
(
`/opportunities/getdraft`
,
isloading
);
res
.
data
.
opportunity
=
data
.
opportunity
;
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_opportunityproducts'
,
JSON
.
stringify
(
res
.
data
.
opportunityproducts
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_opportunitycompetitors'
,
JSON
.
stringify
(
res
.
data
.
opportunitycompetitors
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_quotes'
,
JSON
.
stringify
(
res
.
data
.
quotes
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_opportunityproducts'
,
JSON
.
stringify
(
res
.
data
.
opportunityproducts
));
return
res
;
}
...
...
@@ -518,6 +518,21 @@ export default class OpportunityServiceBase extends EntityService {
public
async
CheckKey
(
context
:
any
=
{},
data
:
any
=
{},
isloading
?:
boolean
):
Promise
<
any
>
{
if
(
context
.
account
&&
context
.
contact
&&
context
.
opportunity
){
let
masterData
:
any
=
{};
let
opportunityproductsData
:
any
=
[];
if
(
!
Object
.
is
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_opportunityproducts'
),
'undefined'
)){
opportunityproductsData
=
JSON
.
parse
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_opportunityproducts'
)
as
any
);
if
(
opportunityproductsData
&&
opportunityproductsData
.
length
&&
opportunityproductsData
.
length
>
0
){
opportunityproductsData
.
forEach
((
item
:
any
)
=>
{
if
(
item
.
srffrontuf
){
if
(
Object
.
is
(
item
.
srffrontuf
,
"0"
)){
item
.
opportunityproductid
=
null
;
}
delete
item
.
srffrontuf
;
}
});
}
}
masterData
.
opportunityproducts
=
opportunityproductsData
;
let
opportunitycompetitorsData
:
any
=
[];
if
(
!
Object
.
is
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_opportunitycompetitors'
),
'undefined'
)){
opportunitycompetitorsData
=
JSON
.
parse
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_opportunitycompetitors'
)
as
any
);
...
...
@@ -548,6 +563,15 @@ export default class OpportunityServiceBase extends EntityService {
}
}
masterData
.
quotes
=
quotesData
;
Object
.
assign
(
data
,
masterData
);
let
res
:
any
=
await
Http
.
getInstance
().
post
(
`/accounts/
${
context
.
account
}
/contacts/
${
context
.
contact
}
/opportunities/
${
context
.
opportunity
}
/checkkey`
,
data
,
isloading
);
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_opportunityproducts'
,
JSON
.
stringify
(
res
.
data
.
opportunityproducts
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_opportunitycompetitors'
,
JSON
.
stringify
(
res
.
data
.
opportunitycompetitors
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_quotes'
,
JSON
.
stringify
(
res
.
data
.
quotes
));
return
res
;
}
if
(
context
.
contact
&&
context
.
opportunity
){
let
masterData
:
any
=
{};
let
opportunityproductsData
:
any
=
[];
if
(
!
Object
.
is
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_opportunityproducts'
),
'undefined'
)){
opportunityproductsData
=
JSON
.
parse
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_opportunityproducts'
)
as
any
);
...
...
@@ -563,15 +587,6 @@ export default class OpportunityServiceBase extends EntityService {
}
}
masterData
.
opportunityproducts
=
opportunityproductsData
;
Object
.
assign
(
data
,
masterData
);
let
res
:
any
=
await
Http
.
getInstance
().
post
(
`/accounts/
${
context
.
account
}
/contacts/
${
context
.
contact
}
/opportunities/
${
context
.
opportunity
}
/checkkey`
,
data
,
isloading
);
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_opportunitycompetitors'
,
JSON
.
stringify
(
res
.
data
.
opportunitycompetitors
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_quotes'
,
JSON
.
stringify
(
res
.
data
.
quotes
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_opportunityproducts'
,
JSON
.
stringify
(
res
.
data
.
opportunityproducts
));
return
res
;
}
if
(
context
.
contact
&&
context
.
opportunity
){
let
masterData
:
any
=
{};
let
opportunitycompetitorsData
:
any
=
[];
if
(
!
Object
.
is
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_opportunitycompetitors'
),
'undefined'
)){
opportunitycompetitorsData
=
JSON
.
parse
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_opportunitycompetitors'
)
as
any
);
...
...
@@ -602,26 +617,11 @@ export default class OpportunityServiceBase extends EntityService {
}
}
masterData
.
quotes
=
quotesData
;
let
opportunityproductsData
:
any
=
[];
if
(
!
Object
.
is
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_opportunityproducts'
),
'undefined'
)){
opportunityproductsData
=
JSON
.
parse
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_opportunityproducts'
)
as
any
);
if
(
opportunityproductsData
&&
opportunityproductsData
.
length
&&
opportunityproductsData
.
length
>
0
){
opportunityproductsData
.
forEach
((
item
:
any
)
=>
{
if
(
item
.
srffrontuf
){
if
(
Object
.
is
(
item
.
srffrontuf
,
"0"
)){
item
.
opportunityproductid
=
null
;
}
delete
item
.
srffrontuf
;
}
});
}
}
masterData
.
opportunityproducts
=
opportunityproductsData
;
Object
.
assign
(
data
,
masterData
);
let
res
:
any
=
await
Http
.
getInstance
().
post
(
`/contacts/
${
context
.
contact
}
/opportunities/
${
context
.
opportunity
}
/checkkey`
,
data
,
isloading
);
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_opportunityproducts'
,
JSON
.
stringify
(
res
.
data
.
opportunityproducts
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_opportunitycompetitors'
,
JSON
.
stringify
(
res
.
data
.
opportunitycompetitors
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_quotes'
,
JSON
.
stringify
(
res
.
data
.
quotes
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_opportunityproducts'
,
JSON
.
stringify
(
res
.
data
.
opportunityproducts
));
return
res
;
}
return
Http
.
getInstance
().
post
(
`/opportunities/
${
context
.
opportunity
}
/checkkey`
,
data
,
isloading
);
...
...
@@ -639,6 +639,21 @@ export default class OpportunityServiceBase extends EntityService {
public
async
Lose
(
context
:
any
=
{},
data
:
any
=
{},
isloading
?:
boolean
):
Promise
<
any
>
{
if
(
context
.
account
&&
context
.
contact
&&
context
.
opportunity
){
let
masterData
:
any
=
{};
let
opportunityproductsData
:
any
=
[];
if
(
!
Object
.
is
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_opportunityproducts'
),
'undefined'
)){
opportunityproductsData
=
JSON
.
parse
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_opportunityproducts'
)
as
any
);
if
(
opportunityproductsData
&&
opportunityproductsData
.
length
&&
opportunityproductsData
.
length
>
0
){
opportunityproductsData
.
forEach
((
item
:
any
)
=>
{
if
(
item
.
srffrontuf
){
if
(
Object
.
is
(
item
.
srffrontuf
,
"0"
)){
item
.
opportunityproductid
=
null
;
}
delete
item
.
srffrontuf
;
}
});
}
}
masterData
.
opportunityproducts
=
opportunityproductsData
;
let
opportunitycompetitorsData
:
any
=
[];
if
(
!
Object
.
is
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_opportunitycompetitors'
),
'undefined'
)){
opportunitycompetitorsData
=
JSON
.
parse
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_opportunitycompetitors'
)
as
any
);
...
...
@@ -669,6 +684,15 @@ export default class OpportunityServiceBase extends EntityService {
}
}
masterData
.
quotes
=
quotesData
;
Object
.
assign
(
data
,
masterData
);
let
res
:
any
=
await
Http
.
getInstance
().
post
(
`/accounts/
${
context
.
account
}
/contacts/
${
context
.
contact
}
/opportunities/
${
context
.
opportunity
}
/lose`
,
data
,
isloading
);
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_opportunityproducts'
,
JSON
.
stringify
(
res
.
data
.
opportunityproducts
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_opportunitycompetitors'
,
JSON
.
stringify
(
res
.
data
.
opportunitycompetitors
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_quotes'
,
JSON
.
stringify
(
res
.
data
.
quotes
));
return
res
;
}
if
(
context
.
contact
&&
context
.
opportunity
){
let
masterData
:
any
=
{};
let
opportunityproductsData
:
any
=
[];
if
(
!
Object
.
is
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_opportunityproducts'
),
'undefined'
)){
opportunityproductsData
=
JSON
.
parse
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_opportunityproducts'
)
as
any
);
...
...
@@ -684,15 +708,6 @@ export default class OpportunityServiceBase extends EntityService {
}
}
masterData
.
opportunityproducts
=
opportunityproductsData
;
Object
.
assign
(
data
,
masterData
);
let
res
:
any
=
await
Http
.
getInstance
().
post
(
`/accounts/
${
context
.
account
}
/contacts/
${
context
.
contact
}
/opportunities/
${
context
.
opportunity
}
/lose`
,
data
,
isloading
);
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_opportunitycompetitors'
,
JSON
.
stringify
(
res
.
data
.
opportunitycompetitors
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_quotes'
,
JSON
.
stringify
(
res
.
data
.
quotes
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_opportunityproducts'
,
JSON
.
stringify
(
res
.
data
.
opportunityproducts
));
return
res
;
}
if
(
context
.
contact
&&
context
.
opportunity
){
let
masterData
:
any
=
{};
let
opportunitycompetitorsData
:
any
=
[];
if
(
!
Object
.
is
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_opportunitycompetitors'
),
'undefined'
)){
opportunitycompetitorsData
=
JSON
.
parse
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_opportunitycompetitors'
)
as
any
);
...
...
@@ -723,26 +738,11 @@ export default class OpportunityServiceBase extends EntityService {
}
}
masterData
.
quotes
=
quotesData
;
let
opportunityproductsData
:
any
=
[];
if
(
!
Object
.
is
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_opportunityproducts'
),
'undefined'
)){
opportunityproductsData
=
JSON
.
parse
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_opportunityproducts'
)
as
any
);
if
(
opportunityproductsData
&&
opportunityproductsData
.
length
&&
opportunityproductsData
.
length
>
0
){
opportunityproductsData
.
forEach
((
item
:
any
)
=>
{
if
(
item
.
srffrontuf
){
if
(
Object
.
is
(
item
.
srffrontuf
,
"0"
)){
item
.
opportunityproductid
=
null
;
}
delete
item
.
srffrontuf
;
}
});
}
}
masterData
.
opportunityproducts
=
opportunityproductsData
;
Object
.
assign
(
data
,
masterData
);
let
res
:
any
=
await
Http
.
getInstance
().
post
(
`/contacts/
${
context
.
contact
}
/opportunities/
${
context
.
opportunity
}
/lose`
,
data
,
isloading
);
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_opportunityproducts'
,
JSON
.
stringify
(
res
.
data
.
opportunityproducts
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_opportunitycompetitors'
,
JSON
.
stringify
(
res
.
data
.
opportunitycompetitors
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_quotes'
,
JSON
.
stringify
(
res
.
data
.
quotes
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_opportunityproducts'
,
JSON
.
stringify
(
res
.
data
.
opportunityproducts
));
return
res
;
}
return
Http
.
getInstance
().
post
(
`/opportunities/
${
context
.
opportunity
}
/lose`
,
data
,
isloading
);
...
...
@@ -760,6 +760,21 @@ export default class OpportunityServiceBase extends EntityService {
public
async
Save
(
context
:
any
=
{},
data
:
any
=
{},
isloading
?:
boolean
):
Promise
<
any
>
{
if
(
context
.
account
&&
context
.
contact
&&
context
.
opportunity
){
let
masterData
:
any
=
{};
let
opportunityproductsData
:
any
=
[];
if
(
!
Object
.
is
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_opportunityproducts'
),
'undefined'
)){
opportunityproductsData
=
JSON
.
parse
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_opportunityproducts'
)
as
any
);
if
(
opportunityproductsData
&&
opportunityproductsData
.
length
&&
opportunityproductsData
.
length
>
0
){
opportunityproductsData
.
forEach
((
item
:
any
)
=>
{
if
(
item
.
srffrontuf
){
if
(
Object
.
is
(
item
.
srffrontuf
,
"0"
)){
item
.
opportunityproductid
=
null
;
}
delete
item
.
srffrontuf
;
}
});
}
}
masterData
.
opportunityproducts
=
opportunityproductsData
;
let
opportunitycompetitorsData
:
any
=
[];
if
(
!
Object
.
is
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_opportunitycompetitors'
),
'undefined'
)){
opportunitycompetitorsData
=
JSON
.
parse
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_opportunitycompetitors'
)
as
any
);
...
...
@@ -790,6 +805,15 @@ export default class OpportunityServiceBase extends EntityService {
}
}
masterData
.
quotes
=
quotesData
;
Object
.
assign
(
data
,
masterData
);
let
res
:
any
=
await
Http
.
getInstance
().
post
(
`/accounts/
${
context
.
account
}
/contacts/
${
context
.
contact
}
/opportunities/
${
context
.
opportunity
}
/save`
,
data
,
isloading
);
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_opportunityproducts'
,
JSON
.
stringify
(
res
.
data
.
opportunityproducts
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_opportunitycompetitors'
,
JSON
.
stringify
(
res
.
data
.
opportunitycompetitors
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_quotes'
,
JSON
.
stringify
(
res
.
data
.
quotes
));
return
res
;
}
if
(
context
.
contact
&&
context
.
opportunity
){
let
masterData
:
any
=
{};
let
opportunityproductsData
:
any
=
[];
if
(
!
Object
.
is
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_opportunityproducts'
),
'undefined'
)){
opportunityproductsData
=
JSON
.
parse
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_opportunityproducts'
)
as
any
);
...
...
@@ -805,15 +829,6 @@ export default class OpportunityServiceBase extends EntityService {
}
}
masterData
.
opportunityproducts
=
opportunityproductsData
;
Object
.
assign
(
data
,
masterData
);
let
res
:
any
=
await
Http
.
getInstance
().
post
(
`/accounts/
${
context
.
account
}
/contacts/
${
context
.
contact
}
/opportunities/
${
context
.
opportunity
}
/save`
,
data
,
isloading
);
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_opportunitycompetitors'
,
JSON
.
stringify
(
res
.
data
.
opportunitycompetitors
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_quotes'
,
JSON
.
stringify
(
res
.
data
.
quotes
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_opportunityproducts'
,
JSON
.
stringify
(
res
.
data
.
opportunityproducts
));
return
res
;
}
if
(
context
.
contact
&&
context
.
opportunity
){
let
masterData
:
any
=
{};
let
opportunitycompetitorsData
:
any
=
[];
if
(
!
Object
.
is
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_opportunitycompetitors'
),
'undefined'
)){
opportunitycompetitorsData
=
JSON
.
parse
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_opportunitycompetitors'
)
as
any
);
...
...
@@ -844,6 +859,14 @@ export default class OpportunityServiceBase extends EntityService {
}
}
masterData
.
quotes
=
quotesData
;
Object
.
assign
(
data
,
masterData
);
let
res
:
any
=
await
Http
.
getInstance
().
post
(
`/contacts/
${
context
.
contact
}
/opportunities/
${
context
.
opportunity
}
/save`
,
data
,
isloading
);
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_opportunityproducts'
,
JSON
.
stringify
(
res
.
data
.
opportunityproducts
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_opportunitycompetitors'
,
JSON
.
stringify
(
res
.
data
.
opportunitycompetitors
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_quotes'
,
JSON
.
stringify
(
res
.
data
.
quotes
));
return
res
;
}
let
masterData
:
any
=
{};
let
opportunityproductsData
:
any
=
[];
if
(
!
Object
.
is
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_opportunityproducts'
),
'undefined'
)){
opportunityproductsData
=
JSON
.
parse
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_opportunityproducts'
)
as
any
);
...
...
@@ -859,14 +882,6 @@ export default class OpportunityServiceBase extends EntityService {
}
}
masterData
.
opportunityproducts
=
opportunityproductsData
;
Object
.
assign
(
data
,
masterData
);
let
res
:
any
=
await
Http
.
getInstance
().
post
(
`/contacts/
${
context
.
contact
}
/opportunities/
${
context
.
opportunity
}
/save`
,
data
,
isloading
);
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_opportunitycompetitors'
,
JSON
.
stringify
(
res
.
data
.
opportunitycompetitors
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_quotes'
,
JSON
.
stringify
(
res
.
data
.
quotes
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_opportunityproducts'
,
JSON
.
stringify
(
res
.
data
.
opportunityproducts
));
return
res
;
}
let
masterData
:
any
=
{};
let
opportunitycompetitorsData
:
any
=
[];
if
(
!
Object
.
is
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_opportunitycompetitors'
),
'undefined'
)){
opportunitycompetitorsData
=
JSON
.
parse
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_opportunitycompetitors'
)
as
any
);
...
...
@@ -897,26 +912,11 @@ export default class OpportunityServiceBase extends EntityService {
}
}
masterData
.
quotes
=
quotesData
;
let
opportunityproductsData
:
any
=
[];
if
(
!
Object
.
is
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_opportunityproducts'
),
'undefined'
)){
opportunityproductsData
=
JSON
.
parse
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_opportunityproducts'
)
as
any
);
if
(
opportunityproductsData
&&
opportunityproductsData
.
length
&&
opportunityproductsData
.
length
>
0
){
opportunityproductsData
.
forEach
((
item
:
any
)
=>
{
if
(
item
.
srffrontuf
){
if
(
Object
.
is
(
item
.
srffrontuf
,
"0"
)){
item
.
opportunityproductid
=
null
;
}
delete
item
.
srffrontuf
;
}
});
}
}
masterData
.
opportunityproducts
=
opportunityproductsData
;
Object
.
assign
(
data
,
masterData
);
let
res
:
any
=
await
Http
.
getInstance
().
post
(
`/opportunities/
${
context
.
opportunity
}
/save`
,
data
,
isloading
);
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_opportunityproducts'
,
JSON
.
stringify
(
res
.
data
.
opportunityproducts
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_opportunitycompetitors'
,
JSON
.
stringify
(
res
.
data
.
opportunitycompetitors
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_quotes'
,
JSON
.
stringify
(
res
.
data
.
quotes
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_opportunityproducts'
,
JSON
.
stringify
(
res
.
data
.
opportunityproducts
));
return
res
;
}
...
...
@@ -932,6 +932,21 @@ export default class OpportunityServiceBase extends EntityService {
public
async
Win
(
context
:
any
=
{},
data
:
any
=
{},
isloading
?:
boolean
):
Promise
<
any
>
{
if
(
context
.
account
&&
context
.
contact
&&
context
.
opportunity
){
let
masterData
:
any
=
{};
let
opportunityproductsData
:
any
=
[];
if
(
!
Object
.
is
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_opportunityproducts'
),
'undefined'
)){
opportunityproductsData
=
JSON
.
parse
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_opportunityproducts'
)
as
any
);
if
(
opportunityproductsData
&&
opportunityproductsData
.
length
&&
opportunityproductsData
.
length
>
0
){
opportunityproductsData
.
forEach
((
item
:
any
)
=>
{
if
(
item
.
srffrontuf
){
if
(
Object
.
is
(
item
.
srffrontuf
,
"0"
)){
item
.
opportunityproductid
=
null
;
}
delete
item
.
srffrontuf
;
}
});
}
}
masterData
.
opportunityproducts
=
opportunityproductsData
;
let
opportunitycompetitorsData
:
any
=
[];
if
(
!
Object
.
is
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_opportunitycompetitors'
),
'undefined'
)){
opportunitycompetitorsData
=
JSON
.
parse
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_opportunitycompetitors'
)
as
any
);
...
...
@@ -962,6 +977,15 @@ export default class OpportunityServiceBase extends EntityService {
}
}
masterData
.
quotes
=
quotesData
;
Object
.
assign
(
data
,
masterData
);
let
res
:
any
=
await
Http
.
getInstance
().
post
(
`/accounts/
${
context
.
account
}
/contacts/
${
context
.
contact
}
/opportunities/
${
context
.
opportunity
}
/win`
,
data
,
isloading
);
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_opportunityproducts'
,
JSON
.
stringify
(
res
.
data
.
opportunityproducts
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_opportunitycompetitors'
,
JSON
.
stringify
(
res
.
data
.
opportunitycompetitors
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_quotes'
,
JSON
.
stringify
(
res
.
data
.
quotes
));
return
res
;
}
if
(
context
.
contact
&&
context
.
opportunity
){
let
masterData
:
any
=
{};
let
opportunityproductsData
:
any
=
[];
if
(
!
Object
.
is
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_opportunityproducts'
),
'undefined'
)){
opportunityproductsData
=
JSON
.
parse
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_opportunityproducts'
)
as
any
);
...
...
@@ -977,15 +1001,6 @@ export default class OpportunityServiceBase extends EntityService {
}
}
masterData
.
opportunityproducts
=
opportunityproductsData
;
Object
.
assign
(
data
,
masterData
);
let
res
:
any
=
await
Http
.
getInstance
().
post
(
`/accounts/
${
context
.
account
}
/contacts/
${
context
.
contact
}
/opportunities/
${
context
.
opportunity
}
/win`
,
data
,
isloading
);
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_opportunitycompetitors'
,
JSON
.
stringify
(
res
.
data
.
opportunitycompetitors
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_quotes'
,
JSON
.
stringify
(
res
.
data
.
quotes
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_opportunityproducts'
,
JSON
.
stringify
(
res
.
data
.
opportunityproducts
));
return
res
;
}
if
(
context
.
contact
&&
context
.
opportunity
){
let
masterData
:
any
=
{};
let
opportunitycompetitorsData
:
any
=
[];
if
(
!
Object
.
is
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_opportunitycompetitors'
),
'undefined'
)){
opportunitycompetitorsData
=
JSON
.
parse
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_opportunitycompetitors'
)
as
any
);
...
...
@@ -1016,26 +1031,11 @@ export default class OpportunityServiceBase extends EntityService {
}
}
masterData
.
quotes
=
quotesData
;
let
opportunityproductsData
:
any
=
[];
if
(
!
Object
.
is
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_opportunityproducts'
),
'undefined'
)){
opportunityproductsData
=
JSON
.
parse
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_opportunityproducts'
)
as
any
);
if
(
opportunityproductsData
&&
opportunityproductsData
.
length
&&
opportunityproductsData
.
length
>
0
){
opportunityproductsData
.
forEach
((
item
:
any
)
=>
{
if
(
item
.
srffrontuf
){
if
(
Object
.
is
(
item
.
srffrontuf
,
"0"
)){
item
.
opportunityproductid
=
null
;
}
delete
item
.
srffrontuf
;
}
});
}
}
masterData
.
opportunityproducts
=
opportunityproductsData
;
Object
.
assign
(
data
,
masterData
);
let
res
:
any
=
await
Http
.
getInstance
().
post
(
`/contacts/
${
context
.
contact
}
/opportunities/
${
context
.
opportunity
}
/win`
,
data
,
isloading
);
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_opportunityproducts'
,
JSON
.
stringify
(
res
.
data
.
opportunityproducts
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_opportunitycompetitors'
,
JSON
.
stringify
(
res
.
data
.
opportunitycompetitors
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_quotes'
,
JSON
.
stringify
(
res
.
data
.
quotes
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_opportunityproducts'
,
JSON
.
stringify
(
res
.
data
.
opportunityproducts
));
return
res
;
}
return
Http
.
getInstance
().
post
(
`/opportunities/
${
context
.
opportunity
}
/win`
,
data
,
isloading
);
...
...
app_CRM/src/service/product/product-service-base.ts
浏览文件 @
45d495c5
...
...
@@ -62,21 +62,21 @@ export default class ProductServiceBase extends EntityService {
*/
public
async
Create
(
context
:
any
=
{},
data
:
any
=
{},
isloading
?:
boolean
):
Promise
<
any
>
{
let
masterData
:
any
=
{};
let
product
association
sData
:
any
=
[];
if
(
!
Object
.
is
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_product
association
s'
),
'undefined'
)){
product
associationsData
=
JSON
.
parse
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_productassociation
s'
)
as
any
);
if
(
product
associationsData
&&
productassociationsData
.
length
&&
productassociation
sData
.
length
>
0
){
product
association
sData
.
forEach
((
item
:
any
)
=>
{
let
product
pricelevel
sData
:
any
=
[];
if
(
!
Object
.
is
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_product
pricelevel
s'
),
'undefined'
)){
product
pricelevelsData
=
JSON
.
parse
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_productpricelevel
s'
)
as
any
);
if
(
product
pricelevelsData
&&
productpricelevelsData
.
length
&&
productpricelevel
sData
.
length
>
0
){
product
pricelevel
sData
.
forEach
((
item
:
any
)
=>
{
if
(
item
.
srffrontuf
){
if
(
Object
.
is
(
item
.
srffrontuf
,
"0"
)){
item
.
product
association
id
=
null
;
item
.
product
pricelevel
id
=
null
;
}
delete
item
.
srffrontuf
;
}
});
}
}
masterData
.
product
associations
=
productassociation
sData
;
masterData
.
product
pricelevels
=
productpricelevel
sData
;
let
productsubstitutesData
:
any
=
[];
if
(
!
Object
.
is
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_productsubstitutes'
),
'undefined'
)){
productsubstitutesData
=
JSON
.
parse
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_productsubstitutes'
)
as
any
);
...
...
@@ -92,21 +92,21 @@ export default class ProductServiceBase extends EntityService {
}
}
masterData
.
productsubstitutes
=
productsubstitutesData
;
let
product
pricelevel
sData
:
any
=
[];
if
(
!
Object
.
is
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_product
pricelevel
s'
),
'undefined'
)){
product
pricelevelsData
=
JSON
.
parse
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_productpricelevel
s'
)
as
any
);
if
(
product
pricelevelsData
&&
productpricelevelsData
.
length
&&
productpricelevel
sData
.
length
>
0
){
product
pricelevel
sData
.
forEach
((
item
:
any
)
=>
{
let
product
association
sData
:
any
=
[];
if
(
!
Object
.
is
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_product
association
s'
),
'undefined'
)){
product
associationsData
=
JSON
.
parse
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_productassociation
s'
)
as
any
);
if
(
product
associationsData
&&
productassociationsData
.
length
&&
productassociation
sData
.
length
>
0
){
product
association
sData
.
forEach
((
item
:
any
)
=>
{
if
(
item
.
srffrontuf
){
if
(
Object
.
is
(
item
.
srffrontuf
,
"0"
)){
item
.
product
pricelevel
id
=
null
;
item
.
product
association
id
=
null
;
}
delete
item
.
srffrontuf
;
}
});
}
}
masterData
.
product
pricelevels
=
productpricelevel
sData
;
masterData
.
product
associations
=
productassociation
sData
;
Object
.
assign
(
data
,
masterData
);
if
(
!
data
.
srffrontuf
||
data
.
srffrontuf
!==
"1"
){
data
[
this
.
APPDEKEY
]
=
null
;
...
...
@@ -116,9 +116,9 @@ 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
+
'_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
));
this
.
tempStorage
.
setItem
(
tempContext
.
srfsessionkey
+
'_productsubstitutes'
,
JSON
.
stringify
(
res
.
data
.
productsubstitutes
));
this
.
tempStorage
.
setItem
(
tempContext
.
srfsessionkey
+
'_productassociations'
,
JSON
.
stringify
(
res
.
data
.
productassociations
));
return
res
;
}
...
...
@@ -133,21 +133,21 @@ export default class ProductServiceBase extends EntityService {
*/
public
async
Update
(
context
:
any
=
{},
data
:
any
=
{},
isloading
?:
boolean
):
Promise
<
any
>
{
let
masterData
:
any
=
{};
let
product
association
sData
:
any
=
[];
if
(
!
Object
.
is
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_product
association
s'
),
'undefined'
)){
product
associationsData
=
JSON
.
parse
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_productassociation
s'
)
as
any
);
if
(
product
associationsData
&&
productassociationsData
.
length
&&
productassociation
sData
.
length
>
0
){
product
association
sData
.
forEach
((
item
:
any
)
=>
{
let
product
pricelevel
sData
:
any
=
[];
if
(
!
Object
.
is
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_product
pricelevel
s'
),
'undefined'
)){
product
pricelevelsData
=
JSON
.
parse
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_productpricelevel
s'
)
as
any
);
if
(
product
pricelevelsData
&&
productpricelevelsData
.
length
&&
productpricelevel
sData
.
length
>
0
){
product
pricelevel
sData
.
forEach
((
item
:
any
)
=>
{
if
(
item
.
srffrontuf
){
if
(
Object
.
is
(
item
.
srffrontuf
,
"0"
)){
item
.
product
association
id
=
null
;
item
.
product
pricelevel
id
=
null
;
}
delete
item
.
srffrontuf
;
}
});
}
}
masterData
.
product
associations
=
productassociation
sData
;
masterData
.
product
pricelevels
=
productpricelevel
sData
;
let
productsubstitutesData
:
any
=
[];
if
(
!
Object
.
is
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_productsubstitutes'
),
'undefined'
)){
productsubstitutesData
=
JSON
.
parse
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_productsubstitutes'
)
as
any
);
...
...
@@ -163,26 +163,26 @@ export default class ProductServiceBase extends EntityService {
}
}
masterData
.
productsubstitutes
=
productsubstitutesData
;
let
product
pricelevel
sData
:
any
=
[];
if
(
!
Object
.
is
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_product
pricelevel
s'
),
'undefined'
)){
product
pricelevelsData
=
JSON
.
parse
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_productpricelevel
s'
)
as
any
);
if
(
product
pricelevelsData
&&
productpricelevelsData
.
length
&&
productpricelevel
sData
.
length
>
0
){
product
pricelevel
sData
.
forEach
((
item
:
any
)
=>
{
let
product
association
sData
:
any
=
[];
if
(
!
Object
.
is
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_product
association
s'
),
'undefined'
)){
product
associationsData
=
JSON
.
parse
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_productassociation
s'
)
as
any
);
if
(
product
associationsData
&&
productassociationsData
.
length
&&
productassociation
sData
.
length
>
0
){
product
association
sData
.
forEach
((
item
:
any
)
=>
{
if
(
item
.
srffrontuf
){
if
(
Object
.
is
(
item
.
srffrontuf
,
"0"
)){
item
.
product
pricelevel
id
=
null
;
item
.
product
association
id
=
null
;
}
delete
item
.
srffrontuf
;
}
});
}
}
masterData
.
product
pricelevels
=
productpricelevel
sData
;
masterData
.
product
associations
=
productassociation
sData
;
Object
.
assign
(
data
,
masterData
);
let
res
:
any
=
await
Http
.
getInstance
().
put
(
`/products/
${
context
.
product
}
`
,
data
,
isloading
);
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
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_productsubstitutes'
,
JSON
.
stringify
(
res
.
data
.
productsubstitutes
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_productassociations'
,
JSON
.
stringify
(
res
.
data
.
productassociations
));
return
res
;
}
...
...
@@ -210,9 +210,9 @@ 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
+
'_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
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_productsubstitutes'
,
JSON
.
stringify
(
res
.
data
.
productsubstitutes
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_productassociations'
,
JSON
.
stringify
(
res
.
data
.
productassociations
));
return
res
;
}
...
...
@@ -228,9 +228,9 @@ 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
+
'_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
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_productsubstitutes'
,
JSON
.
stringify
(
res
.
data
.
productsubstitutes
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_productassociations'
,
JSON
.
stringify
(
res
.
data
.
productassociations
));
return
res
;
}
...
...
@@ -258,21 +258,21 @@ export default class ProductServiceBase extends EntityService {
*/
public
async
Save
(
context
:
any
=
{},
data
:
any
=
{},
isloading
?:
boolean
):
Promise
<
any
>
{
let
masterData
:
any
=
{};
let
product
association
sData
:
any
=
[];
if
(
!
Object
.
is
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_product
association
s'
),
'undefined'
)){
product
associationsData
=
JSON
.
parse
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_productassociation
s'
)
as
any
);
if
(
product
associationsData
&&
productassociationsData
.
length
&&
productassociation
sData
.
length
>
0
){
product
association
sData
.
forEach
((
item
:
any
)
=>
{
let
product
pricelevel
sData
:
any
=
[];
if
(
!
Object
.
is
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_product
pricelevel
s'
),
'undefined'
)){
product
pricelevelsData
=
JSON
.
parse
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_productpricelevel
s'
)
as
any
);
if
(
product
pricelevelsData
&&
productpricelevelsData
.
length
&&
productpricelevel
sData
.
length
>
0
){
product
pricelevel
sData
.
forEach
((
item
:
any
)
=>
{
if
(
item
.
srffrontuf
){
if
(
Object
.
is
(
item
.
srffrontuf
,
"0"
)){
item
.
product
association
id
=
null
;
item
.
product
pricelevel
id
=
null
;
}
delete
item
.
srffrontuf
;
}
});
}
}
masterData
.
product
associations
=
productassociation
sData
;
masterData
.
product
pricelevels
=
productpricelevel
sData
;
let
productsubstitutesData
:
any
=
[];
if
(
!
Object
.
is
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_productsubstitutes'
),
'undefined'
)){
productsubstitutesData
=
JSON
.
parse
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_productsubstitutes'
)
as
any
);
...
...
@@ -288,26 +288,26 @@ export default class ProductServiceBase extends EntityService {
}
}
masterData
.
productsubstitutes
=
productsubstitutesData
;
let
product
pricelevel
sData
:
any
=
[];
if
(
!
Object
.
is
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_product
pricelevel
s'
),
'undefined'
)){
product
pricelevelsData
=
JSON
.
parse
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_productpricelevel
s'
)
as
any
);
if
(
product
pricelevelsData
&&
productpricelevelsData
.
length
&&
productpricelevel
sData
.
length
>
0
){
product
pricelevel
sData
.
forEach
((
item
:
any
)
=>
{
let
product
association
sData
:
any
=
[];
if
(
!
Object
.
is
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_product
association
s'
),
'undefined'
)){
product
associationsData
=
JSON
.
parse
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_productassociation
s'
)
as
any
);
if
(
product
associationsData
&&
productassociationsData
.
length
&&
productassociation
sData
.
length
>
0
){
product
association
sData
.
forEach
((
item
:
any
)
=>
{
if
(
item
.
srffrontuf
){
if
(
Object
.
is
(
item
.
srffrontuf
,
"0"
)){
item
.
product
pricelevel
id
=
null
;
item
.
product
association
id
=
null
;
}
delete
item
.
srffrontuf
;
}
});
}
}
masterData
.
product
pricelevels
=
productpricelevel
sData
;
masterData
.
product
associations
=
productassociation
sData
;
Object
.
assign
(
data
,
masterData
);
let
res
:
any
=
await
Http
.
getInstance
().
post
(
`/products/
${
context
.
product
}
/save`
,
data
,
isloading
);
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
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_productsubstitutes'
,
JSON
.
stringify
(
res
.
data
.
productsubstitutes
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_productassociations'
,
JSON
.
stringify
(
res
.
data
.
productassociations
));
return
res
;
}
...
...
app_CRM/src/service/sales-literature/sales-literature-service-base.ts
浏览文件 @
45d495c5
...
...
@@ -62,6 +62,21 @@ export default class SalesLiteratureServiceBase extends EntityService {
*/
public
async
Create
(
context
:
any
=
{},
data
:
any
=
{},
isloading
?:
boolean
):
Promise
<
any
>
{
let
masterData
:
any
=
{};
let
competitorsalesliteraturesData
:
any
=
[];
if
(
!
Object
.
is
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_competitorsalesliteratures'
),
'undefined'
)){
competitorsalesliteraturesData
=
JSON
.
parse
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_competitorsalesliteratures'
)
as
any
);
if
(
competitorsalesliteraturesData
&&
competitorsalesliteraturesData
.
length
&&
competitorsalesliteraturesData
.
length
>
0
){
competitorsalesliteraturesData
.
forEach
((
item
:
any
)
=>
{
if
(
item
.
srffrontuf
){
if
(
Object
.
is
(
item
.
srffrontuf
,
"0"
)){
item
.
relationshipsid
=
null
;
}
delete
item
.
srffrontuf
;
}
});
}
}
masterData
.
competitorsalesliteratures
=
competitorsalesliteraturesData
;
let
salesliteratureitemsData
:
any
=
[];
if
(
!
Object
.
is
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_salesliteratureitems'
),
'undefined'
)){
salesliteratureitemsData
=
JSON
.
parse
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_salesliteratureitems'
)
as
any
);
...
...
@@ -92,21 +107,6 @@ export default class SalesLiteratureServiceBase extends EntityService {
}
}
masterData
.
productsalesliteratures
=
productsalesliteraturesData
;
let
competitorsalesliteraturesData
:
any
=
[];
if
(
!
Object
.
is
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_competitorsalesliteratures'
),
'undefined'
)){
competitorsalesliteraturesData
=
JSON
.
parse
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_competitorsalesliteratures'
)
as
any
);
if
(
competitorsalesliteraturesData
&&
competitorsalesliteraturesData
.
length
&&
competitorsalesliteraturesData
.
length
>
0
){
competitorsalesliteraturesData
.
forEach
((
item
:
any
)
=>
{
if
(
item
.
srffrontuf
){
if
(
Object
.
is
(
item
.
srffrontuf
,
"0"
)){
item
.
relationshipsid
=
null
;
}
delete
item
.
srffrontuf
;
}
});
}
}
masterData
.
competitorsalesliteratures
=
competitorsalesliteraturesData
;
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
+
'_competitorsalesliteratures'
,
JSON
.
stringify
(
res
.
data
.
competitorsalesliteratures
));
this
.
tempStorage
.
setItem
(
tempContext
.
srfsessionkey
+
'_salesliteratureitems'
,
JSON
.
stringify
(
res
.
data
.
salesliteratureitems
));
this
.
tempStorage
.
setItem
(
tempContext
.
srfsessionkey
+
'_productsalesliteratures'
,
JSON
.
stringify
(
res
.
data
.
productsalesliteratures
));
this
.
tempStorage
.
setItem
(
tempContext
.
srfsessionkey
+
'_competitorsalesliteratures'
,
JSON
.
stringify
(
res
.
data
.
competitorsalesliteratures
));
return
res
;
}
...
...
@@ -133,6 +133,21 @@ export default class SalesLiteratureServiceBase extends EntityService {
*/
public
async
Update
(
context
:
any
=
{},
data
:
any
=
{},
isloading
?:
boolean
):
Promise
<
any
>
{
let
masterData
:
any
=
{};
let
competitorsalesliteraturesData
:
any
=
[];
if
(
!
Object
.
is
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_competitorsalesliteratures'
),
'undefined'
)){
competitorsalesliteraturesData
=
JSON
.
parse
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_competitorsalesliteratures'
)
as
any
);
if
(
competitorsalesliteraturesData
&&
competitorsalesliteraturesData
.
length
&&
competitorsalesliteraturesData
.
length
>
0
){
competitorsalesliteraturesData
.
forEach
((
item
:
any
)
=>
{
if
(
item
.
srffrontuf
){
if
(
Object
.
is
(
item
.
srffrontuf
,
"0"
)){
item
.
relationshipsid
=
null
;
}
delete
item
.
srffrontuf
;
}
});
}
}
masterData
.
competitorsalesliteratures
=
competitorsalesliteraturesData
;
let
salesliteratureitemsData
:
any
=
[];
if
(
!
Object
.
is
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_salesliteratureitems'
),
'undefined'
)){
salesliteratureitemsData
=
JSON
.
parse
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_salesliteratureitems'
)
as
any
);
...
...
@@ -163,26 +178,11 @@ export default class SalesLiteratureServiceBase extends EntityService {
}
}
masterData
.
productsalesliteratures
=
productsalesliteraturesData
;
let
competitorsalesliteraturesData
:
any
=
[];
if
(
!
Object
.
is
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_competitorsalesliteratures'
),
'undefined'
)){
competitorsalesliteraturesData
=
JSON
.
parse
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_competitorsalesliteratures'
)
as
any
);
if
(
competitorsalesliteraturesData
&&
competitorsalesliteraturesData
.
length
&&
competitorsalesliteraturesData
.
length
>
0
){
competitorsalesliteraturesData
.
forEach
((
item
:
any
)
=>
{
if
(
item
.
srffrontuf
){
if
(
Object
.
is
(
item
.
srffrontuf
,
"0"
)){
item
.
relationshipsid
=
null
;
}
delete
item
.
srffrontuf
;
}
});
}
}
masterData
.
competitorsalesliteratures
=
competitorsalesliteraturesData
;
Object
.
assign
(
data
,
masterData
);
let
res
:
any
=
await
Http
.
getInstance
().
put
(
`/salesliteratures/
${
context
.
salesliterature
}
`
,
data
,
isloading
);
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_competitorsalesliteratures'
,
JSON
.
stringify
(
res
.
data
.
competitorsalesliteratures
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_salesliteratureitems'
,
JSON
.
stringify
(
res
.
data
.
salesliteratureitems
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_productsalesliteratures'
,
JSON
.
stringify
(
res
.
data
.
productsalesliteratures
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_competitorsalesliteratures'
,
JSON
.
stringify
(
res
.
data
.
competitorsalesliteratures
));
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
+
'_competitorsalesliteratures'
,
JSON
.
stringify
(
res
.
data
.
competitorsalesliteratures
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_salesliteratureitems'
,
JSON
.
stringify
(
res
.
data
.
salesliteratureitems
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_productsalesliteratures'
,
JSON
.
stringify
(
res
.
data
.
productsalesliteratures
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_competitorsalesliteratures'
,
JSON
.
stringify
(
res
.
data
.
competitorsalesliteratures
));
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
+
'_competitorsalesliteratures'
,
JSON
.
stringify
(
res
.
data
.
competitorsalesliteratures
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_salesliteratureitems'
,
JSON
.
stringify
(
res
.
data
.
salesliteratureitems
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_productsalesliteratures'
,
JSON
.
stringify
(
res
.
data
.
productsalesliteratures
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_competitorsalesliteratures'
,
JSON
.
stringify
(
res
.
data
.
competitorsalesliteratures
));
return
res
;
}
...
...
@@ -258,6 +258,21 @@ export default class SalesLiteratureServiceBase extends EntityService {
*/
public
async
Save
(
context
:
any
=
{},
data
:
any
=
{},
isloading
?:
boolean
):
Promise
<
any
>
{
let
masterData
:
any
=
{};
let
competitorsalesliteraturesData
:
any
=
[];
if
(
!
Object
.
is
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_competitorsalesliteratures'
),
'undefined'
)){
competitorsalesliteraturesData
=
JSON
.
parse
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_competitorsalesliteratures'
)
as
any
);
if
(
competitorsalesliteraturesData
&&
competitorsalesliteraturesData
.
length
&&
competitorsalesliteraturesData
.
length
>
0
){
competitorsalesliteraturesData
.
forEach
((
item
:
any
)
=>
{
if
(
item
.
srffrontuf
){
if
(
Object
.
is
(
item
.
srffrontuf
,
"0"
)){
item
.
relationshipsid
=
null
;
}
delete
item
.
srffrontuf
;
}
});
}
}
masterData
.
competitorsalesliteratures
=
competitorsalesliteraturesData
;
let
salesliteratureitemsData
:
any
=
[];
if
(
!
Object
.
is
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_salesliteratureitems'
),
'undefined'
)){
salesliteratureitemsData
=
JSON
.
parse
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_salesliteratureitems'
)
as
any
);
...
...
@@ -288,26 +303,11 @@ export default class SalesLiteratureServiceBase extends EntityService {
}
}
masterData
.
productsalesliteratures
=
productsalesliteraturesData
;
let
competitorsalesliteraturesData
:
any
=
[];
if
(
!
Object
.
is
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_competitorsalesliteratures'
),
'undefined'
)){
competitorsalesliteraturesData
=
JSON
.
parse
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_competitorsalesliteratures'
)
as
any
);
if
(
competitorsalesliteraturesData
&&
competitorsalesliteraturesData
.
length
&&
competitorsalesliteraturesData
.
length
>
0
){
competitorsalesliteraturesData
.
forEach
((
item
:
any
)
=>
{
if
(
item
.
srffrontuf
){
if
(
Object
.
is
(
item
.
srffrontuf
,
"0"
)){
item
.
relationshipsid
=
null
;
}
delete
item
.
srffrontuf
;
}
});
}
}
masterData
.
competitorsalesliteratures
=
competitorsalesliteraturesData
;
Object
.
assign
(
data
,
masterData
);
let
res
:
any
=
await
Http
.
getInstance
().
post
(
`/salesliteratures/
${
context
.
salesliterature
}
/save`
,
data
,
isloading
);
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_competitorsalesliteratures'
,
JSON
.
stringify
(
res
.
data
.
competitorsalesliteratures
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_salesliteratureitems'
,
JSON
.
stringify
(
res
.
data
.
salesliteratureitems
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_productsalesliteratures'
,
JSON
.
stringify
(
res
.
data
.
productsalesliteratures
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_competitorsalesliteratures'
,
JSON
.
stringify
(
res
.
data
.
competitorsalesliteratures
));
return
res
;
}
...
...
app_CRM/yarn.lock
浏览文件 @
45d495c5
...
...
@@ -2440,11 +2440,6 @@ async-limiter@~1.0.0:
resolved "https://registry.yarnpkg.com/async-limiter/-/async-limiter-1.0.1.tgz#dd379e94f0db8310b08291f9d64c3209766617fd"
integrity sha512-csOlWGAcRFJaI6m+F2WKdnMKr4HhdhFVBk0H/QbJFMCr+uO2kwohwXQPxw/9OCxp05r5ghVBFSyioixx3gfkNQ==
async-validator@^1.10.0:
version "1.12.2"
resolved "https://registry.yarnpkg.com/async-validator/-/async-validator-1.12.2.tgz#beae671e7174d2938b7b4b69d2fb7e722b7fd72c"
integrity sha512-57EETfCPFiB7M4QscvQzWSGNsmtkjjzZv318SK1CBlstk+hycV72ocjriMOOM48HjvmoAoJGpJNjC7Z76RlnZA==
async-validator@^3.3.0:
version "3.3.0"
resolved "https://registry.yarnpkg.com/async-validator/-/async-validator-3.3.0.tgz#1d92193bbe60d6d6c8b246692c7005e9ed14a8ee"
...
...
@@ -4824,8 +4819,8 @@ element-size@^1.1.1:
element-ui@^2.13.2:
version "2.13.2"
resolved "https://registry.
npm.taobao.org/element-ui/download
/element-ui-2.13.2.tgz#582bf47aaaaaafe23ea1958fae217a687ad06447"
integrity sha
1-WCv0eqqqr+I+oZWPriF6aHrQZEc
=
resolved "https://registry.
yarnpkg.com/element-ui/-
/element-ui-2.13.2.tgz#582bf47aaaaaafe23ea1958fae217a687ad06447"
integrity sha
512-r761DRPssMPKDiJZWFlG+4e4vr0cRG/atKr3Eqr8Xi0tQMNbtmYU1QXvFnKiFPFFGkgJ6zS6ASkG+sellcoHlQ=
=
dependencies:
async-validator "~1.8.1"
babel-helper-vue-jsx-merge-props "^2.0.0"
...
...
@@ -12954,12 +12949,12 @@ verror@1.10.0:
core-util-is "1.0.2"
extsprintf "^1.2.0"
view-design@^4.
2
.0:
version "4.
2
.0"
resolved "https://registry.
npm.taobao.org/view-design/download/view-design-4.2.0.tgz#2af4865c956be84b64b25187be073016eab9a748
"
integrity sha
1-KvSGXJVr6EtkslGHvgcwFuq5p0g
=
view-design@^4.
3
.0:
version "4.
3
.0"
resolved "https://registry.
yarnpkg.com/view-design/-/view-design-4.3.0.tgz#9d112dfae78d9d5a28ca5b4bb113804ae9b1583b
"
integrity sha
512-djFj79KBLbYplXoV5CGG/IQTu/r4X73MxgEMFDtTcjujPjnrV0qIigF9YiJja2w5faqzG2FWUnYSCIQeHnyB5Q=
=
dependencies:
async-validator "^
1.10
.0"
async-validator "^
3.3
.0"
deepmerge "^2.2.1"
element-resize-detector "^1.2.0"
js-calendar "^1.2.3"
...
...
编辑
预览
Markdown
格式
0%
请重试
or
添加新附件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
先完成此消息的编辑!
取消
想要评论请
注册
或
登录