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/LexSISearchSetProductController.serContact';
|
import SelectDone from '@salesforce/apex/LexSISearchSetProductController.SelectDone';
|
import getFileName from '@salesforce/apex/LexSISearchSetProductController.getFileName';
|
import init from '@salesforce/apex/LexSISearchSetProductController.init';
|
import LightningConfirm from 'lightning/confirm';
|
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;
|
this.data.activities[i].urlIcon=true;
|
if(this.data.activities[i].Valid_c){
|
this.data.activities[i].img='';
|
}
|
}
|
|
this.columns = [
|
// { label: '选择', fieldName: 'isSelected' },
|
{
|
label: 'Report',
|
fieldName: 'setUrl',
|
type: 'url',
|
typeAttributes: {
|
label: '◆',
|
target: '_blank'
|
},
|
cellAttributes: {
|
iconName: {
|
fieldName: 'urlIcon',
|
operator: '=',
|
value: true
|
} ? 'standard:link' : '',
|
iconPosition: 'left',
|
}
|
},
|
{ 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();
|
}
|
|
async SetMuiltProduct(){
|
console.log("int");
|
var Str = this.data.setPFString;
|
var isPrepared = this.data.DataStatus;
|
console.log("int1");
|
if(isPrepared!='Fin'){
|
console.log("int2");
|
// confirm(isPrepared)
|
console.log("update");
|
var result = await LightningConfirm.open({
|
message: isPrepared,
|
variant: 'headerless',
|
label: '提示信息',
|
// setting theme would have no effect
|
});
|
}else if(Str==''||Str==null){
|
console.log("int3");
|
console.log("update");
|
var result = await LightningConfirm.open({
|
message: "您尚未选取任何产品配套,确认完成么?",
|
variant: 'headerless',
|
label: '提示信息',
|
// setting theme would have no effect
|
});
|
if(result){
|
top.window.close();
|
}else{
|
}
|
}else{
|
console.log("int4");
|
top.window.opener.setProductEntryGateway(Str);
|
console.log("int4.5");
|
top.window.close();
|
console.log("int5");
|
}
|
}
|
async DataPrepare() {
|
// body...
|
console.log("添加:");
|
this.data.DataStatus='数据尚未准备好,请稍等';
|
console.log(this.data);
|
var activities=[];
|
var isSelected=[];
|
var selected = this.template.querySelector("lightning-datatable").getSelectedRows();
|
for (var i = selected.length - 1; i >= 0; i--) {
|
// if(this.data.activities[i].isSelected)
|
activities.push(selected[i].setProductidFull);
|
}
|
console.log("ttt");
|
|
console.log(activities);
|
console.log(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);
|
}
|
this.SetMuiltProduct();
|
}).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';
|
// }
|
}
|