buli
2023-05-23 07390e2fcb4adf27c928335bf27ae7939c5a80ad
force-app/main/default/lwc/lexTenderingEnquiryButton/lexTenderingEnquiryButton.js
@@ -1,7 +1,6 @@
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';
@@ -26,35 +25,29 @@
        init({
            recordId: this.recordId
        }).then(result => {
            if (result != null) {
            console.log(result);
                this.IsLoading = false;
                this.id = result.Id;
                this.isRelateProject = result.isRelateProject;
                this.EnquiryButton();
                this.dispatchEvent(new CloseActionScreenEvent());
            }
        }).catch(error => {
            console.log("error"+error);
        }).finally(() => {
        });
        })
    }
    //招标项目 反应询价状态
    EnquiryButton(){
        if(this.isRelateProject == "否"){
            this.showToast('招投标项目不相关后不能反应询价状态!','error');
            this.dispatchEvent(new CloseActionScreenEvent());
            return;
        }
        var listss = [];
        listss.push(this.id);
        updateOpportunityInformation({TenderIdList : listss}).then(result=>{
            console.log(result,'走开了吗?')
            if(result != 'OK'){
                this.showToast(result,'error');
                this.dispatchEvent(new CloseActionScreenEvent());
            }else {
                console.log('烦')
                // alert('反映完了');
                this.showToast('反映完了','success');
                this.dispatchEvent(new CloseActionScreenEvent());
            }
        })
    }
@@ -65,28 +58,6 @@
            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();