19626
2023-05-24 e6a0a7f9ffb463c5ce78d6770b09eac739f88b15
force-app/main/default/lwc/lexOLYwinBid/lexOLYwinBid.js
@@ -4,7 +4,7 @@
 * @Author: chen jing wu
 * @Date: 2023-04-13 13:15:52
 * @LastEditors: chen jing wu
 * @LastEditTime: 2023-04-13 13:37:19
 * @LastEditTime: 2023-05-24 16:28:23
 */
import { api, wire,LightningElement } from 'lwc';
import { CurrentPageReference } from "lightning/navigation";
@@ -14,6 +14,7 @@
import init  from '@salesforce/apex/OpportunityLightingButtonController.initForOLYwinBidButton';
import updateForOLYwinBidButton  from '@salesforce/apex/OpportunityLightingButtonController.updateForOLYwinBidButton';
import queryForOLYwinBidButton  from '@salesforce/apex/OpportunityLightingButtonController.queryForOLYwinBidButton';
import LightningConfirm from 'lightning/confirm';
export default class LexOLYwinBid extends LightningElement {
    @api recordId;
    ifOpenBid;
@@ -31,6 +32,34 @@
            console.log(str);
            this.recordId = str;
          }
        }
    }
    async handleConfirmClick(msg) {
        const result = await LightningConfirm.open({
            message: msg,
            variant: 'headerless',
            label: 'this is the aria-label value',
        });
        console.log(result);
        if(result){
            try {
                updateForOLYwinBidButton({
                    recordId: this.recordId
                }).then(result=>{
                    if (result) {
                        this.showToast(result,"error");
                    }else{
                        this.IsLoading = false;
                        this.updateRecordView(this.recordId);
                        this.showToast("操作成功!","success");
                    }
                    this.dispatchEvent(new CloseActionScreenEvent());
                });
                } catch(e) {
                   console.log(e);
                }
        }else{
            this.dispatchEvent(new CloseActionScreenEvent());
        }
    }
    connectedCallback(){
@@ -66,19 +95,7 @@
            if(flag){
                this.showToast("条件不符合,不可操作","error");
            }else{
                if (window.confirm('是否确认OLY中标?')) {
                    updateForOLYwinBidButton({
                        recordId: this.recordId
                    }).then(result=>{
                        if (result) {
                            this.showToast(result,"error");
                        }else{
                            this.IsLoading = false;
                            this.updateRecordView(this.recordId);
                            this.showToast("操作成功!","success");
                        }
                    })
                }
                this.handleConfirmClick('是否确认OLY中标?');
            }
        });    
    }