binxie
2023-06-16 da42e2995c00293af89c71fe5ba6e16cbb77e1b3
force-app/main/default/lwc/lexinventoryViewLWC/lexinventoryViewLWC.js
@@ -47,6 +47,7 @@
   @track showTable = false;
   @track hidecheckboxcolumn = true;
   @track check = false;
   @track productkucun;
   //加载
   @track showSpinner = false;
   @track showSpinners = false;
@@ -63,14 +64,14 @@
         type: "Name",
         sortable: true,
         hideDefaultActions: true,
         // initialWidth: 300,
         initialWidth: 300,
         wrapText: true,
         cellAttributes: { alignment: "left" }
      },
      {
         label: "第三分类",
         fieldName: "Category3__c",
         initialWidth: 90,
         initialWidth: 120,
         cellAttributes: { alignment: "left" },
         hideDefaultActions: true,
         sortable: true,
@@ -80,7 +81,7 @@
         label: "第四分类",
         fieldName: "Category4__c",
         cellAttributes: { alignment: "left" },
         initialWidth: 90,
         initialWidth: 120,
         hideDefaultActions: true,
         wrapText: true,
         sortable: true,
@@ -90,7 +91,7 @@
         label: "第五分类",
         fieldName: "Category5__c",
         cellAttributes: { alignment: "left" },
         initialWidth: 90,
         initialWidth: 120,
         hideDefaultActions: true,
         wrapText: true,
         sortable: true,
@@ -118,7 +119,7 @@
         fieldName: "approbation_No",
         cellAttributes: { alignment: "left" },
         wrapText: true,
         initialWidth: 155,
         initialWidth: 200,
         hideDefaultActions: true,
      },
      {
@@ -127,7 +128,7 @@
         cellAttributes: { alignment: "left" },
         wrapText: true,
         hideDefaultActions: true,
         initialWidth: 100
         initialWidth: 110
      },
      {
         label: "CFDA状态",
@@ -147,7 +148,8 @@
      {
         label:'有效期内库存',
         type: "customInventoryColor",
         // sortable: true,
         fieldName: "limitCount",
         sortable: true,
         cellAttributes: {alignment: "right" },
         typeAttributes: {
         value: { fieldName:"limitCount"},
@@ -207,9 +209,6 @@
         console.log("result = " + JSON.stringify(result));
         console.log("result 1= " + JSON.stringify(result.entity));
         console.log("result 2= " + JSON.stringify(result.entity.pageRecords));
         console.log("result.entity.categoryOptionMap 2= " + JSON.stringify(result.entity.categoryOptionMap));
         console.log("result.entity.categoryOptionMap 2= " + JSON.stringify(result.entity.category4OptionMap));
         console.log("result.entity.categoryOptionMap 2= " + JSON.stringify(result.entity.category5OptionMap));
         if (result.status == "Success") {
            console.log('result.entity.paginatedAccounts = ' + JSON.stringify(result.entity.paginatedAccounts));
            this.nextPageToken = result.entity.paginatedAccounts.nextPageToken;
@@ -222,12 +221,13 @@
            this.loader = false;
            this.data = result.entity.pageRecords;
            this.productkucun = result.entity.productkucun;
            for (var i in this.data) {
               this.data[i]["Name__c"] = this.data[i].Prod.Name__c;
               this.data[i]["Category3__c"] = this.data[i].Prod.Category3__c;
               this.data[i]["Category4__c"] = this.data[i].Prod.Category3__c;
               this.data[i]["Category5__c"] = this.data[i].Prod.Category3__c;
               this.data[i]["Category4__c"] = this.data[i].Prod.Category4__c;
               this.data[i]["Category5__c"] = this.data[i].Prod.Category5__c;
               this.data[i]["SFDA_Status__c"] = this.data[i].Prod.SFDA_Status__c;
            }
            this.showTable = true;
@@ -280,8 +280,8 @@
               for (var j in this.data) {
                  this.data[j]["Name__c"] = this.data[j].Prod.Name__c;
                  this.data[j]["Category3__c"] = this.data[j].Prod.Category3__c;
                  this.data[j]["Category4__c"] = this.data[j].Prod.Category3__c;
                  this.data[j]["Category5__c"] = this.data[j].Prod.Category3__c;
                  this.data[j]["Category4__c"] = this.data[j].Prod.Category4__c;
                  this.data[j]["Category5__c"] = this.data[j].Prod.Category5__c;
                  this.data[j]["SFDA_Status__c"] = this.data[j].Prod.SFDA_Status__c;
                  this.data[j]["hospitalSpecialOffer__c"] = this.data[j].hospitalSpecialOffer;
                  console.log('this.data[j].hospitalSpecialOffer__c'+this.data[j].hospitalSpecialOffer);
@@ -339,7 +339,7 @@
                }
                break;
            case "CategoryFour":
                this.Category4 = value;
                this.CategoryFour = value;
                //调用后台显示第五分类
                this.showCate();
                if (this.CategoryFour == '') {
@@ -389,6 +389,7 @@
   searchOrderDetail() {
      this.showTable = false;
      this.showSpinner = true;
      searchOrder({
         category1: this.Name,
         Category3: this.CategoryThree,
@@ -400,6 +401,8 @@
         userWorkLocation: this.userWorkLocation,
         pageSizeLWC: this.pageSize,
         pageTokenLWC: this.currentPageToken,
         productkucunLWC: this.productkucun
         // sortFieldLWC: this.sortBy,
         // sortOrderLWC: this.sortDirection
      })
@@ -411,31 +414,42 @@
               this.recordStart = result.entity.paginatedAccounts.recordStart;
               this.recordEnd = result.entity.paginatedAccounts.recordEnd;
               this.totalPages = Math.ceil(result.entity.paginatedAccounts.totalRecords / this.pageSize);
               console.log('result.entity.paginatedAccounts = ' + JSON.stringify(result.entity.paginatedAccounts));
               console.log('this.totalPages = ' + this.totalPages);
               this.paginationVisibility = this.totalPages > 1 ? true : false;
               console.log('this.sortDirection = ' + this.sortDirection);
               // this.showToast("Success",'搜索成功', result.msg);
               this.showMyToast('搜索成功',result.msg,'success');
               // this.showMyToast('搜索成功',result.msg,'success');
               this.data = result.entity.pageRecords;
               console.log('搜索Data==>'+JSON.stringify(this.data));
               for (var i in this.data) {
                  this.data[i]["Name__c"] = this.data[i].Prod.Name__c;
                  this.data[i]["Category3__c"] = this.data[i].Prod.Category3__c;
                  this.data[i]["Category4__c"] = this.data[i].Prod.Category3__c;
                  this.data[i]["Category5__c"] = this.data[i].Prod.Category3__c;
                  this.data[i]["Category4__c"] = this.data[i].Prod.Category4__c;
                  this.data[i]["Category5__c"] = this.data[i].Prod.Category5__c;
                  this.data[i]["SFDA_Status__c"] = this.data[i].Prod.SFDA_Status__c;
                  this.data[i]["hospitalSpecialOffer__c"] = this.data[i].hospitalSpecialOffer;
                  this.data[i]["guaranteeperiod"] = this.data[i].guaranteeperiod;
               }
               this.data = [...this.data];
               console.log('this.data = ' + JSON.stringify(this.data));
               this.showTable = true;
               this.showSpinner = false;
            } else {
               this.nextPageToken = this.pageSize;
               this.totalRecords = 0;
               this.recordStart = 0;
               this.recordEnd = 0;
               this.totalPages =0;
               // this.showToast("Error",'Error', result.msg);
               this.showMyToast('搜索失败',result.msg,'error');
               // this.showMyToast('搜索失败',result.msg,'error');
               this.showSpinner = false;
            }
         })
         .catch((error) => {
            console.log("error = " + JSON.stringify(error));
            this.showSpinner = false;
         });
   }
   inventoryCount() {
@@ -518,22 +532,25 @@
               for (var i in this.data) {
                  this.data[i]["Name__c"] = this.data[i].Prod.Name__c;
                  this.data[i]["Category3__c"] = this.data[i].Prod.Category3__c;
                  this.data[i]["Category4__c"] = this.data[i].Prod.Category3__c;
                  this.data[i]["Category5__c"] = this.data[i].Prod.Category3__c;
                  this.data[i]["Category4__c"] = this.data[i].Prod.Category4__c;
                  this.data[i]["Category5__c"] = this.data[i].Prod.Category5__c;
                  this.data[i]["SFDA_Status__c"] = this.data[i].Prod.SFDA_Status__c;
                  this.data[i]["guaranteeperiod"] = this.data[i].guaranteeperiod;
               }
               this.showSpinner = false;
               this.showTable = true;
               this.showMyToast('搜索成功',result.msg,'success');
               // this.showMyToast('搜索成功',result.msg,'success');
               // this.showToast("Success",'搜索成功', result.msg);
               this.showSpinner = false;
            } else {
               // this.showToast("Error", 'Error',result.msg);
               this.showMyToast('搜索失败',result.msg,'error');
               // this.showMyToast('搜索失败',result.msg,'error');
               this.showSpinner = false;
            }
         })
         .catch((error) => {
            console.log("error = " + JSON.stringify(error));
            this.showSpinner = false;
         });
   }
@@ -634,23 +651,5 @@
           content = '<h2><strong>'+title+'<strong/></h2>';
        }
        this.template.querySelector('c-common-toast').showToast(variant,content,iconName,10000);
   // showToast(type,title,msg) {
   //    this.showSpinner = false;
   //    let mode = '';
   //    if (type.toLowerCase() != 'success') {
   //       mode = 'sticky';
   //    } else {
   //       mode = 'dismissable';
   //    }
   //    const event = new ShowToastEvent({
   //       title: title,
   //       variant: type,
   //       message: msg,
   //       mode: mode
   //    });
   //    this.dispatchEvent(event);
   // }
   }
}