import { LightningElement, track, wire } from 'lwc';
|
import serContact from '@salesforce/apex/LexSearchProductIraiController.serContact';
|
import init from '@salesforce/apex/LexSearchProductIraiController.init';
|
|
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 Product_Search from '@salesforce/label/c.Product_Search';
|
import Add_Product from '@salesforce/label/c.Add_Product';
|
import Selected from '@salesforce/label/c.Selected';
|
import Asset_No from '@salesforce/label/c.Asset_No';
|
import Product_Name from '@salesforce/label/c.Product_Name';
|
import SFDA_Status from '@salesforce/label/c.SFDA_Status';
|
import ListPrice_In from '@salesforce/label/c.ListPrice_In';
|
import ListPrice_Out from '@salesforce/label/c.ListPrice_Out';
|
import Unit from '@salesforce/label/c.Unit';
|
|
export default class lexSearchProductIrai extends LightningElement {
|
|
|
Label={
|
Set_Name,
|
Search_Condition,
|
Set_Search,
|
Set_Code,
|
Search_Result,
|
Search,
|
Quantity,
|
Valid_Status,
|
Product_Search,
|
Add_Product,
|
Selected,
|
Asset_No,
|
Product_Name,
|
SFDA_Status,
|
ListPrice_In,
|
ListPrice_Out,
|
Unit
|
};
|
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(){
|
console.log("ddddd");
|
await init().then(res=>{
|
console.log("new res:");
|
console.log(res);
|
this.data=res;
|
this.isLoad=true;
|
this.columns=[
|
{ label: this.Label.Selected, fieldName: 'idx' },
|
{ label: this.Label.Asset_No, fieldName: 'Name' },
|
{ label: this.data.LabelOT, fieldName: 'OT_CODE_no_link__c' },
|
{ label: this.Label.Product_Name, fieldName: 'Name' },
|
{ label: this.data.Labelsuit, fieldName: 'suitDepartment__c' },
|
{ label: this.data.LabelAl, fieldName: 'Alternative_Products__c' },
|
{ label: this.Label.SFDA_Status, fieldName: 'SFDA_Status__c' },
|
{ label: this.Label.ListPrice_In, fieldName: 'Intra_Trade_List_RMB__c' },
|
{ label: this.Label.ListPrice_Out, fieldName: 'Foreign_Trade_List_US__c' },
|
{ label: this.Label.Unit, fieldName: 'Qty_Unit__c' },
|
]
|
})
|
}
|
|
|
|
serContact(){
|
serContact({trade:this.data.trade,searchMode:this.data.searchMode,celon:this.data.celon,SearchName:this.data.SearchName}).then(res=>{
|
console.log(res);
|
this.data.cl=res.cl;
|
if(res!=null){
|
this.data.cl=res.cl;
|
this.data.activities=res.activities;
|
this.data.cc=[];
|
for (var i = this.data.cl.length - 1; i >= 0; i--) {
|
this.data.cc.push(this.data.cl[i].pbe.Product2)
|
}
|
console.log("activities!");
|
}
|
let t=this.data;
|
this.data={};
|
this.data=t;
|
})
|
}
|
searchNameInputChange(event){
|
this.data.SearchName = event.detail.value;
|
}
|
|
// QuoteEntryMaxLine = window.opener.QuoteEntryMaxLine;
|
add(){
|
setProductList();
|
return false;
|
}
|
setProductList() {
|
var nextLine = top.window.opener.getLastLineNoNext(window.opener.document);
|
var hasCheckedCnt = 0;
|
var checklist = j$("input[name='checklist']");
|
|
for(var i=0; i<checklist.length; i++){
|
if (checklist[i].checked) {
|
hasCheckedCnt++;
|
if (nextLine < QuoteEntryMaxLine) {
|
SetProductId(nextLine, i);
|
nextLine++;
|
} else {
|
alert('Over Max Line ' + QuoteEntryMaxLine);
|
return false;
|
}
|
}
|
}
|
if (hasCheckedCnt == 0) {
|
alert(top.window.opener.Error_Message34);
|
return false;
|
}
|
top.window.opener.calPriceAll(window.opener.document);
|
top.window.close();
|
}
|
// function setProductOne(lineno, i) {
|
// //lineno = getLastLineNo();
|
// SetProductId(lineno, i);
|
// top.window.opener.calPriceAll(window.opener.document);
|
// top.window.close();
|
// }
|
// function SetProductId(lineno, i) {
|
// debugger
|
// var Asset_Model_No__c = j$(escapeVfId("Page:mainForm:idSearchSetProduct:idRezultVisitor:"+ i +":Asset_Model_No__c")).text();
|
// var Product2Id = j$(escapeVfId("Page:mainForm:idSearchSetProduct:idRezultVisitor:"+ i +":Product_Id")).val();
|
// var SFDA_Status__c = j$(escapeVfId("Page:mainForm:idSearchSetProduct:idRezultVisitor:"+ i +":SFDA_Status__c")).text();
|
// var name = j$(escapeVfId("Page:mainForm:idSearchSetProduct:idRezultVisitor:"+ i +":Name")).text();
|
// var Intra_Trade_List_RMB__c = j$(escapeVfId("Page:mainForm:idSearchSetProduct:idRezultVisitor:"+ i +":Intra_Trade_List_RMB__c")).text();
|
// var Intra_Trade_Service_RMB__c =j$(escapeVfId("Page:mainForm:idSearchSetProduct:idRezultVisitor:"+ i +":Intra_Trade_Service_RMB")).val();
|
// var Foreign_Trade_List_US__c = j$(escapeVfId("Page:mainForm:idSearchSetProduct:idRezultVisitor:"+ i +":Foreign_Trade_List_US__c")).text();
|
// var NameCode = j$(escapeVfId("Page:mainForm:idSearchSetProduct:idRezultVisitor:"+ i +":NameCode")).val();
|
// var Sales_Possibility = j$(escapeVfId("Page:mainForm:idSearchSetProduct:idRezultVisitor:"+ i +":Sales_Possibility")).val();
|
// var Intra_Trade_Cost_RMB__c = j$(escapeVfId("Page:mainForm:idSearchSetProduct:idRezultVisitor:"+ i +":Intra_Trade_Cost_RMB__c")).val();
|
// var Foreign_Trade_Cost_US__c = j$(escapeVfId("Page:mainForm:idSearchSetProduct:idRezultVisitor:"+ i +":Foreign_Trade_Cost_US__c")).val();
|
// var Bsscategory = j$(escapeVfId("Page:mainForm:idSearchSetProduct:idRezultVisitor:"+ i +":Bsscategory")).val();
|
// var PricebookEntryId = j$(escapeVfId("Page:mainForm:idSearchSetProduct:idRezultVisitor:"+ i +":PricebookEntryId")).val();
|
// var trade = window.opener.j$(escapeVfId("Page:mainForm:block:CurrencyIsoCode")).val();
|
// //DB202212304166 【紧急-报价委托与购买意向】请将最后操作的报价委托状态放到购买意向中 fy start
|
// var CanNotCancelledGurantee__c = j$(escapeVfId("Page:mainForm:idSearchSetProduct:idRezultVisitor:"+ i +":CanNotCancelledGurantee__c")).val();
|
// //DB202212304166 【紧急-报价委托与购买意向】请将最后操作的报价委托状态放到购买意向中 fy end
|
|
// //CHAN-BHNBX6 2019/11/20 START
|
// var GuaranteePeriod = j$(escapeVfId("Page:mainForm:idSearchSetProduct:idRezultVisitor:"+ i +":GuaranteePeriod")).value();
|
// //nodiscount 小计
|
// var Intra_Trade_Service_RMB =j$(escapeVfId("Page:mainForm:idSearchSetProduct:idRezultVisitor:"+ i +":Intra_Trade_Service_RMB")).value();
|
// //CHAN-BHNBX6 2019/11/20 END
|
// //No
|
// window.opener.j$(escapeVfId("Page:mainForm:block:lists:"+ lineno +":indexNo")).text(parseInt(lineno)+1);
|
|
// //製品型番
|
// window.opener.j$(escapeVfId("Page:mainForm:block:lists:"+ lineno +":Assert")).val(Asset_Model_No__c);
|
|
// //Status__c
|
// window.opener.j$(escapeVfId("Page:mainForm:block:lists:"+ lineno +":Status__c")).text(SFDA_Status__c);
|
// //SFDA hidden
|
// window.opener.j$(escapeVfId("Page:mainForm:block:lists:"+ lineno +":SFDA")).val(SFDA_Status__c);
|
|
// //DB202212304166 【紧急-报价委托与购买意向】请将最后操作的报价委托状态放到购买意向中 fy start
|
// //取消市场多年保
|
// window.opener.j$(escapeVfId("Page:mainForm:block:lists:"+ lineno +":CanNotCancelledGurantee__c")).val(CanNotCancelledGurantee__c);
|
// //DB202212304166 【紧急-报价委托与购买意向】请将最后操作的报价委托状态放到购买意向中 fy end
|
|
|
// //品目名
|
// var baseUrl = window.opener.j$(escapeVfId("Page:mainForm:block:baseUrl")).val();
|
// window.opener.j$(escapeVfId("Page:mainForm:block:lists:"+ lineno +":Nametext1")).attr("href", baseUrl + "/" + Product2Id);
|
// window.opener.j$(escapeVfId("Page:mainForm:block:lists:"+ lineno +":Nametext1")).text(name);
|
// //品目名hidden
|
|
// window.opener.j$(escapeVfId("Page:mainForm:block:lists:"+ lineno +":Name__c")).val(name);
|
|
// //ListPrice
|
// var ListPrice = 0;
|
// var Cost_c = 0;
|
// //CHAN-BHNBX6 2019/11/20 START
|
// var NoDiscount = 0;
|
|
// if(trade == "CNY") {
|
// ListPrice = Intra_Trade_List_RMB__c;
|
// Cost_c = Intra_Trade_Cost_RMB__c;
|
// NoDiscount = Intra_Trade_Service_RMB;
|
// } else if(trade == "USD"){
|
// ListPrice = Foreign_Trade_List_US__c;
|
// Cost_c = Foreign_Trade_Cost_US__c;
|
// }
|
// Cost_c = top.window.opener.toNum(Cost_c);
|
// ListPrice = top.window.opener.toNum(ListPrice);
|
// NoDiscount = top.window.opener.toNum(NoDiscount);
|
// //CHAN-BHNBX6 2019/11/20 END
|
// window.opener.j$(escapeVfId("Page:mainForm:block:lists:"+ lineno +":ListPricetext")).text(top.window.opener.toNumComma(ListPrice));
|
// //ListPrice hidden
|
// window.opener.j$(escapeVfId("Page:mainForm:block:lists:"+ lineno +":ListPrice")).val(ListPrice);
|
// //CHAN-BHNBX6 NoDiscount 2019/11/20 START
|
// window.opener.j$(escapeVfId("Page:mainForm:block:lists:"+ lineno +":NoDiscount")).val(NoDiscount);
|
// //CHAN-BHNBX6 NoDiscount 2019/11/20 END
|
// //数量
|
// window.opener.j$(escapeVfId("Page:mainForm:block:lists:"+ lineno +":Quantity")).val(1);
|
|
// //CHAN-BHNBX6 保修年限 2019/11/20 START
|
// window.opener.j$(escapeVfId("Page:mainForm:block:lists:"+ lineno +":itemGuaranteePeriod")).text(GuaranteePeriod);
|
// window.opener.j$(escapeVfId("Page:mainForm:block:lists:"+ lineno +":itemGuaranteePeriod")).val(GuaranteePeriod);
|
// //CHAN-BHNBX6 保修年限 2019/11/20 END
|
// //価格
|
// window.opener.j$(escapeVfId("Page:mainForm:block:lists:"+ lineno +":UnitPrice")).val(top.window.opener.toNumComma(ListPrice));
|
|
// //単位
|
// window.opener.j$(escapeVfId("Page:mainForm:block:lists:"+ lineno +":Qty")).text();
|
|
// //小計 主画面ID变更,逻辑不变设值ID变更
|
// // window.opener.j$(escapeVfId("Page:mainForm:block:lists:"+ lineno +":TotalPrice")).text(top.window.opener.toNumComma(ListPrice));
|
|
// //Subtotal__c hidden
|
// // window.opener.j$(escapeVfId("Page:mainForm:block:lists:"+ lineno +":Subtotal__c")).val(ListPrice);
|
|
// //小計lw
|
// window.opener.j$(escapeVfId("Page:mainForm:block:lists:"+ lineno +":ListPriceTotalText")).text(top.window.opener.toNumComma(ListPrice));
|
|
// //ListPriceTotal hidden
|
// window.opener.j$(escapeVfId("Page:mainForm:block:lists:"+ lineno +":ListPriceTotal")).val(ListPrice);
|
|
// //CHAN-BHNBX6 nodiscount 小计 2019/11/20 START
|
// //DB202212304166 【紧急-报价委托与购买意向】请将最后操作的报价委托状态放到购买意向中 fy start
|
// // var cancelMultiyearInsurance = top.window.opener.j$(escapeVfId("Page:mainForm:block:cancelMultiyearInsurance")).val();
|
// // var NoDiscount1;
|
// // if(cancelMultiyearInsurance == '不要' && CanNotCancelledGurantee__c == 'false'){
|
// // NoDiscount1 = 0.00;
|
// // }else{
|
// // NoDiscount1 = NoDiscount;
|
// // }
|
// // window.opener.j$(escapeVfId("Page:mainForm:block:lists:"+ lineno +":NoDiscountTotalText")).text(top.window.opener.toNumComma(NoDiscount1));
|
|
// //DB202212304166 【紧急-报价委托与购买意向】请将最后操作的报价委托状态放到购买意向中 fy end
|
// window.opener.j$(escapeVfId("Page:mainForm:block:lists:"+ lineno +":NoDiscountTotalText")).text(top.window.opener.toNumComma(NoDiscount));
|
// //CHAN-BHNBX6 nodiscount 小计 2019/11/20 END
|
// // window.opener.j$(escapeVfId("Page:mainForm:block:lists:"+ lineno +":NoDiscountTotal")).val(Intra_Trade_Service_RMB);
|
|
|
// //NameCode hidden
|
// window.opener.j$(escapeVfId("Page:mainForm:block:lists:"+ lineno +":NameCode")).val(NameCode);
|
|
// //Product_Name hidden
|
// window.opener.j$(escapeVfId("Page:mainForm:block:lists:"+ lineno +":Product_Name")).val(name);
|
|
// //Product_SFDA hidden
|
// window.opener.j$(escapeVfId("Page:mainForm:block:lists:"+ lineno +":Product_SFDA")).val(SFDA_Status__c);
|
|
// //Sales_Possibility hidden
|
// window.opener.j$(escapeVfId("Page:mainForm:block:lists:"+ lineno +":Sales_Possibility")).val(Sales_Possibility);
|
|
// //Product_ListPrice hidden
|
// window.opener.j$(escapeVfId("Page:mainForm:block:lists:"+ lineno +":Product_ListPrice")).val(ListPrice);
|
|
// //Product_Cost hidden
|
// window.opener.j$(escapeVfId("Page:mainForm:block:lists:"+ lineno +":Product_Cost")).val(Cost_c);
|
|
// //Cost hidden
|
// window.opener.j$(escapeVfId("Page:mainForm:block:lists:"+ lineno +":Cost")).val(Cost_c);
|
|
// //CostSubTotal hidden Cost_c * Quantity;
|
// window.opener.j$(escapeVfId("Page:mainForm:block:lists:"+ lineno +":CostSubTotal")).val(Cost_c);
|
|
// //Bsscategory hidden
|
// window.opener.j$(escapeVfId("Page:mainForm:block:lists:"+ lineno +":Bsscategory")).val(Bsscategory);
|
|
// //Product_Id hidden
|
// window.opener.j$(escapeVfId("Page:mainForm:block:lists:"+ lineno +":Product_Id")).val(Product2Id);
|
|
// //PricebookEntryId hidden
|
// window.opener.j$(escapeVfId("Page:mainForm:block:lists:"+ lineno +":PricebookEntryId")).val(PricebookEntryId);
|
|
// //lineNo hidden
|
// window.opener.j$(escapeVfId("Page:mainForm:block:lists:"+ lineno +":lineNo")).val(parseInt(lineno));
|
// }
|
}
|