liuyn
2024-03-11 a87f1c3df03078814ee97ad0c8ac200a232419e9
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
import { LightningElement , wire, api} from 'lwc';
import { CurrentPageReference,NavigationMixin } from 'lightning/navigation';
import { CloseActionScreenEvent } from 'lightning/actions';
import { updateRecord } from 'lightning/uiRecordApi';
import { ShowToastEvent } from 'lightning/platformShowToastEvent';
import LightningConfirm from 'lightning/confirm';
 
import reassign from '@salesforce/apex/LexConsumApplyEquipmentSetReaController.reassign';
 
export default class LexConsumApplyEquipmentSetReassign extends NavigationMixin(LightningElement) {
    @api recordId;
    @api consumEquipmentId;
    IsLoading = true;
    IsDisplay=false;
    //提示信息
    msg;
 
     connectedCallback(){
      this.IsLoading = false;
      reassign({recordId:this.recordId}).then(result=>{
            console.log('result--->'+ JSON.stringify(result));
            console.log('this.recordId--->'+this.recordId);
            if (result.status != '已出库指示' ) {
              this.IsDisplay = true;
              this.msg = '耗材请单没有出库指示不能重新分配';
              return;
            }else{
              LightningConfirm.open({
                message: "你确定要重新分配吗?",
                variant: 'headerless',
                label: '提示信息',
                // setting theme would have no effect
              }).then(submit=>{
                  if(submit){
                    this.dispatchEvent(new CloseActionScreenEvent());
                    window.open("/apex/ConsumReassign?caid="+this.recordId);
                  }
                  this.closeAction();
                  return;
              })
            }
        })
    }
 
    updateRecordView(recordId) {
        updateRecord({fields: { Id: recordId }});
    }
 
    closeAction() {
      window.open("/"+this.recordId,'_self');
    }
}