19626
2023-06-06 b28b7983fd65d7e3da0e6a57ba1754899f036971
force-app/main/default/lwc/lexPCLLostReportPage/lexPCLLostReportPage.js
@@ -4,7 +4,7 @@
 * @Author: chen jing wu
 * @Date: 2023-04-20 15:04:03
 * @LastEditors: chen jing wu
 * @LastEditTime: 2023-06-06 10:51:30
 * @LastEditTime: 2023-06-06 13:27:33
 */
const columns2=[
    { label: '--无--', value: '' },
@@ -31,7 +31,7 @@
];
const columns3 = [
    {label : "失单品牌",fieldName : "LostBrandName__c"},
    {label : "失单对手型号",fieldName : "LostProduct__c"},
    {label : "失单对手型号",fieldName : "productName"},
    {label : "失单数量",fieldName : "Quantity__c",type : "number"},
    {label : "失单对手型号(手动)",fieldName : "LostProductMannual__c"},
    {label : "失单产品类别",fieldName : "ProductClass__c"},
@@ -171,7 +171,9 @@
        var products = this.LostReport.LostBrands[this.tableflag].LostProducts;
        var productList = [];
        products.forEach(product=>{
            productList.push(product.LostProductss);
            var newProduct = JSON.parse(JSON.stringify(product));
            newProduct.LostProductss.productName = newProduct.productName;
            productList.push(newProduct.LostProductss);
        });
        this.tableflag++;
        return productList;
@@ -201,6 +203,12 @@
    get isEdit(){
        if(this.status.pageStatus == 'Edit'){
            return true;
        }
        return false;
    }
    get isSubmit(){
        if(this.submitFlag){
            return true;
        }
        return false;
@@ -349,22 +357,24 @@
            if(result.error){
                this.showToast(result.error,"error");
            }else{
                var report = JSON.parse(result.LostReport);
                var index1 = 0;
                this.LostReport.LostBrands.forEach(brand=>{
                    brand.lostBrand.Id = report.LostBrands[index1].lostBrand.Id;
                    var index2 = 0;
                    brand.LostProducts.forEach(product=>{
                        product.LostProductss.Id = report.LostBrands[index1].LostProducts[index2].LostProductss.Id;
                        index2++;
                    });
                    index1++;
                });
                // var report = JSON.parse(result.LostReport);
                // var index1 = 0;
                // this.LostReport.LostBrands.forEach(brand=>{
                //     brand.lostBrand.Id = report.LostBrands[index1].lostBrand.Id;
                //     var index2 = 0;
                //     brand.LostProducts.forEach(product=>{
                //         product.LostProductss.Id = report.LostBrands[index1].LostProducts[index2].LostProductss.Id;
                //         index2++;
                //     });
                //     index1++;
                // });
                this.LostReport = JSON.parse(result.LostReport);
                this.reportId = result.reportId;
                this.LostReport.lostReport.Id = result.reportId;
                console.log(this.LostReport);
                // this.LostReport.lostReport.Id = result.reportId;
                // console.log(this.LostReport);
                this.status.pageStatus = 'View';
                this.tableflag = 0;
                console.log(this.LostReport);
            }
        }).catch(error=>{
            console.log("error");