buli
2023-07-11 cd05a7b0ab8dd5838f8998fb36fc0435fd9c5b84
force-app/main/default/lwc/lexinventoryViewLWC/lexinventoryViewLWC.js
@@ -48,6 +48,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: 200,
      wrapText: true,
      cellAttributes: { alignment: "left" }
    },
    {
      label: "第三分类",
      fieldName: "Category3__c",
      initialWidth: 90,
      initialWidth: 102,
      cellAttributes: { alignment: "left" },
      hideDefaultActions: true,
      sortable: true,
@@ -80,7 +81,7 @@
      label: "第四分类",
      fieldName: "Category4__c",
      cellAttributes: { alignment: "left" },
      initialWidth: 90,
      initialWidth: 102,
      hideDefaultActions: true,
      wrapText: true,
      sortable: true
@@ -89,7 +90,7 @@
      label: "第五分类",
      fieldName: "Category5__c",
      cellAttributes: { alignment: "left" },
      initialWidth: 90,
      initialWidth: 102,
      hideDefaultActions: true,
      wrapText: true,
      sortable: true
@@ -99,7 +100,7 @@
      label: "规格",
      fieldName: "packing_list",
      cellAttributes: { alignment: "right" },
      initialWidth: 55,
      initialWidth: 50,
      wrapText: true,
      hideDefaultActions: true
    },
@@ -107,7 +108,7 @@
      label: "单位",
      fieldName: "BoxPiece",
      cellAttributes: { alignment: "left" },
      initialWidth: 55,
      initialWidth: 50,
      wrapText: true,
      hideDefaultActions: true
    },
@@ -116,7 +117,7 @@
      fieldName: "approbation_No",
      cellAttributes: { alignment: "left" },
      wrapText: true,
      initialWidth: 155,
      initialWidth: 104,
      hideDefaultActions: true
    },
    {
@@ -125,13 +126,13 @@
      cellAttributes: { alignment: "left" },
      wrapText: true,
      hideDefaultActions: true,
      initialWidth: 100
      initialWidth: 95
    },
    {
      label: "CFDA状态",
      fieldName: "SFDA_Status__c",
      cellAttributes: { alignment: "left" },
      initialWidth: 95,
      initialWidth: 84,
      wrapText: true,
      hideDefaultActions: true
    },
@@ -140,12 +141,13 @@
      fieldName: "guaranteeperiod",
      cellAttributes: { alignment: "left" },
      hideDefaultActions: true,
      initialWidth: 105
      initialWidth: 95
    },
    {
      label: "有效期内库存",
      type: "customInventoryColor",
      // sortable: true,
      fieldName: "limitCount",
      sortable: true,
      cellAttributes: { alignment: "right" },
      typeAttributes: {
        value: { fieldName: "limitCount" },
@@ -154,7 +156,7 @@
        boxPrice: { fieldName: "BoxPiece" }
      },
      hideDefaultActions: true,
      initialWidth: 150
      initialWidth: 110
    },
    {
@@ -162,7 +164,7 @@
      fieldName: "overlimitCount",
      hideDefaultActions: true,
      cellAttributes: { alignment: "right" },
      initialWidth: 80
      initialWidth: 78
    }
  ];
  defaultSortDirection = "asc";
@@ -208,18 +210,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 = " +
@@ -237,12 +227,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;
@@ -296,8 +287,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;
@@ -360,7 +351,7 @@
        }
        break;
      case "CategoryFour":
        this.Category4 = value;
        this.CategoryFour = value;
        //调用后台显示第五分类
        this.showCate();
        if (this.CategoryFour == "") {
@@ -413,6 +404,7 @@
  searchOrderDetail() {
    this.showTable = false;
    this.showSpinner = true;
    searchOrder({
      category1: this.Name,
      Category3: this.CategoryThree,
@@ -423,7 +415,9 @@
      agencyProType: this.agencyProType,
      userWorkLocation: this.userWorkLocation,
      pageSizeLWC: this.pageSize,
      pageTokenLWC: this.currentPageToken
      pageTokenLWC: this.currentPageToken,
      productkucunLWC: this.productkucun
      // sortFieldLWC: this.sortBy,
      // sortOrderLWC: this.sortDirection
    })
@@ -437,32 +431,46 @@
          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() {
@@ -522,7 +530,8 @@
      agencyProType: this.agencyProType,
      userWorkLocation: this.userWorkLocation,
      pageSizeLWC: this.pageSize,
      pageTokenLWC: this.currentPageToken
      pageTokenLWC: this.currentPageToken,
      productkucunLWC: this.productkucun
    })
      .then((result) => {
        console.log("result搜索 = " + JSON.stringify(result));
@@ -543,22 +552,24 @@
          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;
      });
  }
@@ -667,22 +678,5 @@
    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);
    // }
  }
}