黄千龙
2023-07-18 428f42fab44b654c69fbc461513203830743d7de
force-app/main/default/lwc/lexOSHRecieved/lexOSHRecieved.js
@@ -4,13 +4,20 @@
import { ShowToastEvent } from 'lightning/platformShowToastEvent';
import init  from '@salesforce/apex/QISReportController.initForOSHRecievedButton';
import updateQis  from '@salesforce/apex/QISReportController.updateQis';
import { updateRecord } from 'lightning/uiRecordApi';
/*
 * @Description: OSH现品收到
 * @Author: hql
 * @Date: 2023-07-12 09:45:19
 * @LastEditTime: 2023-07-12 15:44:33
 * @LastEditors:
 */
export default class lexOSHRecieved extends LightningElement {
   @api recordId;
   IsLoading = true;
   qisReportId;
   qisStatus;
    @wire(CurrentPageReference)
    @api recordId;
    IsLoading = true;
    qisReportId;
    qisStatus;
     @wire(CurrentPageReference)
     getStateParameters(currentPageReference) {
             console.log(111);
             console.log(currentPageReference);
@@ -34,18 +41,18 @@
            this.qisReportId = result.Id;
            this.qisStatus = result.qIStatus;
            console.log('this.qisStatus='+this.qisStatus);
            if (this.qisStatus!='OSH检测申请' && this.qisStatus!='完毕') {
            if (this.qisStatus!='OSH检测申请' && this.qisStatus!='完毕') {
                const evt = new ShowToastEvent({
                        title : 'OSH已经收到实物',
                        message: '',
                        title : '',
                        message: 'OSH已经收到实物',
                        variant: 'error'
                    });
                this.dispatchEvent(evt);
                this.dispatchEvent(new CloseActionScreenEvent());
                return;
            }else{
               this.updateQisSubmit();
            }
            }else{
                this.updateQisSubmit();
            }
        }).catch(error => {
            console.log('error='+error);
        }).finally(() => {
@@ -53,21 +60,23 @@
        }); 
    }
    updateQisSubmit(){
           updateQis({
               recordId: this.recordId
              }).then(result =>{
            updateQis({
                 recordId: this.recordId
                }).then(result =>{
                    
                 console.log('result'+result);
                 if (result!='成功') {
                    console.log('result'+result);
                    if (result!='成功') {
                        const evt = new ShowToastEvent({
                            title : '更新失败',
                            message: result,
                            title : '',
                            message: '更新失败'+result,
                            variant: 'error'
                        });
                        this.dispatchEvent(evt);
                        updateRecord({fields: { Id: this.recordId }});
                    }
                this.dispatchEvent(new CloseActionScreenEvent());
              }).catch(error => {
                updateRecord({fields: { Id: this.recordId }});
                }).catch(error => {
            console.log('error='+error);
        }).finally(() => {