liuyn
2024-03-22 e8be4d964c6b336ed39dba5900b1b9a8f3181b96
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
import { LightningElement, track, wire ,api} from 'lwc';
import LightningConfirm from 'lightning/confirm';
import jquery183minjs from '@salesforce/resourceUrl/jquery183minjs';
import PleaseWaitDialog from '@salesforce/resourceUrl/PleaseWaitDialog';
import { ShowToastEvent } from 'lightning/platformShowToastEvent';
import Selected from '@salesforce/label/c.Selected';
import Set_Search from '@salesforce/label/c.Set_Search';
import Search_Condition from '@salesforce/label/c.Search_Condition';
import Search  from '@salesforce/label/c.Search';
import Search_Result  from '@salesforce/label/c.Search_Result';
import { NavigationMixin } from 'lightning/navigation';
import { encodeDefaultFieldValues } from 'lightning/pageReferenceUtils';
import { CurrentPageReference } from 'lightning/navigation';
import { CloseActionScreenEvent } from 'lightning/actions';
    
import getNeedParm1  from "@salesforce/apex/LexChoiceAssetController.getNeedParm1";
import init  from "@salesforce/apex/LexChoiceAssetController.init";
import searchAss  from "@salesforce/apex/LexChoiceAssetController.searchAss";
import getData  from "@salesforce/apex/LexChoiceAssetController.getData";
import getDatainit  from "@salesforce/apex/LexChoiceAssetController.getDatainit";
import getDataNone  from "@salesforce/apex/LexChoiceAssetController.getDataNone";
import lwcCSS from '@salesforce/resourceUrl/lwcCSS';
import {loadStyle} from 'lightning/platformResourceLoader';
// hql 20231213 添加贸易合规 start
import TradeComplianceStatusFlagFW from '@salesforce/label/c.TradeComplianceStatusFlagFW';
import IFTradeComplianceAlert from '@salesforce/label/c.IFTradeComplianceAlert';
// hql 20231213 添加贸易合规 end
// sx 20231218 贸易合规二期 add start 
import IFTradeComplianceAlert2 from '@salesforce/label/c.IFTradeComplianceAlert2';
import accSendEmailFW from '@salesforce/apex/buttonAssetCtl.accSendEmailFW';
import IFTradeComplianceAlertName from '@salesforce/label/c.IFTradeComplianceAlertName';
// sx 20231218 贸易合规二期 add end
 
const columns = [
    { label: '选择', fieldName: 'Selected'},
    { label: '保有设备名称', fieldName: 'Name' },
    { label: '机身编码', fieldName: 'SerialNumber' },
    { label: '医院', fieldName: 'HP_Name' },
    { label: '科室', fieldName: 'Department_Name' },
    { label: '发货日', fieldName: 'Posting_Date' },
    { label: '多年保修期至', fieldName: 'Extend_Gurantee_DateTo'},
    { label: '最近一期维修合同结束日', fieldName: 'CurrentContract_End_Date'},
    // { label: '无零件风险日期', fieldName: 'NoPartRiskDate'},
    ];
export default class lexChoiceAsset  extends NavigationMixin(LightningElement) {
 
    // Label = {
    //     Set_Search,
    //     Search_Condition,
    //     Search,
    //     Search_Result,
    //     Selected
    // }
 
 
 
    @api recordId;
    IsLoading=true;
    data = [];
    columns = columns;
    SSPLine;
    Delivered_Product;
    Department_Name;
    HospitalId;
    AirframeCodeEngineer;
    WorkLocation;
    DepartmentClass;
    //搜索需要的数据
    @track inputData1;
    @track inputData2;
    @track inputData3;
    Id;
    currentDate;
    StatusC;
    Incharge_Staff;
    Repair_Detail;
    FaultTime;
    RepairApplicantName;
    HPname;
    DepName;
    PlannedVisitDay;
    ActualVisitDateFirst;
    RepairsReportDate;
    ReceiverTime;
    ActualVisitDateSecon;
    ActualVisitDateThird;
    ApplicationTime;
    AssetCode;
    canRepair;
    //搜索出的数据 report onclick拼接需要的参数     
    needParm2;
    // 2023 08 04 张赫阳 PIPL相关按钮改造 Start
    assetName;
    //AWSId;  //deloitte-zhj 20231205 PIPL还原
    // 2023 08 04 张赫阳 PIPL相关按钮改造 End
    shouldRender = false;
    SupportingProducts;
    IfDeadHurt;
    ReturnWayType;
    ProblemOccurred;
    ProblemOccurredSelect;
    ReportAdverseEvents;
    WhatProject;
    OperationOrExaminationName;
    BreakORFallOff;
    UseFailProductFinish;
    AfterFailureInformation;
    Delay15Min;
    InformationFrom;
    FailureQInHospital;
    DelayReportReason;
    ProductFailureRelated;
    DeliveryLogisticsNo;
    engineerSendDate;
engineerSendDateTime;  //Deloitte-Nancy 20231222 
    Excworklocation;
    engineerSendDateStr;//lwt 20240301
    // hql 20231213 添加贸易合规 start
    accDealerBlacklist;
    a=IFTradeComplianceAlert;
    b=TradeComplianceStatusFlagFW;
    // hql 20231213 添加贸易合规 end
 
    //deloitte-zhj 20231206 PIPL还原带上直返地址信息 start
    ReturnedPersonName; 
    ReturnedPersonPhone;
    ReturnedCustomer;
    ReturnedCity;
    ReturnedAddress;
    ReturnedZipCode;
    //deloitte-zhj 20231206 PIPL还原带上直返地址信息 end
    AccountName; // WYL 贸易合规2期 add
    state; // WYL 贸易合规2期 add
 
 
    @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;
           }
         }
     }
       handleRowAction(event) {
 
        const action = event.detail.action;
        const row = event.detail.row;
       
                
        switch (action.name) {
            case '点击添加':
                this.handleAdd(row);
                break;
            default:
                break;
        }
    }
 
    handleAdd(row) {
        // Implement edit logic here
        console.log('Editing row' + JSON.stringify(row));
        this.SetProductId(row.setProductidFull);
    }
 
 
   
 
    getInput1(event){
        this.inputData1=event.detail.value;
 
    }
 
    getInput2(event){
        this.inputData2=event.detail.value;
 
    }
    getInput3(event){
        this.inputData3=event.detail.value;
 
    }
 
 
 
    connectedCallback(){
        Promise.all([
            loadStyle(this, lwcCSS)
            ]);
        init({
            recordId: this.recordId
        }).then(result => {
            // console.log(result);
            if (result != null) {
                this.IsLoading = false;
                this.Id = result.Id;
                this.StatusC = result.StatusC;
                this.Incharge_Staff = result.OwnerId;
                this.Repair_Detail = result.Repair_Detail;
                this.FaultTime = result.FaultTime;
                this.RepairApplicantName = result.RepairApplicantName;
                this.HPname = result.HPname;
                this.AssetCode = result.AssetCode;
                this.DepName = result.DepName;
                this.AirframeCodeEngineer = result.AirframeCodeEngineer;
                this.RepairsReportDate = result.RepairsReportDate;
                this.ReceiverTime = result.ReceiverTime;
                this.PlannedVisitDay = result.PlannedVisitDay;
                this.ActualVisitDateFirst = result.ActualVisitDateFirst;
                this.ActualVisitDateSecon = result.ActualVisitDateSecon;
                this.ActualVisitDateThird = result.ActualVisitDateThird;
                this.SupportingProducts = result.SupportingProducts;
                this.ApplicationTime = result.ApplicationTime;
                this.IfDeadHurt = result.IfDeadHurt;
                this.ReturnWayType = result.ReturnWayType;
                this.ProblemOccurred = result.ProblemOccurred;
                this.ProblemOccurredSelect=result.ProblemOccurredSelect;
                this.ReportAdverseEvents = result.ReportAdverseEvents;
                this.WhatProject = result.WhatProject;
                this.OperationOrExaminationName=result.OperationOrExaminationName;
                this.BreakORFallOff = result.BreakORFallOff;
                this.UseFailProductFinish = result.UseFailProductFinish;
                this.AfterFailureInformation = result.AfterFailureInformation;
                this.Delay15Min = result.Delay15Min;
                this.InformationFrom = result.InformationFrom;
                this.FailureQInHospital = result.FailureQInHospital;
                this.DelayReportReason = result.DelayReportReason;
                this.ProductFailureRelated = result.ProductFailureRelated;
                this.DeliveryLogisticsNo = result.DeliveryLogisticsNo;
//deloitte-zhj 20231129 PIPL还原 start
                this.engineerSendDate = result.engineerSendDate;
this.engineerSendDateTime = result.engineerSendDateTime; //Deloitte-Nancy 20231222 
                this.engineerSendDateStr=result.engineerSendDateStr;//lwt 20240301
                //deloitte-zhj 20231129 PIPL还原 end
                this.currentDate = result.currentDate;
 
                //deloitte-zhj 20231206 PIPL还原带上直返地址信息 start
                this.ReturnedPersonName = result.ReturnedPersonName;
                this.ReturnedPersonPhone = result.ReturnedPersonPhone;
                this.ReturnedCustomer = result.ReturnedCustomer;
                this.ReturnedCity = result.ReturnedCity;
                this.ReturnedAddress = result.ReturnedAddress;
                this.ReturnedZipCode = result.ReturnedZipCode;
                //deloitte-zhj 20231206 PIPL还原带上直返地址信息 end
 
                //2023 08 21 Zhang Heyang PIPL按钮改造 strat
                //this.AWSId = result.AWSId;   //deloitte-zhj 20231205 PIPL还原
                //2023 08 21 Zhang Heyang PIPL按钮改造 end
                this.SearchSN = this.AssetCode;
                this.inputData3 = this.AssetCode;
                // hql 20231213 添加贸易合规 start
                this.accDealerBlacklist = result.accDealerBlacklist;
                // hql 20231213 添加贸易合规 end
                this.AccountName = result.AccountName;// WYL 贸易合规2期 add 
                this.state = result.state; // WYL 贸易合规2期 add
                // this.ApplyForRepair();
                console.log('this.AssetCode='+this.AssetCode);
                console.log('this.IfDeadHurt='+this.IfDeadHurt);
                var status = this.StatusC;
                    console.log('status=='+status);
                    if (status != '待处理') {
                        this.dispatchEvent(new CloseActionScreenEvent());
                        const evt = new ShowToastEvent({
                                title : '报修子单的状态不是 待处理 无法申请修理',
                                message: '',
                                variant: 'error',
                         mode: 'sticky'
                            });
                            this.dispatchEvent(evt);
                            // this.dispatchEvent(new CloseActionScreenEvent());
                        return;
                    }else{
                        
                    }
                this.serContactinit();
            }
        }).catch(error => {
            console.log(error);
        })
 
        
    }
    // WYL 贸易合规2期 邮件 start
    async SendEmailFW (Hospital,recordId,type,state,Asset_Model_No){
        accSendEmailFW({
        accname:Hospital,
        mcid:recordId,
        type:type,
        state:state,
        Asset_Model_No:Asset_Model_No
        })
        .then(result=>{
        return;
        }).catch(err=>{
        console.log('邮件错误'+error);
        })
    }
    // WYL 贸易合规2期 邮件 end
    // hql 20231213 添加贸易合规 start
    async invid1() {
        this.invid();
    }
    async invid() {
            return new Promise((resolve, reject) => {
            console.log('IFTradeComplianceAlert=='+this.a);
            console.log('TradeComplianceStatusFlagFW=='+this.b);
            console.log('accDealerBlacklist=='+this.accDealerBlacklist);
                if(this.b=='true'){
                    if(this.accDealerBlacklist==1){
                        const evt = new ShowToastEvent({
                            title : '您所选择的医院存在贸易合规风险,无法新建修理,'+this.a,
                            message: '',
                            variant: 'error',
                             mode: 'sticky'
                        });
                        this.SendEmailFW(this.AccountName,this.recordId,'1',this.state,null);// WYL 贸易合规add
                        this.dispatchEvent(evt);
                        this.dispatchEvent(new CloseActionScreenEvent());
                    }
                    //2023/12/18 sx 贸易合规二期 注释 start
                    // else if(this.accDealerBlacklist==2){
                    //     LightningConfirm.open({
                    //         message: '您所选择的医院存在贸易合规警示风险,是否继续申请修理,'+this.a,
                    //         variant: 'headerless',
                    //         label: 'this is the aria-label value',
                            
                    //     }).then(cancel=>{
                    //         if(cancel) {
                    //             resolve(true);
                    //         } else {
                    //             this.dispatchEvent(new CloseActionScreenEvent());
                    //             resolve(false);
                    //         }
                            
                    //     });
                    // }
                    //2023/12/18 sx 贸易合规二期 注释  end
                    else{
                        resolve(true);
                    }
                }else{
                    resolve(true);
                }
            });
    }
// hql 20231213 添加贸易合规 end
     async SelectNone(){
        const inputSearchNo = this.template.querySelector('lightning-input[data-target="SearchNo"]');
            if (inputSearchNo) {
              inputSearchNo.value = '';
            }
 
        const inputSearchName = this.template.querySelector('lightning-input[data-target="SearchName"]');
        if (inputSearchName) {
          inputSearchName.value = '';
        }
        const inputSearchSN = this.template.querySelector('lightning-input[data-target="SearchSN"]');
       console.log('inputSearchSN=='+inputSearchSN);
        if (inputSearchSN) {
          inputSearchSN.value = '';
        }
 
        this.inputData1='';
        this.inputData2='';
        this.inputData3='';
        var SearchNo = this.inputData1;
        var SearchName = this.inputData2;
        var SearchSN = this.inputData3;
 
        await getDataNone({SearchName : SearchName , SearchNo : SearchNo , SearchSN : SearchSN}).then(res=>{
         if(res!=null){
                this.IsLoading=false;
                this.data=res;
                console.log(res);
                console.log(this.data[0]); 
                }
            }).catch(error=>{
                console.log(error);
            })
 
     }
 
     async validate(){
            return new Promise((resolve, reject) => {
                var selectedRecords =  this.template.querySelector("lightning-datatable").getSelectedRows(); 
                var today = new Date();
                var targetDate = (today.getFullYear()+1) + '/' + (today.getMonth()+1) + '/' + today.getDate();
                var todayNew = today;
                var partSupplyFinishDate = selectedRecords[0].NoPartRiskDate;
                var partSupplyFinishDateNew = new Date(partSupplyFinishDate);
                console.log('partSupplyFinishDateNew=='+partSupplyFinishDateNew);
                console.log('结果1 ='+partSupplyFinishDateNew > todayNew);
                console.log('结果2 ='+partSupplyFinishDateNew <= new Date(targetDate));
                console.log('getFullYear ='+partSupplyFinishDateNew .getFullYear());
                console.log('getMonth ='+partSupplyFinishDateNew.getMonth());
                console.log('getDate ='+partSupplyFinishDateNew.getDate());
                var monthNum = partSupplyFinishDateNew.getMonth()+1;
                if (partSupplyFinishDate != null){
                    var DateOne = partSupplyFinishDateNew.getFullYear() + '/' + monthNum + '/' + partSupplyFinishDateNew.getDate();
                    console.log('结果3 ='+DateOne);
                      if (partSupplyFinishDateNew > todayNew && partSupplyFinishDateNew <= new Date(targetDate)){
                                LightningConfirm.open({
                                        message: '预计'+ DateOne +'零件即将停产,请送修前与工厂及RC联络',
                                        variant: 'headerless',
                                        label: '提示信息',
                                }).then(submit=>{
                                    console.log("ttt:"+submit);
                                    if(!submit){
                                        this.dispatchEvent(new CloseActionScreenEvent());
                                        resolve(false);
                                    }else{
                                        resolve(true);
                                    }
                                })
                        }else if (partSupplyFinishDateNew <= todayNew){
                            LightningConfirm.open({
                                        message: '该型号零件已经停产,有特殊需求,请送修前与工厂RC联络',
                                        variant: 'headerless',
                                        label: '提示信息',
                                }).then(submit=>{
                                    console.log("ttt:"+submit);
                                    if(!submit){
                                        this.dispatchEvent(new CloseActionScreenEvent());
                                        resolve(false);
                                    }else{
                                        resolve(true);
                                    }
                                })
 
                        }else{
                            resolve(true);
                        }
                }else{
                   resolve(true);
                }
            });
     }
 
 
    async SelectDone(){
        var selectedRecords =  this.template.querySelector("lightning-datatable").getSelectedRows();     
            console.log('selectedRecords.length=='+selectedRecords.length);
            if(selectedRecords.length>0){
                if (selectedRecords.length>1) {
                    const evt = new ShowToastEvent({
                        title : '只能选择一个保有设备',
                        message: '',
                        variant: 'error',
                         mode: 'sticky'
                    });
                    this.dispatchEvent(evt);
                    // this.dispatchEvent(new CloseActionScreenEvent());
                    return;
                }
              const shouldContinue = await  this.validate();
              console.log('shouldContinue='+shouldContinue);
              if (!shouldContinue) {
                return; // 用户选择不继续,退出
              }
                searchAss({
                    recordId: selectedRecords[0].Assetid
                }).then(result => {
                    // console.log(result);
                    if (result != null) {
                        console.log('result.canRepair=='+result.canRepair);
                        this.IsLoading = false;
                        this.canRepair = result.canRepair;
                        if (this.canRepair == 'RC送修') {
                            this.Excworklocation = true;
                        }
                    }
                    console.log('this.canRepair=='+this.canRepair);
                    if (this.canRepair == '第三方') {
                        const evt = new ShowToastEvent({
                                title : '非我司修理对象,无法新建修理,如有不明请咨询CIC',
                                message: '',
                                variant: 'error',
                         mode: 'sticky'
                            });
                            this.dispatchEvent(evt);
                            // this.dispatchEvent(new CloseActionScreenEvent());
                            return;
                    }
                     if (this.canRepair == '不'||this.canRepair == null) {
                            const evt = new ShowToastEvent({
                                    title : '本设备无法新建修理',
                                    message: '',
                                    variant: 'error',
                         mode: 'sticky'
                                });
                                this.dispatchEvent(evt);
                                // this.dispatchEvent(new CloseActionScreenEvent());
                            return;
                    }
                    
                    if (this.Id == null || this.Id == '') {
                        const evt = new ShowToastEvent({
                                title : '报修子单Id 不能为空',
                                message: '',
                                variant: 'error',
                         mode: 'sticky'
                            });
                            this.dispatchEvent(evt);
                            // this.dispatchEvent(new CloseActionScreenEvent());
                        return;
                    }
 
                    //20231218 sx 贸易合规二期 add start
                    // WYl 2024/1/30 update 新增proTradeComplianceStatus 判断条件 start
                    if(this.accDealerBlacklist==2 && result.proTradeComplianceStatus == '0'){
                         // WYl 2024/1/30 update 新增proTradeComplianceStatus 判断条件 end
                        this.SendEmailFW(this.AccountName,this.recordId,'9',this.state,result.Asset_Model_No);
                        LightningConfirm.open({
                            message: '您此次申请的业务可能存在贸易合规风险,是否继续申请,如有问题请联系法务本部贸易合规窗口'+IFTradeComplianceAlertName+'进一步评估(一般需5-10个工作日)',
                            variant: 'headerless',
                            label: 'this is the aria-label value',
                        }).then(confirm=>{
                            if(confirm){
                                // 2023 08 04 张赫阳 PIPL相关按钮改造 Start
                                this.assetName = selectedRecords[0].Name;
                                // 2023 08 04 张赫阳 PIPL相关按钮改造 End
                                this.Delivered_Product =  selectedRecords[0].Assetid;
                                this.Department_Name = selectedRecords[0].Accountid;
                                this.HospitalId = selectedRecords[0].Hospital;
                                this.WorkLocation = selectedRecords[0].WorkLocation;
                                this.DepartmentClass = selectedRecords[0].DepartmentClass;
                                this.navigateToNewObjectPage();
                            }else{
                                return;
                            }
                        })
                    }else{
                        // 2023 08 04 张赫阳 PIPL相关按钮改造 Start
                        this.assetName = selectedRecords[0].Name;
                        // 2023 08 04 张赫阳 PIPL相关按钮改造 End
                        this.Delivered_Product =  selectedRecords[0].Assetid;
                        this.Department_Name = selectedRecords[0].Accountid;
                        this.HospitalId = selectedRecords[0].Hospital;
                        this.WorkLocation = selectedRecords[0].WorkLocation;
                        this.DepartmentClass = selectedRecords[0].DepartmentClass;
                        this.navigateToNewObjectPage();
                    }
                    //20231218 sx 贸易合规二期 add end
                    
                }).catch(error => {
                    console.log(error);
                })
            
            }else{
                console.log('else');
                const evt = new ShowToastEvent({
                        title : '请选择一个保有设备',
                        message: '',
                        variant: 'error',
                         mode: 'sticky'
                    });
                    this.dispatchEvent(evt);
                    // this.dispatchEvent(new CloseActionScreenEvent());
                    return;
            }
            
    }
 
 
 
    async serContactinit(){
    console.log('into serContact')
    // hql 20231213 添加贸易合规 start
    const shouldToContinue = await  this.invid();
    if (!shouldToContinue) {
        return; // 用户选择不继续,退出
    }
    this.shouldRender = true;
    // hql 20231213 添加贸易合规 end
    if (this.template.querySelector("lightning-datatable") !=null) {
        
            // 刷新数据表
            const dataTable = this.template.querySelector('lightning-datatable');
            dataTable.selectedRows = [];
            // dataTable.refresh();
            console.log('执行')
    }
 
    
    var SearchNo = this.inputData1;
    var SearchName = this.inputData2;
    var SearchSN = this.inputData3;
 
        if(SearchSN == undefined){
            SearchSN='';
        }
        if(SearchName == undefined){
            SearchName='';
        }
        if(SearchNo == undefined){
            SearchNo = '';
        }
    console.log('SearchName='+SearchName);
    console.log('SearchNo='+SearchNo);
    console.log('SearchSN='+SearchSN);
        await getDatainit({SearchName : SearchName , SearchNo : SearchNo , SearchSN : SearchSN}).then(res=>{
            // console.log('res==='+res);
            // console.log('res2==='+res[0].name);
         if(res!=null){
                this.IsLoading=false;
                this.data=res;
                console.log(res);
                console.log(this.data[0]); 
                }
            }).catch(error=>{
                console.log(error);
            })
 
    }
 
    async serContact(){
    console.log('into serContact')
    if (this.template.querySelector("lightning-datatable") !=null) {
        
            // 刷新数据表
            const dataTable = this.template.querySelector('lightning-datatable');
            dataTable.selectedRows = [];
            // dataTable.refresh();
            console.log('执行')
    }
 
    
    var SearchNo = this.inputData1;
    var SearchName = this.inputData2;
    var SearchSN = this.inputData3;
 
        if(SearchSN == undefined){
            SearchSN='';
        }
        if(SearchName == undefined){
            SearchName='';
        }
        if(SearchNo == undefined){
            SearchNo = '';
        }
    console.log('SearchName='+SearchName);
    console.log('SearchNo='+SearchNo);
    console.log('SearchSN='+SearchSN);
        await getData({SearchName : SearchName , SearchNo : SearchNo , SearchSN : SearchSN}).then(res=>{
            // console.log('res==='+res);
            // console.log('res2==='+res[0].name);
         if(res!=null){
                this.IsLoading=false;
                this.data=res;
                console.log(res);
                console.log(this.data[0]); 
                }
            }).catch(error=>{
                console.log(error);
            })
 
    }
 
    navigateToNewObjectPage() {
        // console.log('RepairApplicantName=='+this.RepairApplicantName);
        // console.log('this.id=='+this.id);
        // var currentDate = new Date();
        const defaultFieldValues =encodeDefaultFieldValues({
          Delivered_Product__c: this.Delivered_Product,
          // 2023 08 04 张赫阳 PIPL相关按钮改造 Start
          AssetName: this.assetName,
          //AWSId: this.AWSId,    //deloitte-zhj 20231205 PIPL还原
          // 2023 08 04 张赫阳 PIPL相关按钮改造 End
          Account__c: this.Department_Name,
          Hospital__c: this.HospitalId,
          SalesOfficeCode_selection__c: this.WorkLocation,
          Incharge_Staff__c:this.Incharge_Staff,
          Repair_Detail__c:this.Repair_Detail,
          Failure_Occurrence_Date__c:this.FaultTime,
          Repair_Source__c:'从报修子单',
          RepairApplicant__c:this.RepairApplicantName,
          RepairApplicantHospital__c:this.HPname,
          RepairApplicantDepartment__c:this.DepName,
          RepairTime__c:this.RepairsReportDate,
          ReceiverTime__c:this.ReceiverTime,
          PlannedVisitDay__c:this.PlannedVisitDay,
          ActualVisitDateFirst__c:this.ActualVisitDateFirst,
          ActualVisitDateSecond__c:this.ActualVisitDateSecon,
          ActualVisitDateThird__c:this.ActualVisitDateThird,
          SubOrderCreatedDate__c:this.currentDate,
          Exc_work_location__c:this.Excworklocation,
          DateReceiptQuestions__c:this.ApplicationTime,
          RepairSubOrder__c:this.recordId,
          Department_Class__c:this.DepartmentClass,
          SupportingProducts__c:this.SupportingProducts,
          ifDeadHurt__c:this.IfDeadHurt,
          ProblemOccurred__c:this.ProblemOccurred,
          Returns_Product_way__c:this.ReturnWayType,
          // hql 20231212 增加移动端申请修理日传值 start
          SubOrderCompleteDate__c: this.ApplicationTime,
          // hql 20231212 增加移动端申请修理日传值 end
 
 
          ProblemOccurredSelect__c:this.ProblemOccurredSelect,
          ReportAdverseEvents__c:this.ReportAdverseEvents,
          WhatProject__c:this.WhatProject,
          OperationOrExaminationName__c:this.OperationOrExaminationName,
          BreakORFallOff__c:this.BreakORFallOff,
          UseFailProductFinish__c:this.UseFailProductFinish,
          AfterFailureInformation__c:this.AfterFailureInformation,
          Delay15Min__c:this.Delay15Min,
          InformationFrom__c:this.InformationFrom,
          FailureQInHospital__c:this.FailureQInHospital,
          DelayReportReason__c:this.DelayReportReason,
          ProductFailureRelated__c:this.ProductFailureRelated,
          DeliveryLogisticsNo__c:this.DeliveryLogisticsNo,
          //20231227 lwt DB202312554975 start
        //   engineerSendDate__c:this.engineerSendDateTime,//Deloitte-Nancy 20231222
          Send_To_RC_Date__c:this.engineerSendDateStr,
          //20231227 lwt DB202312554975 end
          PassType:'lexChoiceAsset', //deloitte-zhj 2023-09-14
          //deloitte-zhj 20231206 PIPL还原带上直返地址信息 start
          address_Contacts__c:this.ReturnedPersonName,
          address_Telephone__c:this.ReturnedPersonPhone,
          address_Contacts_Name__c:this.ReturnedCustomer,
          address_City__c:this.ReturnedCity,
          Detailed_Address__c:this.ReturnedAddress,
          address_ZipCode__c:this.ReturnedZipCode
          //deloitte-zhj 20231206 PIPL还原带上直返地址信息 end
        });
 
            this[NavigationMixin.Navigate]({
              type: 'standard__objectPage',
              attributes: {
                objectApiName: 'Repair__c',
                actionName: 'new'
              },
              state: {
                // 2023 08 07 张赫阳 PIPL相关按钮改造 Start
                //nooverride: '1',
                // 2023 08 07 张赫阳 PIPL相关按钮改造 End
                defaultFieldValues: defaultFieldValues
              }
            });
        this.dispatchEvent(new CloseActionScreenEvent());
      }
 
}