Merge branch 'LEX_dev' of http://47.92.229.245:8089/r/lightningupdate into LEX_dev
| | |
| | | global without sharing class LightingButtonConstant { |
| | | //任务的状态‘OLY中标’ |
| | | public static final String STATUS_OLYwinBid = 'OLY中标'; |
| | | //任务的状态‘竞争对手中标’ |
| | | public static final String STATUS_Bid_LoseBid = '竞争对手中标'; |
| | | //中标通知书的状态‘处理完毕’ |
| | | public static final String STATUS_Bid_Announcement_Consent = '处理完毕'; |
| | | //中标通知书的状态‘草案中’ |
| | |
| | | public static InitData init(String taskId){ |
| | | InitData res = new initData(); |
| | | try{ |
| | | task__c task = [SELECT id, OpportunityId__c |
| | | task__c task = [SELECT id, OpportunityId__c , taskStatus__c |
| | | FROM task__c |
| | | WHERE Id =: taskId |
| | | LIMIT 1]; |
| | | |
| | | res.task = task; |
| | | res.taskStatus = task.taskStatus__c; |
| | | res.OpportunityId = task.OpportunityId__c; |
| | | |
| | | Opportunity opp = [SELECT Sales_owner_buchangID__c,Manager_name__c,Sales_owner_buchang__c, |
| | |
| | | System.debug(LoggingLevel.INFO, '*** e: ' + e); |
| | | } |
| | | return res; |
| | | } |
| | | |
| | | } |
| | | |
| | | public class ReturnData{ |
| | | |
| | | } |
| | | |
| | | //OLY中标 |
| | | @AuraEnabled |
| | | public static String taskOLYwinBid(String recordId) { |
| | | String messageText = ''; |
| | | try { |
| | | Opportunity opp = [SELECT Id,ConfirmationofAward__c FROM Opportunity WHERE Id = :recordId LIMIT 1]; |
| | | opp.Id = recordId; |
| | | opp.ConfirmationofAward__c = LightingButtonConstant.STATUS_OLYwinBid; |
| | | messageText = '1'; |
| | | update opp; |
| | | System.debug(LoggingLevel.INFO, '*** winBid: ' + opp); |
| | | return messageText; |
| | | } catch (Exception ex) { |
| | | System.debug(LoggingLevel.INFO, '*** winBidXu: ' + ex); |
| | | messageText = ex.getMessage(); |
| | | return messageText; |
| | | } |
| | | } |
| | | //竞争对手中标 |
| | | @AuraEnabled |
| | | public static String taskLoseBid(String recordId) { |
| | | String messageText = ''; |
| | | try { |
| | | Opportunity opp = [SELECT Id,ConfirmationofAward__c FROM Opportunity WHERE Id = :recordId LIMIT 1]; |
| | | opp.Id = recordId; |
| | | opp.ConfirmationofAward__c = LightingButtonConstant.STATUS_Bid_LoseBid; |
| | | messageText = '1'; |
| | | update opp; |
| | | System.debug(LoggingLevel.INFO, '*** winBid: ' + opp); |
| | | return messageText; |
| | | } catch (Exception ex) { |
| | | System.debug(LoggingLevel.INFO, '*** winBidXu: ' + ex); |
| | | messageText = ex.getMessage(); |
| | | return messageText; |
| | | } |
| | | } |
| | | public class InitData{ |
| | | //询价数据 |
| | | @AuraEnabled |
| | | public Opportunity opp; |
| | | @AuraEnabled |
| | | public String stageName; |
| | | public String StageName; |
| | | @AuraEnabled |
| | | public Boolean SAP_Send_OK; |
| | | @AuraEnabled |
| | |
| | | @AuraEnabled |
| | | public String OpportunityId; |
| | | @AuraEnabled |
| | | public String taskStatus; |
| | | @AuraEnabled |
| | | public task__c task; |
| | | } |
| | | |
| New file |
| | |
| | | <template> |
| | | <div class="ApplicationSubmit" if:true={IsLoading}> |
| | | <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner> |
| | | </div> |
| | | </template> |
| New file |
| | |
| | | import { LightningElement,wire,track,api} from 'lwc'; |
| | | import { CurrentPageReference } from "lightning/navigation"; |
| | | import { CloseActionScreenEvent } from 'lightning/actions'; |
| | | import init from '@salesforce/apex/OppLoseController.init'; |
| | | import taskLoseBid from '@salesforce/apex/OppLoseController.taskLoseBid'; |
| | | import { ShowToastEvent } from 'lightning/platformShowToastEvent'; |
| | | import { updateRecord } from 'lightning/uiRecordApi'; |
| | | import LightningConfirm from 'lightning/confirm'; |
| | | export default class lexTaskOLYwinBid extends LightningElement { |
| | | @api recordId; |
| | | taskStatus;//任务 状态 |
| | | OpportunityId;//任务 ID |
| | | IsLoading = true; |
| | | @wire(CurrentPageReference) |
| | | getStateParameters(currentPageReference){ |
| | | if(currentPageReference){ |
| | | const urlValue=currentPageReference.state.recordId; |
| | | if(urlValue){ |
| | | let str=`${urlValue}`; |
| | | this.recordId=str; |
| | | } |
| | | } |
| | | } |
| | | connectedCallback(){ |
| | | init({ |
| | | taskId: this.recordId |
| | | }).then(result => { |
| | | this.IsLoading = false; |
| | | console.log(result.OpportunityId,result.taskStatus); |
| | | this.OpportunityId = result.OpportunityId; |
| | | this.taskStatus = result.taskStatus; |
| | | this.taskLoseBid(); |
| | | }) |
| | | } |
| | | |
| | | taskLoseBid(){ |
| | | if(this.taskStatus == '04 取消'){ |
| | | this.showToast('任务取消,不可操作',"error"); |
| | | }else{ |
| | | LightningConfirm.open({ |
| | | message: '是否确认竞争对手中标?', |
| | | variant: 'headerless', |
| | | label: 'this is the aria-label value', |
| | | }).then(res=>{ |
| | | if(res) { |
| | | taskLoseBid({recordId:this.OpportunityId}).then(requst=>{ |
| | | if(requst == '1'){ |
| | | this.showToast("操作成功!","success"); |
| | | this.updateRecordView(); |
| | | this.dispatchEvent(new CloseActionScreenEvent()); |
| | | } |
| | | if(requst != "1"){ |
| | | this.showToast(requst,"error"); |
| | | } |
| | | }) |
| | | }else{ |
| | | this.dispatchEvent(new CloseActionScreenEvent()); |
| | | this.updateRecordView(this.recordId); |
| | | return; |
| | | } |
| | | }); |
| | | } |
| | | } |
| | | showToast(msg,type) { |
| | | const event = new ShowToastEvent({ |
| | | message: msg, |
| | | variant: type |
| | | }); |
| | | this.dispatchEvent(event); |
| | | this.dispatchEvent(new CloseActionScreenEvent()); |
| | | } |
| | | updateRecordView() { |
| | | updateRecord({fields: { Id: this.OpportunityId }}); |
| | | } |
| | | } |
| New file |
| | |
| | | <?xml version="1.0"?> |
| | | <LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata"> |
| | | <apiVersion>54.0</apiVersion> |
| | | <isExposed>true</isExposed> |
| | | <targets> |
| | | <target>lightning__RecordPage</target> |
| | | <target>lightning__AppPage</target> |
| | | <target>lightning__HomePage</target> |
| | | <target>lightning__RecordAction</target> |
| | | </targets> |
| | | </LightningComponentBundle> |
| New file |
| | |
| | | <template> |
| | | <div class="ApplicationSubmit" if:true={IsLoading}> |
| | | <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner> |
| | | </div> |
| | | </template> |
| New file |
| | |
| | | import { LightningElement,wire,track,api} from 'lwc'; |
| | | import { CurrentPageReference } from "lightning/navigation"; |
| | | import { CloseActionScreenEvent } from 'lightning/actions'; |
| | | import init from '@salesforce/apex/OppLoseController.init'; |
| | | import taskOLYwinBid from '@salesforce/apex/OppLoseController.taskOLYwinBid'; |
| | | import { ShowToastEvent } from 'lightning/platformShowToastEvent'; |
| | | import { updateRecord } from 'lightning/uiRecordApi'; |
| | | import LightningConfirm from 'lightning/confirm'; |
| | | export default class lexTaskOLYwinBid extends LightningElement { |
| | | @api recordId; |
| | | taskStatus;//任务 状态 |
| | | OpportunityId;//任务 ID |
| | | IsLoading = true; |
| | | @wire(CurrentPageReference) |
| | | getStateParameters(currentPageReference){ |
| | | if(currentPageReference){ |
| | | const urlValue=currentPageReference.state.recordId; |
| | | if(urlValue){ |
| | | let str=`${urlValue}`; |
| | | this.recordId=str; |
| | | } |
| | | } |
| | | } |
| | | connectedCallback(){ |
| | | init({ |
| | | taskId: this.recordId |
| | | }).then(result => { |
| | | this.IsLoading = false; |
| | | console.log(result.OpportunityId,result.taskStatus); |
| | | this.OpportunityId = result.OpportunityId; |
| | | this.taskStatus = result.taskStatus; |
| | | this.taskOLYwinBid(); |
| | | }) |
| | | } |
| | | //任务 OLY中标 |
| | | taskOLYwinBid(){ |
| | | if(this.taskStatus == '04 取消'){ |
| | | this.showToast('任务取消,不可操作',"error"); |
| | | }else{ |
| | | LightningConfirm.open({ |
| | | message: '是否确认竞争对手中标?', |
| | | variant: 'headerless', |
| | | label: 'this is the aria-label value', |
| | | }).then(res=>{ |
| | | if(res) { |
| | | taskOLYwinBid({recordId:this.OpportunityId}).then(requst=>{ |
| | | if(requst == '1'){ |
| | | this.showToast("操作成功!","success"); |
| | | this.updateRecordView(); |
| | | this.dispatchEvent(new CloseActionScreenEvent()); |
| | | } |
| | | if(requst != "1"){ |
| | | this.showToast(requst,"error"); |
| | | } |
| | | }) |
| | | }else{ |
| | | this.dispatchEvent(new CloseActionScreenEvent()); |
| | | this.updateRecordView(this.recordId); |
| | | return; |
| | | } |
| | | }); |
| | | } |
| | | } |
| | | showToast(msg,type) { |
| | | const event = new ShowToastEvent({ |
| | | message: msg, |
| | | variant: type |
| | | }); |
| | | this.dispatchEvent(event); |
| | | this.dispatchEvent(new CloseActionScreenEvent()); |
| | | } |
| | | updateRecordView() { |
| | | updateRecord({fields: { Id: this.OpportunityId }}); |
| | | } |
| | | } |
| New file |
| | |
| | | <?xml version="1.0"?> |
| | | <LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata"> |
| | | <apiVersion>54.0</apiVersion> |
| | | <isExposed>true</isExposed> |
| | | <targets> |
| | | <target>lightning__RecordPage</target> |
| | | <target>lightning__AppPage</target> |
| | | <target>lightning__HomePage</target> |
| | | <target>lightning__RecordAction</target> |
| | | </targets> |
| | | </LightningComponentBundle> |