import { LightningElement, track,api } 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 tender_4 from '@salesforce/label/c.tender_4'; import tender_5 from '@salesforce/label/c.tender_5'; import tender_6 from '@salesforce/label/c.tender_6'; import tender_7 from '@salesforce/label/c.tender_7'; import tender_8 from '@salesforce/label/c.tender_8'; import tender_9 from '@salesforce/label/c.tender_9'; import {ShowToastEvent} from 'lightning/platformShowToastEvent'; import lwcCSS from '@salesforce/resourceUrl/lwcCSS'; import {loadStyle} from 'lightning/platformResourceLoader' import tnederDeletePageCss from '@salesforce/resourceUrl/tnederDeletePageCss'; // export const $Label = { // tender4 tender_4, // tender5 tender_5, // tender6 tender_6, // tender7 tender_7, // tender8 tender_8, // tender9 tender_9 // } export default class test01 extends LightningElement { @track tender4 = tender_4; @track tender5 = tender_5; @track tender6 = tender_6; @track tender7 = tender_7; @track tender8 = tender_8; @track tender9 = tender_9; @api recordid; //提示 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(); } showToast(msg,type) { if(type == "success"){ const event = new ShowToastEvent({ message: msg, variant: type }); // this.isTrue = false; this.dispatchEvent(event); }else{ const event = new ShowToastEvent({ message: msg, variant: type, mode:"sticky" }); this.dispatchEvent(event); } } 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); //kk 20231124 add console.log('123123马上进入CheckBoxAssignment1'); this.CheckBoxAssignment1(this.InspectData.department_selection1__c); this.CheckBoxAssignment2(this.InspectData.department_selection2__c); this.CheckBoxAssignment3(this.InspectData.department_selection3__c); this.CheckBoxAssignment4(this.InspectData.department_selection4__c); //kk 20231124 end },0.001); } } IsLoading = false; //加载的标识 //加载提示框 OnLoading(flag){ this.IsLoading = flag; } //显示与隐藏 isTrue = false; 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>>' + this.tender4); console.log('this.tender_4>>>' + this.tender_4); Promise.all([ loadStyle(this, lwcCSS), loadStyle(this, tnederDeletePageCss) ]); // this.OnLoadingWait(5000) var paramId = this.recordid; if (paramId == null || paramId == '') { return ; } this.paramIdStr = paramId; this.GetInspectByIdFn(paramId); this.GetIrrelevantReasonsFn(); this.cannotModifyIsRelateProjectFn(paramId); } GetInspectByIdFn(Id) { GetInspectById({Id:Id}).then(result=>{ var response=JSON.parse(result); if (response!=undefined && response.length == 1) { var tempData = response[0]; console.log(tempData.IsRelateProject__c,"是否有值") if(tempData.IsRelateProject__c == undefined){ this.isTrue = false; }else{ this.isTrue = true; } 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== tender_4){ this.template.querySelector('[data-parent-id="unique297"]').checked=true; this.checkboxValueMap.set(1,ticl); }else if(ticl==tender_5){ this.template.querySelector('[data-parent-id="unique298"]').checked=true; this.checkboxValueMap.set(2,ticl); }else if(ticl==tender_6){ this.template.querySelector('[data-parent-id="unique299"]').checked=true; this.checkboxValueMap.set(3,ticl); }else if(ticl==tender_7){ this.template.querySelector('[data-parent-id="unique300"]').checked=true; this.checkboxValueMap.set(4,ticl); }else if(ticl==tender_8){ this.template.querySelector('[data-parent-id="unique301"]').checked=true; this.checkboxValueMap.set(5,ticl); }else if(ticl==tender_9){ this.template.querySelector('[data-parent-id="unique302"]').checked=true; this.checkboxValueMap.set(6,ticl); } }); } //kk 20231124 start //关联战略科室1 CheckBoxAssignment1(department_selection1__c){ console.log('CheckBoxAssignment1'); console.log(department_selection1__c); if(department_selection1__c === null || department_selection1__c === undefined ){ return; } this.checkboxValue1=department_selection1__c; var department_selection1__cList =department_selection1__c.split(";"); department_selection1__cList.forEach(ticl=>{ debugger if(ticl=='消化科'){ this.template.querySelector('[data-parent-id="unique11"]').checked=true; this.checkboxValueMap1.set(1,ticl); }else if(ticl=='呼吸科'){ this.template.querySelector('[data-parent-id="unique12"]').checked=true; this.checkboxValueMap1.set(2,ticl); }else if(ticl=='普外科'){ this.template.querySelector('[data-parent-id="unique13"]').checked=true; this.checkboxValueMap1.set(3,ticl); }else if(ticl=='泌尿科'){ this.template.querySelector('[data-parent-id="unique14"]').checked=true; this.checkboxValueMap1.set(4,ticl); }else if(ticl=='妇科'){ this.template.querySelector('[data-parent-id="unique15"]').checked=true; this.checkboxValueMap1.set(5,ticl); }else if(ticl=='耳鼻喉科'){ this.template.querySelector('[data-parent-id="unique16"]').checked=true; this.checkboxValueMap1.set(6,ticl); } }); } //关联战略科室2 CheckBoxAssignment2(department_selection2__c){ console.log('department_selection2__c'+department_selection2__c); if(department_selection2__c === null || department_selection2__c === undefined ){ console.log('department_selection2__c'+department_selection2__c); return; } this.checkboxValue2=department_selection2__c; var department_selection2__cList =department_selection2__c.split(";"); department_selection2__cList.forEach(ticl=>{ debugger if(ticl=='消化科'){ this.template.querySelector('[data-parent-id="unique21"]').checked=true; this.checkboxValueMap2.set(1,ticl); }else if(ticl=='呼吸科'){ this.template.querySelector('[data-parent-id="unique22"]').checked=true; this.checkboxValueMap2.set(2,ticl); }else if(ticl=='普外科'){ this.template.querySelector('[data-parent-id="unique23"]').checked=true; this.checkboxValueMap2.set(3,ticl); }else if(ticl=='泌尿科'){ this.template.querySelector('[data-parent-id="unique24"]').checked=true; this.checkboxValueMap2.set(4,ticl); }else if(ticl=='妇科'){ this.template.querySelector('[data-parent-id="unique25"]').checked=true; this.checkboxValueMap2.set(5,ticl); }else if(ticl=='耳鼻喉科'){ this.template.querySelector('[data-parent-id="unique26"]').checked=true; this.checkboxValueMap2.set(6,ticl); } }); } //关联战略科室3 CheckBoxAssignment3(department_selection3__c){ if(department_selection3__c === null || department_selection3__c === undefined ){ return; } this.checkboxValue3=department_selection3__c; var department_selection3__cList =department_selection3__c.split(";"); department_selection3__cList.forEach(ticl=>{ debugger if(ticl=='消化科'){ this.template.querySelector('[data-parent-id="unique31"]').checked=true; this.checkboxValueMap3.set(1,ticl); }else if(ticl=='呼吸科'){ this.template.querySelector('[data-parent-id="unique32"]').checked=true; this.checkboxValueMap3.set(2,ticl); }else if(ticl=='普外科'){ this.template.querySelector('[data-parent-id="unique33"]').checked=true; this.checkboxValueMap3.set(3,ticl); }else if(ticl=='泌尿科'){ this.template.querySelector('[data-parent-id="unique34"]').checked=true; this.checkboxValueMap3.set(4,ticl); }else if(ticl=='妇科'){ this.template.querySelector('[data-parent-id="unique35"]').checked=true; this.checkboxValueMap3.set(5,ticl); }else if(ticl=='耳鼻喉科'){ this.template.querySelector('[data-parent-id="unique36"]').checked=true; this.checkboxValueMap3.set(6,ticl); } }); } //关联战略科室4 CheckBoxAssignment4(department_selection4__c){ if(department_selection4__c === null || department_selection4__c === undefined ){ return; } this.checkboxValue4=department_selection4__c; var department_selection4__cList =department_selection4__c.split(";"); department_selection4__cList.forEach(ticl=>{ debugger if(ticl=='消化科'){ this.template.querySelector('[data-parent-id="unique41"]').checked=true; this.checkboxValueMap4.set(1,ticl); }else if(ticl=='呼吸科'){ this.template.querySelector('[data-parent-id="unique42"]').checked=true; this.checkboxValueMap4.set(2,ticl); }else if(ticl=='普外科'){ this.template.querySelector('[data-parent-id="unique43"]').checked=true; this.checkboxValueMap4.set(3,ticl); }else if(ticl=='泌尿科'){ this.template.querySelector('[data-parent-id="unique44"]').checked=true; this.checkboxValueMap4.set(4,ticl); }else if(ticl=='妇科'){ this.template.querySelector('[data-parent-id="unique45"]').checked=true; this.checkboxValueMap4.set(5,ticl); }else if(ticl=='耳鼻喉科'){ this.template.querySelector('[data-parent-id="unique46"]').checked=true; this.checkboxValueMap4.set(6,ticl); } }); } //kk 20231124 end //初始化查询方法 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); } // kk 20231124 add 关联战略科室1、2、3、4 if(this.InspectData.department_selection1__c!=null&&this.InspectData.department_selection1__c!=''&&this.InspectData.department_selection1__c!=undefined){ debugger setTimeout(()=>{ this.CheckBoxAssignment1(this.InspectData.department_selection1__c); },1); } if(this.InspectData.department_selection2__c!=null&&this.InspectData.department_selection2__c!=''&&this.InspectData.department_selection2__c!=undefined){ debugger setTimeout(()=>{ this.CheckBoxAssignment2(this.InspectData.department_selection2__c); },1); } if(this.InspectData.department_selection3__c!=null&&this.InspectData.department_selection3__c!=''&&this.InspectData.department_selection3__c!=undefined){ debugger setTimeout(()=>{ this.CheckBoxAssignment3(this.InspectData.department_selection3__c); },1); } if(this.InspectData.department_selection4__c!=null&&this.InspectData.department_selection4__c!=''&&this.InspectData.department_selection4__c!=undefined){ debugger setTimeout(()=>{ this.CheckBoxAssignment4(this.InspectData.department_selection4__c); },1); } // kk 20231124 end } },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.isTrue = true; 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.isTrue = true; 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: 215px;width: 600px;height: 55%;background-color: white;z-index: 998;"; this.dispatchButtonStyle = 'margin-top: 15px;z-index: 999;position: absolute;left: 30px;top: 210px;'; }else{ this.dispatchDivStyle="position: absolute;left: 30px;top: 150px;width: 600px;height: 55%;background-color: white;z-index: 998;"; this.dispatchButtonStyle = 'margin-top: 15px;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.showToast("保存失败",'error'); 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.dispatchDivStyle="position: absolute;left: 30px;top: 223px;width: 600px;height: 55%;background-color: white;z-index: 998;"; // 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; } // kk 20231124 关联战略科室1、2、3、4 add if(this.checkboxValue1!=''){ this.InspectData.department_selection1__c=this.checkboxValue1; } if(this.checkboxValue2!=''){ this.InspectData.department_selection2__c=this.checkboxValue2; } if(this.checkboxValue3!=''){ this.InspectData.department_selection3__c=this.checkboxValue3; } if(this.checkboxValue4!=''){ this.InspectData.department_selection4__c=this.checkboxValue4; } // kk 20231124 关联战略科室1、2、3、4 end 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.showToast("保存成功",'success'); //保存成功 设置组件为禁用 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; }) setTimeout(() => { window.location.href = '/'+this.recordid },3000) // window.location.hash = "Refresh"+"=="+this.paramIdStr; }else{ this.showToast(response,'error'); } debugger if(this.InspectData.IsRelateProject__c == '是'){ setTimeout(()=>{ this.CheckBoxAssignment(this.InspectData.department_selection__c); // kk 20231124 add 关联战略科室1、2、3、4 start this.CheckBoxAssignment1(this.InspectData.department_selection1__c); this.CheckBoxAssignment2(this.InspectData.department_selection2__c); this.CheckBoxAssignment3(this.InspectData.department_selection3__c); this.CheckBoxAssignment4(this.InspectData.department_selection4__c); // kk 20231124 add 关联战略科室1、2、3、4 end },1); } }); } if(this.InspectData.IsRelateProject__c == '是'){ setTimeout(()=>{ this.CheckBoxAssignment(this.InspectData.department_selection__c); // kk 20231124 add 关联战略科室1、2、3、4 start this.CheckBoxAssignment1(this.InspectData.department_selection1__c); this.CheckBoxAssignment2(this.InspectData.department_selection2__c); this.CheckBoxAssignment3(this.InspectData.department_selection3__c); this.CheckBoxAssignment4(this.InspectData.department_selection4__c); // kk 20231124 add 关联战略科室1、2、3、4 end },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=""; // kk add checkboxValue1=""; checkboxValue2=""; checkboxValue3=""; checkboxValue4=""; checkboxValueMap1=new Map(); checkboxValueMap2=new Map(); checkboxValueMap3=new Map(); checkboxValueMap4=new Map(); // kk end checkboxValueMap=new Map(); //添加或删除科室 splieStr(checked,e,i,number){ if(number === 0){ 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 } //kk add if(number === 1){ if(checked){ var tianjia =[]; this.checkboxValueMap1.set(i,e.srcElement.defaultValue); for (let [k, v] of this.checkboxValueMap1) { tianjia.push(v); } this.checkboxValue1=tianjia.join(';'); }else{ var shanchu=[]; for (let [k, v] of this.checkboxValueMap1) { if(k!=i){ shanchu.push(v); }else{ this.checkboxValueMap1.delete(k); debugger } } if(shanchu.length!=0){ this.checkboxValue1=shanchu.join(';'); }else{ this.checkboxValue1=''; } } var chek=this.checkboxValue1; this.InspectData.department_selection1__c=chek; debugger } if(number === 2){ if(checked){ var tianjia =[]; this.checkboxValueMap2.set(i,e.srcElement.defaultValue); for (let [k, v] of this.checkboxValueMap2) { tianjia.push(v); } this.checkboxValue2=tianjia.join(';'); }else{ var shanchu=[]; for (let [k, v] of this.checkboxValueMap2) { if(k!=i){ shanchu.push(v); }else{ this.checkboxValueMap2.delete(k); debugger } } if(shanchu.length!=0){ this.checkboxValue2=shanchu.join(';'); }else{ this.checkboxValue2=''; } } var chek=this.checkboxValue2; this.InspectData.department_selection2__c=chek; debugger } if(number === 3){ if(checked){ var tianjia =[]; this.checkboxValueMap3.set(i,e.srcElement.defaultValue); for (let [k, v] of this.checkboxValueMap3) { tianjia.push(v); } this.checkboxValue3=tianjia.join(';'); }else{ var shanchu=[]; for (let [k, v] of this.checkboxValueMap3) { if(k!=i){ shanchu.push(v); }else{ this.checkboxValueMap3.delete(k); debugger } } if(shanchu.length!=0){ this.checkboxValue3=shanchu.join(';'); }else{ this.checkboxValue3=''; } } var chek=this.checkboxValue3; this.InspectData.department_selection3__c=chek; debugger } if(number === 4){ if(checked){ var tianjia =[]; this.checkboxValueMap4.set(i,e.srcElement.defaultValue); for (let [k, v] of this.checkboxValueMap4) { tianjia.push(v); } this.checkboxValue4=tianjia.join(';'); }else{ var shanchu=[]; for (let [k, v] of this.checkboxValueMap4) { if(k!=i){ shanchu.push(v); }else{ this.checkboxValueMap4.delete(k); debugger } } if(shanchu.length!=0){ this.checkboxValue4=shanchu.join(';'); }else{ this.checkboxValue4=''; } } var chek=this.checkboxValue4; this.InspectData.department_selection4__c=chek; debugger } //kk end } //关联战略科室 checkbox297(e){ debugger var checked=this.template.querySelector('[data-parent-id="unique297"]').checked; this.splieStr(checked,e,1,0); } checkbox298(e){ debugger var checked=this.template.querySelector('[data-parent-id="unique298"]').checked; this.splieStr(checked,e,2,0); } checkbox299(e){ debugger var checked=this.template.querySelector('[data-parent-id="unique299"]').checked; this.splieStr(checked,e,3,0); } checkbox300(e){ debugger var checked=this.template.querySelector('[data-parent-id="unique300"]').checked; this.splieStr(checked,e,4,0); } checkbox301(e){ debugger var checked=this.template.querySelector('[data-parent-id="unique301"]').checked; this.splieStr(checked,e,5,0); } checkbox302(e){ debugger var checked=this.template.querySelector('[data-parent-id="unique302"]').checked; this.splieStr(checked,e,6,0); } //kk 20231124 add //关联战略科室1 checkbox11(e){ debugger var checked=this.template.querySelector('[data-parent-id="unique11"]').checked; this.splieStr(checked,e,1,1); } checkbox12(e){ debugger var checked=this.template.querySelector('[data-parent-id="unique12"]').checked; this.splieStr(checked,e,2,1); } checkbox13(e){ debugger var checked=this.template.querySelector('[data-parent-id="unique13"]').checked; this.splieStr(checked,e,3,1); } checkbox14(e){ debugger var checked=this.template.querySelector('[data-parent-id="unique14"]').checked; this.splieStr(checked,e,4,1); } checkbox15(e){ debugger var checked=this.template.querySelector('[data-parent-id="unique15"]').checked; this.splieStr(checked,e,5,1); } checkbox16(e){ debugger var checked=this.template.querySelector('[data-parent-id="unique16"]').checked; this.splieStr(checked,e,6,1); } //关联战略科室2 checkbox21(e){ debugger var checked=this.template.querySelector('[data-parent-id="unique21"]').checked; this.splieStr(checked,e,1,2); } checkbox22(e){ debugger var checked=this.template.querySelector('[data-parent-id="unique22"]').checked; this.splieStr(checked,e,2,2); } checkbox23(e){ debugger var checked=this.template.querySelector('[data-parent-id="unique23"]').checked; this.splieStr(checked,e,3,2); } checkbox24(e){ debugger var checked=this.template.querySelector('[data-parent-id="unique24"]').checked; this.splieStr(checked,e,4,2); } checkbox25(e){ debugger var checked=this.template.querySelector('[data-parent-id="unique25"]').checked; this.splieStr(checked,e,5,2); } checkbox26(e){ debugger var checked=this.template.querySelector('[data-parent-id="unique26"]').checked; this.splieStr(checked,e,6,2); } //关联战略科室3 checkbox31(e){ debugger var checked=this.template.querySelector('[data-parent-id="unique31"]').checked; this.splieStr(checked,e,1,3); } checkbox32(e){ debugger var checked=this.template.querySelector('[data-parent-id="unique32"]').checked; this.splieStr(checked,e,2,3); } checkbox33(e){ debugger var checked=this.template.querySelector('[data-parent-id="unique33"]').checked; this.splieStr(checked,e,3,3); } checkbox34(e){ debugger var checked=this.template.querySelector('[data-parent-id="unique34"]').checked; this.splieStr(checked,e,4,3); } checkbox35(e){ debugger var checked=this.template.querySelector('[data-parent-id="unique35"]').checked; this.splieStr(checked,e,5,3); } checkbox36(e){ debugger var checked=this.template.querySelector('[data-parent-id="unique36"]').checked; this.splieStr(checked,e,6,3); } //关联战略科室4 checkbox41(e){ debugger var checked=this.template.querySelector('[data-parent-id="unique41"]').checked; this.splieStr(checked,e,1,4); } checkbox42(e){ debugger var checked=this.template.querySelector('[data-parent-id="unique42"]').checked; this.splieStr(checked,e,2,4); } checkbox43(e){ debugger var checked=this.template.querySelector('[data-parent-id="unique43"]').checked; this.splieStr(checked,e,3,4); } checkbox44(e){ debugger var checked=this.template.querySelector('[data-parent-id="unique44"]').checked; this.splieStr(checked,e,4,4); } checkbox45(e){ debugger var checked=this.template.querySelector('[data-parent-id="unique45"]').checked; this.splieStr(checked,e,5,4); } checkbox46(e){ debugger var checked=this.template.querySelector('[data-parent-id="unique46"]').checked; this.splieStr(checked,e,6,4); } //kk 20231124 end }