| | |
| | | errorMsgNode.className = ''; |
| | | } |
| | | |
| | | function getCKEinstance(api_name){ |
| | | let t = jQuery("label[for$='textAreaDelegate_"+api_name+"']").parent().next().find("textarea")[0]; |
| | | if(t && t.id){ |
| | | return CKEDITOR.instances[t.id] |
| | | |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | //1。获取所有字段值 |
| | | function getReportInformation() { |
| | | let nodelist = document.querySelectorAll("[data-id]"); |
| | |
| | | } else if (nodelist[index].type == 'select-multiple') { |
| | | //nodelist[index].getAttribute("data-id") |
| | | let multiple = nodelist[index].getAttribute("data-id"); |
| | | let targets = document.querySelector("[data-id=" + multiple + "]").nextSibling.children[0].children[1].children[2].innerText; |
| | | targets = targets.replace(/\n/g, ";"); |
| | | console.log('targets = ' + targets); |
| | | result[nodelist[index].getAttribute("data-id")] = targets; |
| | | //let targets = document.querySelector("[data-id=" + multiple + "]").nextSibling.children[0].children[1].children[2].innerText; |
| | | //Before Update By Li Jun 20220411 |
| | | // let targets = document.querySelector("[data-id=" + multiple + "]").parentNode.children[2].children[0].children[1].children[2].children[0].innerText; |
| | | // targets = targets.replace(/\n/g, ";"); |
| | | // console.log('targets = ' + targets); |
| | | // result[nodelist[index].getAttribute("data-id")] = targets; |
| | | //Before Update By Li Jun 20220411 |
| | | |
| | | //After Update By Li Jun 20220411 Start |
| | | let targets = document.querySelector("[data-id=" + multiple + "]").options; |
| | | let selValues = []; |
| | | for(i=0; i < targets.length; i++){ |
| | | if(targets[i].selected){ |
| | | selValues.push(targets[i].value); |
| | | } |
| | | } |
| | | let setValuesStr = JSON.stringify(selValues); |
| | | setValuesStr = setValuesStr.substring(1,setValuesStr.length-1); |
| | | if(setValuesStr){ |
| | | setValuesStr = setValuesStr.replace(/"/g,""); |
| | | if(setValuesStr.indexOf(',')!=-1){ |
| | | setValuesStr = setValuesStr.replace(/,/g,";"); |
| | | } |
| | | } |
| | | console.log('targets = ' + setValuesStr); |
| | | result[nodelist[index].getAttribute("data-id")] = setValuesStr; |
| | | //After Update By Li Jun 20220411 End |
| | | |
| | | |
| | | } else { |
| | | result[nodelist[index].getAttribute("data-id")] = nodelist[index].value; |
| | | } |
| | |
| | | } |
| | | } |
| | | //手术分类1 |
| | | result.Technical_Category1__c = document.getElementById('page:form:j_id30:j_id60:4:j_id61:j_id62:2:j_id63')!=null?document.getElementById('page:form:j_id30:j_id60:4:j_id61:j_id62:2:j_id63').value:''; |
| | | result.Technical_Category1__c = document.getElementById('page:form:j_id5:j_id35:4:j_id36:j_id37:2:j_id38')!=null?document.getElementById('page:form:j_id5:j_id35:4:j_id36:j_id37:2:j_id38').value:''; |
| | | //手术分类2 |
| | | result.Technical_Category2__c = document.getElementById('page:form:j_id30:j_id60:4:j_id61:j_id62:4:j_id63')!=null?document.getElementById('page:form:j_id30:j_id60:4:j_id61:j_id62:4:j_id63').value:''; |
| | | result.Technical_Category2__c = document.getElementById('page:form:j_id5:j_id35:4:j_id36:j_id37:4:j_id38')!=null?document.getElementById('page:form:j_id5:j_id35:4:j_id36:j_id37:4:j_id38').value:''; |
| | | //目的2 |
| | | if(document.getElementById('page:form:j_id30:j_id60:3:j_id61:j_id62:1:j_id63')){ |
| | | result.Purpose2__c = document.getElementById('page:form:j_id30:j_id60:3:j_id61:j_id62:1:j_id63').value; |
| | | } |
| | | if(document.getElementById('page:form:j_id30:j_id60:2:j_id61:j_id62:1:j_id63')){ |
| | | result.Purpose2__c = document.getElementById('page:form:j_id30:j_id60:2:j_id61:j_id62:1:j_id63').value; |
| | | if(document.getElementById('page:form:j_id5:j_id35:2:j_id36:j_id37:1:j_id38')){ |
| | | result.Purpose2__c = document.getElementById('page:form:j_id5:j_id35:2:j_id36:j_id37:1:j_id38').value; |
| | | } |
| | | //富文本框赋值 |
| | | if(getCKEinstance('Customer_sigh_photo__c')){ |
| | | result.Customer_sigh_photo__c = getCKEinstance('Customer_sigh_photo__c').getData() |
| | | } |
| | | if(getCKEinstance('Photo1__c')){ |
| | | result.Photo1__c = getCKEinstance('Photo1__c').getData() |
| | | } |
| | | if(getCKEinstance('Photo2__c')){ |
| | | result.Photo2__c = getCKEinstance('Photo2__c').getData() |
| | | } |
| | | if(getCKEinstance('Photo3__c')){ |
| | | result.Photo3__c = getCKEinstance('Photo3__c').getData() |
| | | } |
| | | if(getCKEinstance('VOC_follow_up_result__c')){ |
| | | result.VOC_follow_up_result__c = getCKEinstance('VOC_follow_up_result__c').getData() |
| | | } |
| | | if(getCKEinstance('VOC_follow_up_result1__c')){ |
| | | result.VOC_follow_up_result1__c = getCKEinstance('VOC_follow_up_result1__c').getData() |
| | | } |
| | | //用户签字的照片 |
| | | if(document.querySelector("[aria-describedby = 'cke_34']")){ |
| | | result.Customer_sigh_photo__c = document.querySelector("[aria-describedby = 'cke_34']").contentWindow.document.getElementsByTagName('body')[0].innerHTML |
| | | // if(document.querySelector("[aria-describedby = 'cke_34']")){ |
| | | // result.Customer_sigh_photo__c = document.querySelector("[aria-describedby = 'cke_34']").contentWindow.document.getElementsByTagName('body')[0].innerHTML |
| | | // } |
| | | // //照片1 Photo1__c |
| | | // if(document.querySelector("[aria-describedby = 'cke_42']")){ |
| | | // result.Photo1__c = document.querySelector("[aria-describedby = 'cke_42']").contentWindow.document.getElementsByTagName('body')[0].innerHTML |
| | | // } |
| | | // //照片2 Photo2__c |
| | | // if(document.querySelector("[aria-describedby = 'cke_75']")){ |
| | | // result.Photo2__c = document.querySelector("[aria-describedby = 'cke_75']").contentWindow.document.getElementsByTagName('body')[0].innerHTML |
| | | // } |
| | | // //照片3 Photo3__c |
| | | // if(document.querySelector("[aria-describedby = 'cke_108']")){ |
| | | // result.Photo3__c = document.querySelector("[aria-describedby = 'cke_108']").contentWindow.document.getElementsByTagName('body')[0].innerHTML |
| | | // } |
| | | // //对应结果 VOC_follow_up_result__c cke_38 |
| | | // if(document.querySelector("[aria-describedby = 'cke_38']")){ |
| | | // result.VOC_follow_up_result__c = document.querySelector("[aria-describedby = 'cke_38']").contentWindow.document.getElementsByTagName('body')[0].innerHTML |
| | | // } |
| | | // //对应结果第一次 VOC_follow_up_result1__c cke_71 |
| | | // if(document.querySelector("[aria-describedby = 'cke_71']")){ |
| | | // result.VOC_follow_up_result1__c = document.querySelector("[aria-describedby = 'cke_71']").contentWindow.document.getElementsByTagName('body')[0].innerHTML |
| | | // } |
| | | if(result.From__c){ |
| | | result.From__c = result.From__c.replace(/\//g, '-')+':00'; |
| | | } |
| | | //照片1 Photo1__c |
| | | if(document.querySelector("[aria-describedby = 'cke_42']")){ |
| | | result.Photo1__c = document.querySelector("[aria-describedby = 'cke_42']").contentWindow.document.getElementsByTagName('body')[0].innerHTML |
| | | } |
| | | //照片2 Photo2__c |
| | | if(document.querySelector("[aria-describedby = 'cke_75']")){ |
| | | result.Photo2__c = document.querySelector("[aria-describedby = 'cke_75']").contentWindow.document.getElementsByTagName('body')[0].innerHTML |
| | | } |
| | | //照片3 Photo3__c |
| | | if(document.querySelector("[aria-describedby = 'cke_108']")){ |
| | | result.Photo3__c = document.querySelector("[aria-describedby = 'cke_108']").contentWindow.document.getElementsByTagName('body')[0].innerHTML |
| | | } |
| | | //对应结果 VOC_follow_up_result__c cke_38 |
| | | if(document.querySelector("[aria-describedby = 'cke_38']")){ |
| | | result.VOC_follow_up_result__c = document.querySelector("[aria-describedby = 'cke_38']").contentWindow.document.getElementsByTagName('body')[0].innerHTML |
| | | } |
| | | //对应结果第一次 VOC_follow_up_result1__c cke_71 |
| | | if(document.querySelector("[aria-describedby = 'cke_71']")){ |
| | | result.VOC_follow_up_result1__c = document.querySelector("[aria-describedby = 'cke_71']").contentWindow.document.getElementsByTagName('body')[0].innerHTML |
| | | if(result.To__c){ |
| | | result.To__c = result.To__c.replace(/\//g, '-')+':00'; |
| | | } |
| | | return result; |
| | | } |
| | |
| | | //5.新建或编辑 |
| | | function ProcessPI(reportJson, payloadForNewPI) { |
| | | blockme(); |
| | | if ({!isNewMode}) { |
| | | if ({!isNewMode} || {!isCloneMode}) { |
| | | NewPIToAWS(reportJson, payloadForNewPI) |
| | | }else { |
| | | UpdatePIToAWS(reportJson, payloadForNewPI) |
| | |
| | | if(document.querySelector("[data-id='Practitioner1__c']") != null){ |
| | | let sfId = document.getElementById(document.querySelector("[data-id='Practitioner1__c']").id + '_lkid').value; |
| | | let dataId = contactsInfo[sfId]; |
| | | let url = staticResourcesContact.queryUrl + '?dataId=' + dataId; |
| | | queryContactNameFetch(url,'Practitioner1__c'); |
| | | let url = staticResourcesContact.queryUrl; |
| | | queryContactNameFetch(url,dataId,'Practitioner1__c'); |
| | | } |
| | | if(document.querySelector("[data-id='Practitioner2__c']") != null){ |
| | | let sfId = document.getElementById(document.querySelector("[data-id='Practitioner2__c']").id + '_lkid').value; |
| | | let dataId = contactsInfo[sfId]; |
| | | let url = staticResourcesContact.queryUrl + '?dataId=' + dataId; |
| | | queryContactNameFetch(url,'Practitioner2__c'); |
| | | let url = staticResourcesContact.queryUrl; |
| | | queryContactNameFetch(url,dataId,'Practitioner2__c'); |
| | | } |
| | | if(document.querySelector("[data-id='Practitioner3__c']") != null){ |
| | | let sfId = document.getElementById(document.querySelector("[data-id='Practitioner3__c']").id + '_lkid').value; |
| | | let dataId = contactsInfo[sfId]; |
| | | let url = staticResourcesContact.queryUrl + '?dataId=' + dataId; |
| | | queryContactNameFetch(url,'Practitioner3__c'); |
| | | let url = staticResourcesContact.queryUrl; |
| | | queryContactNameFetch(url,dataId,'Practitioner3__c'); |
| | | } |
| | | if(document.querySelector("[data-id='Practitioner4__c']") != null){ |
| | | let sfId = document.getElementById(document.querySelector("[data-id='Practitioner4__c']").id + '_lkid').value; |
| | | let dataId = contactsInfo[sfId]; |
| | | let url = staticResourcesContact.queryUrl + '?dataId=' + dataId; |
| | | queryContactNameFetch(url,'Practitioner4__c'); |
| | | let url = staticResourcesContact.queryUrl; |
| | | queryContactNameFetch(url,dataId,'Practitioner4__c'); |
| | | } |
| | | if(document.querySelector("[data-id='Practitioner5__c']") != null){ |
| | | let sfId = document.getElementById(document.querySelector("[data-id='Practitioner5__c']").id + '_lkid').value; |
| | | let dataId = contactsInfo[sfId]; |
| | | let url = staticResourcesContact.queryUrl + '?dataId=' + dataId; |
| | | queryContactNameFetch(url,'Practitioner5__c'); |
| | | let url = staticResourcesContact.queryUrl; |
| | | queryContactNameFetch(url,dataId,'Practitioner5__c'); |
| | | } |
| | | if(document.querySelector("[data-id='Person_In_Charge__c']") != null){ |
| | | let sfId = document.getElementById(document.querySelector("[data-id='Person_In_Charge__c']").id + '_lkid').value; |
| | | let dataId = contactsInfo[sfId]; |
| | | let url = staticResourcesContact.queryUrl + '?dataId=' + dataId; |
| | | queryContactNameFetch(url,'Person_In_Charge__c'); |
| | | let url = staticResourcesContact.queryUrl; |
| | | queryContactNameFetch(url,dataId,'Person_In_Charge__c'); |
| | | } |
| | | } |
| | | |
| | | function queryContactNameFetch(url,filedId){ |
| | | fetch(url, { |
| | | method: 'GET', |
| | | headers: { |
| | | 'Content-Type': 'application/json', |
| | | 'pi-token': staticResources.token |
| | | } |
| | | }).then((data) => { |
| | | return data.json(); |
| | | }).then((result) => { |
| | | if(result.object){ |
| | | document.querySelector("[data-id="+filedId+"]").value = result.object.lastName; |
| | | } |
| | | }) |
| | | function queryContactNameFetch(url,dataId,filedId){ |
| | | let queryBackContactNameFetch = function queryBackContactNameFetch(result){ |
| | | document.querySelector("[data-id="+filedId+"]").value = result.object.lastName; |
| | | }; |
| | | AWSService.query(url, dataId, queryBackContactNameFetch, staticResources.token); |
| | | } |
| | | |
| | | //自定义lookup查询 |
| | | function searchContact(contactNodeId,field){ |
| | | closeField = field; |
| | | //searchContactKeyWord |
| | | let searchContactKeyWord = document.querySelector("[data-id="+field+"]").value |
| | | let accountValue = ""; |
| | | if (document.querySelector("[data-id='Hospital_Department__c']")) { |
| | | let accountNodeId = document.querySelector("[data-id='Hospital_Department__c']").id + '_lkid'; |
| | |
| | | console.log(accountValue); |
| | | if(accountValue !='000000000000000'){ |
| | | let baseUrl = "/apex/SearchContactPage"; |
| | | let suffixUrl = "?contactId="+contactNodeId+"&accountId="+accountValue; |
| | | let suffixUrl = "?contactId="+contactNodeId+"&accountId="+accountValue+"&searchContactKeyWord=" + searchContactKeyWord; |
| | | let newSearchContactParam = 'height=600,width=800,left=100,top=100,dialogHide=true,resizable=no,scrollbars=yes,toolbar=no,status=no'; |
| | | newSearchContactWindow = window.open(baseUrl+suffixUrl, 'Popup', newSearchContactParam); |
| | | if (window.focus) { |
| | |
| | | } |
| | | return false; |
| | | }else{ |
| | | alertErrorMessage('{!PIPL_Input_Account_Error_Msg}'); |
| | | alertErrorMessage('请先选择科室!'); |
| | | } |
| | | } |
| | | //窗口关闭时发生 |
| | |
| | | //新建编辑回调函数 |
| | | var insertOrUpdateBack = function insertOrUpdateBack(payloadJson, result, isNewMode) { |
| | | console.log(result); |
| | | if(result.status != '0'){ |
| | | unblockUI(); |
| | | console.log('回调函数出错拉') |
| | | return |
| | | } |
| | | console.log('Result from AWS' + result); |
| | | console.log('payloadJson=' + payloadJson); |
| | | payloadJson.VOC_Informer_Name__c = result.object[0].vocInformerName; |
| | |
| | | payloadJson.age_Encrypted__c = result.object[0].ageEncrypt; |
| | | payloadJson.Medical_History_Encrypted__c = result.object[0].medicalHistoryEncrypt; |
| | | payloadJson.sex_Encrypted__c = result.object[0].sexEncrypt; |
| | | if (isNewMode) { |
| | | if (isNewMode || {!isCloneMode}) { |
| | | payloadJson.AWS_Data_Id__c = result.object[0].dataId; |
| | | } else { |
| | | payloadJson.AWS_Data_Id__c = '{!AWSDataId}'; |
| | |
| | | // 3. Check Required Field |
| | | let checkRequiredFieldMsgResult = checkRequiredFieldMsg(reportJson); |
| | | if (checkRequiredFieldMsgResult) { |
| | | alertErrorMessage('{!requiredErrorMsg}'+checkRequiredFieldMsgResult); |
| | | alertErrorMessage('{!Input_Required_Field_Msg}'+checkRequiredFieldMsgResult); |
| | | return |
| | | } |
| | | //4. Prepare the payload for New PI API To AWS - To Do |
| | |
| | | </apex:repeat> |
| | | <script> |
| | | sfdcPage.appendToOnloadQueue(function () { |
| | | //判断是否为只读选项 |
| | | var layoutSections = JSON.parse('{!layoutSectionsStr}'); |
| | | for (let m = 0; m < layoutSections.length; m++) { |
| | | let layoutSection = layoutSections[m].layoutFields; |
| | | for (let n = 0; n < layoutSection.length; n++) { |
| | | let layoutField = layoutSection[n]; |
| | | if (layoutField.fieldAPI != '' && document.querySelector("[data-id='"+layoutField.fieldAPI+"']") != null) { |
| | | let e = document.querySelector("[data-id='"+layoutField.fieldAPI+"']"); |
| | | e.disabled = !(layoutField.editableField); |
| | | if (!(layoutField.editableField)) { |
| | | if (e.getAttribute("multiple") && e.getAttribute("multiple") == 'multiple') { |
| | | e.parentNode.classList.add("disabledbutton"); |
| | | } |
| | | if (e.tagName == 'DIV') { |
| | | e.classList.add("disabledbutton"); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | //1. Set Last Name label |
| | | //document.querySelector("[data-id='LastName']").parentNode.parentNode.parentNode.children[2].children[0].innerText = '姓名'; |
| | | //2. Query AWS Data by dataId |
| | |
| | | replaceSearchContactLookup(); |
| | | //3. Set Readonly Attribute |
| | | document.querySelector("[data-id='OwnerId']").classList.add("disabledbutton"); |
| | | |
| | | //如果是OPD计划过来的 |
| | | if('{!no1Name}' != '' && '{!no1Id}' != ''){ |
| | | console.log('name = '+'{!no1Name}') |
| | | console.log('Id = '+'{!no1Id}') |
| | | document.querySelector("[data-id='Loaner_request_no1__c']").value = '{!no1Name}' |
| | | document.getElementById(document.querySelector("[data-id='Loaner_request_no1__c']").id + '_lkid').value = '{!no1Id}' |
| | | } |
| | | |
| | | let previous_value = {}; |
| | | jQuery(".lookupInput input").each(function(i,e){ |
| | | let je =jQuery(e); |
| | | |
| | | let dataid = je.attr('data-id'); |
| | | if(['Practitioner1__c','Practitioner2__c','Practitioner3__c','Practitioner4__c','Practitioner5__c','Person_In_Charge__c'].indexOf(dataid) < 0) return; |
| | | |
| | | jQuery(e).focus(function(){ |
| | | previous_value[this.id] = this.value; |
| | | }) |
| | | |
| | | jQuery(e).change(function(){ |
| | | if (previous_value[this.id] != jQuery(this).val()) { |
| | | document.getElementById(this.id+'_lkid').value = ''; |
| | | } |
| | | }) |
| | | }) |
| | | |
| | | // jQuery(".lookupInput").each(function (i, e) { |
| | | // let je = jQuery(e).find('input'); |
| | | // je.attr("readonly", ""); |
| | | // je.css("background", "unset"); |
| | | |
| | | // let dataid = je.attr('data-id'); |
| | | // if (['Practitioner1__c','Practitioner2__c','Practitioner3__c','Practitioner4__c','Practitioner5__c','Person_In_Charge__c'].indexOf(dataid) > -1) |
| | | // jQuery(e).children(":last-child").before('<img class="closeIcon" data-id="' + dataid + '" generate="" alt="Clear" src="/s.gif" style="display: inline-block;">'); |
| | | // }) |
| | | |
| | | // jQuery(".lookupInput").on("mouseenter", "img[generate]", function (e) { |
| | | // this.className = "closeIconOn"; |
| | | // }); |
| | | |
| | | // jQuery(".lookupInput").on("mouseleave", "img[generate]", function (e) { |
| | | // this.className = "closeIcon" |
| | | // }); |
| | | |
| | | // jQuery(".lookupInput").on("click", "img[generate]", function (e) { |
| | | // let id = jQuery("input[data-id='" + jQuery(this).attr("data-id") + "']").attr("id"); |
| | | // let input = document.getElementById(id); |
| | | // if (input) { |
| | | // input.value = ''; |
| | | // let hidden = document.getElementById(id + '_lkid'); |
| | | // if (hidden) { |
| | | // hidden.value = ''; |
| | | // } |
| | | // } |
| | | // }); |
| | | }); |
| | | </script> |
| | | <div class="pbBottomButtons"> |