1
chenjingwu
2024-05-24 35910c355f74e736e2068a0ffb7f39ae9615d8e1
force-app/main/default/lwc/lexTenderingEnquiryButton/lexTenderingEnquiryButton.js
@@ -1,6 +1,7 @@
import { LightningElement,wire,track,api} from 'lwc';
import { CurrentPageReference } from "lightning/navigation";
import { CloseActionScreenEvent } from 'lightning/actions';
import { NavigationMixin } from 'lightning/navigation';
import  init  from '@salesforce/apex/TenderingButtonController.initTenderingController';
import  updateOpportunityInformation  from '@salesforce/apex/UpdateTenderInformationBatch.updateOpportunityInformation';
import { ShowToastEvent } from 'lightning/platformShowToastEvent';
@@ -32,7 +33,11 @@
                this.EnquiryButton();
                this.dispatchEvent(new CloseActionScreenEvent());
            }
        })
        }).catch(error => {
            console.log("error"+error);
        }).finally(() => {
        });
    }
    //招标项目 反应询价状态
    EnquiryButton(){
@@ -43,20 +48,45 @@
        var listss = [];
        listss.push(this.id);
        updateOpportunityInformation({TenderIdList : listss}).then(result=>{
            console.log(result,'走开了吗?')
            if(result != 'OK'){
                this.showToast(result,'error');
            }else {
                console.log('烦')
                // alert('反映完了');
                this.showToast('反映完了','success');
            }
        })
    }
    showToast(msg,type) {
        console.log(msg,type);
        const event = new ShowToastEvent({
            message: msg,
            variant: type
        });
        console.log('提示框不能用了吗?');
        this.dispatchEvent(event);
        this.dispatchEvent(new CloseActionScreenEvent());
    }
}
}
// var foo = function(){
//     if('{!Tender_information__c.IsRelateProject__c}'== "否"){
//     alert('招投标项目不相关后不能反应询价状态!');
//     return;
//     }
//     var listss = [];
//     listss.push('{!Tender_information__c.Id}');
//     var rtn = sforce.apex.execute("UpdateTenderInformationBatch", "updateOpportunityInformation", {TenderIdList : listss } );
//     if(rtn != 'OK'){
//     alert(rtn);
//     }else {
//     alert('反映完了');
//     }
//     //重新加载页面
//     window.location.reload();
//     }
//     foo();