1
chenjingwu
2024-05-24 35910c355f74e736e2068a0ffb7f39ae9615d8e1
force-app/main/default/lwc/lexLoseReport/lexLoseReport.js
@@ -4,7 +4,7 @@
 * @Author: chen jing wu
 * @Date: 2023-04-20 14:08:55
 * @LastEditors: chen jing wu
 * @LastEditTime: 2023-09-25 13:21:17
 * @LastEditTime: 2023-10-16 14:45:16
 */
/*
 * @Description: 
@@ -20,6 +20,7 @@
import { updateRecord } from 'lightning/uiRecordApi';
import { ShowToastEvent } from 'lightning/platformShowToastEvent';
import init  from '@salesforce/apex/OpportunityLightingButtonController.initForLostReportButton';
import queryLostReport  from '@salesforce/apex/OpportunityLightingButtonController.queryLostReport';
import lwcCSS from '@salesforce/resourceUrl/lwcCSS';
import {loadStyle} from 'lightning/platformResourceLoader';
export default class LexLoseReport extends LightningElement {
@@ -35,6 +36,7 @@
    salesOwnerBuchang;
    salesOwnerBuchangID;
    cntLostCancelDraft;
    haveLostReport;
    IsLoading = true;
    @wire(CurrentPageReference)
    getStateParameters(currentPageReference) {
@@ -70,7 +72,18 @@
            this.salesOwnerBuchang = result.salesOwnerBuchang;
            this.salesOwnerBuchangID = result.salesOwnerBuchangID;
            this.cntLostCancelDraft = result.cntLostCancelDraft;
            this.loseReport();
            if(!result.isHavePower){
                this.showToast('您不能创建失单/部分失单报告!','error');
                this.dispatchEvent(new CloseActionScreenEvent());
                return;
            }
            queryLostReport({
                recordId: this.recordId
            }).then(result=>{
                this.haveLostReport = result;
                this.loseReport();
            });
        })
    }
    loseReport(){
@@ -83,38 +96,32 @@
        else if (this.sapSendOK == '1') {
            this.showToast("已经上传SAP、不能做 失单 了!","error");
        }
        else if (this.cntLostCancelReport - this.cntLostCancelDraft > 0) {
            // this.showToast("询价已经有 取消/失单报告 了!","error");
        else if (this.haveLostReport) {
            this.showToast('询价已经有 取消/失单报告 了!','error');
        }
        //else if({!Not(ISBLANK(Opportunity.Bidding_Project_Name_Bid__c))} && //'{!Opportunity.InfoTypeBid__c}' != '3:结果' ){
        //alert("关联招投标项目的询价,只能在有结果后做失单报告!");
        //}
        else {
            var url = '/apex/PCLLostReportPageLwc?pageStatus=Create&oppId=' + this.recordId + '&lostType=失单';
            var url = '/lightning/n/PCLLostReportPageLwc#pageStatus=Create&oppId=' + this.recordId + '&lostType=失单';
            location.href = url;
            // location.href = '/a1U/e?retURL=%2F' + this.recordId +
            // '&RecordType=01210000000R4hM' +
            // '&CF00N10000004lbGT=' + this.name +
            // '&CF00N10000004lbGT_lkid=' + this.recordId +
            // '&CF00N10000006QShg=' + this.salesAssistantName +
            // '&CF00N10000006QShg_lkid=' + this.salesAssistantID +
            // '&CF00N10000006QShq=' + this.managerName +
            // '&CF00N10000006QShq_lkid=' + this.salesManagerDepartmentID +
            // '&CF00N10000006QShb=' + this.salesOwnerBuchang +
            // '&CF00N10000006QShb_lkid=' + this.salesOwnerBuchangID +
            // '';
        }
        this.dispatchEvent(new CloseActionScreenEvent());
    }
    showToast(msg,type) {
        const event = new ShowToastEvent({
            title: ' ',
            message: msg,
            variant: type,
            duration: 15000
        });
        this.dispatchEvent(event);
        if(type == 'success'){
            const event = new ShowToastEvent({
                message: msg,
                variant: type,
            });
            this.dispatchEvent(event);
            this.dispatchEvent(new CloseActionScreenEvent());
        }else{
            const event = new ShowToastEvent({
                message: msg,
                variant: type,
                mode: 'sticky'
            });
            this.dispatchEvent(event);
            this.dispatchEvent(new CloseActionScreenEvent());
        }
    }
    //显示信息
    showMyToast(title, message, variant) {