import { LightningElement, track } from 'lwc'; import GetInspectById from '@salesforce/apex/InspectCheckController.GetInspectById'; import cannotModifyIsRelateProject from '@salesforce/apex/InspectCheckController.cannotModifyIsRelateProject'; import { refreshApex } from '@salesforce/apex'; import GetIrrelevantReasons from '@salesforce/apex/InspectCheckController.GetIrrelevantReasons'; // import AssignValuesToOwner from '@salesforce/apex/InspectCheckController.AssignValuesToOwner'; import SaveData from '@salesforce/apex/InspectCheckController.SaveData'; import SearchYY from '@salesforce/apex/InspectCheckController.SearchYY'; import SearchYH from '@salesforce/apex/InspectCheckController.SearchYH'; import SearchZLKS from '@salesforce/apex/InspectCheckController.SearchZLKS'; import SearchParent from '@salesforce/apex/InspectCheckController.SearchParent'; import SearchAccountById from '@salesforce/apex/InspectCheckController.SearchAccountById'; import SearchUserById from '@salesforce/apex/InspectCheckController.SearchUserById'; import GetIsPrentIdArr from '@salesforce/apex/InspectCheckController.GetIsPrentIdArr'; import SearchUserByIds from '@salesforce/apex/InspectCheckController.SearchUserByIds'; import {ShowToastEvent} from 'lightning/platformShowToastEvent'; export default class test01 extends LightningElement { //提示 Tongzhishow=false; //提示显示的标识 SaveShowText="操作成功";//提示框的文本 TongzhiIcon = 'standard:account' //提示框的图标 IsLeftStyle = "" //提示框的样式 BgColorStyle = "" // 是否关联能不能编辑 xgxLyDisabled = false; //弹框提示 content 内容 error 是否是错误提示框 left 是否居左 Alert(content,error = false,left = false){ this.SaveShowText = content; this.Tongzhishow = true; // setTimeout(()=>{ // this.Tongzhishow = false; // this.SaveShowText = ""; // },3000) if (error) { this.TongzhiIcon = "standard:first_non_empty"; this.BgColorStyle = "background-color:#f88568"; }else{ this.TongzhiIcon = "standard:account"; this.BgColorStyle = "background-color:#69e669"; } if (left) { this.IsLeftStyle = "left: 0.25rem" }else{ this.IsLeftStyle = "" } } //关闭提示框 CloseAlert() {debugger // if (this.Tongzhishow == true) { // this.Tongzhishow = false; // } // if (this.SaveShowText != "") { // this.SaveShowText = ""; // } this.closeOffRefresh(); } closeOffRefresh(){ if (this.Tongzhishow == true) { this.Tongzhishow = false; } if (this.SaveShowText != "") { this.SaveShowText = ""; } if(this.InspectData.IsRelateProject__c == '是'){ setTimeout(()=>{ this.CheckBoxAssignment(this.InspectData.department_selection__c); },0.001); } } IsLoading = false; //加载的标识 //加载提示框 OnLoading(flag){ this.IsLoading = flag; } //显示与隐藏 isShi = true; //选着 是 的标识 isFou = false; //选着 否 的标识 isOther = false; //选着 其他 的标识 isDisable = false; OnLoadingWait(time) { this.OnLoading(true); setTimeout(()=>{ this.OnLoading(false); },time); } getQueryVariable(variable) { var query = window.location.search.substring(1); var vars = query.split("&"); for (var i=0;i{ var response=JSON.parse(result); if (response!=undefined && response.length == 1) { var tempData = response[0]; this.checkDatas(tempData); this.InspectData = tempData; } }) } cannotModifyIsRelateProjectFn(Id) { cannotModifyIsRelateProject({Id:Id}).then(result=>{ this.xgxLyDisabled = result; console.log(this.xgxLyDisabled); }) } checkDatas(tempData) { if (tempData.irrelevantReasonOther__c == undefined || tempData.irrelevantReasonOther__c == '') { tempData.irrelevantReasonOther__c = ''; } // if (tempData.irrelevantReasons__c == '8.其他(手写)'||tempData.irrelevantReasons__c == '1.关键词不相关') { this.isOther = true; // } if (tempData.IsRelateProject__c == "是" && !(tempData.status__c == '01.待确认' || tempData.status__c == '02.不相关' || tempData.status__c == '03.不应标' || tempData.status__c == '04.待关联询价') ) { this.isShi = true; this.isFou = false; this.isOther = false; //加载关联数据 // this.yyInit(); // this.InitZLKS(); // this.InitPTKS(); this.OnLoading(true); setTimeout(()=>{ this.InitSearchDatas(tempData); },3000); this.dispatchFn(false); var boxs = this.template.querySelectorAll('lightning-combobox'); boxs.forEach(fileInput=>{ fileInput.disabled = true; }) } else if(tempData.IsRelateProject__c == "是"){ this.isShi = true; this.isFou = false; this.isOther = false; //加载关联数据 // this.yyInit(); // this.InitZLKS(); // this.InitPTKS(); this.OnLoading(true); setTimeout(()=>{ this.InitSearchDatas(tempData); },3000); this.dispatchFn(false); var boxs = this.template.querySelectorAll('lightning-combobox'); boxs.forEach(fileInput=>{ fileInput.disabled = false; }) } else if(tempData.IsRelateProject__c == "否"){ this.isShi = false; this.isFou = true; this.dispatchFn(true); } } //给复选框赋值 CheckBoxAssignment(department_selection__c){ this.checkboxValue=department_selection__c; var department_selection__cList =department_selection__c.split(";"); department_selection__cList.forEach(ticl=>{ debugger if(ticl=='01210000000QemLAAS'){ this.template.querySelector('[data-parent-id="unique297"]').checked=true; this.checkboxValueMap.set(1,ticl); }else if(ticl=='01210000000QezZAAS'){ this.template.querySelector('[data-parent-id="unique298"]').checked=true; this.checkboxValueMap.set(2,ticl); }else if(ticl=='01210000000QezeAAC'){ this.template.querySelector('[data-parent-id="unique299"]').checked=true; this.checkboxValueMap.set(3,ticl); }else if(ticl=='01210000000QezjAAC'){ this.template.querySelector('[data-parent-id="unique300"]').checked=true; this.checkboxValueMap.set(4,ticl); }else if(ticl=='01210000000QezoAAC'){ this.template.querySelector('[data-parent-id="unique301"]').checked=true; this.checkboxValueMap.set(5,ticl); }else if(ticl=='01210000000QeztAAC'){ this.template.querySelector('[data-parent-id="unique302"]').checked=true; this.checkboxValueMap.set(6,ticl); } }); } //初始化查询方法 InitSearchDatas(tempData){ var temp = 3; //判断是否有医院 if (tempData.Hospital__c != undefined) { this.template.querySelector('[data-parent-id="lookup1"]').setvalue(tempData.Hospital__c); this.yyId = tempData.Hospital__c; this.yyIdArrs[0] = this.yyId; temp --; // this.InitZLKS(); }else {temp --;} //判断是否有医院1 if (tempData.Hospital1__c != undefined) { this.template.querySelector('[data-parent-id="lookupyy1"]').setvalue(tempData.Hospital1__c); this.yyId1 = tempData.Hospital1__c; this.yyIdArrs[1] = this.yyId1; temp --; }else {temp --;} //判断是否有医院2 if (tempData.Hospital2__c != undefined) { this.template.querySelector('[data-parent-id="lookupyy2"]').setvalue(tempData.Hospital2__c); this.yyId2 = tempData.Hospital2__c; this.yyIdArrs[2] = this.yyId2; temp --; }else {temp --;} //判断是否有医院3 if (tempData.Hospital3__c != undefined) { this.template.querySelector('[data-parent-id="lookupyy3"]').setvalue(tempData.Hospital3__c); this.yyId3 = tempData.Hospital3__c; this.yyIdArrs[3] = this.yyId3; temp --; }else {temp --;} // //判断是否有医院4 if (tempData.Hospital4__c != undefined) { this.template.querySelector('[data-parent-id="lookupyy4"]').setvalue(tempData.Hospital4__c); this.yyId4 = tempData.Hospital4__c; this.yyIdArrs[4] = this.yyId4; temp --; }else {temp --;} //判断是否有项目负责人 // if (tempData.AccountOwner__c != undefined) { // SearchUserById({Id:tempData.AccountOwner__c}).then(result=>{ // var datas = JSON.parse(result); // this.template.querySelector('[data-parent-id="lookupfzr"]').setvalue(datas[0].Name); // temp--; // if (temp <= 0) { // this.OnLoading(false); // } // }) // this.fzrId5 = tempData.AccountOwner__c; // }else {temp --;} //判断是否有战略科室 // if (tempData.department__c != undefined) { // SearchAccountById({Id:tempData.department__c}).then(result=>{ // var datas = JSON.parse(result); // this.template.querySelector('[data-parent-id="lookup2"]').setvalue(datas[0].Name); // temp--; // if (temp <= 0) { // this.OnLoading(false); // } // }) // this.ZLKSId = tempData.department__c; // }else {temp --;} // if (tempData.subDepartment1__c != undefined) { // SearchAccountById({Id:tempData.subDepartment1__c}).then(result=>{ // var datas = JSON.parse(result); // this.template.querySelector('[data-parent-id="lookup3"]').setvalue(datas[0].Name); // temp--; // if (temp <= 0) { // this.OnLoading(false); // } // }) // this.ZLKSId1 = tempData.subDepartment1__c; // }else {temp --;} // //判断是否有战略科室1 // if (tempData.subDepartment2__c != undefined) { // SearchAccountById({Id:tempData.subDepartment2__c}).then(result=>{ // var datas = JSON.parse(result); // this.template.querySelector('[data-parent-id="lookup4"]').setvalue(datas[0].Name); // temp--; // if (temp <= 0) { // this.OnLoading(false); // } // }) // this.ZLKSId2 = tempData.subDepartment2__c; // }else {temp --;} // //判断是否有战略科室2 // if (tempData.subDepartment3__c != undefined) { // SearchAccountById({Id:tempData.subDepartment3__c}).then(result=>{ // var datas = JSON.parse(result); // this.template.querySelector('[data-parent-id="lookup5"]').setvalue(datas[0].Name); // temp--; // if (temp <= 0) { // this.OnLoading(false); // } // }) // this.ZLKSId3 = tempData.subDepartment3__c; // }else {temp --;} // //判断是否有战略科室3 // if (tempData.subDepartment4__c != undefined) { // SearchAccountById({Id:tempData.subDepartment4__c}).then(result=>{ // var datas = JSON.parse(result); // this.template.querySelector('[data-parent-id="lookup6"]').setvalue(datas[0].Name); // temp--; // if (temp <= 0){ // this.OnLoading(false); // } // }) // this.ZLKSId4 = tempData.subDepartment4__c; // }else {temp --;} // if (temp <= 0) { // } setTimeout(()=>{ this.OnLoading(false); debugger if(this.InspectData.department_selection__c!=null&&this.InspectData.department_selection__c!=''&&this.InspectData.department_selection__c!=undefined){ debugger if(this.InspectData.IsRelateProject__c == '是'){ setTimeout(()=>{ this.CheckBoxAssignment(this.InspectData.department_selection__c); },1); } } },2000); } GetIrrelevantReasonsFn() { GetIrrelevantReasons().then(result=>{ var response=JSON.parse(result); this.IrrelevantReasons = response; }) } @track InspectData = {}; //数据 IrrelevantReasons=[]; //相关性检查 RelateOption=[ {label:"是",value:"是"}, {label:"否",value:"否"}, ] IsRelateProjectShow = false; //是否输入 //是否关联 handleRelationFn(event) { // this.IsRelateProjectShow = true; var value = event.target.value; // if (this.InspectData.IsRelateProject__c != undefined && this.InspectData.IsRelateProject__c == "是" && value=="否") { // this.InspectData.IsRelateProject__c = "是"; // return; // } this.InspectData.IsRelateProject__c = value; if (value == "是") { this.isShi = true; this.isFou = false; this.isOther = false; // this.OnLoading(true); // setTimeout(()=>{ // this.InitSearchDatas(this.InspectData); // },3000); // this.InitSearchDatas(this.InspectData); this.dispatchFn(false); } if (value == "否") { // this.isShi = false; this.isFou = true; // if (this.InspectData.irrelevantReasons__c = '8.其他(手写)'||this.InspectData.irrelevantReasons__c == '1.关键词不相关') { this.isOther = true; // }else{ // this.isOther = false; // } this.dispatchFn(true); } } dispatchDivStyle="position: absolute;left: 30px;top: 90px;width: 600px;height: 500px;background-color: white;z-index: 998;"; dispatchButtonStyle = 'z-index: 999;position: absolute;left: 30px;top: 100px;'; dispatchFn(flag,top) { if (flag) { if (this.isOther) { this.dispatchDivStyle="position: absolute;left: 30px;top: 210px;width: 600px;height: 500px;background-color: white;z-index: 998;"; this.dispatchButtonStyle = 'margin-top: 10px;z-index: 999;position: absolute;left: 30px;top: 210px;'; }else{ this.dispatchDivStyle="position: absolute;left: 30px;top: 150px;width: 600px;height: 500px;background-color: white;z-index: 998;"; this.dispatchButtonStyle = 'margin-top: 10px;z-index: 999;position: absolute;left: 30px;top: 150px;'; } }else{ this.dispatchDivStyle=""; this.dispatchButtonStyle = 'margin-top: 10px;'; } } //不相关理由 handleIrrelevantFn(event) { var value = event.target.value; this.InspectData.irrelevantReasons__c = value; debugger; // if (value == "8.其他(手写)"||value == '1.关键词不相关') { this.isOther = true; // }else{ // this.isOther = false; // } this.dispatchFn(true); } otherData = "" saveButtonShow = true; //保存按钮是否显示 //其他理由 handleOtherIrrelevantFn(event) { var value = event.target.value; this.otherData = value; this.InspectData.irrelevantReasonOther__c = this.otherData ; } //没有输入的提示样式 xgxLy ="slds-form-element"; //error = slds-form-element slds-has-error xgxLyFlag = false; bxgLy ="slds-form-element"; //error = slds-form-element slds-has-error bxgLyFlag = false; qtLy="slds-form-element"; qtLyFlag = false; //保存数据逻辑 saveFn(){ var flag = true; if(this.checkZLSKIsRepeate()== false) { this.Alert("保存失败",true,true); return; } //判断是否为空 if (this.isShi==true) { var id1 = this.template.querySelector('[data-parent-id="lookup1"]').getvalue(); // var id2 = this.template.querySelector('[data-parent-id="lookup2"]').getvalue(); if (id1 == undefined || id1 == '') { this.InspectData.Hospital__c == undefined; } // if (id2 == undefined || id2 == '') { // this.InspectData.department__c == undefined; // } } //判断 IsRelateProject__c if (this.InspectData.IsRelateProject__c == undefined || this.InspectData.IsRelateProject__c == "" ) { this.xgxLy = "slds-form-element slds-has-error" this.xgxLyFlag = true; flag = false; }else{ this.xgxLy = "slds-form-element" this.xgxLyFlag = false; } //判断 irrelevantReasons__c if (this.InspectData.irrelevantReasons__c == undefined | this.InspectData.irrelevantReasons__c == "" && this.InspectData.IsRelateProject__c != undefined && this.InspectData.IsRelateProject__c == "否") { this.bxgLy = "slds-form-element slds-has-error" this.bxgLyFlag = true; flag = false; }else{ this.bxgLy = "slds-form-element" this.bxgLyFlag = false; } //判断 irrelevantReasons__c // if ( (this.InspectData.irrelevantReasons__c == '8.其他(手写)'||this.InspectData.irrelevantReasons__c== '1.关键词不相关') && this.InspectData.irrelevantReasonOther__c == "") { if (this.InspectData.irrelevantReasons__c == '8.其他(手写)' && this.InspectData.irrelevantReasonOther__c == "") { this.qtLy="slds-form-element slds-has-error"; this.qtLyFlag = true; flag = false; }else{ this.qtLy="slds-form-element"; this.qtLyFlag = false; } //判断 Hospital__c if ((this.InspectData.Hospital__c == undefined || this.InspectData.Hospital__c == '' ) && this.InspectData.IsRelateProject__c == "是" ) { this.isErrorShowYY = true; flag = false; }else{ this.isErrorShowYY = false; } //判断 AccountOwner__c // if ( this.InspectData.IsRelateProject__c == "是" && (this.InspectData.AccountOwner__c == undefined || this.InspectData.AccountOwner__c == '' )) { // this.isErrorShowFZR = true; // flag = false; // }else{ // this.isErrorShowFZR = false; // } // if ( (this.InspectData.department__c == undefined || this.InspectData.department__c =='') && this.InspectData.IsRelateProject__c == "是" ) { // this.isErrorShowZLKS = true; // flag = false; // }else{ // this.isErrorShowZLKS = false; // } // if (this.InspectData.irrelevantReasons__c != '8.其他(手写)'&&this.InspectData.irrelevantReasons__c !='1.关键词不相关') { // this.InspectData.irrelevantReasonOther__c = ''; // } if (this.InspectData.IsRelateProject__c == '是') { this.InspectData.irrelevantReasons__c = ''; this.InspectData.irrelevantReasonOther__c = ''; } if(this.checkboxValue!=''){ this.InspectData.department_selection__c=this.checkboxValue; } if (flag) { this.OnLoading(true); console.warn(this.InspectData); debugger SaveData({JsonData:JSON.stringify(this.InspectData),Id:this.paramIdStr,checkboxValue:this.checkboxValue}).then((response)=>{ this.OnLoading(false); // AssignValuesToOwner({Id:this.paramIdStr,checkboxValue:this.checkboxValue}).then((reslut)=>{ // debugger // console.warn(reslut); // }); if (response == '成功') { this.Alert("保存成功",false,true); //保存成功 设置组件为禁用 var buttons = this.template.querySelectorAll('button'); buttons.forEach(fileInput=>{ fileInput.disabled = true; }) var combbox = this.template.querySelectorAll('lightning-combobox'); combbox.forEach(fileInput=>{ fileInput.disabled = true; }) var inputs = this.template.querySelectorAll('input'); inputs.forEach(input=>{ input.disabled = true; }) var lookups = this.template.querySelectorAll('c-jzlookupv3'); lookups.forEach(lookups=>{ lookups.todisabled(); }) var lookupslighting = this.template.querySelectorAll('c-jzlookuplightning'); lookupslighting.forEach(lighting=>{ lighting.todisabled(); }) var checkboxgroup = this.template.querySelectorAll('lightning-checkbox-group'); debugger checkboxgroup.forEach(group=>{ group.disabled = true; }) window.location.hash = "Refresh"+"=="+this.paramIdStr; }else{ this.Alert(response,true); } debugger if(this.InspectData.IsRelateProject__c == '是'){ setTimeout(()=>{ this.CheckBoxAssignment(this.InspectData.department_selection__c); },1); } }); } if(this.InspectData.IsRelateProject__c == '是'){ setTimeout(()=>{ this.CheckBoxAssignment(this.InspectData.department_selection__c); },1); } } isHospitorCheck = false; //判断是否重复 isrepeate1 = false; isrepeate2 = false; isrepeate3 = false; isrepeate4 = false; isrepeate5 = false; checkZLSKIsRepeate(){ this.isrepeate1 = false; this.isrepeate2 = false; this.isrepeate3 = false; this.isrepeate4 = false; this.isrepeate5 = false; var arr = ['department__c','subDepartment1__c','subDepartment2__c','subDepartment3__c','subDepartment4__c']; var repeateArr = []; arr.forEach(item=>{ var tempId = this.InspectData[item]; if (tempId != undefined && tempId!= '') { arr.forEach(temps=>{ if (this.InspectData[temps] == tempId && item!=temps) { repeateArr.push(item); repeateArr.push(temps); } }) } }) if (repeateArr.length > 0 ) { //显示效果 repeateArr.forEach(item=>{ if (item == 'department__c') { this.isrepeate1 = true; } if (item == 'subDepartment1__c') { this.isrepeate2 = true; } if (item == 'subDepartment2__c') { this.isrepeate3 = true; } if (item == 'subDepartment3__c') { this.isrepeate4 = true; } if (item == 'subDepartment4__c') { this.isrepeate5 = true; } }) return false; }else{ return true; } } clear(flag){ if (flag == 0) { this.InspectData.department__c = undefined; this.ZLKSId = ''; this.template.querySelector('[data-parent-id="lookup2"]').setvalue(""); // this.InitZLKS(); } } //关联医院 yyId = ''; //医院的ID yyIdArrs = []; //医院选择的集合 isErrorShowYY=false; //错误显示 onsearchchange(event){ this.yyId = event.detail.value; this.yyIdArrs[0] = this.yyId; this.InspectData.Hospital__c = this.yyId; this.SeachUserByIds(); } //关联医院 //关联医院1 yyId1 = ''; //医院的ID onsearchchange1(event){ this.yyId1 = event.detail.value; this.yyIdArrs[1] = this.yyId1; this.InspectData.Hospital1__c = this.yyId1; this.SeachUserByIds(); } //关联医院1 //关联医院2 yyId2 = ''; //医院的ID onsearchchange2(event){ this.yyId2 = event.detail.value; this.yyIdArrs[2] = this.yyId2; this.InspectData.Hospital2__c = this.yyId2; } //关联医院2 //关联医院3 yyId3 = ''; //医院的ID onsearchchange3(event){ this.yyId3 = event.detail.value; this.yyIdArrs[3] = this.yyId3; this.InspectData.Hospital3__c = this.yyId3; this.SeachUserByIds(); } //关联医院3 //关联医院4 yyId4 = ''; //医院的ID onsearchchange4(event){ this.yyId4 = event.detail.value; this.yyIdArrs[4] = this.yyId4; this.InspectData.Hospital4__c = this.yyId4; this.SeachUserByIds(); } //关联医院4 //关联战略科室 optionZLKS = [{lableOne:"Name",lableTwo:"Acc_Record_Type__c"}] searchdataZLKS=[]; isErrorShowZLKS = false; onsearchchangeZLKS(event){ var searchContentStr = event.detail.searchContent; searchContentStr = searchContentStr.trim(); SearchZLKS({content:searchContentStr,ParentId:this.yyIdArrs}).then(response=>{ var datas = JSON.parse(response); this.searchdataZLKS = datas; if (this.isShi==true) { if (this.searchdataZLKS !=undefined && this.searchdataZLKS.length > 0) { this.template.querySelector('[data-parent-id="lookup2"]').refreshdata(this.searchdataZLKS); }else{ this.template.querySelector('[data-parent-id="lookup2"]').iszero(); } } }) } ZLKSId = ''; selectedZLKS(event) { console.warn(event.detail.selectdata.Id); this.ZLKSId = event.detail.selectdata.Id; this.InspectData.department__c = this.ZLKSId; } InitZLKS() { SearchZLKS({content:undefined,ParentId:this.yyIdArrs}).then(response=>{ var datas = JSON.parse(response); this.searchdataZLKS = datas; if (this.isShi==true) { this.template.querySelector('[data-parent-id="lookup2"]').refreshdata(this.searchdataZLKS); } }) } onclearZLKS(event) { this.InspectData.department__c = ''; this.template.querySelector('[data-parent-id="lookup2"]').setvalue(""); this.InitZLKS(); } //关联战略科室 //关联战略科室 -- 1 optionZLKS1 = [{lableOne:"Name",lableTwo:"Acc_Record_Type__c"}] searchdataZLKS1=[]; onsearchchangeZLKS1(event){ var searchContentStr = event.detail.searchContent; SearchZLKS({content:searchContentStr,ParentId:this.yyIdArrs}).then(response=>{ var datas = JSON.parse(response); this.searchdataZLKS1 = datas; console.warn(datas); if (this.isShi==true) { if (this.searchdataZLKS1 !=undefined && this.searchdataZLKS1.length > 0) { console.warn("refresh1"); this.template.querySelector('[data-parent-id="lookup3"]').refreshdata(this.searchdataZLKS1); }else{ this.template.querySelector('[data-parent-id="lookup3"]').iszero(); } } }) } ZLKSId1 = ''; selectedZLKS1(event) { this.ZLKSId1 = event.detail.selectdata.Id; this.InspectData.subDepartment1__c = this.ZLKSId1; } InitZLKS1() { SearchZLKS({content:undefined,ParentId:this.yyIdArrs}).then(response=>{ var datas = JSON.parse(response); this.searchdataZLKS1 = datas; if (this.isShi==true) { this.template.querySelector('[data-parent-id="lookup3"]').refreshdata(this.searchdataZLKS1); } }) } onclearZLKS1(event) { this.InspectData.subDepartment1__c = ''; this.template.querySelector('[data-parent-id="lookup3"]').setvalue(""); this.InitZLKS1(); } //关联战略科室 --1 //关联战略科室 -- 2 optionZLKS2 = [{lableOne:"Name",lableTwo:"Acc_Record_Type__c"}] searchdataZLKS2=[]; onsearchchangeZLKS2(event){ var searchContentStr = event.detail.searchContent; SearchZLKS({content:searchContentStr,ParentId:this.yyIdArrs}).then(response=>{ var datas = JSON.parse(response); this.searchdataZLKS2 = datas; console.warn(datas); if (this.isShi==true) { if (this.searchdataZLKS2 !=undefined && this.searchdataZLKS2.length > 0) { this.template.querySelector('[data-parent-id="lookup4"]').refreshdata(this.searchdataZLKS2); }else{ this.template.querySelector('[data-parent-id="lookup4"]').iszero(); } } }) } ZLKSId2 = ''; selectedZLKS2(event) { this.ZLKSId2 = event.detail.selectdata.Id; this.InspectData.subDepartment2__c = this.ZLKSId2; } InitZLKS2() { SearchZLKS({content:undefined,ParentId:this.yyIdArrs}).then(response=>{ var datas = JSON.parse(response); this.searchdataZLKS2 = datas; if (this.isShi==true) { this.template.querySelector('[data-parent-id="lookup4"]').refreshdata(this.searchdataZLKS2); } }) } onclearZLKS2(event) { this.InspectData.subDepartment2__c = ''; this.template.querySelector('[data-parent-id="lookup4"]').setvalue(""); this.InitZLKS2(); } //关联战略科室 --2 //关联战略科室 -- 3 optionZLKS3 = [{lableOne:"Name",lableTwo:"Acc_Record_Type__c"}] searchdataZLKS3=[]; onsearchchangeZLKS3(event){ var searchContentStr = event.detail.searchContent; SearchZLKS({content:searchContentStr,ParentId:this.yyIdArrs}).then(response=>{ var datas = JSON.parse(response); this.searchdataZLKS3 = datas; console.warn(datas); if (this.isShi==true) { if (this.searchdataZLKS3 !=undefined && this.searchdataZLKS3.length > 0) { this.template.querySelector('[data-parent-id="lookup5"]').refreshdata(this.searchdataZLKS3); }else{ this.template.querySelector('[data-parent-id="lookup5"]').iszero(); } } }) } ZLKSId3 = ''; selectedZLKS3(event) { this.ZLKSId3 = event.detail.selectdata.Id; this.InspectData.subDepartment3__c = this.ZLKSId3; } InitZLKS3() { SearchZLKS({content:undefined,ParentId:this.yyIdArrs}).then(response=>{ var datas = JSON.parse(response); this.searchdataZLKS3 = datas; if (this.isShi==true) { this.template.querySelector('[data-parent-id="lookup5"]').refreshdata(this.searchdataZLKS3); } }) } onclearZLKS3(event) { this.InspectData.subDepartment3__c = ''; this.template.querySelector('[data-parent-id="lookup5"]').setvalue(""); this.InitZLKS3(); } //关联战略科室 --3 //关联战略科室 -- 4 optionZLKS4 = [{lableOne:"Name",lableTwo:"Acc_Record_Type__c"}] searchdataZLKS4=[]; onsearchchangeZLKS4(event){ var searchContentStr = event.detail.searchContent; SearchZLKS({content:searchContentStr,ParentId:this.yyIdArrs}).then(response=>{ var datas = JSON.parse(response); this.searchdataZLKS4 = datas; console.warn(datas); if (this.isShi==true) { if (this.searchdataZLKS4 !=undefined && this.searchdataZLKS4.length > 0) { this.template.querySelector('[data-parent-id="lookup6"]').refreshdata(this.searchdataZLKS4); }else{ this.template.querySelector('[data-parent-id="lookup6"]').iszero(); } } }) } ZLKSId4 = ''; selectedZLKS4(event) { this.ZLKSId4 = event.detail.selectdata.Id; this.InspectData.subDepartment4__c = this.ZLKSId4; } InitZLKS4() { SearchZLKS({content:undefined,ParentId:this.yyIdArrs}).then(response=>{ var datas = JSON.parse(response); this.searchdataZLKS4 = datas; if (this.isShi==true) { this.template.querySelector('[data-parent-id="lookup6"]').refreshdata(this.searchdataZLKS4); } }) } onclearZLKS4(event) { this.InspectData.subDepartment4__c = ''; this.template.querySelector('[data-parent-id="lookup6"]').setvalue(""); this.InitZLKS4(); } //关联战略科室 -- 4 //负责人 option5 = [{lableOne:"Name",lableTwo:"Acc_Record_Type__c"}] //lookup组件的显示字段 searchdata5=[]; // lookup组件的显示数据 isErrorShowFZR = false; onsearchchange5(event){ var searchContentStr = event.detail.searchContent; searchContentStr = searchContentStr.trim(); var SearchArr = this.SeachCheckUserByName(searchContentStr); this.template.querySelector('[data-parent-id="lookupfzr"]').refreshdata(SearchArr); if (searchContentStr == undefined || searchContentStr == '') { this.onclearFZR5(); } } fzrId5 = ''; //医院的ID //这个是lookup组件的查询方法 selected5(event) { console.warn(event.detail.selectdata.Id); this.fzrId5 = event.detail.selectdata.Id; this.InspectData.AccountOwner__c = this.fzrId5; this.InspectData.departmentOwner__c = this.fzrId5; this.InspectData.ownerid = this.fzrId5; // this.clear(0); } //这个是lookup组件的清除方法 onclearFZR5(event){ // this.yyInit(); } //////////////// //缓存查询用户 //////////////// UserList = []; //用户集合 //关联医院4 checkHospital() { var tempArr = []; this.yyIdArrs.forEach(item=>{ if (item == this.InspectData.Hospital__c || item == this.InspectData.Hospital1__c || item == this.InspectData.Hospital2__c || item == this.InspectData.Hospital3__c || item == this.InspectData.Hospital4__c ) { tempArr.push(item); } }) this.yyIdArrs = tempArr; } SeachUserByIds() { this.checkHospital(); SearchUserByIds({his:this.yyIdArrs}).then(response=>{ var data = JSON.parse(response); this.UserList = []; this.UserList = data; }) } SeachCheckUserByName(content) { debugger; var tempArr = []; this.UserList.forEach(item=>{ if (item.Name.indexOf(content)!= -1 || item.Alias.indexOf(content)!= -1) { tempArr.push(item); } }) return tempArr; } value = ['option2']; get options() { return [ { label: 'Ross', value: 'option1'}, { label: 'Rachel', value: 'option2' }, ]; } get selectedValues() { return this.value.join(','); } handleChange(e) { debugger; this.value = e.detail.value; } checkboxValue=""; checkboxValueMap=new Map(); //添加或删除科室 splieStr(checked,e,i){ if(checked){ var tianjia =[]; this.checkboxValueMap.set(i,e.srcElement.defaultValue); for (let [k, v] of this.checkboxValueMap) { tianjia.push(v); } this.checkboxValue=tianjia.join(';'); }else{ var shanchu=[]; for (let [k, v] of this.checkboxValueMap) { if(k!=i){ shanchu.push(v); }else{ this.checkboxValueMap.delete(k); debugger } } if(shanchu.length!=0){ this.checkboxValue=shanchu.join(';'); }else{ this.checkboxValue=''; } } var chek=this.checkboxValue; this.InspectData.department_selection__c=chek; debugger } checkbox297(e){ debugger var checked=this.template.querySelector('[data-parent-id="unique297"]').checked; this.splieStr(checked,e,1); } checkbox298(e){ debugger var checked=this.template.querySelector('[data-parent-id="unique298"]').checked; this.splieStr(checked,e,2); } checkbox299(e){ debugger var checked=this.template.querySelector('[data-parent-id="unique299"]').checked; this.splieStr(checked,e,3); } checkbox300(e){ debugger var checked=this.template.querySelector('[data-parent-id="unique300"]').checked; this.splieStr(checked,e,4); } checkbox301(e){ debugger var checked=this.template.querySelector('[data-parent-id="unique301"]').checked; this.splieStr(checked,e,5); } checkbox302(e){ debugger var checked=this.template.querySelector('[data-parent-id="unique302"]').checked; this.splieStr(checked,e,6); } }