import { LightningElement, api, track } from 'lwc'; import SaveData from '@salesforce/apex/TenderLostController.SaveData'; import SearchPTKS from '@salesforce/apex/TenderLostController.SearchPTKS'; // import SearchParent from '@salesforce/apex/TenderLostController.SearchParent'; import InitData from '@salesforce/apex/TenderLostController.InitData'; import LinkedHospitals from '@salesforce/apex/TenderLostController.LinkedHospitals'; export default class TenderLost extends LightningElement { //资金来源选项 RelateOption=[ {label:"政府拨款",value:"政府資金"}, {label:"医院资金",value:"病院資金"}, {label:"国际资金",value:"国際資金"}, {label:"银行资金",value:"銀行資金"}, {label:"公司/个人投资",value:"会社/個人資金"}, {label:"融资租赁",value:"融资租赁(リース)"}, // SWAG-CK363P 2022-10-12 start {label:"贴息贷款",value:"贴息贷款"}, // {label:"其他",value:"その他"}, // SWAG-CK363P 2022-10-12 end ]; //招标方式选项 RelateOption1=[ {label:"政府招标",value:"政府招标"}, {label:"院内招标",value:"院内招标"}, {label:"竟争性谈判",value:"竟争性谈判(非招标)"}, {label:"单一来源采购",value:"单一来源采购"}, {label:"私立医院采购",value:"私立医院采购"}, {label:"耗材采购",value:"耗材采购"}, ]; // 页面对象 opp = {}; hospitals = []; //资金来源 handleRelationFn(event){ var value = event.target.value; this.opp.Fund_Basis__c = value; } //招标方式 handleRelationFn1(event){ var value = event.target.value; this.opp.Sales_Method__c = value; } //从url上取得ID getQueryVariable(variable) { var query = window.location.search.substring(1); var vars = query.split("&"); for (var i=0;i{ this.opp=JSON.parse(response); }); LinkedHospitals({ParamIdStr:this.tenId}).then(response=>{ this.hospitals = response; console.log('get linked hospital:' + this.hospitals); }); } //关联普通科室 optionPTKS = [{lableOne:"Name",lableTwo:"Acc_Record_Type__c"}]; searchdataPTKS=[]; onsearchchangePTKS(event){ var searchContentStr = event.detail.searchContent; if(!searchContentStr){ this.opp.AccountId = ""; } console.log('hospitals: ' + this.hospitals); SearchPTKS({content:searchContentStr, hospitals:this.hospitals}).then(response=>{ var datas = JSON.parse(response); this.searchdataPTKS = datas; this.template.querySelector('[data-parent-id="lookup3"]').refreshdata(this.searchdataPTKS); }) } PTKSId = ''; selectedPTKS(event) { debugger console.warn(event.detail.selectdata.Id); this.opp.AccountId = event.detail.selectdata.Id; } // InitPTKS() // { // SearchPTKS({content:undefined}).then(response=>{ // var datas = JSON.parse(response); // this.searchdataPTKS = datas; // this.template.querySelector('[data-parent-id="lookup3"]').refreshdata(this.searchdataPTKS); // }) // } //关联普通科室 //保存数据逻辑 saveFn(){ if(this.opp.Fund_Basis__c == undefined || this.opp.Sales_Method__c == undefined || this.opp.AccountId == undefined ||this.opp.Fund_Basis__c == "" || this.opp.Sales_Method__c == "" || this.opp.AccountId == "" ){ this.Alert("请不要输入空哦。",false,true); }else{ this.OnLoading(true); SaveData({JsonData:JSON.stringify(this.opp)}).then((response)=>{ if (response != '' && response.indexOf('错误') < 0) { this.OnLoading(false); console.log(response); this.Alert("保存成功",false,true); window.open('/apex/PCLLostReportPage?pageStatus=Create&oppId=' + response + '&lostType=失单'); // window.location.hash = "Refresh"+"=="+response; top.window.close(); }else{ this.Alert(response,true); } }); } } //-------- 保存提示框 -------- //提示 SaveShowText="保存成功";//提示框的文本 Tongzhishow=false; //提示显示的标识 TongzhiIcon = 'standard:account' //提示框的图标 IsLeftStyle = "" //提示框的样式 BgColorStyle = "" //弹框提示 content 内容 error 是否是错误提示框 left 是否居左 Alert(content,error = false,left = false){ this.SaveShowText = content; this.Tongzhishow = true; 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(){ this.closeOffRefresh(); } closeOffRefresh(){ if (this.Tongzhishow == true) { this.Tongzhishow = false; } if (this.SaveShowText != "") { this.SaveShowText = ""; } } //加载 IsLoading = false; OnLoading(flag) { this.IsLoading = flag; } //-------- 保存提示框 -------- }