| New file |
| | |
| | | import { LightningElement,wire,track,api} from 'lwc'; |
| | | import { CurrentPageReference } from "lightning/navigation"; |
| | | import { CloseActionScreenEvent } from 'lightning/actions'; |
| | | import init from '@salesforce/apex/InquiryFormController.init'; |
| | | import sqlResult from '@salesforce/apex/InquiryFormController.sqlResult'; |
| | | import { ShowToastEvent } from 'lightning/platformShowToastEvent'; |
| | | export default class lexInquiryFormCustomLink1 extends LightningElement { |
| | | @api recordId;//OwnerId |
| | | IsLoading = true; |
| | | Id= ""; |
| | | ServiceStatus= ""; |
| | | profileId= ""; |
| | | userId= ""; |
| | | Status= ""; |
| | | LeadLink= ""; |
| | | OppNameSearch= ""; |
| | | ContactName= ""; |
| | | ContactId = ""; |
| | | HospitalName= ""; |
| | | HospitalID= ""; |
| | | DepartmentClass= ""; |
| | | DepartmentID = ""; |
| | | OppNameSearchID= ""; |
| | | Campaign= ""; |
| | | CampaignID= ""; |
| | | Name= ""; |
| | | CancelReason= ""; |
| | | Phone= ""; |
| | | Email= ""; |
| | | LastName= ""; |
| | | LeadSource= ""; |
| | | OpportunityDivision= ""; |
| | | Request1= ""; |
| | | Urgent = false; |
| | | FSEOwner= ""; |
| | | FamilyName= ""; |
| | | @wire(CurrentPageReference) |
| | | getStateParameters(currentPageReference) { |
| | | if (currentPageReference) { |
| | | const urlValue = currentPageReference.state.recordId; |
| | | if (urlValue) { |
| | | let str = `${urlValue}`; |
| | | this.recordId = str; |
| | | } |
| | | } |
| | | } |
| | | connectedCallback(){ |
| | | init({ |
| | | recordId: this.recordId |
| | | }).then(result => { |
| | | this.IsLoading = false; |
| | | this.Id = result.Id != undefined ? result.Id : ""; |
| | | this.ServiceStatus = result.ServiceStatus != undefined ? result.ServiceStatus : ""; |
| | | this.profileId = result.profileId != undefined ? result.profileId : ""; |
| | | this.userId = result.userId != undefined ? result.userId : ""; |
| | | this.Status = result.Status != undefined ? result.Status : ""; |
| | | this.LeadLink = result.LeadLink != undefined ? result.LeadLink : ""; |
| | | this.OppNameSearch = result.OppNameSearch != undefined ? result.OppNameSearch : ""; |
| | | this.ContactName = result.ContactName != undefined ? result.ContactName : ""; |
| | | this.ContactId = result.ContactId != undefined ? result.ContactId : ""; |
| | | this.HospitalName = result.HospitalName != undefined ? result.HospitalName : ""; |
| | | this.HospitalID = result.HospitalID != undefined ? result.HospitalID : ""; |
| | | this.DepartmentClass = result.DepartmentClass != undefined ? result.DepartmentClass : ""; |
| | | this.DepartmentID = result.DepartmentID != undefined ? result.DepartmentID : ""; |
| | | this.OppNameSearchID = result.OppNameSearchID != undefined ? result.OppNameSearchID : ""; |
| | | this.Campaign = result.Campaign != undefined ? result.Campaign : ""; |
| | | this.CampaignID = result.CampaignID != undefined ? result.CampaignID : ""; |
| | | this.Name = result.Name != undefined ? result.Name : ""; |
| | | this.CancelReason = result.CancelReason != undefined ? result.CancelReason : ""; |
| | | this.Phone = result.Phone != undefined ? result.Phone : ""; |
| | | this.Email = result.Email != undefined ? result.Email : ""; |
| | | this.LastName = result.LastName != undefined ? result.LastName : ""; |
| | | this.LeadSource = result.LeadSource != undefined ? result.LeadSource : ""; |
| | | this.OpportunityDivision = result.OpportunityDivision != undefined ? result.OpportunityDivision : ""; |
| | | this.Request1 = result.Request1 != undefined ? result.Request1 : ""; |
| | | this.FSEOwner = result.FSEOwner != undefined ? result.FSEOwner : ""; |
| | | this.FamilyName = result.FamilyName != undefined ? result.FamilyName : ""; |
| | | this.Urgent = result.Urgent == 0 ? 0 :1; |
| | | this.CustomLink1(); |
| | | }) |
| | | } |
| | | // 产品咨询单 新建意向 |
| | | CustomLink1(){ |
| | | var lead = ""; |
| | | var search = ""; |
| | | sqlResult({id:this.recordId}).then(records=>{ |
| | | var Request = ''; |
| | | if(records[0].Request_Detail__c != null){ |
| | | Request = records[0].Request_Detail__c.toString(); |
| | | } |
| | | var lead = this.LeadLink; |
| | | var search = this.OppNameSearch; |
| | | // this.CustomLink1(); |
| | | if(lead){ |
| | | // alert('已经有意向了,不能再创建新的意向。'); |
| | | this.showToast("已经有意向了,不能再创建新的意向。!","error"); |
| | | return; |
| | | }else{ |
| | | //var urlStr ='/00Q/e?RecordType=01210000000QiRa&ent=Lead'; |
| | | //window.open(urlStr); |
| | | var urlStr ='/apex/NewAndEditLead?RecordType=01210000000QiRa&ent=Lead'+ |
| | | '&CF00N10000006ps6f='+encodeURI(this.ContactName)+ |
| | | '&CF00N10000006ps6f_lkid='+encodeURI(this.ContactId)+ |
| | | '&CF00N10000002CvC5='+encodeURI(this.HospitalName)+ |
| | | '&CF00N10000002CvC5_lkid='+encodeURI(this.HospitalID)+ |
| | | '&CF00N10000006qNtt='+encodeURI(this.DepartmentClass)+ |
| | | '&CF00N10000006qNtt_lkid='+encodeURI(this.DepartmentID)+ |
| | | '&CF00N10000006qNty='+encodeURI(this.OppNameSearch)+ |
| | | '&CF00N10000006qNty_lkid='+encodeURI(this.OppNameSearchID)+ |
| | | '&CF00N10000004oN28='+encodeURI(this.Campaign)+ |
| | | '&CF00N10000004oN28_lkid='+encodeURI(this.CampaignID)+ |
| | | '&CF00N1000000962np='+encodeURI(this.Name)+ |
| | | '&CF00N1000000962np_lkid='+encodeURI(this.Id)+ |
| | | '&00N10000006qBYk='+encodeURI(this.CancelReason)+ |
| | | // '&00N10000006qGvj='+result.ProductOwner+ |
| | | '&00N10000002CvBM=' + encodeURI(Request) + |
| | | '&lea13=未跟进'+ |
| | | '&lea3='+encodeURI(this.HospitalName)+ |
| | | '&lea8='+encodeURI(this.Phone.trim())+ |
| | | '&lea11='+encodeURI(this.Email.trim())+ |
| | | '&name_lastlea2=' + encodeURI(this.FamilyName) + |
| | | '&name_firstlea2='+encodeURI(this.LastName)+ |
| | | '&lea5='+encodeURI(this.LeadSource)+ |
| | | '&00N10000002CvBR='+encodeURI(this.Request1)+ |
| | | '&00N10000002CvBC='+encodeURI(this.OpportunityDivision)+ |
| | | //'&00N10000002EjE1={!Inquiry_form__c.Opp_Name_Search__c}'+ |
| | | '&00N10000002CvB7='+encodeURI(this.Urgent); |
| | | if(search != "" && search != null){ |
| | | urlStr += '&00N10000002EjE1='+this.OppNameSearch; |
| | | } |
| | | window.open(urlStr); |
| | | this.dispatchEvent(new CloseActionScreenEvent()); |
| | | } |
| | | }) |
| | | } |
| | | showToast(msg,type) { |
| | | const event = new ShowToastEvent({ |
| | | message: msg, |
| | | variant: type |
| | | }); |
| | | this.dispatchEvent(event); |
| | | this.dispatchEvent(new CloseActionScreenEvent()); |
| | | } |
| | | } |
| | | |
| | | // var foo = function() { |
| | | // var lead = '{!Inquiry_form__c.Lead_link__c}'; |
| | | // var status = '{!Inquiry_form__c.Status__c}'; |
| | | // //gzw add |
| | | // var search = '{!Inquiry_form__c.Opp_Name_Search__c}'; |
| | | // //zyh add-search |
| | | // var name = '{!Inquiry_form__c.Contact_Name__c}'; |
| | | // name = name.replace(" ", ""); |
| | | // var sql = "select id,Request_Detail__c from Inquiry_form__c where id = '{!Inquiry_form__c.Id}'"; |
| | | // var sqlResult = sforce.connection.query(sql); |
| | | // var records = sqlResult.getArray("records"); |
| | | // var Request = ''; |
| | | // if(records[0].Request_Detail__c != null){ |
| | | // Request = records[0].Request_Detail__c.toString(); |
| | | // } |
| | | // //gzw add |
| | | // if(lead){ |
| | | // alert('已经有意向了,不能再创建新的意向。'); |
| | | // return; |
| | | // }else{ |
| | | // //var urlStr ='/00Q/e?RecordType=01210000000QiRa&ent=Lead'; |
| | | // //window.open(urlStr); |
| | | // var urlStr ='/00Q/e?RecordType=01210000000QiRa&ent=Lead'+ |
| | | // '&CF00N10000006ps6f={!HTMLENCODE(Inquiry_form__c.Contact_Name__c)}'+ |
| | | // '&CF00N10000006ps6f_lkid={!Inquiry_form__c.Contact_Id__c}'+ |
| | | // '&CF00N10000002CvC5={!HTMLENCODE(Inquiry_form__c.Hospital_Name__c)}'+ |
| | | // '&CF00N10000002CvC5_lkid={!Inquiry_form__c.Hospital_ID__c}'+ |
| | | // '&CF00N10000006qNtt={!HTMLENCODE(Inquiry_form__c.Department_Class__c)}'+ |
| | | // '&CF00N10000006qNtt_lkid={!Inquiry_form__c.Department_ID__c}'+ |
| | | // '&CF00N10000006qNty={!HTMLENCODE(Inquiry_form__c.Opp_Name_Search__c)}'+ |
| | | // '&CF00N10000006qNty_lkid={!Inquiry_form__c.Opp_Name_Search_ID__c}'+ |
| | | // '&CF00N10000004oN28={!HTMLENCODE(Inquiry_form__c.Campaign__c)}'+ |
| | | // '&CF00N10000004oN28_lkid={!Inquiry_form__c.Campaign_ID__c}'+ |
| | | // '&CF00N1000000962np={!HTMLENCODE(Inquiry_form__c.Name)}'+ |
| | | // '&CF00N1000000962np_lkid={!Inquiry_form__c.Id}'+ |
| | | // '&00N10000006qBYk={!HTMLENCODE(Inquiry_form__c.Cancel_Reason__c)}'+ |
| | | // '&00N10000006qGvj={!Inquiry_form__c.Product_Owner__c}'+ |
| | | // '&00N10000002CvBM=' + Request + |
| | | // '&lea13=未跟进'+ |
| | | // '&lea3={!HTMLENCODE(Inquiry_form__c.Hospital_Name__c)}'+ |
| | | // '&lea8={!HTMLENCODE(Inquiry_form__c.Phone__c)}'+ |
| | | // '&lea11={!HTMLENCODE(Inquiry_form__c.Email__c)}'+ |
| | | // '&name_lastlea2=' + name + |
| | | // '&name_firstlea2={!HTMLENCODE(Inquiry_form__c.Last_Name__c)}'+ |
| | | // '&lea5={!HTMLENCODE( TEXT(Inquiry_form__c.LeadSource__c))}'+ |
| | | // '&00N10000002CvBC={!HTMLENCODE(TEXT(Inquiry_form__c.Opportunity_Division__c))}'+ |
| | | // '&00N10000002CvBR={!Inquiry_form__c.Request1__c}'+ |
| | | // //'&00N10000002EjE1={!Inquiry_form__c.Opp_Name_Search__c}'+ |
| | | // '&00N10000002CvB7={!Inquiry_form__c.Urgent__c}'; |
| | | // if(search != "" && search != null){ |
| | | // urlStr += '&00N10000002EjE1={!Inquiry_form__c.Opp_Name_Search__c}'; |
| | | // } |
| | | // window.open(urlStr); |
| | | // } |
| | | // } |
| | | // foo(); |