zz
2023-05-10 396c5c48682370f5060728817bcdcaf91657f1d4
招标项目 失单 修改ID使用HardCode的写法
3个文件已修改
35 ■■■■■ 已修改文件
force-app/main/default/classes/LightingButtonConstant.cls 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/TenderingButtonController.cls 19 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexTenderingLostButton/lexTenderingLostButton.js 11 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/LightingButtonConstant.cls
@@ -86,6 +86,11 @@
    public static final String CN_NO = '否';
    public static final String VOC_NAME = 'VOC';
    public static final String OK = 'OK';
    public static final String LU_SHENG_NAME = '陆 胜';
    public static final String HU_DI_AN_NAME = '胡 迪安';
    public static final String SYSTEM_PROFILE_NAME = '系统管理员';
    public static final String TwoS1_Sales_Hospital = '2S1_销售医院担当';
    public static final String TwoS4_Sales_Manager = '2S4_销售管理者';
    public static final String SOBJECT_NAME_OF_REPORT_SHARE ='Report__Share';
    public static final String  SOBJECT_NAME_OF_VOC_SHARE = 'VOCShare__c';
    public static final String REPAIR_FIELD_DOJ_STATUS_NOT_OBJECT = '非对象';
force-app/main/default/classes/TenderingButtonController.cls
@@ -11,6 +11,9 @@
            res.opportunityNum = String.valueOf(report.OpportunityNum__c);
            res.isRelateProject = report.IsRelateProject__c;
            res.profileId = UserInfo.getProfileId();
            res.systemProfileId = getProfileIdByName(LightingButtonConstant.SYSTEM_PROFILE_NAME);
            res.SalesManagerId = getProfileIdByName(LightingButtonConstant.SYSTEM_PROFILE_NAME);
            res.SalesHospitalId = getProfileIdByName(LightingButtonConstant.SYSTEM_PROFILE_NAME);
            res.Environment_Url = System.Label.Environment_Url;
            System.debug(LoggingLevel.INFO, '*** xu: ' + res);
        }catch(Exception e){
@@ -19,6 +22,16 @@
        return res;
    }
    @AuraEnabled
    public static string getProfileIdByName(String name){
        Profile profile = null;
        try {
            profile = [select Id from Profile where Name =:name];
        } catch (Exception e) {
            throw new AuraHandledException(e.getMessage());
        }
        return profile.Id;
    }
    // var sql = "select id from Tender_Opportunity_Link__c where Tender_information__c='" + '{!Tender_information__c.Id}'+ "'";
    // var sqlResult = sforce.connection.query(sql);
    @AuraEnabled
@@ -49,6 +62,12 @@
        @AuraEnabled
        public String profileId;
        @AuraEnabled
        public String systemProfileId;
        @AuraEnabled
        public String SalesManagerId;
        @AuraEnabled
        public String SalesHospitalId;
        @AuraEnabled
        public String Environment_Url;
    }
}
force-app/main/default/lwc/lexTenderingLostButton/lexTenderingLostButton.js
@@ -8,6 +8,9 @@
    @api recordId;//当前这条数据的id
    status;//状态
    profileId;//profileId id
    systemProfileId;
    SalesManagerId;
    SalesHospitalId;
    IsLoading = true;
    @wire(CurrentPageReference)
@@ -26,9 +29,13 @@
        init({
            recordId: this.recordId
        }).then(result => {
                console.log();
                this.IsLoading = false;
                this.status = result.status;
                this.profileId = result.profileId.slice(0,15);
                this.profileId = result.profileId;
                this.systemProfileId = result.systemProfileId;
                this.SalesManagerId = result.SalesManagerId;
                this.SalesHospitalId = result.SalesHospitalId;
                this.LoseButton();
                this.dispatchEvent(new CloseActionScreenEvent());
        })        
@@ -38,7 +45,7 @@
    LoseButton(){
        sqlResult({id: this.recordId}).then(result=>{
            //简档权限 2S1_销售医院担当 2S4_销售管理者 系统管理员
            if (this.profileId != '00e10000000xnp2' && this.profileId != '00e10000000xnpH' && this.profileId != '00e10000000Y3o5') {
            if (this.profileId != this.SalesManagerId  && this.profileId != this.SalesHospitalId && this.profileId != this.systemProfileId) {
                this.showToast("您没有权限,无法创建询价提交失单。","error");
                return;
            }