zz
2023-04-07 993c5170391cfd6719f89c9b83bc17ab5e787035
招标项目 失单 新建医院 查看附件提交
11个文件已添加
3个文件已修改
329 ■■■■ 已修改文件
force-app/main/default/classes/ApplicationButtonController.cls 22 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/TenderingButtonController.cls 51 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/TenderingButtonController.cls-meta.xml 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexApplicationCancelSubmit/lexApplicationCancelSubmit.js 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexApplicationSubmitButton/lexApplicationSubmitButton.js 20 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexTenderingAttachmentButton/lexTenderingAttachmentButton.html 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexTenderingAttachmentButton/lexTenderingAttachmentButton.js 49 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexTenderingAttachmentButton/lexTenderingAttachmentButton.js-meta.xml 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexTenderingHospitalButton/lexTenderingHospitalButton.html 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexTenderingHospitalButton/lexTenderingHospitalButton.js 46 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexTenderingHospitalButton/lexTenderingHospitalButton.js-meta.xml 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexTenderingLostButton/lexTenderingLostButton.html 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexTenderingLostButton/lexTenderingLostButton.js 72 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexTenderingLostButton/lexTenderingLostButton.js-meta.xml 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/ApplicationButtonController.cls
@@ -3,7 +3,6 @@
    public static InitData initSubmitButton (String recordId){
        InitData res = new initData();
        try{
            // Request_tedner_doc__c report = [SELECT     OwnerId,Id,Product_discription__c,Status__c FROM Request_tedner_doc__c WHERE Id = :recordId LIMIT 1];
            Request_tedner_doc__c report = [SELECT     OwnerId,Id FROM Request_tedner_doc__c WHERE Id = :recordId LIMIT 1];
            res.OwnerId = report.OwnerId;
            res.Id = report.Id;
@@ -18,10 +17,9 @@
    @AuraEnabled
    public static String submit(String recordId) {
       try {
        // Request_tedner_doc__c rac = [SELECT     Id,Status__c,Submit_check_flag__c,RecordTypeId,Submit_time__c,Request_target__c,Document_format__c,Bid_distributor__c,Product_discription__c,Tedner_date__c,Tender_active_day__c,tender_inactive_date__c,Tender_request_reason__c FROM Request_tedner_doc__c WHERE Id = :recordId LIMIT 1];
        Request_tedner_doc__c rac = [SELECT     Id,Status__c,Submit_check_flag__c,RecordTypeId,Submit_time__c FROM Request_tedner_doc__c WHERE Id = :recordId LIMIT 1];
        rac.Status__c = LightingButtonConstant.STATUS_Application_Submitted;
        rac.RecordTypeId = '01210000000RNXn';
        rac.RecordTypeId = rac.RecordTypeId = Schema.SObjectType.Request_tedner_doc__c.getRecordTypeInfosByName().get(LightingButtonConstant.RECORD_TYPE_NAME_Application + LightingButtonConstant.STATUS_Application_Submitted).getRecordTypeId();
        rac.Submit_check_flag__c = true;
        rac.Submit_time__c = Datetime.now();
        update rac;
@@ -29,7 +27,6 @@
       } catch (Exception ex) {
        System.debug(LoggingLevel.INFO, '*** xu: ' + ex);
        return ex.getMessage();
        // return ex.getMessage().split(',')[1];
       } finally {
       }
@@ -59,13 +56,10 @@
    public static UserResult UserInfo_Owner() {
        UserResult result = new UserResult();
        ID myUserID = UserInfo.getUserId();
        try { 
            User tempUser =
                [select id from user where id = : myUserID ];
            User tempUser = [select id from user where id = : myUserID ];
            result.id = tempUser.id;
        } catch (exception e) {
            result.result = e.getMessage();
        }
        return result;
@@ -85,15 +79,5 @@
        }
        @AuraEnabled
        public string id;
        //20210105 CHAN-BWX3YU you end
    }
}
    // if("{!Request_tedner_doc__c.OwnerId}" == "{!$User.Id}") {
    //     var rac = new sforce.SObject("Request_tedner_doc__c");
    //     rac.Id = "{!Request_tedner_doc__c.Id}";
    //     rac.Status__c = "已提交";
    //     rac.Submit_check_flag__c = "true";
    //     rac.RecordTypeId = "01210000000RNXn";
    //     var serverTimestamp = sforce.connection.getServerTimestamp();
    //     rac.Submit_time__c = serverTimestamp.timestamp;
}
force-app/main/default/classes/TenderingButtonController.cls
New file
@@ -0,0 +1,51 @@
public class TenderingButtonController {
    @AuraEnabled
    public static InitData initTenderingController(String recordId) {
        InitData res = new initData();
        try{
            Tender_information__c report = [SELECT     OpportunityNum__c,OwnerId,Id,status__c,Name,IsRelateProject__c FROM Tender_information__c WHERE Id = :recordId LIMIT 1];
            res.OwnerId = report.OwnerId;
            res.Id = report.Id;
            res.status = report.status__c;
            res.name = report.Name;
            res.opportunityNum = String.valueOf(report.OpportunityNum__c);
            res.isRelateProject = report.IsRelateProject__c;
            res.profileId = UserInfo.getProfileId();
            System.debug(LoggingLevel.INFO, '*** xu: ' + res);
        }catch(Exception e){
            System.debug(LoggingLevel.INFO, '*** xu: ' + e);
        }
        return res;
    }
    // 招标项目失单 TenderOpportunityLink
    // 调用该接口var sql = "select id from Tender_Opportunity_Link__c where Tender_information__c='" + '{!Tender_information__c.Id}'+ "'";
    @AuraEnabled
    public static List<Tender_Opportunity_Link__c> sqlResult (String id) {
        try {
            List<Tender_Opportunity_Link__c> TenderOpportunityLink = [SELECT id FROM Tender_Opportunity_Link__c WHERE Tender_information__c = :id];
            System.debug(LoggingLevel.INFO, '*** xu1: ' + TenderOpportunityLink);
            return TenderOpportunityLink;
        } catch (exception e) {
            System.debug(LoggingLevel.INFO, '*** xu1111111: ' + e);
            throw new AuraHandledException(e.getMessage());
        }
    }
    public class InitData{
        @AuraEnabled
        public String Id;
        @AuraEnabled
        public String OwnerId;
        @AuraEnabled
        public String status;
        @AuraEnabled
        public String name;
        @AuraEnabled
        public String opportunityNum;
        @AuraEnabled
        public String isRelateProject;
        @AuraEnabled
        public String profileId;
    }
}
force-app/main/default/classes/TenderingButtonController.cls-meta.xml
New file
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
    <apiVersion>56.0</apiVersion>
    <status>Active</status>
</ApexClass>
force-app/main/default/lwc/lexApplicationCancelSubmit/lexApplicationCancelSubmit.js
@@ -1,13 +1,12 @@
import { LightningElement,wire,track,api} from 'lwc';
import { CurrentPageReference } from "lightning/navigation";
import { CloseActionScreenEvent } from 'lightning/actions';
import { NavigationMixin } from 'lightning/navigation';
import  init  from '@salesforce/apex/ApplicationButtonController.initSubmitButton';
import { updateRecord } from 'lightning/uiRecordApi';
import { ShowToastEvent } from 'lightning/platformShowToastEvent';
import submitCancel from '@salesforce/apex/ApplicationButtonController.submitCancel';
import UserInfo_Owner from '@salesforce/apex/ApplicationButtonController.UserInfo_Owner';
export default class Submit extends LightningElement {
export default class lexApplicationCancelSubmit extends LightningElement {
    @api recordId;//OwnerId
    ownerId;
    monthlyReportId;
@@ -19,33 +18,29 @@
           const urlValue = currentPageReference.state.recordId;
           if (urlValue) {
             let str = `${urlValue}`;
             console.log("str:"+str);
             this.recordId = str;
           }
         }
     }
    
    connectedCallback(){
        init({
            recordId: this.recordId
        }).then(result => {
            if (result != null) {
                this.IsLoading = false;
                this.ownerId = result.OwnerId;
                this.monthlyReportId = result.Id;
                this.cancelSubmit();
            }
        }).catch(error => {
            console.log("error"+error);
        }).catch(() => {
        }).finally(() => {
            
        });        
    }
    //授权申请 取消提交
    cancelSubmit(){
        //'获取当前登陆人id'
        UserInfo_Owner({}).then(result=>{
            console.log(result,'获取当前登陆人id')
            if(this.ownerId == result.id){
                submitCancel({
                    recordId: this.recordId
@@ -64,7 +59,6 @@
            }
        })
    }
    updateRecordView() {
        updateRecord({fields: { Id: this.recordId }});
force-app/main/default/lwc/lexApplicationSubmitButton/lexApplicationSubmitButton.js
@@ -1,13 +1,12 @@
import { LightningElement,wire,track,api} from 'lwc';
import { CurrentPageReference } from "lightning/navigation";
import { CloseActionScreenEvent } from 'lightning/actions';
import { NavigationMixin } from 'lightning/navigation';
import  init  from '@salesforce/apex/ApplicationButtonController.initSubmitButton';
import UserInfo_Owner from '@salesforce/apex/ApplicationButtonController.UserInfo_Owner';
import submit  from '@salesforce/apex/ApplicationButtonController.submit';
import { updateRecord } from 'lightning/uiRecordApi';
import { ShowToastEvent } from 'lightning/platformShowToastEvent';
export default class Submit extends LightningElement {
export default class lexApplicationSubmitButton extends LightningElement {
    @api recordId;//OwnerId
    ownerId;//所有人id
    id;//返回值的id
@@ -16,33 +15,27 @@
    @wire(CurrentPageReference)
     getStateParameters(currentPageReference) {
        console.log(currentPageReference,'666666666666');
         if (currentPageReference) {
           const urlValue = currentPageReference.state.recordId;
           if (urlValue) {
             let str = `${urlValue}`;
             console.log("str:"+str);
             this.recordId = str;
           }
         }
     }
    
    connectedCallback(){
        init({
            recordId: this.recordId
        }).then(result => {
            console.log(result,"请求成功了吗")
            if (result != null) {
                this.IsLoading = false;
                this.ownerId = result.OwnerId;
                this.id = result.Id;
                this.Submit();
            }
        }).catch(error => {
            console.log("error"+error);
        }).catch(() => {
        }).finally(() => {
        });        
    }
@@ -50,7 +43,6 @@
        this.arrMessage = [];
        //获取获取当前登陆人
        UserInfo_Owner({}).then(result=>{
            console.log(result,'获取当前登陆人id')
            if(this.ownerId == result.id){
                submit({
                    recordId: this.recordId
@@ -66,11 +58,6 @@
                            }
                            messageage += this.arrMessage[i+1];
                        }
                        // if(requst.split(',')[1].slice(-1) == '式'){
                        //     messageage = requst.split(',')[1] + "," + requst.split(',')[2] + "," +  requst.split(',')[3] + "," +  requst.split(',')[4] + "," +  requst.split(',')[5] + "," + requst.split(',')[6];
                        // }else{
                        //     messageage = requst.split(',')[1];
                        // }
                        this.showToast(messageage,"error");
                    }
                })
@@ -80,19 +67,16 @@
        })
    }
    updateRecordView() {
        updateRecord({fields: { Id: this.recordId }});
    }
    showToast(msg,type) {
        console.log(msg,type);
        const event = new ShowToastEvent({
            message: msg,
            variant: type
        });
        this.dispatchEvent(event);
        console.log('走到这里了吗');
        if(type == 'success'){
            this.updateRecordView();
        }
force-app/main/default/lwc/lexTenderingAttachmentButton/lexTenderingAttachmentButton.html
New file
@@ -0,0 +1,5 @@
<template>
    <div class="AttachmentButton" if:true={IsLoading}>
        <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner>
    </div>
</template>
force-app/main/default/lwc/lexTenderingAttachmentButton/lexTenderingAttachmentButton.js
New file
@@ -0,0 +1,49 @@
import { LightningElement,wire,track,api} from 'lwc';
import { CurrentPageReference } from "lightning/navigation";
import { CloseActionScreenEvent } from 'lightning/actions';
import  init  from '@salesforce/apex/TenderingButtonController.initTenderingController';
import { ShowToastEvent } from 'lightning/platformShowToastEvent';
export default class lexTenderingAttachmentButton extends LightningElement {
    @api recordId;//当前这条数据的id
    id;//返回值的id  Tender_information__c招标项目的id
    IsLoading = true;
    @wire(CurrentPageReference)
     getStateParameters(currentPageReference) {
         if (currentPageReference) {
           const urlValue = currentPageReference.state.recordId;
           if (urlValue) {
             let str = `${urlValue}`;
             this.recordId = str;
           }
         }
     }
    connectedCallback(){
        init({
            recordId: this.recordId
        }).then(result => {
            this.IsLoading = false;
            this.id = result.Id;
            this.AttachmentButton();
            this.dispatchEvent(new CloseActionScreenEvent());
        }).catch(() => {
        }).finally(() => {
        });
    }
    //查看附件
    AttachmentButton(){
        window.open(`/apex/TenderInformationUploadPdf?id=${this.id}`);
    }
    showToast(msg,type) {
        const event = new ShowToastEvent({
            message: msg,
            variant: type
        });
        this.dispatchEvent(event);
    }
}
force-app/main/default/lwc/lexTenderingAttachmentButton/lexTenderingAttachmentButton.js-meta.xml
New file
@@ -0,0 +1,11 @@
<?xml version="1.0"?>
<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
    <apiVersion>54.0</apiVersion>
    <isExposed>true</isExposed>
    <targets>
        <target>lightning__RecordPage</target>
        <target>lightning__AppPage</target>
        <target>lightning__HomePage</target>
        <target>lightning__RecordAction</target>
    </targets>
</LightningComponentBundle>
force-app/main/default/lwc/lexTenderingHospitalButton/lexTenderingHospitalButton.html
New file
@@ -0,0 +1,5 @@
<template>
    <div class="HospitalButton" if:true={IsLoading}>
        <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner>
    </div>
</template>
force-app/main/default/lwc/lexTenderingHospitalButton/lexTenderingHospitalButton.js
New file
@@ -0,0 +1,46 @@
import { LightningElement,wire,track,api} from 'lwc';
import { CurrentPageReference } from "lightning/navigation";
import { CloseActionScreenEvent } from 'lightning/actions';
import  init  from '@salesforce/apex/TenderingButtonController.initTenderingController';
export default class lexTenderingHospitalButton extends LightningElement {
    @api recordId;//当前这条数据的id
    id;//返回值的id  Tender_information__c招标项目的id
    name;//招标项目名
    IsLoading = true;
    @wire(CurrentPageReference)
     getStateParameters(currentPageReference) {
         if (currentPageReference) {
           const urlValue = currentPageReference.state.recordId;
           if (urlValue) {
             let str = `${urlValue}`;
             this.recordId = str;
           }
         }
     }
    connectedCallback(){
        init({
            recordId: this.recordId
        }).then(result => {
                this.IsLoading = false;
                this.id = result.Id;
                this.name = result.name;
                this.HospitalButton();
                this.dispatchEvent(new CloseActionScreenEvent());
        }).catch(() => {
        }).finally(() => {
        });
    }
    //新建医院
    HospitalButton(){
        var url = 'https://ocsm.my.salesforce.com/?ec=302&startURL=%2F'+'001/e?CF00N10000009I0o7='+encodeURIComponent(this.name)
        +'&CF00N10000009I0o7_lkid='+encodeURIComponent(this.id)
        +'&00N10000009HFQT='+encodeURIComponent('招标项目')
        +'&RecordType=01210000000QemG'
        +'&retURL='+ encodeURIComponent(this.id);
        window.location.href = url;
    }
}
force-app/main/default/lwc/lexTenderingHospitalButton/lexTenderingHospitalButton.js-meta.xml
New file
@@ -0,0 +1,11 @@
<?xml version="1.0"?>
<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
    <apiVersion>54.0</apiVersion>
    <isExposed>true</isExposed>
    <targets>
        <target>lightning__RecordPage</target>
        <target>lightning__AppPage</target>
        <target>lightning__HomePage</target>
        <target>lightning__RecordAction</target>
    </targets>
</LightningComponentBundle>
force-app/main/default/lwc/lexTenderingLostButton/lexTenderingLostButton.html
New file
@@ -0,0 +1,5 @@
<template>
    <div class="LostButton" if:true={IsLoading}>
        <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner>
    </div>
</template>
force-app/main/default/lwc/lexTenderingLostButton/lexTenderingLostButton.js
New file
@@ -0,0 +1,72 @@
import { LightningElement,wire,track,api} from 'lwc';
import { CurrentPageReference } from "lightning/navigation";
import { CloseActionScreenEvent } from 'lightning/actions';
import  init  from '@salesforce/apex/TenderingButtonController.initTenderingController';
import  sqlResult  from '@salesforce/apex/TenderingButtonController.sqlResult';
import { ShowToastEvent } from 'lightning/platformShowToastEvent';
export default class lexTenderingLostButton extends LightningElement {
    @api recordId;//当前这条数据的id
    id;//返回值的id  Tender_information__c招标项目的id
    status;//状态
    profileId;//profileId id
    IsLoading = true;
    @wire(CurrentPageReference)
     getStateParameters(currentPageReference) {
         if (currentPageReference) {
           const urlValue = currentPageReference.state.recordId;
           if (urlValue) {
             let str = `${urlValue}`;
             this.recordId = str;
           }
         }
     }
    connectedCallback(){
        init({
            recordId: this.recordId
        }).then(result => {
                this.IsLoading = false;
                this.id = result.Id;
                this.status = result.status;
                this.profileId = result.profileId.slice(0,15);
                this.LoseButton();
                this.dispatchEvent(new CloseActionScreenEvent());
        }).catch(() => {
        }).finally(() => {
        });
    }
    //失单
    LoseButton(){
        sqlResult({id: this.id}).then(result=>{
            //简档权限 2S1_销售医院担当 2S4_销售管理者 系统管理员
            if (this.profileId != '00e10000000xnp2' && this.profileId != '00e10000000xnpH' && this.profileId != '00e10000000Y3o5') {
                this.showToast("您没有权限,无法创建询价提交失单。","error");
                return;
            }
            // 判断内部确认状态
            if(this.status == '01.待确认'|| this.status == '02.不相关'){
                this.showToast("状态为待确认或不相关,不可以做失单。","error");
                return;
            }
            // 判断是否需要新建询价
            if(this.status == '05.询价中'|| this.status == '06.成交' || this.status == '07.部分成交' || this.status == '08.失单' || result.length > 0){
                if(confirm('此项目已关联询价,请确实是否新建询价提交失单。')) {
                }else{
                    return;
                }
            }
            window.open(`/apex/TenderLostPage?id=${this.id}`,'','height=500,width=800,top=200,left=250,location=no');
        })
    }
    showToast(msg,type) {
        const event = new ShowToastEvent({
            message: msg,
            variant: type
        });
        this.dispatchEvent(event);
    }
}
force-app/main/default/lwc/lexTenderingLostButton/lexTenderingLostButton.js-meta.xml
New file
@@ -0,0 +1,11 @@
<?xml version="1.0"?>
<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
    <apiVersion>54.0</apiVersion>
    <isExposed>true</isExposed>
    <targets>
        <target>lightning__RecordPage</target>
        <target>lightning__AppPage</target>
        <target>lightning__HomePage</target>
        <target>lightning__RecordAction</target>
    </targets>
</LightningComponentBundle>