import { LightningElement, api, track, wire } from 'lwc';
|
import { CurrentPageReference } from 'lightning/navigation';
|
import initData from '@salesforce/apex/LexTenderinformationPIPLController.initData';
|
import queryAccount from '@salesforce/apex/LexTenderinformationPIPLController.queryAccount';
|
import { NavigationMixin } from 'lightning/navigation';
|
import { AWSService } from 'c/piUtils';
|
import lexPIPLCustomStyle from '@salesforce/resourceUrl/lexPIPLCustomStyle'
|
import { loadStyle } from 'lightning/platformResourceLoader';
|
import { ShowToastEvent } from 'lightning/platformShowToastEvent';
|
import { getObjectInfo } from 'lightning/uiObjectInfoApi';
|
import TENDER from '@salesforce/schema/Tender_information__c';
|
import { conmentCancel } from "c/lexPIPLConmentMethods";
|
// Add By Li Jun 20231025 Start
|
import LexRecordNotCreateable from '@salesforce/label/c.LexRecordNotCreateable';
|
import LexNotCreateNote from '@salesforce/label/c.LexNotCreateNote';
|
import Agency_ID_c from '@salesforce/label/c.Agency_ID_c';
|
|
const customLabel = {
|
LexRecordNotCreateable,
|
LexNotCreateNote
|
}
|
// Add By Li Jun 20231025 End
|
|
export default class LexNewAndEditTenderinformationPIPL extends NavigationMixin(LightningElement) {
|
sobjectType = 'Tender_information__c';
|
@track customLabel = customLabel;
|
@api recordId;
|
@wire(CurrentPageReference) pageRef;
|
@track recordData = {};
|
@track title;
|
@track recordTypeId = '';
|
@track isLoading = true;
|
@track layout = [];
|
@track staticResource;
|
@track staticResourceContact;
|
@track piFieldsMap;
|
@track abstractData = '';
|
@track data = {};
|
@track piplData = {};
|
@track isNewMode = false;
|
@track isCloneMode = false;
|
@track isEditMode = false;
|
@track sectionName = [];
|
@track AWSToSobjectMap = {};
|
@track AWSDataId = '';
|
@track contactAWSDataId = '';
|
@track txId = '';
|
@track isShowSearchAccount = false;
|
@track hospitalId = '';
|
@track contactId = '';
|
AWSService;
|
defaultValues = {};
|
@track isInitSuccess = false;
|
|
//姓名
|
//@track lastName = '';
|
|
@track modifyObj = {};
|
modifyArray = ['LastName', 'Hospital_Name__c'];
|
fieldLabel = {};
|
|
@wire(getObjectInfo, { objectApiName: TENDER })
|
getReportInfo({data,error}){
|
if(data){
|
this.fieldLabel = data.fields;
|
}
|
}
|
|
connectedCallback() {
|
loadStyle(this, lexPIPLCustomStyle);
|
console.log('enter connectedCallback');
|
this.AWSService = new AWSService();
|
if (!this.recordId || this.isCloneMode) {
|
this.title = '新建招标项目';
|
this.isNewMode = true;
|
}
|
if (this.recordId) {
|
this.title = '编辑招标项目';
|
this.isEditMode = true;
|
}
|
if (this.pageRef && this.pageRef.state) {
|
this.recordTypeId = this.pageRef.state.recordTypeId;
|
console.log('this.recordTypeId = ' + this.recordTypeId);
|
}
|
console.log('recordId = ' + this.recordId + ' pid = ' + this.pid + ' recordTypeId = ' + this.recordTypeId + ' sobjectType = ' + this.sobjectType);
|
initData({
|
rid: this.recordId,
|
recordTypeId: this.recordTypeId,
|
sobjectType: this.sobjectType
|
}).then((r) => {
|
r = JSON.parse(JSON.stringify(r));
|
if (r.status == 'Success') {
|
let layout = JSON.parse(r.entity.layout);
|
layout = this.sortMetaLayouts(layout);
|
this.recordData = r.entity.data;
|
this.AWSDataId = r.entity.AWSDataId;
|
this.sectionName = layout.map(s => s.label);
|
let index = 1;
|
for (let s of layout) {
|
s['showSection'] = false;
|
// if(s['editHeading']){
|
// s['showSection'] = true;
|
// }else if(!s['detailHeading']){
|
// s['showSection'] = true;
|
// }
|
if(s['editHeading'] || s['detailHeading']){
|
s['showSection'] = true;
|
}
|
s['showLabel'] = false;
|
for (let c of s.layoutColumns) {
|
c['index'] = index++;
|
if(c.layoutItems.length != 0 && s['showLabel'] == false){
|
s['showLabel'] = true;
|
}
|
if (c.layoutItems) {
|
for (let item of c.layoutItems) {
|
item['isModify'] = false;
|
item['isRecordType'] = false;
|
item['isDisable'] = item.behavior == 'Readonly' ? true : false;
|
item['isRequired'] = item.behavior == 'Required' ? true : false;
|
//记录类型,并自动带入记录类型
|
if(item['field'] == 'RecordTypeId' || item['field'] == 'RecordType'){
|
item['value'] = this.recordTypeId;
|
item['isRecordType'] = true;
|
item['isDisable'] = true;
|
}
|
}
|
}
|
}
|
}
|
this.layout = layout;
|
console.log('this.layout = ' + JSON.stringify(this.layout))
|
this.AWSToSobjectMap = JSON.parse(JSON.stringify(r.entity.AWSToSobjectNonEncryptedMap));
|
this.staticResource = JSON.parse(r.entity.staticResource);
|
this.staticResourceContact = JSON.parse(r.entity.staticResourceContact);
|
if(r.entity.recordTypeId != null && r.entity.recordTypeId != ''){
|
this.recordTypeId = r.entity.recordTypeId;
|
}
|
console.log('this.recordTypeId = ' + this.recordTypeId)
|
//编辑
|
if (this.isEditMode) {
|
//解密客户人员
|
// this.queryContactName();
|
//解密意向的加密字段
|
this.queryLeadFromAWSIFS();
|
}
|
// this.isLoading = false;
|
this.isInitSuccess = true;
|
} else {
|
console.log('result:'+JSON.stringify(r));
|
this.isLoading = false;
|
this.showMyToast('Error', r.msg,'error');
|
}
|
})
|
}
|
|
sortMetaLayouts(layout){
|
layout.forEach(s => {
|
let c1 = (s.layoutColumns[0].layoutItems != null) ? s.layoutColumns[0].layoutItems : [];
|
let c2 = [];
|
if(s.layoutColumns.length > 1){
|
c2 = (s.layoutColumns[1].layoutItems != null) ? s.layoutColumns[1].layoutItems : [];
|
}
|
else{
|
s.layoutColumns.push({ "reserved": null, "layoutItems": [] });
|
}
|
let emptySpaceItem = {
|
"width": null,
|
"showScrollbars": null,
|
"showLabel": null,
|
"scontrol": null,
|
"reportChartComponent": null,
|
"page_x": null,
|
"height": null,
|
"field": null,
|
"emptySpace": true,
|
"customLink": null,
|
"component": null,
|
"canvas": null,
|
"behavior": null,
|
"analyticsCloudComponent": null
|
}
|
let maxSize = 0
|
if(c1.length > c2.length){
|
maxSize = c1.length;
|
for(let i = 0; i < maxSize; i++){
|
if(c2.length == maxSize){
|
break;
|
}
|
c2.push(emptySpaceItem);
|
}
|
}else{
|
maxSize = c2.length;
|
for(let i = 0; i < maxSize; i++){
|
if(c1.length == maxSize){
|
break;
|
}
|
c1.push(emptySpaceItem);
|
}
|
}
|
let tempList = [];
|
let index = 0;
|
for(let i = 0; i < maxSize; i++){
|
tempList.push(c1[i]);
|
if(tempList.length == maxSize){
|
s.layoutColumns[index].layoutItems = tempList;
|
tempList = [];
|
tempList.push(c2[i]);
|
index++;
|
}else{
|
tempList.push(c2[i]);
|
if(tempList.length == maxSize){
|
s.layoutColumns[index].layoutItems = tempList;
|
tempList = [];
|
index++;
|
}
|
}
|
}
|
})
|
layout = [...layout];
|
return layout;
|
}
|
|
handleLoad() {
|
console.log("handleLoad");
|
console.log("this.isInitSuccess = " + this.isInitSuccess);
|
if (this.isInitSuccess) {
|
let time = 1000;
|
if (!this.isNewMode) {
|
time = 2000;
|
}
|
|
let that = this;
|
setTimeout(() => {
|
that.isLoading = false;
|
}, time);
|
}
|
}
|
|
//解密意向的加密字段
|
queryLeadFromAWSIFS() {
|
var that = this;
|
debugger
|
this.AWSService.query(this.staticResource.queryUrl, this.AWSDataId, function (data) {
|
console.log('queryLeadFromAWSIFS data = ' + JSON.stringify(data));
|
if (data.object) {
|
// for (var s of that.layout) {
|
// for (var c of s.layoutFields) {
|
// for (let f in that.AWSToSobjectMap) {
|
// if (data.object.hasOwnProperty(f) && c['fieldAPI'] == that.AWSToSobjectMap[f]) {
|
// c['value'] = data.object[f] == null ? '' : data.object[f];
|
// if (c['fieldAPI'] == 'LastName') {
|
// that.modifyObj['LastName'] = data.object[f] == null ? '' : data.object[f];
|
// }
|
// }
|
// }
|
// }
|
// }
|
|
for (let s of that.layout) {
|
for (let c of s.layoutColumns) {
|
if (c.layoutItems) {
|
for (let item of c.layoutItems) {
|
for (let f in that.AWSToSobjectMap) {
|
if (data.object.hasOwnProperty(f) && item['field'] == that.AWSToSobjectMap[f]) {
|
item['value'] = data.object[f] == null ? '' : data.object[f];
|
if (item['field'] == 'LastName') {
|
that.modifyObj['LastName'] = data.object[f] == null ? '' : data.object[f];
|
}
|
}
|
}
|
}
|
}
|
}
|
}
|
}
|
}, this.staticResource.token)
|
}
|
|
//取消
|
cancel() {
|
conmentCancel(this.defaultValues);
|
}
|
|
//change事件
|
dataChange(event) {
|
let fieldName = event.target.getAttribute("data-field");
|
let value = event.detail.value;
|
console.log("fieldName = " + fieldName + " value = " + event.detail.value);
|
// for (var s of this.layout) {
|
// for (var c of s.layoutFields) {
|
// if (c.fieldAPI == fieldName) {
|
// console.log('c.fieldAPI = ' + c.fieldAPI);
|
// c['value'] = value;
|
// }
|
// }
|
// }
|
if (this.modifyArray.indexOf(fieldName) != -1) {
|
switch (fieldName) {
|
case "LastName":
|
this.modifyObj[fieldName] = value;
|
break;
|
case "Hospital_Name__c":
|
//需要给战略科室分类和公司赋值
|
if (value != Agency_ID_c && value != '') {
|
let ls = ['Department_Class__c'];
|
this.hospitalId = value;
|
this.setVlookup(ls, value + '');
|
} else {
|
//清空战略科室分类
|
this.clearVlookup();
|
}
|
break;
|
}
|
}
|
}
|
|
//战略科室分类和公司赋值
|
setVlookup(ls, hospitalId) {
|
this.isLoading = true;
|
console.log('ls = ' + JSON.stringify(ls));
|
console.log('hospitalId = ' + hospitalId);
|
queryAccount({
|
accountTypes: JSON.stringify(ls),
|
accountId: hospitalId
|
}).then((r) => {
|
r = JSON.parse(JSON.stringify(r));
|
console.log('r = ' + JSON.stringify(r));
|
if (r.status == 'Success') {
|
console.log('queryAccount success');
|
|
// for (var s of this.layout) {
|
// for (var c of s.layoutFields) {
|
// if (c['fieldAPI'] == 'Department_Class__c') {
|
// console.log('m = ' + JSON.stringify(r.entity.m))
|
// if (JSON.stringify(r.entity.m) != '{}') {
|
// c['value'] = r.entity.m.Department_Class__c.Id;
|
// }
|
// }
|
// if (c['fieldAPI'] == 'Company') {
|
// c['value'] = r.entity.account.Name;
|
// }
|
// }
|
// }
|
for (let s of this.layout) {
|
for (let c of s.layoutColumns) {
|
if (c.layoutItems) {
|
for (let item of c.layoutItems) {
|
if (item['field'] == 'Department_Class__c') {
|
if (JSON.stringify(r.entity.m) != '{}') {
|
item['value'] = r.entity.m.Department_Class__c.Id;
|
}
|
}
|
if (item['field'] == 'Company') {
|
item['value'] = r.entity.account.Name;
|
}
|
}
|
}
|
}
|
}
|
//1.5秒后将会调用执行remind()函数
|
var that = this;
|
setTimeout(function () { that.isLoading = false; }, 1500);
|
//this.isLoading = false;
|
} else {
|
this.showMyToast('Error', r.Msg,'error');
|
}
|
})
|
}
|
|
//清空战略科室分类
|
clearVlookup() {
|
console.log('clearVlookup')
|
// for (var s of this.layout) {
|
// for (var c of s.layoutFields) {
|
// if (c['fieldAPI'] == 'Department_Class__c') {
|
// c['value'] = ''
|
// }
|
// }
|
// }
|
for (let s of this.layout) {
|
for (let c of s.layoutColumns) {
|
if (c.layoutItems) {
|
for (let item of c.layoutItems) {
|
if (item['field'] == 'Department_Class__c') {
|
item['value'] = ''
|
}
|
}
|
}
|
}
|
}
|
}
|
|
clickSubmit(){
|
console.log('clickSubmit');
|
const btn = this.template.querySelector( ".hidden" );
|
|
if( btn ){
|
btn.click();
|
}
|
}
|
|
clickSubmitAndNew(){
|
console.log('clickSubmitAndNew');
|
this.saveAndNew = true;
|
const btn = this.template.querySelector(".hidden");
|
if (btn) {
|
btn.click();
|
}
|
}
|
|
//提交保存
|
handleSubmit(event) {
|
this.isLoading = true;
|
//1. Get Sobject Information from Form
|
console.log('handleSubmit');
|
event.preventDefault();
|
const fields = event.detail.fields;
|
console.log('this.modifyObj = ' + JSON.stringify(this.modifyObj));
|
Object.assign(fields, this.modifyObj);
|
fields['Contact_Name__c'] = this.contactId;
|
console.log('fields = ' + JSON.stringify(fields));
|
|
//2. select cannot actively select redaction option
|
let validationResultMessage = this.validateFieldValueFormate(fields);
|
console.log(validationResultMessage);
|
if (validationResultMessage) {
|
this.showMyToast('Error', validationResultMessage,'error');
|
return
|
}
|
|
//3. Check Required Field
|
let checkRequiredFieldMsgResult = this.checkRequiredFieldMsg(fields);
|
console.log('checkRequiredFieldMsgResult = ' + checkRequiredFieldMsgResult);
|
if (checkRequiredFieldMsgResult != '') {
|
this.showMyToast('Error', checkRequiredFieldMsgResult + '需要进行填写','error');
|
return
|
}
|
|
//4. Prepare the payload for New PI API To AWS - To Do
|
let payloadForNewPI = this.getPIPayload(fields);
|
console.log('payloadForNewPI = ' + payloadForNewPI);
|
|
//5. PI To AWS
|
//新建
|
debugger
|
if (this.isNewMode || this.AWSDataId == '') {
|
this.NewPIToAWS(payloadForNewPI, fields);
|
return
|
}
|
//编辑
|
if (this.isEditMode) {
|
this.UpdatePIToAWS(payloadForNewPI, fields);
|
}
|
}
|
|
//提交保存ToAWS
|
NewPIToAWS(payloadForNewPI, fields) {
|
this.AWSService.post(this.staticResource.newUrl, payloadForNewPI, (result) => {
|
if (result && result.object) {
|
console.log('result = ' + JSON.stringify(result));
|
for (let f in this.AWSToSobjectMap) {
|
if (result.object[0].hasOwnProperty(f)) {
|
fields[this.AWSToSobjectMap[f]] = result.object[0][f];
|
console.log('this.AWSToSobjectMap[f] = ' + this.AWSToSobjectMap[f]);
|
console.log('fields[this.AWSToSobjectMap[f]] = ' + fields[this.AWSToSobjectMap[f]]);
|
}
|
else {
|
console.log(f + 'is not in result.object[0]');
|
}
|
}
|
fields['AWS_Data_Id__c'] = result.object[0].dataId;
|
this.txId = result.txId;
|
console.log('this.txId = ' + this.txId);
|
console.log('PI After fields = ' + JSON.stringify(fields));
|
if (fields.RecordTypeId) {
|
console.log('length = ' + JSON.stringify(fields.RecordTypeId.length));
|
fields['RecordTypeId'] = fields.RecordTypeId.substring(1, fields.RecordTypeId.length - 1);
|
console.log('RecordTypeId = ' + JSON.stringify(fields['RecordTypeId']));
|
}
|
//保存到后端
|
this.template.querySelector('lightning-record-edit-form').submit(fields);
|
} else {
|
console.log('result = ' + JSON.stringify(result));
|
}
|
}, this.staticResource.token);
|
}
|
|
//编辑保存ToAWS
|
UpdatePIToAWS(payloadForNewPI, fields) {
|
debugger
|
let obj = JSON.parse(payloadForNewPI);
|
if(this.AWSDataId){
|
obj[0].dataId = this.AWSDataId;
|
}else{
|
//this.showMyToast("Error", '未找到该记录的AWS Id,请确认记录完整性', 'error');
|
//return;
|
//deloitte-zhj 20231018 招标项目无AWSId。AWS新增,salesforce更新
|
this.NewPIToAWS(payloadForNewPI, fields);
|
return
|
}
|
obj[0].dataId = this.AWSDataId;
|
let payloadForNewPIJson = JSON.stringify(obj);
|
let that = this;
|
this.AWSService.post(this.staticResource.updateUrl, payloadForNewPIJson, (result) => {
|
if (result && result.object) {
|
console.log('result = ' + JSON.stringify(result));
|
for (let f in this.AWSToSobjectMap) {
|
if (result.object[0].hasOwnProperty(f)) {
|
fields[this.AWSToSobjectMap[f]] = result.object[0][f];
|
console.log('this.AWSToSobjectMap[f] = ' + this.AWSToSobjectMap[f]);
|
console.log('fields[this.AWSToSobjectMap[f]] = ' + fields[this.AWSToSobjectMap[f]]);
|
}
|
else {
|
console.log(f + 'is not in result.object[0]');
|
}
|
}
|
if (this.isNewMode) {
|
fields['AWS_Data_Id__c'] = result.object[0].dataId;
|
} else {
|
//更新
|
fields['AWS_Data_Id__c'] = this.AWSDataId;
|
}
|
this.txId = result.txId;
|
console.log('this.txId = ' + this.txId);
|
console.log('PI After fields = ' + JSON.stringify(fields));
|
if (fields.RecordTypeId) {
|
console.log('length = ' + JSON.stringify(fields.RecordTypeId.length));
|
fields['RecordTypeId'] = fields.RecordTypeId.substring(1, fields.RecordTypeId.length - 1);
|
console.log('RecordTypeId = ' + JSON.stringify(fields['RecordTypeId']));
|
}else{
|
fields.RecordTypeId = that.recordTypeId;
|
}
|
//保存到后端
|
console.log('update submit = ' + JSON.stringify(fields));
|
this.template.querySelector('lightning-record-edit-form').submit(fields);
|
} else {
|
console.log('result = ' + JSON.stringify(result));
|
}
|
}, this.staticResource.token);
|
}
|
|
//提交保存成功
|
handleSuccess(event) {
|
let updatedRecord = event.detail.id;
|
console.log('onsuccess: ', updatedRecord);
|
//成功之后确认事物
|
console.log('confirmTrans:'+updatedRecord+'---'+this.txId+'---'+this.staticResource.token+'---'+this.staticResource.transactionUrl);
|
let that = this;
|
this.AWSService.confirm(true, updatedRecord, this.txId, this.staticResource.token, this.staticResource.transactionUrl, function (result) {
|
console.log('result = ' + JSON.stringify(result))
|
//that.showMyToast('Success', '保存成功');
|
const event = new ShowToastEvent({
|
//title: 'Success',
|
variant: 'Success',
|
message: '保存成功'
|
});
|
that.dispatchEvent(event);
|
console.log('updatedRecord = ' + updatedRecord)
|
that[NavigationMixin.Navigate]({
|
type: 'standard__recordPage',
|
attributes: {
|
actionName: "view",
|
recordId: updatedRecord,
|
objectApiName: that.sobjectType
|
}
|
});
|
});
|
|
}
|
|
//提交保存失败
|
handleError(event) {
|
event.preventDefault();
|
event.stopImmediatePropagation();
|
// this.showMyToast("Error", event.detail.detail,'error');
|
//字段级别的报错
|
debugger
|
if (event.detail.output && event.detail.output.fieldErrors && Object.keys(event.detail.output.fieldErrors).length != 0) {
|
let msg = '';
|
for (let key in event.detail.output.fieldErrors) {
|
msg += ',' + event.detail.output.fieldErrors[key][0].message;
|
}
|
msg = msg.substring(1);
|
this.showMyToast(event.detail.message + ' : ' + msg, '', 'error');
|
} else {
|
//add by Li Jun 20231025 Start
|
if(event.detail.message != '' && this.customLabel.LexRecordNotCreateable.indexOf(event.detail.message) != -1){
|
this.showMyToast("Error", this.customLabel.LexNotCreateNote, 'error');
|
}else{
|
this.showMyToast("Error", event.detail.message + ' : ' + event.detail.detail, 'error');
|
}
|
//add by Li Jun 20231025 End
|
}
|
//add by Li Jun 20231025 Start
|
if(this.txId && this.staticResource){
|
this.AWSService.confirm(false,'',this.txId,this.staticResource.token,this.staticResource.transactionUrl,function(result){
|
console.log('result = ' + JSON.stringify(result))
|
});
|
}
|
//add by Li Jun 20231025 End
|
}
|
|
//验证字段
|
validateFieldValueFormate(fields) {
|
let error_msg = '';
|
let b = false;
|
for (var key in fields) {
|
if (fields[key] == "*****")
|
b = true;
|
}
|
if (b)
|
error_msg = '下拉框不能主动选择密文选项';
|
return error_msg;
|
}
|
|
//验证required字段需要进行填写
|
checkRequiredFieldMsg(fields) {
|
let msg = '';
|
// for (var s of this.layout) {
|
// for (var c of s.layoutFields) {
|
// if (c.isRequired && c.editableField && (fields[c.fieldAPI] == null || fields[c.fieldAPI] == '')) {
|
// msg += ';' + c.fieldLabel;
|
// }
|
// }
|
// }
|
for (let s of this.layout) {
|
for (let c of s.layoutColumns) {
|
if (c.layoutItems) {
|
for (let item of c.layoutItems) {
|
if (item.isRequired && (fields[item.field] == null || fields[item.field] === '')) {
|
msg += ";" + this.fieldLabel[item.field].label ;
|
}
|
}
|
}
|
}
|
}
|
msg = msg.substring(1);
|
return msg;
|
}
|
|
//获取PI字段
|
getPIPayload(sobjJsonLwc) {
|
console.log()
|
let leadPayloadList = [];
|
let leadPIData = {};
|
|
for (let f in this.AWSToSobjectMap) {
|
if (sobjJsonLwc.hasOwnProperty(this.AWSToSobjectMap[f])) {
|
leadPIData[f] = sobjJsonLwc[this.AWSToSobjectMap[f]]
|
}
|
else {
|
console.log(this.AWSToSobjectMap[f] + 'is not in sobjJsonLwc');
|
}
|
}
|
|
leadPIData.medicalStaffFullName = leadPIData.lastName;
|
leadPIData.sfRecordId = '';
|
console.log('Sobject PI Data x :' + leadPIData);
|
leadPayloadList.push(leadPIData);
|
console.log('leadPayloadList = ' + JSON.stringify(leadPayloadList));
|
return JSON.stringify(leadPayloadList);
|
}
|
|
//查询客户人员根据医院
|
searchHospitalNameModal(event) {
|
let fieldName = event.target.getAttribute("data-field");
|
if (fieldName == 'Contact_Name__c') {
|
if (this.hospitalId == Agency_ID_c || this.hospitalId == '') {
|
this.showMyToast('Error', '请先选择医院名','error');
|
return
|
}
|
this.template.querySelector(".slds-modal").style="display:none";
|
this.isShowSearchAccount = true;
|
}
|
}
|
|
//选择客户人员后进行赋值
|
handleSelectContact(event) {
|
this.isLoading = true;
|
console.log('enter handleSelectContact ');
|
const selectContact = event.detail;
|
console.log('selectContact = ' + JSON.stringify(selectContact))
|
// for (var s of this.layout) {
|
// for (var c of s.layoutFields) {
|
// if (c['fieldAPI'] == 'Contact_Name__c') {
|
// c['value'] = selectContact.data.medicalStaffFullName;
|
// this.contactId = selectContact.data.sfRecordId;
|
// console.log('this.contactId = ' + this.contactId);
|
// console.log('selectContact.data.sfRecordId = ' + selectContact.data.sfRecordId);
|
// console.log('c[value] = ' + c['value']);
|
// }
|
// if (c['fieldAPI'] == 'LastName') {
|
// c['value'] = selectContact.data.medicalStaffFullName;
|
// this.modifyObj['LastName'] = selectContact.data.medicalStaffFullName;
|
// console.log('c[value] = ' + c['value']);
|
// }
|
// }
|
// }
|
|
for (let s of this.layout) {
|
for (let c of s.layoutColumns) {
|
if (c.layoutItems) {
|
for (let item of c.layoutItems) {
|
if (item['field'] == 'Contact_Name__c') {
|
item['value'] = selectContact.data.medicalStaffFullName;
|
this.contactId = selectContact.data.sfRecordId;
|
}
|
if (item['field'] == 'LastName') {
|
item['value'] = selectContact.data.medicalStaffFullName;
|
this.modifyObj['LastName'] = selectContact.data.medicalStaffFullName;
|
console.log('item[value] = ' + item['value']);
|
}
|
}
|
}
|
}
|
}
|
this.layout = [...this.layout];
|
this.isLoading = false;
|
this.closeHospitalNameModal();
|
}
|
|
//关闭客户人员根据医院模态框
|
closeHospitalNameModal() {
|
this.isShowSearchAccount = false;
|
this.template.querySelector(".slds-modal").style="";
|
}
|
|
//显示信息
|
showMyToast(title, message, variant) {
|
console.log('show custom message');
|
let iconName = '';
|
let content = '';
|
if (variant == 'success') {
|
iconName = 'utility:check';
|
} else {
|
iconName = 'utility:error';
|
}
|
if (message != '') {
|
content =
|
'<h2><strong>' +
|
title +
|
'<strong/></h2><h5>' +
|
message +
|
'</h5>';
|
} else {
|
content = '<h2><strong>' + title + '<strong/></h2>';
|
}
|
this.template
|
.querySelector('c-common-toast')
|
.showToast(variant, content, iconName, 10000);
|
this.isLoading = false;
|
}
|
}
|