buli
2023-07-11 80a3f59e2d3df07805bc67e329300b8de90a5b3a
force-app/main/default/lwc/lexConsumable/lexConsumable.js
@@ -20,11 +20,10 @@
import searchContract from '@salesforce/apex/LexSearchContractController.searchContract';
import deleteAtt from '@salesforce/apex/LexConsumableController.deleteAtt';
//table css 
import { loadStyle } from "lightning/platformResourceLoader";
import WrappedHeaderTable from "@salesforce/resourceUrl/lexdatatable";
import { loadStyle } from 'lightning/platformResourceLoader';
import WrappedHeaderTable from '@salesforce/resourceUrl/lexdatatable';
export default class LexConsumable extends NavigationMixin(LightningElement) {
   //页面基础数据
   @track editAble;
   @track pageType;
@@ -115,10 +114,34 @@
   @track tempidHp;
   @track hosCols = [
      // {label:'医院名称',fieldName:'Name',type:'button',typeAttributes:{label:{fieldName:'Name'},variant:'base'}},
      {label:'',type:'button',typeAttributes:{label:'选择'},initialWidth:90,hideDefaultActions: true,wrapText:true},
      {label:'医院名称',fieldName:'Name',initialWidth:380,wrapText:true,hideDefaultActions: true},
      {label:'省份',fieldName:'StateMaster',initialWidth:80,hideDefaultActions: true,wrapText:true},
      {label:'地址',fieldName:'Address__c',hideDefaultActions: true,wrapText:true}
        {
            label: '',
            type: 'button',
            typeAttributes: { label: '选择' },
            initialWidth: 90,
            hideDefaultActions: true,
            wrapText: true
        },
        {
            label: '医院名称',
            fieldName: 'Name',
            initialWidth: 380,
            wrapText: true,
            hideDefaultActions: true
        },
        {
            label: '省份',
            fieldName: 'StateMaster',
            initialWidth: 80,
            hideDefaultActions: true,
            wrapText: true
        },
        {
            label: '地址',
            fieldName: 'Address__c',
            hideDefaultActions: true,
            wrapText: true
        }
   ];
   //合同搜索
   @track contractLabel;
@@ -131,66 +154,224 @@
   @track contractName;
   @track tempidPp;
   @track conCols = [
      {label:'',type:'button',typeAttributes:{label:'选择'},initialWidth:90,hideDefaultActions: true,wrapText:true},
      {label:'合同名称',fieldName:'Name',wrapText:true,hideDefaultActions: true},
      {label:'省份',fieldName:'StateMaster',initialWidth:80,hideDefaultActions: true,wrapText:true},
      {label:'申请销售课',fieldName:'Sales_Section__c',initialWidth:160,hideDefaultActions: true,wrapText:true},
      {label:'允许报价期间(开始日)',fieldName:'Contract_Decide_Start_Date__c',initialWidth:175,hideDefaultActions: true,wrapText:true},
      {label:'允许报价期间(结束日)',fieldName:'Contract_Decide_End_Date__c',initialWidth:175,hideDefaultActions: true,wrapText:true}
        {
            label: '',
            type: 'button',
            typeAttributes: { label: '选择' },
            initialWidth: 90,
            hideDefaultActions: true,
            wrapText: true
        },
        {
            label: '合同名称',
            fieldName: 'Name',
            wrapText: true,
            hideDefaultActions: true
        },
        {
            label: '省份',
            fieldName: 'StateMaster',
            initialWidth: 80,
            hideDefaultActions: true,
            wrapText: true
        },
        {
            label: '申请销售课',
            fieldName: 'Sales_Section__c',
            initialWidth: 160,
            hideDefaultActions: true,
            wrapText: true
        },
        {
            label: '允许报价期间(开始日)',
            fieldName: 'Contract_Decide_Start_Date__c',
            initialWidth: 175,
            hideDefaultActions: true,
            wrapText: true
        },
        {
            label: '允许报价期间(结束日)',
            fieldName: 'Contract_Decide_End_Date__c',
            initialWidth: 175,
            hideDefaultActions: true,
            wrapText: true
        }
   ];
   //消耗品数据col
   get cols(){
      var cols = [];
      cols.push({label:'消耗品名称',fieldName:'prodName',wrapText:true,hideDefaultActions: true,sortable: true});
      cols.push({label:'规格',fieldName:'packing_list',wrapText:true,hideDefaultActions: true,initialWidth:50,cellAttributes: { alignment: "right" }});
      cols.push({label:'CFDA状态',fieldName:'prodSFDAStatus',wrapText:true,hideDefaultActions: true,initialWidth:97});
      cols.push({label:'注册证编码号',fieldName:'approbation_No',wrapText:true,hideDefaultActions: true,initialWidth:120});
      cols.push({label:'注册证效期',fieldName:'expiration_Date',wrapText:true,hideDefaultActions: true,initialWidth:105});
      cols.push({label:'第3分类',fieldName:'prodCategory3',wrapText:true,hideDefaultActions: true,initialWidth:78,sortable: true});
      cols.push({label:'第4分类',fieldName:'prodCategory4',wrapText:true,hideDefaultActions: true,initialWidth:107,sortable: true});
      cols.push({label:'第5分类',fieldName:'prodCategory5',wrapText:true,hideDefaultActions: true,initialWidth:80,sortable: true});
        cols.push({
            label: '消耗品名称',
            fieldName: 'prodName',
            wrapText: true,
            hideDefaultActions: true,
            sortable: true
            // initialWidth: 136
        });
        cols.push({
            label: '规格',
            fieldName: 'packing_list',
            wrapText: true,
            hideDefaultActions: true,
            initialWidth: 50,
            cellAttributes: { alignment: 'right' }
        });
        cols.push({
            label: 'CFDA状态',
            fieldName: 'prodSFDAStatus',
            wrapText: true,
            hideDefaultActions: true,
            initialWidth: 84
        });
        cols.push({
            label: '注册证编码号',
            fieldName: 'approbation_No',
            wrapText: true,
            hideDefaultActions: true,
            initialWidth: 104
        });
        cols.push({
            label: '注册证效期',
            fieldName: 'expiration_Date',
            wrapText: true,
            hideDefaultActions: true,
            initialWidth: 95
        });
        cols.push({
            label: '第3分类',
            fieldName: 'prodCategory3',
            wrapText: true,
            hideDefaultActions: true,
            initialWidth: 84,
            sortable: true
        });
        cols.push({
            label: '第4分类',
            fieldName: 'prodCategory4',
            wrapText: true,
            hideDefaultActions: true,
            initialWidth: 84,
            sortable: true
        });
        cols.push({
            label: '第5分类',
            fieldName: 'prodCategory5',
            wrapText: true,
            hideDefaultActions: true,
            initialWidth: 84,
            sortable: true
        });
      if(this.cansee){
         cols.push({label:'标准单价',type:'number',typeAttributes:{minimumFractionDigits: 2},fieldName:'prodIntraTradeList',hideDefaultActions: true,initialWidth:80});
            cols.push({
                label: '标准单价',
                type: 'number',
                typeAttributes: { minimumFractionDigits: 2 },
                fieldName: 'prodIntraTradeList',
                hideDefaultActions: true,
                initialWidth: 78
            });
      }
      if(this.editAble){
         cols.push(
            {label:'采购数量',
            type: "customTableInput",typeAttributes: {
               recordId: { fieldName: "recordId" },
               inputValue: { fieldName: "consumableCount" },
               upperLimit: { fieldName: "upperlimit" },
               lowerLimit: { fieldName: "lowerlimit" },
               allnumber: { fieldName: "allnumber" },
            cols.push({
                label: '采购数量',
                type: 'customTableInput',
                typeAttributes: {
                    recordId: { fieldName: 'recordId' },
                    inputValue: { fieldName: 'consumableCount' },
                    upperLimit: { fieldName: 'upperlimit' },
                    lowerLimit: { fieldName: 'lowerlimit' },
                    allnumber: { fieldName: 'allnumber' },
               valueType: 'Number'
            },
            hideDefaultActions: true,initialWidth:80});
                hideDefaultActions: true,
                initialWidth: 78
            });
      }else{
         cols.push({label:'采购数量',fieldName:'consumableCount',hideDefaultActions: true,initialWidth:80,cellAttributes: { alignment: "right" }});
            cols.push({
                label: '采购数量',
                fieldName: 'consumableCount',
                hideDefaultActions: true,
                initialWidth: 78,
                cellAttributes: { alignment: 'right' }
            });
      }
      cols.push({label:'在库数下限',fieldName:'lowerlimit',hideDefaultActions: true,initialWidth:100,cellAttributes: { alignment: "right" }});
      cols.push({label:'在库数上限',fieldName:'upperlimit',hideDefaultActions: true,initialWidth:100,cellAttributes: { alignment: "right" }});
        cols.push({
            label: '在库数下限',
            fieldName: 'lowerlimit',
            hideDefaultActions: true,
            initialWidth: 86,
            cellAttributes: { alignment: 'right' }
        });
        cols.push({
            label: '在库数上限',
            fieldName: 'upperlimit',
            hideDefaultActions: true,
            initialWidth: 86,
            cellAttributes: { alignment: 'right' }
        });
      // cols.push({label:'有效期库存(盒)',fieldName:'allnumber',hideDefaultActions: true,initialWidth:105,sortable: true});
      cols.push(
         {label:'有效期库存(盒)',
         type: "customInventoryColor",
        cols.push({
            label: '有效期库存(盒)',
            type: 'customInventoryColor',
            fieldName: 'allnumber',
         typeAttributes: {
            value: { fieldName: "allnumber" },
            upperlimit: { fieldName: "upperlimit" },
            lowerlimit: { fieldName: "lowerlimit" },
                value: { fieldName: 'allnumber' },
                upperlimit: { fieldName: 'upperlimit' },
                lowerlimit: { fieldName: 'lowerlimit' },
            boxPrice: '盒'
         },
         hideDefaultActions: true,initialWidth:126});
      cols.push({label:'有效期库存(个)',fieldName:'allnumber_piece',hideDefaultActions: true,initialWidth:126,cellAttributes: { alignment: "right" }});
            hideDefaultActions: true,
            initialWidth: 122,
            sortable: true
        });
        cols.push({
            label: '有效期库存(个)',
            fieldName: 'allnumber_piece',
            hideDefaultActions: true,
            initialWidth: 112,
            cellAttributes: { alignment: 'right' }
        });
      return cols;
   }
   //附件cols
   @track attCols = [
      {label:'标题',fieldName:'attUrl',type:'url',typeAttributes:{label:{fieldName:'fileName'},target: "_blank"},hideDefaultActions: true},
      {label:'创建人',fieldName:'ownerUrl',type:'url',typeAttributes:{label:{fieldName:'ownerName'},target: "_blank"},hideDefaultActions: true},
      {label:'上传日期',fieldName:'updateDate',hideDefaultActions: true},
      {label:'',type:'tableCellIcon',typeAttributes:{iconName:'utility:delete',recordId:{fieldName : 'recordId'}},initialWidth:50,hideDefaultActions: true}
        {
            label: '标题',
            fieldName: 'attUrl',
            type: 'url',
            typeAttributes: {
                label: { fieldName: 'fileName' },
                target: '_blank'
            },
            hideDefaultActions: true
        },
        {
            label: '创建人',
            fieldName: 'ownerUrl',
            type: 'url',
            typeAttributes: {
                label: { fieldName: 'ownerName' },
                target: '_blank'
            },
            hideDefaultActions: true
        },
        {
            label: '上传日期',
            fieldName: 'updateDate',
            hideDefaultActions: true
        },
        {
            label: '',
            type: 'tableCellIcon',
            typeAttributes: {
                iconName: 'utility:delete',
                recordId: { fieldName: 'recordId' }
            },
            initialWidth: 50,
            hideDefaultActions: true
        }
   ];
   //取得所有被勾选的产品id
@@ -210,23 +391,33 @@
      for(var i in this.consumableorderdetailsRecordsview){
         var count = 0;
         for(var j in selectedRows){
            if(this.consumableorderdetailsRecordsview[i].recordId == selectedRows[j].recordId){
               count++
               console.log("checkId:"+selectedRows[j].recordId+'---'+this.consumableorderdetailsRecordsview[i].prodName);
                if (
                    this.consumableorderdetailsRecordsview[i].recordId ==
                    selectedRows[j].recordId
                ) {
                    count++;
                    console.log(
                        'checkId:' +
                            selectedRows[j].recordId +
                            '---' +
                            this.consumableorderdetailsRecordsview[i].prodName
                    );
            }
         }
         if(count == 0){
            this.consumableorderdetailsRecordsview[i].check = false;
         }else{
            this.consumableorderdetailsRecordsview[i].check = true;
            this.selectRows.push(this.consumableorderdetailsRecordsview[i].recordId);
                this.selectRows.push(
                    this.consumableorderdetailsRecordsview[i].recordId
                );
         }
      }
      for(var i in this.selectRows){
         console.log("checkId1:"+this.selectRows[i]);
            console.log('checkId1:' + this.selectRows[i]);
         for(var i in this.currentRecord){
            if(this.currentRecord[i].recordId == this.selectRows[i]){
               console.log("currentRecord:"+this.selectRows[i]);
                    console.log('currentRecord:' + this.selectRows[i]);
            }
         }
      }
@@ -238,20 +429,33 @@
      var conCount = event.detail.data.value;
      console.log('countChange:'+recordId+'---'+conCount);
      for(var i in this.consumableorderdetailsRecordsview){
         if(this.consumableorderdetailsRecordsview[i].recordId == recordId){
            this.consumableorderdetailsRecordsview[i].esd.Consumable_count__c = conCount;
            this.consumableorderdetailsRecordsview[i].consumableCount = conCount;
            if (
                this.consumableorderdetailsRecordsview[i].recordId == recordId
            ) {
                this.consumableorderdetailsRecordsview[
                    i
                ].esd.Consumable_count__c = conCount;
                this.consumableorderdetailsRecordsview[i].consumableCount =
                    conCount;
            if(conCount != null && conCount !=0 && conCount!=''){
               this.consumableorderdetailsRecordsview[i].check = true;
            }else{
               this.consumableorderdetailsRecordsview[i].check = false;
                    this.consumableorderdetailsRecordsview[
                        i
                    ].esd.Consumable_count__c = null;
                    this.consumableorderdetailsRecordsview[i].consumableCount =
                        null;
            }
         }
      }
      this.getAllChecked();
      for(var i in this.currentRecord){
         if(this.currentRecord[i].recordId == recordId){
            console.log("currentRecord1:"+this.currentRecord[i].esd.Consumable_count__c);
                console.log(
                    'currentRecord1:' +
                        this.currentRecord[i].esd.Consumable_count__c
                );
         }
      }
   }
@@ -262,8 +466,22 @@
      var allnumber = event.detail.data.allnumber;
      var upperLimit = event.detail.data.upperLimit;
      var lowerLimit = event.detail.data.lowerLimit;
      console.log('limit:'+conCount+'---'+ allnumber+'---'+lowerLimit+'---'+allnumber);
      if(upperLimit != null && lowerLimit != null && conCount != null && allnumber != null){
        console.log(
            'limit:' +
                conCount +
                '---' +
                allnumber +
                '---' +
                lowerLimit +
                '---' +
                allnumber
        );
        if (
            upperLimit != null &&
            lowerLimit != null &&
            conCount != null &&
            allnumber != null
        ) {
         if(parseInt(allnumber) + parseInt(conCount) > upperLimit){
            // window.alert("该产品订购数量超出库存上限!");
            this.showMyToast('该产品订购数量超出库存上限!','','error');
@@ -292,11 +510,11 @@
      if (!this.stylesLoaded) {
          Promise.all([loadStyle(this, WrappedHeaderTable)])
              .then(() => {
                  console.log("Custom styles loaded");
                    console.log('Custom styles loaded');
                  this.stylesLoaded = true;
              })
              .catch((error) => {
                  console.error("Error loading custom styles");
                    console.error('Error loading custom styles');
              });
      }
   }
@@ -304,14 +522,19 @@
   //页面初始化
   connectedCallback(){
      this.showSpinner = true;
      initPage({type:this.pageType, esetId:this.esetId, keywordStr:this.keyWords})
         .then(result=>{
        initPage({
            type: this.pageType,
            esetId: this.esetId,
            keywordStr: this.keyWords
        })
            .then((result) => {
            this.isNoteStay = result.isNoteStay;
            if(result.result == 'Success'){
               this.editAble = result.editAble;
               this.edoffersPrice = result.edoffersPrice;
               this.cansee = result.cansee;
               this.editDelCommitBtnDisabled = result.editDelCommitBtnDisabled;
                    this.editDelCommitBtnDisabled =
                        result.editDelCommitBtnDisabled;
               this.category3Option = result.category3Option;
               this.category4Option = result.category4Option;
               this.category5Option = result.category5Option;
@@ -321,32 +544,48 @@
               this.hospitalName = result.hospitalName;
               this.contractName = result.contractName;
               this.contractLabel = '经销商有效合同';
               this.consumableorderdetailsRecordsview = result.consumableorderdetailsRecordsview;
                    this.consumableorderdetailsRecordsview =
                        result.consumableorderdetailsRecordsview;
               this.currentPage = 1;
               this.showCurrentReocrd();
               this.getAllChecked();
               this.attachmentRecoeds = result.attachmentRecoeds;
               console.log("attSize:"+this.attachmentRecoeds.length);
                    console.log('attSize:' + this.attachmentRecoeds.length);
               for(var i in this.attachmentRecoeds){
                  this.attachmentRecoeds[i]['recordId'] = this.attachmentRecoeds[i].Concc.Id;
                  this.attachmentRecoeds[i]['documentId'] = this.attachmentRecoeds[i].Concc.ContentDocumentId;
                  this.attachmentRecoeds[i]['fileFullName'] = this.attachmentRecoeds[i].Concc.Title;
                  var contractionName = this.attachmentRecoeds[i].Concc.Title;
                        this.attachmentRecoeds[i]['recordId'] =
                            this.attachmentRecoeds[i].Concc.Id;
                        this.attachmentRecoeds[i]['documentId'] =
                            this.attachmentRecoeds[i].Concc.ContentDocumentId;
                        this.attachmentRecoeds[i]['fileFullName'] =
                            this.attachmentRecoeds[i].Concc.Title;
                        var contractionName =
                            this.attachmentRecoeds[i].Concc.Title;
                  // var contractionName = '长文件长文件长文件长文件';
                  if(contractionName.length > 25){
                     contractionName = contractionName.substr(0,21) + "...";
                            contractionName =
                                contractionName.substr(0, 21) + '...';
                  }
                  this.attachmentRecoeds[i]['fileName'] = contractionName;
                  this.attachmentRecoeds[i]['ownerName'] = this.attachmentRecoeds[i].Concc.Owner.Name;
                  this.attachmentRecoeds[i]['downloadUrl'] = '/sfc/servlet.shepherd/document/download/'+this.attachmentRecoeds[i].Concc.ContentDocumentId+'?operationContext=S1';
                        this.attachmentRecoeds[i]['ownerName'] =
                            this.attachmentRecoeds[i].Concc.Owner.Name;
                        this.attachmentRecoeds[i]['downloadUrl'] =
                            '/sfc/servlet.shepherd/document/download/' +
                            this.attachmentRecoeds[i].Concc.ContentDocumentId +
                            '?operationContext=S1';
                  // var date = this.attachmentRecoeds[i].Concc.CreatedDate;
                  // var year = date.getFullYear();
                  // var month = date.getMonth();
                  // var day = date.getDay();
                  // console.log(year+'-'+month+'-'+day);
                  this.attachmentRecoeds[i]['updateDate'] = new Date(Date.parse(this.attachmentRecoeds[i].Concc.CreatedDate)).toLocaleString();
                  this.attachmentRecoeds[i]['attUrl'] = '/'+this.attachmentRecoeds[i].Concc.Id;
                  this.attachmentRecoeds[i]['ownerUrl'] = '/'+this.attachmentRecoeds[i].Concc.OwnerId;
                        this.attachmentRecoeds[i]['updateDate'] = new Date(
                            Date.parse(
                                this.attachmentRecoeds[i].Concc.CreatedDate
                            )
                        ).toLocaleString();
                        this.attachmentRecoeds[i]['attUrl'] =
                            '/' + this.attachmentRecoeds[i].Concc.Id;
                        this.attachmentRecoeds[i]['ownerUrl'] =
                            '/' + this.attachmentRecoeds[i].Concc.OwnerId;
               }
               this.errorMsgs = result.errorMsgList;
               this.warningMsgs = result.warningMsgList;
@@ -361,13 +600,22 @@
               this.contactDealer = result.contactDealer;
               this.pageType = result.methodType;
               this.proLimitAndDate = result.proLimitAndDate;
               console.log("proLimitAndDate:"+JSON.stringify(this.proLimitAndDate));
                    console.log(
                        'proLimitAndDate:' +
                            JSON.stringify(this.proLimitAndDate)
                    );
               this.coc = result.coc;
               this.cocId = this.coc.Id;
               if(this.pageType == 'hospitalorder' && this.agencyProType != 'ET'){
                    if (
                        this.pageType == 'hospitalorder' &&
                        this.agencyProType != 'ET'
                    ) {
                  this.showHospital = true;
               }
               if(this.coc.Order_status__c == "已提交" || this.coc.Order_status__c == "批准"){
                    if (
                        this.coc.Order_status__c == '已提交' ||
                        this.coc.Order_status__c == '批准'
                    ) {
                  this.showOrderDate = true;
               }
               if(this.coc.Consumable_pdf_insert_day__c != null){
@@ -377,41 +625,60 @@
                  this.showEditBtn = true;
                  this.showOfferPriceInputBtn = true;
               }
               if(this.coc.Order_status__c == "已提交" || this.coc.Order_status__c == "批准" || this.coc.Order_status__c == "驳回"){
                    if (
                        this.coc.Order_status__c == '已提交' ||
                        this.coc.Order_status__c == '批准' ||
                        this.coc.Order_status__c == '驳回'
                    ) {
                  this.disabledEditBtn = true;
                  this.disabledUploadSheetBtn = true;
                  this.disabledSubOrderbtn = true;
                  this.disabledDeleteBtn = true;
                  this.disabledOfferPriceInputBtn = true;
               }
               if(!(this.editDelCommitBtnDisabled || this.editAble || this.edoffersPrice)){
                    if (
                        !(
                            this.editDelCommitBtnDisabled ||
                            this.editAble ||
                            this.edoffersPrice
                        )
                    ) {
                  this.showPrintSheetBtn = true;
                  this.showUploadSheetBtn = true;
                  this.showSubOrderbtn = true;
                  this.showDeleteBtn = true;
               }
               if((this.editDelCommitBtnDisabled || this.editAble || this.edoffersPrice) && this.coc.Order_status__c != "驳回"){
                    if (
                        (this.editDelCommitBtnDisabled ||
                            this.editAble ||
                            this.edoffersPrice) &&
                        this.coc.Order_status__c != '驳回'
                    ) {
                  this.showSaveOrderbtn1 = true;
               }
               if(this.coc.Order_status__c == "驳回" && this.editAble){
                    if (this.coc.Order_status__c == '驳回' && this.editAble) {
                  this.showSaveOrderbtn2 = true;
               }
               if(this.coc.Order_status__c == "驳回" && !this.editAble){
                    if (this.coc.Order_status__c == '驳回' && !this.editAble) {
                  this.showReapplyBtn = true;
               }
               this.showSpinner = false;
               this.showPage = true;
            }else{
               this.showSpinner = false;
               console.log("Error:"+result.errorMsg);
               this.showMyToast('初始化页面失败',result.errorMsg,'error');
                    console.log('Error:' + result.errorMsg);
                    this.showMyToast(
                        '初始化页面失败',
                        result.errorMsg,
                        'error'
                    );
            }
         })
         .catch(error=>{
            .catch((error) => {
            this.showSpinner = false;
            console.log("error:"+error);
                console.log('error:' + error);
            this.showMyToast('初始化页面失败',error,'error');
         })
            });
   }
   //排序
@@ -421,9 +688,13 @@
      if(this.editAble){
         const { fieldName: sortedBy, sortDirection } = event.detail;
         const cloneData = [...this.currentRecord];
         cloneData.sort(this.sortBy(sortedBy, sortDirection === 'asc' ? 1 : -1));
            cloneData.sort(
                this.sortBy(sortedBy, sortDirection === 'asc' ? 1 : -1)
            );
         let index = 0;
         let selectedRows = this.template.querySelector('c-lex-custom-lightning-datatable').getSelectedRows();
            let selectedRows = this.template
                .querySelector('c-lex-custom-lightning-datatable')
                .getSelectedRows();
         let selectedRowsIds = [];
         for(var i in selectedRows){
            selectedRowsIds.push(selectedRows[i].recordId);
@@ -445,7 +716,9 @@
      }else{
         const { fieldName: sortedBy, sortDirection } = event.detail;
         const cloneData = [...this.currentRecord];
         cloneData.sort(this.sortBy(sortedBy, sortDirection === 'asc' ? 1 : -1));
            cloneData.sort(
                this.sortBy(sortedBy, sortDirection === 'asc' ? 1 : -1)
            );
         this.currentRecord = cloneData;
         this.sortDirection = sortDirection;
         this.sortedBy = sortedBy;
@@ -504,18 +777,20 @@
      this.category3 = event.detail.value;
      this.category4 = '';
      this.category5 = '';
      categoryAllload({agencyProTypeStr:this.agencyProType, category3Str:this.category3})
         .then(result=>{
        categoryAllload({
            agencyProTypeStr: this.agencyProType,
            category3Str: this.category3
        }).then((result) => {
            if(result.result == 'Success'){
               this.category4Option = result.category4Option;
               this.category5Option = result.category5Option;
               this.showSpinner = false;
            }else{
               this.showSpinner = false;
               console.log("Error:"+result.errorMsg);
                console.log('Error:' + result.errorMsg);
               this.showMyToast('加载分类失败',result.errorMsg,'error');
            }
         })
        });
   }
   //第四分类change事件
@@ -523,18 +798,21 @@
      this.showSpinner = true;
      this.category4 = event.detail.value;
      this.category5 = '';
      categoryload({agencyProTypeStr:this.agencyProType, category3Str:this.category3, category4Str:this.category4})
         .then(result=>{
        categoryload({
            agencyProTypeStr: this.agencyProType,
            category3Str: this.category3,
            category4Str: this.category4
        }).then((result) => {
            if(result.result == 'Success'){
               this.category4Option = result.category4Option;
               this.category5Option = result.category5Option;
               this.showSpinner = false;
            }else{
               this.showSpinner = false;
               console.log("Error:"+result.errorMsg);
                console.log('Error:' + result.errorMsg);
               this.showMyToast('加载分类失败',result.errorMsg,'error');
            }
         })
        });
   }
   //第五分类change事件
@@ -545,7 +823,8 @@
   //搜索产品
   searchProduct(event){
      this.showSpinner = true;
      searchConsumableorderdetails({userWorkLocationStr:this.userWorkLocation,
        searchConsumableorderdetails({
            userWorkLocationStr: this.userWorkLocation,
         agencyProTypeStr:this.agencyProType,
         accountNameStr:this.accountName,
         accountIdStr:this.accountid,
@@ -560,12 +839,15 @@
         dealerProductIdStr:JSON.stringify(this.dealerProductId), 
         methodTypeStr:this.pageType,
         editAbleStr:this.editAble,
         consumableorderdetailsRecordsviewStr:JSON.stringify(this.consumableorderdetailsRecordsview),
            consumableorderdetailsRecordsviewStr: JSON.stringify(
                this.consumableorderdetailsRecordsview
            ),
         proLimitAndDateList : this.proLimitAndDate
      })
            .then(result=>{
            .then((result) => {
               if(result.result == 'Success'){
                  this.consumableorderdetailsRecordsview = result.consumableorderdetailsRecordsview;
                    this.consumableorderdetailsRecordsview =
                        result.consumableorderdetailsRecordsview;
                  this.currentPage = 1;
                  this.currentRecord = [];
                  this.showCurrentReocrd();
@@ -578,7 +860,7 @@
                  this.showMyToast('搜索成功',result.errorMsg,'success');
               }else{
                  this.showSpinner = false;
                  console.log("Error:"+result.errorMsg);
                    console.log('Error:' + result.errorMsg);
                  if(result.errorMsg == '没有搜索到相关数据'){
                     this.showMyToast(result.errorMsg,'','error');
                  }else{
@@ -586,9 +868,9 @@
                  }
               }
            })
            .catch(error=>{
               console.log("Error:"+error);
            })
            .catch((error) => {
                console.log('Error:' + error);
            });
   }
   //清除搜索栏
@@ -614,11 +896,14 @@
         dealerProductIdStr:JSON.stringify(this.dealerProductId), 
         methodTypeStr:this.pageType,
         editAbleStr:this.editAble,
         consumableorderdetailsRecordsviewStr:JSON.stringify(this.consumableorderdetailsRecordsview),
            consumableorderdetailsRecordsviewStr: JSON.stringify(
                this.consumableorderdetailsRecordsview
            ),
         proLimitAndDateList : this.proLimitAndDate
      }).then(result=>{
        }).then((result) => {
            if(result.result == 'Success'){
               this.consumableorderdetailsRecordsview = result.consumableorderdetailsRecordsview;
                this.consumableorderdetailsRecordsview =
                    result.consumableorderdetailsRecordsview;
               this.currentPage = 1;
               this.currentRecord = [];
               this.showCurrentReocrd();
@@ -627,27 +912,33 @@
               this.showMyToast('搜索成功',result.errorMsg,'success');
            }else{
               this.showSpinner = false;
               console.log("Error:"+result.errorMsg);
                console.log('Error:' + result.errorMsg);
               if(result.errorMsg == '没有搜索到相关数据'){
                  this.showMyToast(result.errorMsg,'','error');
               }else{
                  this.showMyToast('搜索失败',result.errorMsg,'error');
               }
            }
         })
        });
   }
   //选择所有
   checkAll(event){
      for(let i=0, len=this.consumableorderdetailsRecordsview.length; i < len ;i++){
         this.consumableorderdetailsRecordsview[i].check = event.target.checked;
        for (
            let i = 0, len = this.consumableorderdetailsRecordsview.length;
            i < len;
            i++
        ) {
            this.consumableorderdetailsRecordsview[i].check =
                event.target.checked;
      }
   }
   //选择
   check(event){
      let index = event.target.getAttribute("data-index");
      this.consumableorderdetailsRecordsview[index].check = event.target.checked;
        let index = event.target.getAttribute('data-index');
        this.consumableorderdetailsRecordsview[index].check =
            event.target.checked;
   }
   //采购数量change事件
@@ -674,7 +965,9 @@
         cocStr:JSON.stringify(this.coc),
         agencyProTypeStr:this.agencyProType,
         accountidStr:this.accountid,
         consumableorderdetailsRecordsviewStr:JSON.stringify(this.consumableorderdetailsRecordsview),
            consumableorderdetailsRecordsviewStr: JSON.stringify(
                this.consumableorderdetailsRecordsview
            ),
         contactDealerStr:JSON.stringify(this.contactDealer),
         methodTypeStr:this.pageType,
         eSetIdStr:this.esetId,
@@ -682,23 +975,27 @@
         contractIdStr : this.contractId,
         agencyProType1Str : this.agencyProType1,
         OSHFLGStr : this.OSHFLG
      }).then(result=>{
        }).then((result) => {
         this.showSpinner = false;
         if(result.result == 'Success'){
            this.esetId = result.eSetId;
            const config = {
               type: 'standard__webPage',
               attributes: {
                  url: '/lexconsumable?ESetid=' + this.esetId + '&type=' + this.pageType
                        url:
                            '/lexconsumable?ESetid=' +
                            this.esetId +
                            '&type=' +
                            this.pageType
               }
           };
           this[NavigationMixin.Navigate](config);
         }else{
            this.showSpinner = false;
            console.log("Error:"+result.errorMsg);
                console.log('Error:' + result.errorMsg);
            this.showMyToast('保存失败',result.errorMsg,'error');
         }
      })
        });
   }
   //保存订单(驳回)
@@ -709,36 +1006,41 @@
         cocStr:JSON.stringify(this.coc),
         agencyProTypeStr:this.agencyProType,
         accountidStr:this.accountid,
         consumableorderdetailsRecordsviewStr:JSON.stringify(this.consumableorderdetailsRecordsview),
            consumableorderdetailsRecordsviewStr: JSON.stringify(
                this.consumableorderdetailsRecordsview
            ),
         contactDealerStr:JSON.stringify(this.contactDealer),
         methodTypeStr:this.pageType,
         hospitalIdStr:this.hospitalId,
         contractIdStr : this.contractId,
         agencyProType1Str : this.agencyProType1,
         OSHFLGStr : this.OSHFLG
      }).then(result=>{
        }).then((result) => {
         this.showSpinner = false;
         if(result.result == 'Success'){
            this.esetId = result.eSetId;
            const config = {
               type: 'standard__webPage',
               attributes: {
                   url: '/lexconsumable?ESetid=' + this.esetId + '&type=' + this.pageType
                        url:
                            '/lexconsumable?ESetid=' +
                            this.esetId +
                            '&type=' +
                            this.pageType
               }
           };
           this[NavigationMixin.Navigate](config);
         }else{
            this.showSpinner = false;
            console.log("Error:"+result.errorMsg);
                console.log('Error:' + result.errorMsg);
            this.showMyToast('保存失败',result.errorMsg,'error');
         }
      })
        });
   }
   //编辑
   editOrder(event){
      setEditAble({eSetidStr:this.esetId})
         .then(result=>{
        setEditAble({ eSetidStr: this.esetId }).then((result) => {
            if(result.result == 'Success'){
               const config = {
                  type: 'standard__webPage',
@@ -749,10 +1051,10 @@
              this[NavigationMixin.Navigate](config);
            }else{
               this.showSpinner = false;
               console.log("Error:"+result.errorMsg);
                console.log('Error:' + result.errorMsg);
               this.showMyToast('编辑失败',result.errorMsg,'error');
            }
         })
        });
   }
   //打印配置单
@@ -761,7 +1063,8 @@
      const config = {
         type: 'standard__webPage',
         attributes: {
            url: site+'/consumable/PrintConsumblePDF?ESetid='+this.esetId
                url:
                    site + '/consumable/PrintConsumblePDF?ESetid=' + this.esetId
         }
      };
      this[NavigationMixin.Navigate](config);
@@ -775,7 +1078,7 @@
   //提交订单
   submitOrder(event){
      sorder({eSetidStr:this.esetId,accountidStr:this.accountid})
         .then(result=>{
            .then((result) => {
            if(result.result == 'Success'){
               const config = {
                  type: 'standard__webPage',
@@ -788,16 +1091,16 @@
               this.showSpinner = false;
               this.errorMsgs = result.errorMsgList;
               this.warningMsgs = result.warningMsgList;
               console.log("Error:"+result.errorMsg);
               if(result.errorMsg.indexOf("请上传订货配置单附件") != -1){
                    console.log('Error:' + result.errorMsg);
                    if (result.errorMsg.indexOf('请上传订货配置单附件') != -1) {
                  result.errorMsg = '请上传订货配置单附件';
               }
               this.showMyToast('提交失败',result.errorMsg,'error');
            }
         })
         .catch(error=>{
            console.log("Error:"+error);
         })
            .catch((error) => {
                console.log('Error:' + error);
            });
   }
   //删除订单
@@ -805,8 +1108,7 @@
      if(!window.confirm('删除是不可恢复的,你确认要删除吗?')){
         return;
      }
      delConsumable({eSetidStr:this.esetId})
         .then(result=>{
        delConsumable({ eSetidStr: this.esetId }).then((result) => {
            if(result.result == 'Success'){
               const config = {
                  type: 'standard__webPage',
@@ -817,10 +1119,10 @@
            this[NavigationMixin.Navigate](config);
            }else{
               this.showSpinner = false;
               console.log("Error:"+result.errorMsg);
                console.log('Error:' + result.errorMsg);
               this.showMyToast('删除失败',result.errorMsg,'error');
            }
         })
        });
   }
   //特价金额录入
@@ -833,7 +1135,13 @@
         this.showEditBtn = false;
         this.showOfferPriceInputBtn = false;
      }
      if(!(this.editDelCommitBtnDisabled || this.editAble || this.edoffersPrice)){
        if (
            !(
                this.editDelCommitBtnDisabled ||
                this.editAble ||
                this.edoffersPrice
            )
        ) {
         this.showPrintSheetBtn = true;
         this.showUploadSheetBtn = true;
         this.showSubOrderbtn = true;
@@ -844,7 +1152,12 @@
         this.showSubOrderbtn = false;
         this.showDeleteBtn = false;
      }
      if((this.editDelCommitBtnDisabled || this.editAble || this.edoffersPrice) && this.coc.Order_status__c != "驳回"){
        if (
            (this.editDelCommitBtnDisabled ||
                this.editAble ||
                this.edoffersPrice) &&
            this.coc.Order_status__c != '驳回'
        ) {
         this.showSaveOrderbtn1 = true;
      }else{
         this.showSaveOrderbtn1 = false;
@@ -853,8 +1166,7 @@
   //再申请
   reapplyOrder(event){
      backOrder({eSetidStr:this.esetId})
         .then(result=>{
        backOrder({ eSetidStr: this.esetId }).then((result) => {
            if(result.result == 'Success'){
               const config = {
                  type: 'standard__webPage',
@@ -865,10 +1177,10 @@
            this[NavigationMixin.Navigate](config);
            }else{
               this.showSpinner = false;
               console.log("Error:"+result.errorMsg);
                console.log('Error:' + result.errorMsg);
               this.showMyToast('再申请失败',result.errorMsg,'error');
            }
         })
        });
   }
   //附件change事件
@@ -882,7 +1194,11 @@
   //是否显示附件移除
   get attDelBtn(){
      if(this.fileName != '' && this.fileName != null && this.fileName != '请选择一个文件上传'){
        if (
            this.fileName != '' &&
            this.fileName != null &&
            this.fileName != '请选择一个文件上传'
        ) {
         return true;
      }else{
         return false;
@@ -912,16 +1228,16 @@
         }
         this.fileReader= new FileReader();
         this.fileReader.onloadend = (() => {
            this.fileReader.onloadend = () => {
            this.fileContents = this.fileReader.result;
            let base64 = 'base64,';
            this.content = this.fileContents.indexOf(base64) + base64.length;
                this.content =
                    this.fileContents.indexOf(base64) + base64.length;
            this.fileContents = this.fileContents.substring(this.content);
            this.saveToFile();
         });
            };
         this.fileReader.readAsDataURL(this.file);
      }
      else {
        } else {
         this.fileName = '请选择一个文件上传';
      }
   }
@@ -929,18 +1245,22 @@
   //调用上传附件后台方法
   saveToFile() {
      this.showPopSpinner = true;
      filesUpload({pId:this.esetId, fileName: this.file.name, base64Data: encodeURIComponent(this.fileContents)})
         .then(result => {
        filesUpload({
            pId: this.esetId,
            fileName: this.file.name,
            base64Data: encodeURIComponent(this.fileContents)
        })
            .then((result) => {
            this.showPopSpinner = false;
            if(result.result == 'Success'){
               this.closePop();
               window.location.reload();
            }else{
               console.log("Error:"+result.errorMsg);
                    console.log('Error:' + result.errorMsg);
               this.showMyToast('上传失败',result.errorMsg,'error');
            }
         })
         .catch(error => {
            .catch((error) => {
            this.showPopSpinner = false;
            this.showMyToast('上传失败',error,'error');
         });
@@ -949,28 +1269,28 @@
   //删除附件
   deleteAtt(event){
      this.showSpinner = true;
      var recordId = event.target.getAttribute("data-fileid");
        var recordId = event.target.getAttribute('data-fileid');
      console.log('attid:'+recordId);
      deleteAtt({contentVersionId : recordId})
      .then(result=>{
        deleteAtt({ contentVersionId: recordId, cocId: this.esetId })
            .then((result) => {
         this.showSpinner = false;
         if(result.result == 'Success'){
            window.location.reload();
         }else{
            console.log("Error:"+result.errorMsg);
                    console.log('Error:' + result.errorMsg);
            this.showMyToast('删除失败',result.errorMsg,'error');
         }
      })
      .catch(error=>{
            .catch((error) => {
         this.showSpinner = false;
         console.log("Error:"+error);
                console.log('Error:' + error);
         this.showMyToast('删除失败',JSON.stringify(error),'error');
      })
            });
   }
   //预览附件
   previweAtt(event){
      var recordId = event.target.getAttribute("data-fileid");
        var recordId = event.target.getAttribute('data-fileid');
      console.log(recordId);
      this[NavigationMixin.Navigate]({ 
         type:'standard__namedPage',
@@ -987,46 +1307,55 @@
   //打开搜索弹窗,并初始化弹窗
   showSearchHos(event){
      initHospital()
         .then(result=>{
            .then((result) => {
            if(result.result == 'Success'){
               this.showAttHosPop = true;
               this.hospitalList = result.attList;
               for(var i in this.hospitalList){
                  if(this.hospitalList[i].State_Master__c){
                     this.hospitalList[i]['StateMaster'] = this.hospitalList[i].State_Master__r.Name;
                            this.hospitalList[i]['StateMaster'] =
                                this.hospitalList[i].State_Master__r.Name;
                  }
               }
            }else{
               console.log("Error:"+result.errorMsg);
               this.showMyToast('初始化检索医院页面失败',result.errorMsg,'error');
                    console.log('Error:' + result.errorMsg);
                    this.showMyToast(
                        '初始化检索医院页面失败',
                        result.errorMsg,
                        'error'
                    );
            }
         })
         .catch(error=>{
            console.log("Error:"+error);
            .catch((error) => {
                console.log('Error:' + error);
            this.showMyToast('初始化检索医院页面失败',error,'error');
         })
            });
   }
   //检索医院
   searchHos(event){
      searchHospital({searchName:this.searchNameHos, accountId:this.accountid})
         .then(result=>{
        searchHospital({
            searchName: this.searchNameHos,
            accountId: this.accountid
        })
            .then((result) => {
            if(result.result == 'Success'){
               this.hospitalList = result.attList;
               for(var i in this.hospitalList){
                  if(this.hospitalList[i].State_Master__c){
                     this.hospitalList[i]['StateMaster'] = this.hospitalList[i].State_Master__r.Name;
                            this.hospitalList[i]['StateMaster'] =
                                this.hospitalList[i].State_Master__r.Name;
                  }
               }
            }else{
               console.log("Error:"+result.errorMsg);
                    console.log('Error:' + result.errorMsg);
               this.showMyToast('搜索失败',result.errorMsg,'error');
            }
         })
         .catch(error=>{
            console.log("Error:"+error);
            .catch((error) => {
                console.log('Error:' + error);
            this.showMyToast('搜索失败',error,'error');
         })
            });
   }
   //医院名称change
@@ -1092,27 +1421,37 @@
               accountNameStr : this.accountName,
               proLimitAndDateList : this.proLimitAndDate,
               editAbleStr : this.editAble
            }).then(result=>{
                })
                    .then((result) => {
               if(result.result == 'Success'){
                  this.consumableorderdetailsRecordsview = result.consumableorderdetailsRecordsview;
                            this.consumableorderdetailsRecordsview =
                                result.consumableorderdetailsRecordsview;
                  this.currentPage = 1;
                  this.currentRecord = [];
                  this.showCurrentReocrd();
                  this.getAllChecked();
                  this.showMyToast('搜索成功',result.errorMsg,'success');
                            this.showMyToast(
                                '搜索成功',
                                result.errorMsg,
                                'success'
                            );
               }else{
                  console.log("Error:"+result.errorMsg);
                            console.log('Error:' + result.errorMsg);
                  if(result.errorMsg == '没有搜索到相关数据'){
                     this.showMyToast(result.errorMsg,'','error');
                  }else{
                     this.showMyToast('搜索产品失败',result.errorMsg,'error');
                                this.showMyToast(
                                    '搜索产品失败',
                                    result.errorMsg,
                                    'error'
                                );
                  }
               }
            })
            .catch(error=>{
               console.log("Error:"+error);
                    .catch((error) => {
                        console.log('Error:' + error);
               this.showMyToast('搜索产品失败',error,'error');
            })
                    });
            this.tempidHp = 'tempId';
         }
      }else{
@@ -1123,46 +1462,57 @@
   //打开合同检索弹窗并初始化
   showSearchCon(){
      initContract({ctype:this.agencyProType1})
      .then(result=>{
            .then((result) => {
         if(result.result == 'Success'){
            this.showConPop = true;
            this.contractList = result.attList;
            for(var i in this.contractList){
               if(this.contractList[i].State_Master__c){
                  this.contractList[i]['StateMaster'] = this.contractList[i].State_Master__r.Name;
                            this.contractList[i]['StateMaster'] =
                                this.contractList[i].State_Master__r.Name;
               }
            }
         }else{
            console.log("Error:"+result.errorMsg);
            this.showMyToast('初始化检索合同页面失败',result.errorMsg,'error');
                    console.log('Error:' + result.errorMsg);
                    this.showMyToast(
                        '初始化检索合同页面失败',
                        result.errorMsg,
                        'error'
                    );
         }
      })
      .catch(error=>{
         console.log("Error:"+error);
            .catch((error) => {
                console.log('Error:' + error);
         this.showMyToast('初始化检索合同页面失败',error,'error');
      })
            });
   }
   //检索合同
   searchCon(){
      searchContract({searchName:this.searchNameCon, accountId:this.accountid, ctype:this.agencyProType1,OSHFLGStr : this.OSHFLG})
      .then(result=>{
        searchContract({
            searchName: this.searchNameCon,
            accountId: this.accountid,
            ctype: this.agencyProType1,
            OSHFLGStr: this.OSHFLG
        })
            .then((result) => {
         if(result.result == 'Success'){
            this.contractList = result.attList;
            for(var i in this.contractList){
               if(this.contractList[i].State_Master__c){
                  this.contractList[i]['StateMaster'] = this.contractList[i].State_Master__r.Name;
                            this.contractList[i]['StateMaster'] =
                                this.contractList[i].State_Master__r.Name;
               }
            }
         }else{
            console.log("Error:"+result.errorMsg);
                    console.log('Error:' + result.errorMsg);
            this.showMyToast('搜索失败',result.errorMsg,'error');
         }
      })
      .catch(error=>{
         console.log("Error:"+error);
            .catch((error) => {
                console.log('Error:' + error);
         this.showMyToast('搜索失败',error,'error');
      })
            });
   }
   searchNameConChange(event){
@@ -1201,7 +1551,12 @@
         this.tempidPp = this.chooseContractId;
         this.contractName = this.chooseContract;
         this.closeContractPop();
         if(this.tempidPp != 'tempId' && this.tempidPp != '' && this.contractId != '' && this.pageType == 'promotionorder'){
            if (
                this.tempidPp != 'tempId' &&
                this.tempidPp != '' &&
                this.contractId != '' &&
                this.pageType == 'promotionorder'
            ) {
            searchorderdetails({
               methodTypeStr : this.pageType,
               accountIdStr : this.accountid,
@@ -1211,27 +1566,37 @@
               accountNameStr : this.accountName,
               proLimitAndDateList : this.proLimitAndDate,
               editAbleStr : this.editAble
            }).then(result=>{
                })
                    .then((result) => {
               if(result.result == 'Success'){
                  this.consumableorderdetailsRecordsview = result.consumableorderdetailsRecordsview;
                            this.consumableorderdetailsRecordsview =
                                result.consumableorderdetailsRecordsview;
                  this.currentPage = 1;
                  this.currentRecord = [];
                  this.showCurrentReocrd();
                  this.getAllChecked();
                  this.showMyToast('搜索成功',result.errorMsg,'success');
                            this.showMyToast(
                                '搜索成功',
                                result.errorMsg,
                                'success'
                            );
               }else{
                  console.log("Error:"+result.errorMsg);
                            console.log('Error:' + result.errorMsg);
                  if(result.errorMsg == '没有搜索到相关数据'){
                     this.showMyToast(result.errorMsg,'','error');
                  }else{
                     this.showMyToast('搜索产品失败',result.errorMsg,'error');
                                this.showMyToast(
                                    '搜索产品失败',
                                    result.errorMsg,
                                    'error'
                                );
                  }
               }
            })
            .catch(error=>{
               console.log("Error:"+error);
                    .catch((error) => {
                        console.log('Error:' + error);
               this.showMyToast('搜索产品失败',error,'error');
            })
                    });
            this.tempidPp = 'tempId';
         }
      }else{
@@ -1249,12 +1614,18 @@
         iconName = 'utility:error';
      }
      if(message != ''){
         content = '<h2><strong>'+title+'<strong/></h2><h5>'+message+'</h5>';
            content =
                '<h2><strong>' +
                title +
                '<strong/></h2><h5>' +
                message +
                '</h5>';
      }else{
         content = '<h2><strong>'+title+'<strong/></h2>';
      }
      this.template.querySelector('c-common-toast').
      showToast(variant,content,iconName,10000);
        this.template
            .querySelector('c-common-toast')
            .showToast(variant, content, iconName, 10000);
      // var mode;
      // if(this.isNoteStay){
      //     mode ='sticky';
@@ -1275,10 +1646,14 @@
      var startIndex = 0;
      var endIndex = 0;
      console.log('len:'+this.consumableorderdetailsRecordsview.length);
      if(this.consumableorderdetailsRecordsview != null && this.consumableorderdetailsRecordsview.length > 0){
        if (
            this.consumableorderdetailsRecordsview != null &&
            this.consumableorderdetailsRecordsview.length > 0
        ) {
         var currentRecord = [];
         var currentCount = 0;
         var mu = this.consumableorderdetailsRecordsview.length % this.pageSize;
            var mu =
                this.consumableorderdetailsRecordsview.length % this.pageSize;
         if(this.currentPage == this.totalPage){
            if(mu != 0){
               currentCount = mu;
@@ -1306,12 +1681,17 @@
         for(var i = startIndex; i <= endIndex; i++){
            var count  = 0;
            for(var j in this.currentRecord){
               if(this.consumableorderdetailsRecordsview[i].recordId == this.currentRecord[j].recordId){
                    if (
                        this.consumableorderdetailsRecordsview[i].recordId ==
                        this.currentRecord[j].recordId
                    ) {
                  count++;
               }
            }
            if(count == 0){
               currentRecord.push(this.consumableorderdetailsRecordsview[i]);
                    currentRecord.push(
                        this.consumableorderdetailsRecordsview[i]
                    );
            }
         }
         this.recordStart = startIndex + 1;
@@ -1332,10 +1712,20 @@
   }
   get totalPage(){
      if(this.consumableorderdetailsRecordsview.length % this.pageSize == 0){
         return Math.trunc(this.consumableorderdetailsRecordsview.length / this.pageSize);
        if (
            this.consumableorderdetailsRecordsview.length % this.pageSize ==
            0
        ) {
            return Math.trunc(
                this.consumableorderdetailsRecordsview.length / this.pageSize
            );
      }else{
         return Math.trunc(this.consumableorderdetailsRecordsview.length / this.pageSize) + 1;
            return (
                Math.trunc(
                    this.consumableorderdetailsRecordsview.length /
                        this.pageSize
                ) + 1
            );
      }
   }