19626
2023-10-07 988f9735377909b6310301e582c15804e004783f
force-app/main/default/lwc/lexAgencyAuthorize/lexAgencyAuthorize.js
@@ -4,7 +4,7 @@
 * @Author: chen jing wu
 * @Date: 2023-04-12 14:51:44
 * @LastEditors: chen jing wu
 * @LastEditTime: 2023-09-05 15:47:38
 * @LastEditTime: 2023-10-04 12:28:54
 */
import { api, wire,LightningElement } from 'lwc';
import { CurrentPageReference } from "lightning/navigation";
@@ -20,6 +20,10 @@
import TradeComplianceStatusFlag from '@salesforce/label/c.TradeComplianceStatusFlag';
import IFTradeComplianceAlert from '@salesforce/label/c.IFTradeComplianceAlert';
import LightningConfirm from 'lightning/confirm';
import lwcCSS from '@salesforce/resourceUrl/lwcCSS';
import {loadStyle} from 'lightning/platformResourceLoader';
import queryQuote from '@salesforce/apex/OpportunityLightingButtonController.queryQuote';
export default class LexAgencyAuthorize extends LightningElement {
    @api recordId;
    agency1Id;
@@ -68,6 +72,9 @@
        }
    }
    connectedCallback(){
        Promise.all([
            loadStyle(this, lwcCSS)
           ]);
        init({
            recordId: this.recordId
        }).then(result=>{
@@ -118,14 +125,20 @@
        var oppid = this.recordId;
        var angency = this.agency1Id;
        var profileId = this.profileId;
         //测试已锁定授权合同申请为“1”
        this.estimationId = 'test';
        this.detailNum = 1;
        if (profileId != this.systemProfileId && profileId != this.j3ProfileId && profileId != this.s61ProfileId && profileId != this.s62ProfileId && profileId != this.m4ProfileId) {
            this.showToast("您没有授权申请的权限。请联系系统管理员。","error");
            return;
        }
        //贸易合规 you
        queryQuote({
            estimationId: this.estimationId
        }).then(result=>{
            console.log(result);
            if(result == true){
                this.showToast("包含虚拟产品,不能授权,请更新报价单后申请","error");
                return;
            }
             //贸易合规 you
        var AccDealerBlacklist = this.AccDealerBlacklist;//判断客户/经销商是否为黑名单
        var angency1 = this.angency1;
        var angency2 = this.angency2;
@@ -206,6 +219,10 @@
            this.ss();
        }
        //贸易合规 you
        });
    }
    ss(){
        if (this.stageName != '引合' && this.stageName != '询价' ) {
@@ -221,10 +238,11 @@
            this.showToast("耗材不可与奥辉产品同时存在!","error");
            return;
        } else if (this.cntLostCancelDraft > 0) {
            if(!confirm('询价有草案中的取消/失单报告,是否继续?')){
                this.dispatchEvent(new CloseActionScreenEvent());
                return ;
            }
            // if(!confirm('询价有草案中的取消/失单报告,是否继续?')){
            //     this.dispatchEvent(new CloseActionScreenEvent());
            //     return ;
            // }
            this.handleConfirmClick1("询价有草案中的取消/失单报告,是否继续?");
        } else if (this.cntLostCancelReport - this.cntLostCancelDraft > 0) {
            this.showToast('询价有已提交的取消/失单报告。',"error");
            return;
@@ -240,7 +258,13 @@
        }else if (this.ifSubmit == '1') {
            this.showToast('上传失败,请联系系统管理员!',"error");
            return;
        }else{
            this.dd();
        }
    }
    dd(){
        if (this.ifAuthorizingLock == true) {
            this.showToast('询价正在授权中,请不要重复提交。',"error");
            return;
@@ -290,11 +314,25 @@
            this.dispatchEvent(new CloseActionScreenEvent());
        }
    }
    async handleConfirmClick1(msg) {
        const result = await LightningConfirm.open({
            message: msg,
            variant: 'headerless',
            label: 'this is the aria-label value'
        });
        if (result) {
            this.dd();
        } else {
            this.dispatchEvent(new CloseActionScreenEvent());
        }
    }
    showToast(msg,type) {
        const event = new ShowToastEvent({
            title: '',
            message: msg,
            variant: type
            variant: type,
            mode: 'sticky'
        });
        this.dispatchEvent(event);
        this.dispatchEvent(new CloseActionScreenEvent());