twysparks
2023-06-26 a8628cfe2640797ba9265e9be46c42430d9e7eba
force-app/main/default/lwc/lexQISMBCrequestNew/lexQISMBCrequestNew.js
@@ -10,8 +10,17 @@
    CloseActionScreenEvent
} from 'lightning/actions';
import init from '@salesforce/apex/buttonQISReportCtl.init';
import {
    NavigationMixin
} from 'lightning/navigation';
import {
    encodeDefaultFieldValues
} from 'lightning/pageReferenceUtils';
import {
    ShowToastEvent
} from 'lightning/platformShowToastEvent';
export default class LexQISMBCrequestNew extends LightningElement {
export default class LexQISMBCrequestNew extends NavigationMixin(LightningElement) {
    @api recordId;
    str;
    IsLoading = true;
@@ -52,12 +61,35 @@
    // 新建QIS M-BC申请.
    QISMBCRequestNew() {
        var status = this.QISStatusC;
        if (status != '完毕' && status != '已回答' && status != '取消') {
            alert("QIS没有审批完毕或取消,不可以创建QIS M-BC!");
            this.ShowToastEvent("QIS没有审批完毕或取消,不可以创建QIS M-BC!", "error");
            return;
        }
        var url = "a20/e?retURL=%2Fa20%2Fo&Name=" + this.Name + "&CF00N10000006Q4NP_lkid=" + this.Id;
        window.top.location.href = url;
        const url = encodeDefaultFieldValues({
            Name: this.Name,
            QIS_request_name__c: this.Id
        });
        this[NavigationMixin.Navigate]({
            type: 'standard__objectPage',
            attributes: {
                objectApiName: 'QIS_M_BC__c',
                actionName: 'new'
            },
            state: {
                nooverride: '1',
                defaultFieldValues: url
            }
        });
        // var url = "a20/e?retURL=%2Fa20%2Fo&Name=" + this.Name + "&CF00N10000006Q4NP_lkid=" + this.Id;
        // window.open(url);
    }
    ShowToastEvent(msg, type) {
        const event = new ShowToastEvent({
            title: '',
            message: msg,
            variant: type
        });
        this.dispatchEvent(event);
    }
}