import { LightningElement, track, wire } from 'lwc'; import Set_Name from '@salesforce/label/c.Set_Name'; import Search_Condition from '@salesforce/label/c.Search_Condition'; import Set_Search from '@salesforce/label/c.Set_Search'; import Set_Code from '@salesforce/label/c.Set_Code'; import Search from '@salesforce/label/c.Search'; import Search_Result from '@salesforce/label/c.Search_Result'; import Quantity from '@salesforce/label/c.Quantity'; import Valid_Status from '@salesforce/label/c.Valid_Status'; import serContact from '@salesforce/apex/SISearchSetProductController.serContact'; import SelectDone from '@salesforce/apex/SISearchSetProductController.SelectDone'; import getFileName from '@salesforce/apex/SISearchSetProductController.getFileName'; import init from '@salesforce/apex/SISearchSetProductController.init'; import a from '@salesforce/resourceUrl/jquery183minjs'; import b from '@salesforce/resourceUrl/PleaseWaitDialog'; export default class lexSISearchSetProduct extends LightningElement { Label={ Set_Name, Search_Condition, Set_Search, Set_Code, Search_Result, Search, Quantity, Valid_Status, }; isLoad=false; data; LabelI=''; SearchName=''; SearchCode=''; columns = [ { label: '选择', fieldName: 'isSelected' }, { label: 'Report', fieldName: 'setUrl' }, { label: this.Label.Set_Name, fieldName: 'Name' }, { label: this.Label.Set_Code, fieldName: 'Product_Set_CD_c' }, { label: this.Label.Quantity, fieldName: 'Quantity' }, { label: this.Label.Valid_Status, fieldName: 'img' } // { label: 'Website', fieldName: 'Asset_Model_No_forPrint__c', type: 'url' }, // { label: 'Phone', fieldName: 'phone', type: 'phone' }, // { label: 'Balance', fieldName: 'amount', type: 'currency' }, // { label: 'CloseAt', fieldName: 'closeAt', type: 'date' }, ]; async connectedCallback(){ // getFileName().then(res=>{ // console.log("ttt"); // console.log(res); // this.Quote_Select_Info__c_Label=res; // }) console.log("jinru"); await init().then(res=>{ console.log("hhh"); console.log("res:"); console.log(res); console.log(res.LabelI); this.data=res; this.LabelI=res.LabelI; for (var i = this.data.activities.length - 1; i >= 0; i--) { this.data.activities[i].setUrl= res.baseUrl + '/'+ res.reportid +'?pv1='+ this.data.activities[i].setProductid; if(this.data.activities[i].Valid_c){ this.data.activities[i].img=''; } } this.columns = [ // { label: '选择', fieldName: 'isSelected' }, { label: 'Report', fieldName: 'setUrl', type:'url' }, { label: this.Label.Set_Name, fieldName: 'Name' }, { label: this.Label.Set_Code, fieldName: 'Product_Set_CD_c' }, { label: this.Label.Quantity, fieldName: 'Quantity' }, { label: this.data.LabelI, fieldName: 'Quote_Select_Info_c' }, { label: this.Label.Valid_Status, fieldName: 'img' } ]; this.isLoad=true; }); } SetProductId(str) { //top.window.opener.setProductEntry(str); top.window.opener.setProductEntryGateway(str); top.window.close(); } SetMuiltProduct(){ var Str = this.data.setPFString; var isPrepared = this.data.DataStatus; if(isPrepared!='Fin'){ confirm(isPrepared) }else if(Str==''||Str==null){ if(confirm("您尚未选取任何产品配套,确认完成么?")){ top.window.close(); }else{ } }else{ top.window.opener.setProductEntryGateway(Str); top.window.close(); } } async DataPrepare() { // body... console.log("添加:"); this.data.DataStatus='数据尚未准备好,请稍等'; console.log(this.data); let activities=[]; let isSelected=[]; for (var i = this.data.activities.length - 1; i >= 0; i--) { activities.push(this.data.activities[i].setProductidFull); isSelected.push(this.data.activities[i].isSelected); } //j$(escapeVfId("Page:mainForm:DataStatus")).val('数据尚未准备好,请稍等'); await SelectDone({activities:activities,isSelected:isSelected}).then(res=>{ console.log("SelectDone:"); console.log(res); if(res!=null){ this.data.setPFString=res.setPFString; this.data.setProductidFullList=res.setProductidFullList; this.data.DataStatus=res.DataStatus; console.log(this.data); } }).catch(err=>{ console.log("err:"); console.log(err); console.log(err.message); }); } Select(){ serContact({searchName:this.data.SearchName,searchCode:this.data.SearchCode}).then(res=>{ console.log("查询结果"); console.log(res); if(res!=null){ this.data.cl=res.cl; this.data.activities=res.activities; for (var i = this.data.activities.length - 1; i >= 0; i--) { this.data.activities[i].setUrl= this.data.baseUrl + '/'+ this.data.reportid +'?pv1='+ this.data.activities[i].setProductid; if(this.data.activities[i].Valid_c){ this.data.activities[i].img='√'; } } console.log("activities!"); } let t=this.data; this.data={}; this.data=t; console.log(this.data); }) } searchNameInputChange(event){ this.data.SearchName = event.detail.value; } searchCodeInputChange(event){ this.data.SearchCode = event.detail.value; } // function DataReady() { // // body... // j$(escapeVfId("Page:mainForm:DataStatus")).value()='Fin'; // } }