/*
|
* @Author: zhangchunxu
|
* @Date: 2023-08-13 18:57:20
|
* @LastEditors: zhangchunxu
|
* @LastEditTime: 2023-09-11 17:14:46
|
*
|
*/
|
import { LightningElement,wire,track,api} from 'lwc';
|
import { CurrentPageReference } from "lightning/navigation";
|
import { CloseActionScreenEvent } from 'lightning/actions';
|
import init from '@salesforce/apex/TenderingButtonController.initTenderingController';
|
// import updateOpportunityInformation from '@salesforce/apex/LexInquiryController.UpdateOpportunityInformation';
|
import updateOpportunityInformation from '@salesforce/apex/UpdateTenderInformationBatch.updateOpportunityInformation';
|
import { ShowToastEvent } from 'lightning/platformShowToastEvent';
|
import lwcCSS from '@salesforce/resourceUrl/lwcCSS';
|
import {loadStyle} from 'lightning/platformResourceLoader'
|
export default class lexTenderingEnquiryButton extends LightningElement {
|
@api recordId;//当前这条数据的id
|
id;//返回值的id Tender_information__c招标项目的id
|
IsLoading = true;
|
isRelateProject;//判断是否反应
|
|
@wire(CurrentPageReference)
|
getStateParameters(currentPageReference) {
|
if (currentPageReference) {
|
const urlValue = currentPageReference.state.recordId;
|
if (urlValue) {
|
let str = `${urlValue}`;
|
this.recordId = str;
|
}
|
}
|
}
|
|
connectedCallback(){
|
Promise.all([
|
loadStyle(this, lwcCSS)
|
]);
|
init({
|
recordId: this.recordId
|
}).then(result => {
|
console.log(result);
|
this.IsLoading = false;
|
this.id = result.Id;
|
this.isRelateProject = result.isRelateProject;
|
this.EnquiryButton();
|
})
|
}
|
//招标项目 反应询价状态
|
async EnquiryButton(){
|
if(this.isRelateProject == "否"){
|
this.showToast('招投标项目不相关后不能反应询价状态!','error');
|
this.dispatchEvent(new CloseActionScreenEvent());
|
return;
|
}
|
var listss = [];
|
listss.push(this.id);
|
await updateOpportunityInformation({TenderIdList : listss}).then(result=>{
|
if(result != 'OK'){
|
this.showToast(result,'error');
|
}else {
|
this.showToast('反映完了','success');
|
setTimeout(()=>{
|
window.location ="/" + this.recordId;
|
},500);
|
}
|
})
|
}
|
|
showToast(msg,type) {
|
if(type == "success"){
|
const event = new ShowToastEvent({
|
message: msg,
|
variant: type
|
});
|
this.dispatchEvent(event);
|
this.dispatchEvent(new CloseActionScreenEvent());
|
}else{
|
const event = new ShowToastEvent({
|
message: msg,
|
variant: type,
|
mode:"sticky"
|
});
|
this.dispatchEvent(event);
|
this.dispatchEvent(new CloseActionScreenEvent());
|
}
|
}
|
}
|