1
chenjingwu
2024-05-24 2a2cfdf553cd932dc1b1a591b188a8c224181c96
force-app/main/default/lwc/lexComplete/lexComplete.js
@@ -1,3 +1,11 @@
/*
 * @Description:
 * @version:
 * @Author: chen jing wu
 * @Date: 2023-04-07 09:02:03
 * @LastEditors: chen jing wu
 * @LastEditTime: 2023-04-11 11:21:30
 */
import { LightningElement,wire,track,api} from 'lwc';
import { CurrentPageReference } from "lightning/navigation";
import { CloseActionScreenEvent } from 'lightning/actions';
@@ -11,6 +19,22 @@
    profileId;
    status;
    IsLoading = true;
    @wire(CurrentPageReference)
    getStateParameters(currentPageReference) {
            console.log(111);
            console.log(currentPageReference);
        if (currentPageReference) {
          const urlValue = currentPageReference.state.recordId;
          if (urlValue) {
            let str = `${urlValue}`;
            console.log("str");
            console.log(str);
            this.recordId = str;
          }
        }
    }
    
    connectedCallback () {
        console.log(this.recordId);
@@ -19,18 +43,14 @@
        }).then(result => {
            console.log(result);
            if (result != null) {
                this.IsLoading = false;
                this.status = result.status;
                this.profileId = result.profileId;
                this.complete();
                this.dispatchEvent(new CloseActionScreenEvent());
                //window.location.replace("https://ocsm--partial.sandbox.lightning.force.com/lightning/r/Report__c/" + this.recordId + "/view");
            }
        }).catch(error => {
            console.log("error");
            console.log(error);
        }).finally(() => {
        });   
        //this.updateRecordView(this.recordId);
    }
@@ -53,18 +73,24 @@
    complete () {
        // 陆胜,胡迪安,系统管理员以外没有权限
        if (UserInfo_Owner.Id != "00510000004reg2" && UserInfo_Owner.Id != "00510000000gWAE" && this.profileId != "00e10000000Y3o5") {
            ShowToastEvent("你没有权限","error");
            this.showToast("你没有权限","error");
            return;
        }
        if (this.status == "完毕") {
            ShowToastEvent("已经完毕!","error");
            this.showToast("已经完毕!","error");
            return;
        }
        updateForCompleteButton({
            recordId: this.recordId
        }).then(result =>{
            this.updateRecordView(this.recordId);
            this.showToast("完毕成功!","success");
            if(result){
                this.showToast(result,"error");
            }else{
                this.updateRecordView(this.recordId);
                this.showToast("完毕成功!","success");
            }
            this.IsLoading = false;
            this.dispatchEvent(new CloseActionScreenEvent());
        });
    }
}