buli
2023-05-23 07390e2fcb4adf27c928335bf27ae7939c5a80ad
force-app/main/default/lwc/lexRentalApplyDiscountApproval/lexRentalApplyDiscountApproval.js
@@ -11,7 +11,7 @@
} from 'lightning/actions';
import init from '@salesforce/apex/buttonRepairQuotationCtl.init';
import updateRepairQuotation03 from '@salesforce/apex/buttonRepairQuotationCtl.updateRepairQuotation03';
import initSelectProfile from '@salesforce/apex/buttonRepairQuotationCtl.initSelectProfile';
import {
    ShowToastEvent
} from 'lightning/platformShowToastEvent';
@@ -24,6 +24,7 @@
    RentalApplyDiscountStatusC;
    LoanerRepairSysC;
    profileId;
    profileName;
    @wire(CurrentPageReference)
    getStateParameters(currentPageReference) {
@@ -49,7 +50,17 @@
                this.RentalApplyDiscountStatusC = result.RentalApplyDiscountStatusC;
                this.LoanerRepairSysC = result.LoanerRepairSysC;
                this.RentalApplyDiscountApproval();
                initSelectProfile({
                    profileId: this.profileId
                }).then(result => {
                    console.log(result);
                    if (result != null) {
                        this.IsLoading = false;
                        this.profileName = result[0].Name;
                        this.RentalApplyDiscountApproval();
                    }
                })
                this.dispatchEvent(new CloseActionScreenEvent());
            }
        }).catch(error => {
@@ -59,23 +70,20 @@
    // 备品减价申请   
    RentalApplyDiscountApproval() {
        var power = this.profileId;
        // 2B2_备品中心检测&仓库管理 00e10000000xnoY
        if (power != '00e10000000xnoY') {
        var power = this.profileName;
        if (power != '2B2_备品中心检测&仓库管理') {
            this.ShowToastEvent("对不起,您没有权限提交此申请!", "error");
            // alert('对不起,您没有权限提交此申请!');
            return;
        }
        var status = this.RentalApplyDiscountStatusC;
        if (status == '审批中') {
            this.ShowToastEvent("审批提交成功,当前正在审批请勿再提交!", "error");
            // alert("审批提交成功,当前正在审批请勿再提交!");
            return;
        }
        if (status == '批准') {
            this.ShowToastEvent("审批已批准,请勿再提交!", "error");
            // alert("审批已批准,请勿再提交!");
            return;
        }
        if (status == '草案中' || status == undefined || status == '驳回') {
@@ -91,12 +99,10 @@
                    }
                })
            } else {
                this.ShowToastEvent("请先填写备品减价金额!", "error");
                // alert("请先填写备品减价金额!");
                this.ShowToastEvent("提交失败", "error");
                return;
            }
        }
        location.reload();
    }
    // 弹窗