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
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
/* eslint-disable no-console */
/* eslint-disable @lwc/lwc/no-async-operation */
// import lookUp from '@salesforce/apex/LookUpUtilControllerEvent.lookUp';
import lookUp from '@salesforce/apex/LookUpUtilController.lookUp';
// import getRecordForContact from '@salesforce/apex/ControllerUtilEvent.getRecordForContact';
import getRecordForContact from '@salesforce/apex/ControllerUtil.getRecordForContact';
// import getPIPLInfo from '@salesforce/apex/LookUpUtilControllerEvent.getPIPLInfo';//deloitte-zhj 获取解密信息 2023/07/19 
import getPIPLInfo from '@salesforce/apex/LookUpUtilController.getPIPLInfo';//deloitte-zhj 获取解密信息 2023/07/19 
// import searchContactInit from '@salesforce/apex/LookUpUtilControllerEvent.searchContactInit';//deloitte-zhj 搜索需要的PI数据 2023/07/19 
import searchContactInit from '@salesforce/apex/LookUpUtilController.searchContactInit';//deloitte-zhj 搜索需要的PI数据 2023/07/19 
// import searchContactByAccountId from '@salesforce/apex/LookUpUtilControllerEvent.searchContactByAccountId';//deloitte-zhj 新建判断重复 2023/07/19 
import searchContactByAccountId from '@salesforce/apex/LookUpUtilController.searchContactByAccountId';//deloitte-zhj 新建判断重复 2023/07/19 
// import { AWSService } from 'c/piUtils';//deloitte-zhj 调用aws 2023/07/19 
import { getObjectInfo } from 'lightning/uiObjectInfoApi';
import { getRecord } from 'lightning/uiRecordApi';
import { NavigationMixin } from 'lightning/navigation';
import { api, LightningElement, track, wire } from 'lwc';
import saveContact from '@salesforce/apex/LwcDailyReportController.saveContact';
import { ShowToastEvent } from 'lightning/platformShowToastEvent';
import { refreshApex } from '@salesforce/apex';
 
export default class lookUpUtilEvent extends NavigationMixin(LightningElement) {
    // AWSService;  //deloitte-亚楠 20240120 PIPL还原
    @track theContact = {};
    @track showModal = false;
    //记录id
    @api valueId;
    @api objName;
    @api iconName;
    @api disabled;
    @api filter;
    @api agencyContactName;
    @api uniqueKey;
    @api fields;
 
    @api searchLabel;
    @track searchTerm;
    //record name value
    @track valueObj;
    //record href
    @track href;
    //fetch result
    @track options;
    //是否展示pill
    @track isValue = false;
    isCanCanle = true;
    @track blurTimeout;
    isOpen = false;
    @track visitorPalceFields = ['Account.Name'];
    @track newContactAcc;
     //访问对象
 
    handleContactDepartmentSelection(event) {
        console.log('handleContactDepartmentSelection!!!!!!!!!!!!');
        this.newContactAcc = event.detail.selectedId;
    }
    get boxClass() {
        let classes = "slds-combobox slds-dropdown-trigger slds-dropdown-trigger_click slds-has-focus";
        if (this.isOpen) {
            return classes + " slds-is-open";
        }
        return classes;
    }
    _passFilter;
    @api
    get passFilter() {
        return this._passFilter;
    }
 
    set passFilter(newValue) {
        this._passFilter = newValue;
        this.filter = newValue;
    }
    //css:
    @track inputClass = '';
 
    @api staticResourceContact;
    @track txId;
      //deloitte-zhj 获取PIPL需要的数据 2023/07/19 start
    connectedCallback() {
        //deloitte-亚楠 20240120 PIPL还原 start
        // if(!this.AWSService) {
        //     this.AWSService = new AWSService();
        // }
        // // if(!this.staticResourceContact) {
        //     getPIPLInfo().then((r) => {
        //         r = JSON.parse(JSON.stringify(r));
        //         console.log('r = ' + JSON.stringify(r))
        //         if (r.status == 'Success') {
        //             this.staticResourceContact = JSON.parse(r.entity.staticResourceContact);
        //             console.log('this.staticResourceContact.searchUrl = ' + this.staticResourceContact.searchUrl)
        //         } else {
        //             console.log('error msg = ' + r.msg)
        //         }
        //     })
        // console.log('this.staticResourceContact.end :' +this.staticResourceContact);
        // }
        //deloitte-亚楠 20240120 PIPL还原 end
        
    }
 
    getPIPLInfoJs() {
       
    }
 
    //deloitte-zhj 获取PIPL需要的数据 2023/07/19 end
    //deloitte-zhj 解密 2023/07/19 start
    @wire(lookUp, { searchTerm: '$searchTerm', objName: '$objName', filter: '$filter' })
    wiredRecords({ error, data }) {
        console.log('enter wiredRecords');
        //deloitte-亚楠 20240120 PIPL还原 start
        // if(!this.AWSService) {
        //    this.AWSService = new AWSService(); 
        //    // if(!this.staticResourceContact || !this.staticResourceContact.search) {
        //         getPIPLInfo().then((r) => {
        //             r = JSON.parse(JSON.stringify(r));
        //             console.log('r = ' + JSON.stringify(r))
        //             if (r.status == 'Success') {
        //                 this.staticResourceContact = JSON.parse(r.entity.staticResourceContact);
        //                 console.log('this.staticResourceContact.searchUrl = ' + this.staticResourceContact.searchUrl)
        //             } else {
        //                 console.log('error msg = ' + r.msg)
        //             }
        //         })
        //    // }
           
        // }
        //deloitte-亚楠 20240120 PIPL还原 end
 
        if (data) {
            let that = this;
            console.log('data = ' + JSON.stringify(data))
            // let dataClone = this.deepClone(data);
            let dataClone = [];
            console.log('dataClone deepClone= ' + JSON.stringify(dataClone));
            //搜索,需要把对应account下面进行了PIPL的数据查出来,需要搜索值和accountid都存在才行
            console.log('this.filter = ' + this.filter)
            console.log('this.searchTerm = ' + this.searchTerm)
            if (this.filter) {
                searchContactInit({
                    accountId: this.filter
                }).then((r) => {
                    r = JSON.parse(JSON.stringify(r));
                    console.log('r = ' + JSON.stringify(r))
                    if (r.status == 'Success') {
                        //deloitte-亚楠 20240120 PIPL还原 start
                        let conList = r.entity.conList;
                        for(let i=0; i < conList.length; i++){
                            let PIData = {};
                            PIData.Id = conList[i].Id;
                            PIData.Name = conList[i].LastName;
                            dataClone.push(PIData)
                        }
                        that.executeWiredRecords(dataClone);
                        // let awsIdToContactMap = r.entity.awsIdToContactMap;
                        // let conAWSIds = r.entity.conAWSIds;
                        // console.log('awsIdToContactMap = ' + awsIdToContactMap);
                        // console.log('conAWSIds = ' + conAWSIds);
                        // that.AWSService.search(that.staticResourceContact.searchUrl, {
                        //     dataIds: conAWSIds,
                        //     contactName: that.searchTerm
                        // }, function (data) {
                        //     console.log('data = ' + JSON.stringify(data));
                        //     if (data.object) {
                        //         let limit = data.object.length > 50 ? 50 : data.object.length;//最多找20条
                        //         for(let i=0; i < limit; i++){
                        //             if(awsIdToContactMap.hasOwnProperty(data.object[i].dataId)){
                        //                 let PIData = {};
                        //                 PIData.Id = awsIdToContactMap[data.object[i].dataId].Id;
                        //                 PIData.Name = data.object[i].lastName;
                        //                 PIData.AWSDataId = data.object[i].dataId;
                        //                 dataClone.push(PIData)
                        //             }
                        //         }
                        //         console.log('dataClone = ' + JSON.stringify(dataClone));
                        //     }
                        //     that.executeWiredRecords(dataClone);
                        // }, that.staticResourceContact.token)
                        //deloitte-亚楠 20240120 PIPL还原 end
                    } else {
                        console.log('r.msg = ' + r.msg)
                    }
                })
            } else {
                this.executeWiredRecords(dataClone)
            }
        } else if (error) {
            this.error = error;
            this.record = undefined;
            console.log("wire.error", this.error);
        } else {
            console.log('啥都没有');
        }
    }
    deepClone(obj) {
        return JSON.parse(JSON.stringify(obj));
    }
    executeWiredRecords(dataClone) {
        //deloitte-亚楠 20240120 PIPL还原 start
        if(dataClone.length != 0){
            this.record = dataClone;
            console.log('this.record = ' + JSON.stringify(this.record));
            this.error = undefined;
            this.options = this.record;
            console.log("common this.options", JSON.stringify(this.options));
        }else{
            this.record = dataClone;
            this.error = undefined;
            this.options = this.record;
            console.log("common this.options", JSON.stringify(this.options));
        }
        
        // let arr = [];
        // for (var i in dataClone) {
        //     if (dataClone[i].AWSDataId && arr.indexOf(dataClone[i].AWSDataId) == -1) 
        //         arr.push(dataClone[i].AWSDataId)
        // }
        // if(!this.AWSService) {
        //    this.AWSService = new AWSService(); 
        // }
        // console.log('arr = ' + arr);
        // let that = this;
        // if (arr.length != 0) {
        //     this.AWSService.search(this.staticResourceContact.searchUrl, {
        //         dataIds: arr
        //     }, function (dataAWS) {
        //         console.log('dataAWS = ' + JSON.stringify(dataAWS));
        //         if (dataAWS && dataAWS.object && dataAWS.object.length > 0) {
        //             let awsMap = {};
        //             for (let di in dataAWS.object) {
        //                 awsMap[dataAWS.object[di].dataId] = dataAWS.object[di];
        //             }
        //             console.log('awsMap = ' + JSON.stringify(awsMap));
        //             for (var i in dataClone) {
        //                 if (awsMap.hasOwnProperty(dataClone[i].AWSDataId)) {
        //                     dataClone[i].Name = awsMap[dataClone[i].AWSDataId].lastName
        //                 }
        //             }
        //             console.log('dataClone = ' + JSON.stringify(dataClone));
        //             that.record = dataClone;
        //             console.log('that.record = ' + JSON.stringify(that.record));
        //             that.error = undefined;
        //             that.options = that.record;
        //             console.log("common this.options", JSON.stringify(that.options));
        //         } else {
        //             that.record = dataClone;
        //             that.error = undefined;
        //             that.options = that.record;
        //             console.log("common this.options", JSON.stringify(that.options));
        //         }
        //     }, this.staticResourceContact.token)
        // } else {
        //     this.record = dataClone;
        //     this.error = undefined;
        //     this.options = this.record;
        //     console.log("common this.options", JSON.stringify(this.options));
        // }
        //deloitte-亚楠 20240120 PIPL还原 end
    }
 
    @wire(getRecordForContact, { recordId: '$valueId', fields: '$fields' })
    async wiredOptions({ error, data }) {
        if(!this.valueId) {
            return;
        }
        console.log('zzzzzzz----222222');
        console.log('wiredOptions');
        var agencyContactNameTmp;
        if (data) {
            //deloitte-亚楠 20240120 PIPL还原 start
            this.record = data;
            console.log('this.record =  ' + JSON.stringify(this.record));
            this.error = undefined;
            this.valueObj = data.Name;
            this.href = '/' + this.record.id;
            this.isValue = true;
            // if(!this.AWSService) {
            //    this.AWSService = new AWSService(); 
            // }
            // console.log('wiredOptions data = ' + JSON.stringify(data))
            // // deloitte-zhj 解密 2023/07/19 start
            // if (data.AWS_Data_Id && data.Name.includes('***')) {
            //     console.log('data.fields.AWS_Data_Id__c.value = ' + data.AWS_Data_Id)
            //     let that = this;
            //     // if(!this.staticResourceContact || !this.staticResourceContact.query) {
            //         console.log('enter connectedCallback')
                    
            //         await getPIPLInfo().then((r) => {
            //             r = JSON.parse(JSON.stringify(r));
            //             console.log('r = ' + JSON.stringify(r))
            //             if (r.status == 'Success') {
            //                 this.staticResourceContact = JSON.parse(r.entity.staticResourceContact);
            //                 console.log('this.staticResourceContact.searchUrl = ' + this.staticResourceContact.searchUrl)
            //                 console.log('this.staticResourceContact.queryUrl'+this.staticResourceContact);
            //                 this.AWSService.query(this.staticResourceContact.queryUrl, data.AWS_Data_Id, function (dataAWS) {
            //                     console.log('queryLeadFromAWSIFS data = ' + JSON.stringify(dataAWS));
            //                     if (dataAWS.object) {
            //                         //data.fields.Name.value = dataAWS.object['lastName'];
            //                         that.record = data;
            //                         console.log('that.record =  ' + JSON.stringify(that.record));
            //                         that.error = undefined;
            //                         that.valueObj = dataAWS.object['lastName'];
            //                         that.href = '/' + that.record.id;
            //                         that.isValue = true;
            //                     } else {
            //                         that.record = data;
            //                         that.error = undefined;
            //                         that.valueObj = that.record.Name;
            //                         that.href = '/' + that.record.id;
            //                         that.isValue = true;
            //                     }
            //                     // agencyContactNameTmp = that.valueObj;
            //                     // console.log('agencyContactName' +that.valueObj);
            //                     // console.log('this.agencyContactName:' +this.agencyContactName);
            //                 }, this.staticResourceContact.token)
            //             } else {
            //                 console.log('error msg = ' + r.msg)
            //             }
            //         })
 
                
            // } else {
            //     this.record = data;
            //     this.error = undefined;
            //     this.valueObj = this.record.Name;
            //     this.href = '/' + this.record.id;
            //     this.isValue = true;
            //     // agencyContactNameTmp = this.valueObj;
            // }
            // // this.valueObj = agencyContactNameTmp;
            // // console.log('this.valueObj:'+this.valueObj);
            // //deloitte-zhj 解密 2023/07/19 end
            //deloitte-亚楠 20240120 PIPL还原 end
        } else if (error) {
            this.error = error;
            this.record = undefined;
        }
    }
 
 
 
 
    handleClick() {
        console.log("In handleClick");
        if(this.disabled){
            return;
        }
        if(!this.filter) {
            this.showToast('Error','请设定访问场所');
            return;
        }
        this.searchTerm = '';
        this.inputClass = 'slds-has-focus';
        this.isOpen = true;
        //deloitte-zhj refresh wiredRecords start 
        this.searchTerm = 'refresh';
        this.searchTerm = '';
        refreshApex(this.wiredRecords);
        //deloitte-zhj refresh wiredRecords end
        // this.boxClass = 'slds-combobox slds-dropdown-trigger slds-dropdown-trigger_click slds-has-focus slds-is-open';
    }
 
    onSelect(event) {
        console.log("In onSelect");
        let ele = event.currentTarget;
        let selectedId = ele.dataset.id;
        let key = this.uniqueKey;
        console.log("key = " + key);
        console.log("selectedId = " + selectedId);
        const valueSelectedEvent = new CustomEvent('valueselect', {
            detail: { selectedId, key },
        });
        this.dispatchEvent(valueSelectedEvent);
        this.isOpen = false;
        // this.boxClass = 'slds-combobox slds-dropdown-trigger slds-dropdown-trigger_click slds-has-focus';
    }
 
    searchChange(event) {
        this.searchTerm = event.target.value;
    }
 
    onBlur() {
        if (!this.isCanCanle) {
            return;
        }
        this.isOpen = false;
        // this.boxClass = 'slds-combobox slds-dropdown-trigger slds-dropdown-trigger_click slds-has-focus';
    }
    @api
    handleRemovePill() {
        if(this.disabled){
            return;
        }
        console.log("In handleRemovePill");
        this.isValue = false;
        let selectedId = '';
        let key = this.uniqueKey;
        const valueSelectedEvent = new CustomEvent('valueselect', {
            detail: { selectedId, key },
        });
        this.dispatchEvent(valueSelectedEvent);
    }
 
    newObject() {
        if(!this.filter) {
            this.showToast('Error','请设定访问场所');
            return;
        }
        this.clearDailog();
        this.isOpen = false;
        this.showModal = true;
        // const newEvent = new CustomEvent('newrecord', {
        //     detail: { key :this.uniqueKey},
        // });
        // this.dispatchEvent(newEvent);
    }
    closeModal() {
        console.log('closeModal');
        
        this.showModal = false;
    }
    handleMouseleave() {
        this.isCanCanle = true;
    }
    handleMouseenter(event) {
        this.isCanCanle = false;
    }
    sureSave(event) {
        event.preventDefault();//很重要 如果没得这个会导致页面刷新!
        console.log('submitDetails');
        let flag = true;
        let requiredFieldList = this.template.querySelectorAll('lightning-input-field');
        requiredFieldList.forEach(ele => {
            if (ele.required == true && this.stringIsEmpty(ele.value)) {
                ele.reportValidity();
                flag = false;
            }
        });
        //deloitte-亚楠 20240120 PIPL还原
        // if(!this.AWSService) {
        //    this.AWSService = new AWSService(); 
        // }
        console.log(flag);
        console.log('this.theContact = ' + JSON.stringify(this.theContact));
        if (flag) {
            //deloitte-亚楠 20240120 PIPL还原 start
            let that = this;
            saveContact({ 
                contactJson: JSON.stringify(that.theContact) 
            }).then(result => {
                if (result.code === 200) {
                    that.showToast('success', '保存成功');
                    let selectedId = result.msg;
                    let key = that.uniqueKey;
                    const valueSelectedEvent = new CustomEvent('valueselect', {
                        detail: { selectedId, key },
                    });
                    that.dispatchEvent(valueSelectedEvent);
                    that.isOpen = false;
                } else {
                    that.showToast('error', '保存联系人失败,' + result.msg);
                }
                that.showModal = false;
            })
            .catch(error => {
                that.showToast('error', '保存报错,' + error);
                that.showModal = false;
            });
            // let payloadForNewPI = [];
            // let PIData = {};
            // PIData['lastName'] = this.theContact['LastName']
            // PIData['phone'] = this.theContact['Phone']
            // payloadForNewPI.push(PIData);
            // payloadForNewPI = JSON.stringify(payloadForNewPI);
            // console.log('payloadForNewPI = ' + payloadForNewPI)
            // // console.log('this.theContact[AccountId] = ' + this.theContact['AccountId'])
            // // this.theContact['AccountId'] = this.newContactAcc;
            // // console.log('this.theContact[AccountId] = ' + this.filter);
            // let that = this;
            // //deloitte-zhj 新建判断重复并且进行加密 2023/07/19 start
            // if(!this.theContact['AccountId']) {
            //     this.theContact['AccountId'] = this.filter;
            // }
            // console.log('AccountId:' +this.theContact['AccountId'])
            // console.log('visitorPlaceId:' +this.filter)
            // searchContactByAccountId({
            //     accountId: this.theContact['AccountId'],
            //     visitorPlaceId:this.filter
                
            // }).then((resultAccount) => {
            //     resultAccount = JSON.parse(JSON.stringify(resultAccount));
            //     console.log('resultAccount:'+resultAccount);
            //     if (resultAccount.status == 'fail') {
            //         that.showToast('Error', resultAccount.message);
            //         console.log()
            //         return
            //     }
            //     let accountName = resultAccount.accountName;
            //     let dataIdManageCodeMap = resultAccount.dataIdManageCodeMap;
            //     let contactList = '';
            //     for (var i = 0; i < resultAccount.contactList.length; i++) {
            //         if (resultAccount.contactList[i].AWS_Data_Id__c)
            //             contactList += ',' + resultAccount.contactList[i].AWS_Data_Id__c;
            //     }
            //     contactList = contactList.substring(1);
            //     payloadForNewPI = JSON.parse(payloadForNewPI);
            //     payloadForNewPI[0].contactIds = contactList;
            //     payloadForNewPI[0].isMobileVerif = resultAccount.isMobileVerif;
            //     payloadForNewPI[0].isNameMobileVerif = resultAccount.isNameMobileVerif;
            //     payloadForNewPI = JSON.stringify(payloadForNewPI);
            //     //AWS加密
            //     that.AWSService.post(that.staticResourceContact.newUrl + 'V2', payloadForNewPI, (resultAWS) => {
            //         if (resultAWS && resultAWS.object) {
            //             //判断已存在相同名字的联系人
            //             let errorMsg = '';
            //             if (resultAWS.status == '129') {
            //                 errorMsg = '客户 [ ' + accountName + ' ],已存在相同名字的联系人 人员管理编码 [' + dataIdManageCodeMap[resultAWS.object[0].dataId] + ' ] ,不能重复创建,请了解';
            //                 that.showToast('Error',errorMsg)
            //                 return
            //             }
            //             if (resultAWS.status == '130') {
            //                 if (resultAWS.object[0] && resultAWS.object[0].sfRecordId != null && resultAWS.object[0].sfRecordId != '') {
            //                     errorMsg = '已找到重复值: UniqueNumber__c 与记录值重复,ID 为: ' + resultAWS.object[0].sfRecordId + '客户人员信息';
            //                 }
            //                 else {
            //                     errorMsg = '数据中存在重复的电话号码';
            //                 }
            //                 that.showToast('Error',errorMsg)
            //                 return
            //             }
            //             console.log('resultAWS = ' + JSON.stringify(resultAWS));
            //             that.theContact['LastName'] = resultAWS.object[0]['lastName'];
            //             that.theContact['Phone'] = resultAWS.object[0]['phone'];
            //             that.theContact['AWS_Data_Id__c'] = resultAWS.object[0]['dataId'];
            //             that.txId = resultAWS.txId;
            //             console.log('that.theContact = ' + that.theContact)
            //             //保存到后端
            //             saveContact({ contactJson: JSON.stringify(that.theContact) })
            //                 .then(result => {
            //                     if (result.code === 200) {
            //                         //deloitte-zhj 新建判断重复并且进行加密成功之后需要进行事务确认 2023/07/19 start
            //                         that.AWSService.confirm(true, result.msg, that.txId, that.staticResourceContact.token, that.staticResourceContact.transactionUrl, function (resultConfirm) {
            //                             console.log('resultConfirm = ' + JSON.stringify(resultConfirm))
            //                             that.showToast('success', '保存成功');
            //                             let selectedId = result.msg;
            //                             let key = that.uniqueKey;
            //                             const valueSelectedEvent = new CustomEvent('valueselect', {
            //                                 detail: { selectedId, key },
            //                             });
            //                             that.dispatchEvent(valueSelectedEvent);
            //                             that.isOpen = false;
            //                         });
            //                         //deloitte-zhj 新建判断重复并且进行加密成功之后需要进行事务确认 2023/07/19 end
            //                     } else {
            //                         that.showToast('error', '保存联系人失败,' + result.msg);
            //                     }
            //                     that.showModal = false;
            //                 })
            //                 .catch(error => {
            //                     that.showToast('error', '保存报错,' + error);
            //                     that.showModal = false;
            //                 });
            //         } else {
            //             console.log('result = ' + JSON.stringify(result));
            //         }
            //     }, that.staticResourceContact.token);
            // });
            // //deloitte-zhj 新建判断重复并且进行加密 2023/07/19 end
            //deloitte-亚楠 20240120 PIPL还原 end
        }
    }
    stringIsEmpty(str) {
        if (str === '' || str === undefined || str === null) {
            return true;
        } else {
            return false;
        }
    }
    
    showToast(type,msg) {
        if(type == 'success'){
            const event = new ShowToastEvent({
                message: msg,
                variant: type
            });
            this.dispatchEvent(event);
        }else{
            const event = new ShowToastEvent({
                message: msg,
                variant: type,
                mode: 'sticky'
            });
            this.dispatchEvent(event);
        }
    }
    //字段信息改变
    async fieldChange(event) {
        const { value } = event.detail;
        const { fieldName } = event.target || event.currentTarget;
        let checked = event.target.value || event.currentTarget.value;
        if (value == undefined && checked != undefined) {
            this.theContact[fieldName] = checked;
        } else {
            this.theContact[fieldName] = value instanceof Array ? value[0] : value;
        }
    }
    //清空新建窗口的输入框
    clearDailog() {
        this.theContact['Name'] = null;
        this.theContact['Phone'] = null;
        this.theContact['AccountId'] = this.filter;
    }
}