import { LightningElement, track } from 'lwc';
|
import GetInspectById from '@salesforce/apex/EnquiryNoBiddingController.GetInspectById';
|
import SaveDataYB from '@salesforce/apex/EnquiryNoBiddingController.SaveDataYB';
|
import ChangeDataYB from '@salesforce/apex/EnquiryNoBiddingController.ChangeDataYB';
|
import GetIrresponsibleReason from '@salesforce/apex/EnquiryNoBiddingController.GetIrresponsibleReason';
|
|
import CheckOwnerRequest from '@salesforce/apex/EnquiryNoBiddingController.CheckOwner';
|
|
import GetTenderInformationById from '@salesforce/apex/EnquiryNoBiddingController.GetTenderInformationById';
|
|
|
import GetDataById from '@salesforce/apex/EnquiryNoBiddingController.GetDataById';
|
|
|
export default class TEnquiryNoBidding extends LightningElement {
|
|
|
|
IsLoading = false; //加载的标识
|
//加载提示框
|
OnLoading(flag){
|
this.IsLoading = flag;
|
}
|
|
|
|
//提示
|
Tongzhishow=false; //提示显示的标识
|
SaveShowText="操作成功"; //提示显示的文本
|
TongzhiIcon = 'standard:account' //提示显示的标签
|
IsLeftStyle = "" //提示显示的样式
|
BgColorStyle = ""
|
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()
|
{
|
if (this.Tongzhishow == true) {
|
this.Tongzhishow = false;
|
}
|
if (this.SaveShowText != "") {
|
this.SaveShowText = "";
|
}
|
|
}
|
|
getQueryVariable(variable)
|
{
|
var query = window.location.search.substring(1);
|
var vars = query.split("&");
|
for (var i=0;i<vars.length;i++) {
|
var pair = vars[i].split("=");
|
if(pair[0] == variable){return pair[1];}
|
}
|
return(false);
|
}
|
ParamIdStr = '' //不应标申请iD
|
ParamOIdStr = '' //询价ID
|
ParamPIdStr = '' //招投标ID
|
|
|
connectedCallback(){
|
this.OnLoading(true);
|
|
var paramId = this.getQueryVariable('id');
|
var paramOId = this.getQueryVariable('oid');
|
var paramTId = this.getQueryVariable('tid');
|
// paramId = 'a4Y1m0000000dhGEAQ';
|
// paramOId = '0061000000QL9M4AAL';
|
|
this.ParamIdStr= paramId;
|
this.ParamOIdStr = paramOId;
|
this.ParamPIdStr = paramTId;
|
|
debugger;
|
|
this.GetIrresponsibleReasonFn();
|
|
// Opp_Bid__c | Bidding_Project_Name_BidId__c
|
|
if(this.ParamOIdStr !=undefined && this.ParamOIdStr!=false)
|
{
|
GetDataById({Id:this.ParamOIdStr}).then(response=>{
|
var data = JSON.parse(response);
|
console.warn(data);
|
this.OpportunityObjec = data.tender == null?{}:data.tender;
|
this.InspectData = data.enquiry == null?{}:data.enquiry ;
|
|
this.check();
|
|
setTimeout(()=>{
|
this.OnLoading(false);
|
},1500);
|
})
|
}
|
}
|
|
check()
|
{
|
if(this.InspectData != undefined && this.InspectData != null && this.InspectData != {})
|
{
|
this.checkData(this.InspectData);
|
}else{
|
this.InspectData.irresponsibleReason__c = ''
|
this.InspectData.InvolveBudgetAmount__c = 0
|
this.InspectData.RepsExtraContent__c = ''
|
this.InspectData.irresponsibleReasonOther__c = ''
|
}
|
if(this.OpportunityObjec != undefined && this.OpportunityObjec != null && this.OpportunityObjec != {})
|
{
|
this.checkTender();
|
}
|
}
|
|
OpportunityObjec = {}; //招投标的数据
|
|
checkTender()
|
{
|
if (this.InspectData.InvolveBudgetAmount__c == null || this.InspectData.InvolveBudgetAmount__c == 0) {
|
if (this.OpportunityObjec.BudgetAmountNumber__c != null) {
|
this.InspectData.InvolveBudgetAmount__c = this.OpportunityObjec.BudgetAmountNumber__c;
|
}
|
}
|
}
|
|
ShowText = '';
|
IrresponsibleReasons = []; //选项列表展示的列
|
GetIrresponsibleReasonFn()
|
{
|
GetIrresponsibleReason().then(result=>{
|
var response=JSON.parse(result);
|
this.IrresponsibleReasons = response;
|
})
|
|
}
|
@track InspectData = {}; //数据
|
IsSQZButton = false;
|
checkData(tempData)
|
{
|
|
if (tempData.irresponsibleReason__c != undefined && tempData.irresponsibleReason__c == '其他(可手动填写)') {
|
this.otherShow = true;
|
}else{
|
this.otherShow = false;
|
}
|
|
if (tempData.InvolveBudgetAmount__c == undefined) {
|
tempData.InvolveBudgetAmount__c = 0;
|
}
|
|
if (tempData.irresponsibleReason__c == undefined) {
|
tempData.irresponsibleReason__c = '';
|
}
|
|
if (tempData.RepsExtraContent__c == undefined) {
|
tempData.RepsExtraContent__c = '';
|
}
|
|
if (tempData.irresponsibleReasonOther__c == undefined) {
|
tempData.irresponsibleReasonOther__c = '';
|
}
|
|
if (tempData.NotBidApprovalStatus__c == '申请中' || tempData.NotBidApprovalStatus__c == '批准' ) {
|
setTimeout(()=>{
|
this.DisabledSet();
|
},1000);
|
}
|
}
|
|
|
//输入框 未输入展示的值
|
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;
|
|
}
|
//输入框 未输入展示的值
|
BCIsShow = true;
|
handleBCSMFn(event)
|
{
|
var value = event.target.value;
|
this.InspectData.RepsExtraContent__c = value;
|
|
}
|
|
|
//
|
YSJEIsShow = true;
|
InvolveBudgetAmount__c = '';
|
handleYSJEFn(event)
|
{
|
var value = event.target.value;
|
this.InvolveBudgetAmount__c = value;
|
this.InspectData.InvolveBudgetAmount__c = value;
|
|
}
|
|
//数据保存方法
|
saveFn(event,temp){
|
if(!this.IsCheck){return;}
|
|
this.IsCheck = false;
|
|
debugger;
|
var flag = true;
|
|
|
if (this.InspectData.irresponsibleReason__c == undefined || this.InspectData.irresponsibleReason__c == '' ) {
|
this.bxgLyFlag = true;
|
flag = false;
|
}else{
|
this.bxgLyFlag = false;
|
}
|
|
if (this.InspectData.irresponsibleReason__c == "其他(可手动填写)" && (this.InspectData.irresponsibleReasonOther__c == undefined || this.InspectData.irresponsibleReasonOther__c == "" )) {
|
this.qtLyFlag = true;
|
flag = false;
|
}else{
|
this.qtLyFlag = false;
|
}
|
|
if (flag) {
|
debugger;
|
|
var IsInsert = this.InspectData.Id==undefined?"是":"否";
|
if (temp == 1) {
|
ChangeDataYB({JsonData:JSON.stringify(this.InspectData),Id:this.ParamOIdStr,IsInsert:IsInsert}).then((response)=>{
|
if (response.indexOf("成功") != -1) {
|
this.Alert("提交成功");
|
this.DisabledSet();
|
|
this.IsCheck = true;
|
|
|
window.location.hash = "Refresh"+"=="+this.ParamOIdStr;
|
}else{
|
this.Alert(response,true);
|
this.IsCheck = true;
|
}
|
});
|
}else
|
{
|
SaveDataYB({JsonData:JSON.stringify(this.InspectData),Id:this.ParamOIdStr,IsInsert:IsInsert}).then((response)=>{
|
if (response=="成功") {
|
this.Alert("保存成功",false,true);
|
window.location.hash = "Refresh"+"=="+this.ParamOIdStr;
|
this.IsCheck = true;
|
}else{
|
this.Alert(response,true);
|
this.IsCheck = true;
|
}
|
});
|
}
|
}
|
}
|
IsCheck = true;
|
|
|
|
CheckFn()
|
{
|
|
this.saveFn(null,1);
|
|
}
|
|
|
|
|
DisabledSet()
|
{
|
var inputs = this.template.querySelectorAll('input');
|
inputs.forEach(fileInput=>{
|
fileInput.disabled = true;
|
})
|
|
var buttons = this.template.querySelectorAll('button');
|
buttons.forEach(fileInput=>{
|
fileInput.disabled = true;
|
})
|
|
var combobox = this.template.querySelectorAll('lightning-combobox');
|
combobox.forEach(box=>{
|
box.disabled = true;
|
})
|
|
|
}
|
|
|
|
|
|
|
|
|
}
|