import { LightningElement, track } from 'lwc'; import GetInspectById from '@salesforce/apex/InspectCheckController.GetInspectById'; import SaveDataYB from '@salesforce/apex/InspectCheckController.SaveDataYB'; import ChangeDataYB from '@salesforce/apex/InspectCheckController.ChangeDataYB'; import GetIrresponsibleReason from '@salesforce/apex/InspectCheckController.GetIrresponsibleReason'; export default class Yb extends LightningElement { //提示 Tongzhishow=false; SaveShowText="操作成功"; Alert(content){ this.SaveShowText = content; this.Tongzhishow = true; setTimeout(()=>{ this.Tongzhishow = false; this.SaveShowText = ""; },3000) } getQueryVariable(variable) { var query = window.location.search.substring(1); var vars = query.split("&"); for (var i=0;i{ var response=JSON.parse(result); this.IrresponsibleReasons = response; }) } @track InspectData = {}; //数据 IsSQZ = false; GetInspectByIdFn(Id) { GetInspectById({Id:Id}).then(result=>{ var response=JSON.parse(result); if (response!=undefined && response.length == 1) { var tempData = response[0]; if (tempData.IsBid__c != undefined && tempData.IsBid__c == '否') { this.irresponsibleReasonShow = true; }else{ this.irresponsibleReasonShow = false; } if (tempData.irresponsibleReason__c != undefined && tempData.irresponsibleReason__c == '其他(可手动填写)') { this.otherShow = true; }else{ this.otherShow = false; } if (tempData.irresponsibleReason__c == undefined) { tempData.irresponsibleReason__c = ''; } if (tempData.irresponsibleReasonOther__c == undefined) { tempData.irresponsibleReasonOther__c = ''; } if (tempData.NotBidApprovalStatus__c == '申请中') { this.IsSQZ = true; } this.InspectData =tempData; } }) } IsBidArr=[ {label :"是",value:"是"}, {label :"否",value:"否"}, ] irresponsibleReasonShow = false; handleChange(event) { var value = event.detail.value; this.InspectData.IsBid__c = value; if (value == "否") { this.irresponsibleReasonShow = true; }else{ this.InspectData.irresponsibleReason__c = ''; this.irresponsibleReasonShow = false; } } bxgLy ="slds-form-element"; //error = slds-form-element slds-has-error bxgLyFlag = false; otherShow = false; handleIrresponsibleReasonsFn(event) { var value = event.target.value; this.InspectData.irresponsibleReason__c = value; if (value == "其他(可手动填写)") { this.otherShow = true; }else{ this.InspectData.irresponsibleReasonOther__c = ''; this.otherShow = false; } } qtLy="slds-form-element"; qtLyFlag = false; handleOtherIrrelevantFn(event) { var value = event.target.value; this.InspectData.irresponsibleReasonOther__c = value; } saveFn(){ var flag = true; if (this.InspectData.IsBid__c == "否" && (this.InspectData.irresponsibleReason__c == undefined || this.InspectData.irresponsibleReason__c == "" )) { this.bxgLy = "slds-form-element slds-has-error" this.bxgLyFlag = true; flag = false; }else{ this.bxgLy = "slds-form-element" this.bxgLyFlag = false; } if (this.InspectData.irresponsibleReason__c == "其他(可手动填写)" && (this.InspectData.irresponsibleReasonOther__c == undefined || this.InspectData.irresponsibleReasonOther__c == "" )) { this.qtLy = "slds-form-element slds-has-error" this.qtLyFlag = true; flag = false; }else{ this.qtLy = "slds-form-element" this.qtLyFlag = false; } if (flag) { SaveDataYB({JsonData:JSON.stringify(this.InspectData)}).then((response)=>{ if (response=="成功") { this.Alert("保存成功"); } if (response=="失败") { this.Alert("保存失败"); } }); } } CheckFn() { ChangeDataYB({JsonData:JSON.stringify(this.InspectData)}).then((response)=>{ if (response=="成功") { this.Alert("审核成功"); this.IsSQZ = true; } if (response=="失败") { this.Alert("审核失败"); } }); } }