load lead & opportunity by username
This commit is contained in:
parent
b3c7131205
commit
6a445e2838
@ -6,12 +6,21 @@ import insuranceQuery from './queries/insuranceQuery';
|
||||
import optionsQuery from './queries/optionsQuery';
|
||||
import staticDataQuery from './queries/staticDataQuery';
|
||||
import systemUserQuery from './queries/systemUserQuery';
|
||||
import initialOwnerQuery from './queries/initialOwnerQuery';
|
||||
|
||||
export default () =>
|
||||
new Promise((resolve, reject) => {
|
||||
getUser()
|
||||
.then(({ UserName, DomainName }) => {
|
||||
.then(({ UserName, DomainName, FullName }) => {
|
||||
Promise.all([
|
||||
CrmService.crmgqlquery({
|
||||
query: initialOwnerQuery,
|
||||
variables: {
|
||||
statecode: 0,
|
||||
fullName: FullName,
|
||||
},
|
||||
toOptions: ['selectLead', 'selectOpportunity'],
|
||||
}),
|
||||
CrmService.getEntities({
|
||||
queries: optionsQuery,
|
||||
}),
|
||||
@ -32,6 +41,7 @@ export default () =>
|
||||
])
|
||||
.then(
|
||||
([
|
||||
{ entities: ownerOptions },
|
||||
{ entities: initialOptions },
|
||||
{ entities: staticEntities },
|
||||
{
|
||||
@ -39,6 +49,7 @@ export default () =>
|
||||
},
|
||||
{ entities: insuranceCompanies },
|
||||
]) => {
|
||||
CalculationStore.applyOptions(ownerOptions);
|
||||
CalculationStore.applyOptions(initialOptions);
|
||||
CalculationStore.applyStaticData(staticEntities);
|
||||
CalculationStore.applyStaticData({ systemuser: [systemuser] });
|
||||
|
||||
@ -0,0 +1,26 @@
|
||||
import { gql } from '@apollo/client';
|
||||
export default gql`
|
||||
query($statecode: Int, $fullName: String) {
|
||||
selectLead: leads(statecode: $statecode, owner_domainname: $fullName) {
|
||||
customerid
|
||||
leadid
|
||||
fullname
|
||||
evo_opportunityid
|
||||
evo_agent_accountid
|
||||
evo_double_agent_accountid
|
||||
evo_broker_accountid
|
||||
evo_fin_department_accountid
|
||||
}
|
||||
selectOpportunity: opportunities(
|
||||
statecode: $statecode
|
||||
owner_domainname: $fullName
|
||||
) {
|
||||
opportunityid
|
||||
name
|
||||
accountid
|
||||
evo_leadid
|
||||
evo_client_riskid
|
||||
parentaccountid
|
||||
}
|
||||
}
|
||||
`;
|
||||
@ -2,38 +2,6 @@ import { TEntityQuery } from 'core/types/Entities/query';
|
||||
import { currentDate } from 'client/tools/date';
|
||||
|
||||
const initialOptionsQuery: TEntityQuery[] = [
|
||||
{
|
||||
alias: 'selectLead',
|
||||
entityName: 'lead',
|
||||
fields: [
|
||||
'customerid',
|
||||
'leadid',
|
||||
'fullname',
|
||||
'evo_opportunityid',
|
||||
'evo_agent_accountid',
|
||||
'evo_double_agent_accountid',
|
||||
'evo_broker_accountid',
|
||||
'evo_fin_department_accountid',
|
||||
],
|
||||
where: { statecode: 0 },
|
||||
many: true,
|
||||
toOption: true,
|
||||
},
|
||||
{
|
||||
alias: 'selectOpportunity',
|
||||
entityName: 'opportunity',
|
||||
fields: [
|
||||
'opportunityid',
|
||||
'name',
|
||||
'accountid',
|
||||
'evo_leadid',
|
||||
'evo_client_riskid',
|
||||
'parentaccountid',
|
||||
],
|
||||
where: { statecode: 0 },
|
||||
many: true,
|
||||
toOption: true,
|
||||
},
|
||||
{
|
||||
alias: 'selectSupplier',
|
||||
entityName: 'account',
|
||||
|
||||
@ -28,6 +28,7 @@ export interface ILead {
|
||||
evo_double_agent_accountid?: string;
|
||||
evo_agent_accountid?: string;
|
||||
accountidData?: IAccount;
|
||||
owner_domainname?: string;
|
||||
}
|
||||
|
||||
export interface IOpportunity {
|
||||
|
||||
Reference in New Issue
Block a user