import { LightningElement,track } from 'lwc';
|
import GetNormalProductSearch from '@salesforce/apex/OpportunityService.GetNormalProductSearch';
|
import saveInquiryData from '@salesforce/apex/OpportunityService.saveInquiryData';
|
|
import saveInquiryDataTemp from '@salesforce/apex/OpportunityService.saveInquiryDataTemp';
|
export default class test02 extends LightningElement {
|
|
|
//==================获取招投标项目id================
|
ParamIdStr = '';
|
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);
|
}
|
connectedCallback(){
|
var paramId = this.getQueryVariable('id');
|
if (paramId == null || paramId == '') {
|
return ;
|
}
|
this.ParamIdStr = paramId;
|
console.warn(this.ParamIdStr);
|
}
|
//错误提示
|
@track ErrorTongzhishow = false;
|
// TZErrorshow(init){
|
// this.ErrorTongzhishow = init;
|
// }
|
// ErrorTongzhiClick(event)
|
// {
|
// this.ErrorTongzhishow = false;
|
// }
|
//=============================================================================
|
// isShow= false;
|
// isShow1= false;
|
// isShow2= false;
|
// inputText = '';
|
// apply = '';
|
// apply1 = '';
|
// apply2 = '';
|
// onClicks(event){
|
// var valu=event.currentTarget.innerText;
|
// this.apply=valu;
|
// this.isShow = false;
|
// }
|
// onClicks1(event){
|
// var valu=event.currentTarget.innerText;
|
// this.apply1=valu;
|
// this.isShow1 = false;
|
// }
|
// onClicks2(event){
|
// var valu=event.currentTarget.innerText;
|
// this.apply2=valu;
|
// this.isShow2 = false;
|
// }
|
// handleChanges(event)
|
// {
|
// this.inputText = event.target.value;
|
// console.warn( this.inputText);
|
// this.isShow = true;
|
// }
|
// handleChanges1(event)
|
// {
|
// this.inputText = event.target.value;
|
// console.warn( this.inputText);
|
// this.isShow1 = true;
|
// }
|
// handleChanges2(event)
|
// {
|
// this.inputText = event.target.value;
|
// console.warn( this.inputText);
|
// this.isShow2 = true;
|
// }
|
|
// onmousedownFn(event){
|
// debugger;
|
// console.warn( event.target.value);
|
// this.isShow= true;
|
// }
|
// onmousedownFn1(event){
|
// debugger;
|
// console.warn( event.target.value);
|
// this.isShow1= true;
|
// }
|
// onmousedownFn2(event){
|
// debugger;
|
// console.warn( event.target.value);
|
// this.isShow2= true;
|
// }
|
// 点击搜索触发
|
searchData(event){
|
let searchParams = event.detail.searchParams || {};
|
let temp = this.template;
|
this.template.querySelector('[data-parent-id="parent-div-id"]').refreshDataTable({searchParams: searchParams});
|
// this.template.activeElement.refreshDataTable({searchParams: searchParams});
|
// this.cancel();
|
}
|
//搜索框,搜索询价编码
|
@track
|
initSearchForm = [
|
{
|
label: "询价编码",
|
type: "text",
|
name: "Opportunity_No__cEqual",
|
isInput: true
|
}
|
]
|
@track tableIsLoding = true;
|
//列表标签
|
@track
|
initDataTable = {
|
columns: [
|
{label: '询价名称', fieldName: 'Name', sortable: true},
|
{label: '询价编码', fieldName: 'Opportunity_No__c', sortable: true},
|
{label: '医院', fieldName: 'HP_Name__c', sortable: true}
|
],
|
sortInterfaces: false,
|
searchColumns: this.initSearchForm
|
}
|
|
//列表数据
|
@track jzData = [];
|
//后台交互,获取数据列表
|
getTableData(event){
|
let listQuery = event.detail.listQuery;
|
listQuery.pageLimit=20;
|
GetNormalProductSearch(listQuery).then(result => {
|
debugger
|
var jzselectInquiry=[];
|
var jzInquiry=[];
|
var responseObj = JSON.parse(result);
|
// this.jzData = responseObj.records;
|
responseObj.records.forEach(item=>{
|
if(item.Bidding_Project_Name_Bid__c!=undefined){
|
jzselectInquiry.push(item);
|
}else{
|
jzInquiry.push(item);
|
}
|
});
|
this.jzData=[...jzselectInquiry,...jzInquiry];
|
console.warn(this.jzData);
|
this.tableIsLoding = false;
|
})
|
}
|
//选中
|
@track SelectedFnDate=[]
|
SelectedFn(event){
|
let arr = event.detail.rows;
|
var arrr=[];
|
arr.forEach(item=>{
|
if(item.Bidding_Project_Name_Bid__c!=undefined){
|
this.ErrorTongzhishow = true;
|
setTimeout(()=>{
|
this.ErrorTongzhishow = false;
|
},2000)
|
}else{
|
arrr.push(item);
|
}
|
});
|
this.SelectedFnDate = arrr;
|
}
|
//保存
|
saveInquiry(){
|
debugger;
|
var newTemp=[];
|
this.SelectedFnDate.forEach(item=>{
|
let Temp = {};
|
Temp.Id=item.Id;
|
Temp.BiddingProjectNameBidc=this.ParamIdStr;
|
newTemp.push(Temp);
|
});
|
var jsondata=JSON.stringify(newTemp);
|
debugger;
|
saveInquiryData({JsonStr:jsondata}).then(result => {
|
debugger;
|
var resultObject = JSON.parse(result);
|
console.warn(resultObject);
|
});
|
// saveInquiryDataTemp().then(result=>{
|
|
// var a = result;
|
// debugger;x
|
// });
|
}
|
}
|