buli
2023-07-13 a046b3fe914e46147334d33bbdcb21e2759a3c43
force-app/main/default/lwc/lexConsumable/lexConsumable.js
@@ -1,27 +1,27 @@
import { LightningElement, wire, api, track } from "lwc";
import { CurrentPageReference } from "lightning/navigation";
import { ShowToastEvent } from "lightning/platformShowToastEvent";
import { NavigationMixin } from "lightning/navigation";
import initPage from "@salesforce/apex/LexConsumableController.init";
import categoryAllload from "@salesforce/apex/LexConsumableController.categoryAllload";
import categoryload from "@salesforce/apex/LexConsumableController.categoryload";
import searchConsumableorderdetails from "@salesforce/apex/LexConsumableController.searchConsumableorderdetails";
import searchorderdetails from "@salesforce/apex/LexConsumableController.searchorderdetails";
import save from "@salesforce/apex/LexConsumableController.save";
import ordrCopy from "@salesforce/apex/LexConsumableController.ordrCopy";
import setEditAble from "@salesforce/apex/LexConsumableController.setEditAble";
import backOrder from "@salesforce/apex/LexConsumableController.backOrder";
import delConsumable from "@salesforce/apex/LexConsumableController.delConsumable";
import sorder from "@salesforce/apex/LexConsumableController.sorder";
import filesUpload from "@salesforce/apex/LexConsumableController.filesUpload";
import initHospital from "@salesforce/apex/LexSearchHospitalController.init";
import searchHospital from "@salesforce/apex/LexSearchHospitalController.searchHospital";
import initContract from "@salesforce/apex/LexSearchContractController.init";
import searchContract from "@salesforce/apex/LexSearchContractController.searchContract";
import deleteAtt from "@salesforce/apex/LexConsumableController.deleteAtt";
import { LightningElement, wire, api, track } from 'lwc';
import { CurrentPageReference } from 'lightning/navigation';
import { ShowToastEvent } from 'lightning/platformShowToastEvent';
import { NavigationMixin } from 'lightning/navigation';
import initPage from '@salesforce/apex/LexConsumableController.init';
import categoryAllload from '@salesforce/apex/LexConsumableController.categoryAllload';
import categoryload from '@salesforce/apex/LexConsumableController.categoryload';
import searchConsumableorderdetails from '@salesforce/apex/LexConsumableController.searchConsumableorderdetails';
import searchorderdetails from '@salesforce/apex/LexConsumableController.searchorderdetails';
import save from '@salesforce/apex/LexConsumableController.save';
import ordrCopy from '@salesforce/apex/LexConsumableController.ordrCopy';
import setEditAble from '@salesforce/apex/LexConsumableController.setEditAble';
import backOrder from '@salesforce/apex/LexConsumableController.backOrder';
import delConsumable from '@salesforce/apex/LexConsumableController.delConsumable';
import sorder from '@salesforce/apex/LexConsumableController.sorder';
import filesUpload from '@salesforce/apex/LexConsumableController.filesUpload';
import initHospital from '@salesforce/apex/LexSearchHospitalController.init';
import searchHospital from '@salesforce/apex/LexSearchHospitalController.searchHospital';
import initContract from '@salesforce/apex/LexSearchContractController.init';
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) {
  //页面基础数据
@@ -37,9 +37,9 @@
  @track specialCampaign = false;
  @track dealerProductId = [];
  @track category1;
  @track category3 = "";
  @track category4 = "";
  @track category5 = "";
    @track category3 = '';
    @track category4 = '';
    @track category5 = '';
  @track category_Goods;
  @track category3Option = [];
  @track category4Option = [];
@@ -81,7 +81,7 @@
  //是否一直显示提示
  @track isNoteStay = true;
  //排序相关
  @track sortDirection = "asc";
    @track sortDirection = 'asc';
  @track sortedBy;
  //分页
  @track currentPage = 1;
@@ -115,30 +115,30 @@
  @track hosCols = [
    // {label:'医院名称',fieldName:'Name',type:'button',typeAttributes:{label:{fieldName:'Name'},variant:'base'}},
    {
      label: "",
      type: "button",
      typeAttributes: { label: "选择" },
            label: '',
            type: 'button',
            typeAttributes: { label: '选择' },
      initialWidth: 90,
      hideDefaultActions: true,
      wrapText: true
    },
    {
      label: "医院名称",
      fieldName: "Name",
            label: '医院名称',
            fieldName: 'Name',
      initialWidth: 380,
      wrapText: true,
      hideDefaultActions: true
    },
    {
      label: "省份",
      fieldName: "StateMaster",
            label: '省份',
            fieldName: 'StateMaster',
      initialWidth: 80,
      hideDefaultActions: true,
      wrapText: true
    },
    {
      label: "地址",
      fieldName: "Address__c",
            label: '地址',
            fieldName: 'Address__c',
      hideDefaultActions: true,
      wrapText: true
    }
@@ -155,43 +155,43 @@
  @track tempidPp;
  @track conCols = [
    {
      label: "",
      type: "button",
      typeAttributes: { label: "选择" },
            label: '',
            type: 'button',
            typeAttributes: { label: '选择' },
      initialWidth: 90,
      hideDefaultActions: true,
      wrapText: true
    },
    {
      label: "合同名称",
      fieldName: "Name",
            label: '合同名称',
            fieldName: 'Name',
      wrapText: true,
      hideDefaultActions: true
    },
    {
      label: "省份",
      fieldName: "StateMaster",
            label: '省份',
            fieldName: 'StateMaster',
      initialWidth: 80,
      hideDefaultActions: true,
      wrapText: true
    },
    {
      label: "申请销售课",
      fieldName: "Sales_Section__c",
            label: '申请销售课',
            fieldName: 'Sales_Section__c',
      initialWidth: 160,
      hideDefaultActions: true,
      wrapText: true
    },
    {
      label: "允许报价期间(开始日)",
      fieldName: "Contract_Decide_Start_Date__c",
            label: '允许报价期间(开始日)',
            fieldName: 'Contract_Decide_Start_Date__c',
      initialWidth: 175,
      hideDefaultActions: true,
      wrapText: true
    },
    {
      label: "允许报价期间(结束日)",
      fieldName: "Contract_Decide_End_Date__c",
            label: '允许报价期间(结束日)',
            fieldName: 'Contract_Decide_End_Date__c',
      initialWidth: 175,
      hideDefaultActions: true,
      wrapText: true
@@ -202,61 +202,61 @@
  get cols() {
    var cols = [];
    cols.push({
      label: "消耗品名称",
      fieldName: "prodName",
            label: '消耗品名称',
            fieldName: 'prodName',
      wrapText: true,
      hideDefaultActions: true,
      sortable: true
      // initialWidth: 136
    });
    cols.push({
      label: "规格",
      fieldName: "packing_list",
            label: '规格',
            fieldName: 'packing_list',
      wrapText: true,
      hideDefaultActions: true,
      initialWidth: 50,
      cellAttributes: { alignment: "right" }
            cellAttributes: { alignment: 'right' }
    });
    cols.push({
      label: "CFDA状态",
      fieldName: "prodSFDAStatus",
            label: 'CFDA状态',
            fieldName: 'prodSFDAStatus',
      wrapText: true,
      hideDefaultActions: true,
      initialWidth: 84
    });
    cols.push({
      label: "注册证编码号",
      fieldName: "approbation_No",
            label: '注册证编码号',
            fieldName: 'approbation_No',
      wrapText: true,
      hideDefaultActions: true,
      initialWidth: 104
    });
    cols.push({
      label: "注册证效期",
      fieldName: "expiration_Date",
            label: '注册证效期',
            fieldName: 'expiration_Date',
      wrapText: true,
      hideDefaultActions: true,
      initialWidth: 95
    });
    cols.push({
      label: "第3分类",
      fieldName: "prodCategory3",
            label: '第3分类',
            fieldName: 'prodCategory3',
      wrapText: true,
      hideDefaultActions: true,
      initialWidth: 84,
      sortable: true
    });
    cols.push({
      label: "第4分类",
      fieldName: "prodCategory4",
            label: '第4分类',
            fieldName: 'prodCategory4',
      wrapText: true,
      hideDefaultActions: true,
      initialWidth: 84,
      sortable: true
    });
    cols.push({
      label: "第5分类",
      fieldName: "prodCategory5",
            label: '第5分类',
            fieldName: 'prodCategory5',
      wrapText: true,
      hideDefaultActions: true,
      initialWidth: 84,
@@ -264,73 +264,73 @@
    });
    if (this.cansee) {
      cols.push({
        label: "标准单价",
        type: "number",
                label: '标准单价',
                type: 'number',
        typeAttributes: { minimumFractionDigits: 2 },
        fieldName: "prodIntraTradeList",
                fieldName: 'prodIntraTradeList',
        hideDefaultActions: true,
        initialWidth: 78
      });
    }
    if (this.editAble) {
      cols.push({
        label: "采购数量",
        type: "customTableInput",
                label: '采购数量',
                type: 'customTableInput',
        typeAttributes: {
          recordId: { fieldName: "recordId" },
          inputValue: { fieldName: "consumableCount" },
          upperLimit: { fieldName: "upperlimit" },
          lowerLimit: { fieldName: "lowerlimit" },
          allnumber: { fieldName: "allnumber" },
          valueType: "Number"
                    recordId: { fieldName: 'recordId' },
                    inputValue: { fieldName: 'consumableCount' },
                    upperLimit: { fieldName: 'upperlimit' },
                    lowerLimit: { fieldName: 'lowerlimit' },
                    allnumber: { fieldName: 'allnumber' },
                    valueType: 'Number'
        },
        hideDefaultActions: true,
        initialWidth: 78
      });
    } else {
      cols.push({
        label: "采购数量",
        fieldName: "consumableCount",
                label: '采购数量',
                fieldName: 'consumableCount',
        hideDefaultActions: true,
        initialWidth: 78,
        cellAttributes: { alignment: "right" }
                cellAttributes: { alignment: 'right' }
      });
    }
    cols.push({
      label: "在库数下限",
      fieldName: "lowerlimit",
            label: '在库数下限',
            fieldName: 'lowerlimit',
      hideDefaultActions: true,
      initialWidth: 86,
      cellAttributes: { alignment: "right" }
            cellAttributes: { alignment: 'right' }
    });
    cols.push({
      label: "在库数上限",
      fieldName: "upperlimit",
            label: '在库数上限',
            fieldName: 'upperlimit',
      hideDefaultActions: true,
      initialWidth: 86,
      cellAttributes: { alignment: "right" }
            cellAttributes: { alignment: 'right' }
    });
    // cols.push({label:'有效期库存(盒)',fieldName:'allnumber',hideDefaultActions: true,initialWidth:105,sortable: true});
    cols.push({
      label: "有效期库存(盒)",
      type: "customInventoryColor",
      fieldName: "allnumber",
            label: '有效期库存(盒)',
            type: 'customInventoryColor',
            fieldName: 'allnumber',
      typeAttributes: {
        value: { fieldName: "allnumber" },
        upperlimit: { fieldName: "upperlimit" },
        lowerlimit: { fieldName: "lowerlimit" },
        boxPrice: "盒"
                value: { fieldName: 'allnumber' },
                upperlimit: { fieldName: 'upperlimit' },
                lowerlimit: { fieldName: 'lowerlimit' },
                boxPrice: '盒'
      },
      hideDefaultActions: true,
      initialWidth: 122,
      sortable: true
    });
    cols.push({
      label: "有效期库存(个)",
      fieldName: "allnumber_piece",
            label: '有效期库存(个)',
            fieldName: 'allnumber_piece',
      hideDefaultActions: true,
      initialWidth: 112,
      cellAttributes: { alignment: "right" }
            cellAttributes: { alignment: 'right' }
    });
    return cols;
  }
@@ -338,36 +338,36 @@
  //附件cols
  @track attCols = [
    {
      label: "标题",
      fieldName: "attUrl",
      type: "url",
            label: '标题',
            fieldName: 'attUrl',
            type: 'url',
      typeAttributes: {
        label: { fieldName: "fileName" },
        target: "_blank"
                label: { fieldName: 'fileName' },
                target: '_blank'
      },
      hideDefaultActions: true
    },
    {
      label: "创建人",
      fieldName: "ownerUrl",
      type: "url",
            label: '创建人',
            fieldName: 'ownerUrl',
            type: 'url',
      typeAttributes: {
        label: { fieldName: "ownerName" },
        target: "_blank"
                label: { fieldName: 'ownerName' },
                target: '_blank'
      },
      hideDefaultActions: true
    },
    {
      label: "上传日期",
      fieldName: "updateDate",
            label: '上传日期',
            fieldName: 'updateDate',
      hideDefaultActions: true
    },
    {
      label: "",
      type: "tableCellIcon",
            label: '',
            type: 'tableCellIcon',
      typeAttributes: {
        iconName: "utility:delete",
        recordId: { fieldName: "recordId" }
                iconName: 'utility:delete',
                recordId: { fieldName: 'recordId' }
      },
      initialWidth: 50,
      hideDefaultActions: true
@@ -397,9 +397,9 @@
        ) {
          count++;
          console.log(
            "checkId:" +
                        'checkId:' +
              selectedRows[j].recordId +
              "---" +
                            '---' +
              this.consumableorderdetailsRecordsview[i].prodName
          );
        }
@@ -414,10 +414,10 @@
      }
    }
    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]);
        }
      }
    }
@@ -427,19 +427,25 @@
  conCountChange(event) {
    var recordId = event.detail.data.recordId;
    var conCount = event.detail.data.value;
    console.log("countChange:" + recordId + "---" + conCount);
        console.log('countChange:' + recordId + '---' + conCount);
    for (var i in this.consumableorderdetailsRecordsview) {
      if (this.consumableorderdetailsRecordsview[i].recordId == recordId) {
        this.consumableorderdetailsRecordsview[i].esd.Consumable_count__c =
            if (
                this.consumableorderdetailsRecordsview[i].recordId == recordId
            ) {
                this.consumableorderdetailsRecordsview[
                    i
                ].esd.Consumable_count__c = conCount;
                this.consumableorderdetailsRecordsview[i].consumableCount =
          conCount;
        this.consumableorderdetailsRecordsview[i].consumableCount = conCount;
        if (conCount != null && conCount != 0 && 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 =
                    this.consumableorderdetailsRecordsview[
                        i
                    ].esd.Consumable_count__c = null;
                    this.consumableorderdetailsRecordsview[i].consumableCount =
            null;
          this.consumableorderdetailsRecordsview[i].consumableCount = null;
        }
      }
    }
@@ -447,7 +453,8 @@
    for (var i in this.currentRecord) {
      if (this.currentRecord[i].recordId == recordId) {
        console.log(
          "currentRecord1:" + this.currentRecord[i].esd.Consumable_count__c
                    'currentRecord1:' +
                        this.currentRecord[i].esd.Consumable_count__c
        );
      }
    }
@@ -460,13 +467,13 @@
    var upperLimit = event.detail.data.upperLimit;
    var lowerLimit = event.detail.data.lowerLimit;
    console.log(
      "limit:" +
            'limit:' +
        conCount +
        "---" +
                '---' +
        allnumber +
        "---" +
                '---' +
        lowerLimit +
        "---" +
                '---' +
        allnumber
    );
    if (
@@ -477,25 +484,25 @@
    ) {
      if (parseInt(allnumber) + parseInt(conCount) > upperLimit) {
        // window.alert("该产品订购数量超出库存上限!");
        this.showMyToast("该产品订购数量超出库存上限!", "", "error");
                this.showMyToast('该产品订购数量超出库存上限!', '', 'error');
      }
      if (parseInt(allnumber) + parseInt(conCount) < lowerLimit) {
        // window.alert("该产品订购数量低于库存下限!");
        this.showMyToast("该产品订购数量低于库存下限!", "", "error");
                this.showMyToast('该产品订购数量低于库存下限!', '', 'error');
      }
    }
  }
  @wire(CurrentPageReference)
  getStateParameters(currentPageReference) {
    console.log("CurrentPageReference");
        console.log('CurrentPageReference');
    if (currentPageReference) {
      this.pageType = currentPageReference.state?.type;
      this.esetId = currentPageReference.state?.ESetid;
      this.keyWords = currentPageReference.state?.KeyWords;
      console.log("type:" + this.pageType);
      console.log("esetId:" + this.esetId);
      console.log("keyWords:" + this.keyWords);
            console.log('type:' + this.pageType);
            console.log('esetId:' + this.esetId);
            console.log('keyWords:' + this.keyWords);
    }
  }
@@ -503,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');
        });
    }
  }
@@ -522,11 +529,12 @@
    })
      .then((result) => {
        this.isNoteStay = result.isNoteStay;
        if (result.result == "Success") {
                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;
@@ -535,45 +543,49 @@
          this.OSHFLG = result.OSHFLG;
          this.hospitalName = result.hospitalName;
          this.contractName = result.contractName;
          this.contractLabel = "经销商有效合同";
                    this.contractLabel = '经销商有效合同';
          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]['recordId'] =
              this.attachmentRecoeds[i].Concc.Id;
            this.attachmentRecoeds[i]["documentId"] =
                        this.attachmentRecoeds[i]['documentId'] =
              this.attachmentRecoeds[i].Concc.ContentDocumentId;
            this.attachmentRecoeds[i]["fileFullName"] =
                        this.attachmentRecoeds[i]['fileFullName'] =
              this.attachmentRecoeds[i].Concc.Title;
            var contractionName = 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]['fileName'] = contractionName;
                        this.attachmentRecoeds[i]['ownerName'] =
              this.attachmentRecoeds[i].Concc.Owner.Name;
            this.attachmentRecoeds[i]["downloadUrl"] =
              "/sfc/servlet.shepherd/document/download/" +
                        this.attachmentRecoeds[i]['downloadUrl'] =
                            '/sfc/servlet.shepherd/document/download/' +
              this.attachmentRecoeds[i].Concc.ContentDocumentId +
              "?operationContext=S1";
                            '?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)
                        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]['attUrl'] =
                            '/' + this.attachmentRecoeds[i].Concc.Id;
                        this.attachmentRecoeds[i]['ownerUrl'] =
                            '/' + this.attachmentRecoeds[i].Concc.OwnerId;
          }
          this.errorMsgs = result.errorMsgList;
          this.warningMsgs = result.warningMsgList;
@@ -589,16 +601,20 @@
          this.pageType = result.methodType;
          this.proLimitAndDate = result.proLimitAndDate;
          console.log(
            "proLimitAndDate:" + JSON.stringify(this.proLimitAndDate)
                        '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 == "批准"
                        this.coc.Order_status__c == '已提交' ||
                        this.coc.Order_status__c == '批准'
          ) {
            this.showOrderDate = true;
          }
@@ -610,9 +626,9 @@
            this.showOfferPriceInputBtn = true;
          }
          if (
            this.coc.Order_status__c == "已提交" ||
            this.coc.Order_status__c == "批准" ||
            this.coc.Order_status__c == "驳回"
                        this.coc.Order_status__c == '已提交' ||
                        this.coc.Order_status__c == '批准' ||
                        this.coc.Order_status__c == '驳回'
          ) {
            this.disabledEditBtn = true;
            this.disabledUploadSheetBtn = true;
@@ -636,48 +652,54 @@
            (this.editDelCommitBtnDisabled ||
              this.editAble ||
              this.edoffersPrice) &&
            this.coc.Order_status__c != "驳回"
                        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) => {
        this.showSpinner = false;
        console.log("error:" + error);
        this.showMyToast("初始化页面失败", error, "error");
                console.log('error:' + error);
                this.showMyToast('初始化页面失败', error, 'error');
      });
  }
  //排序
  onHandleSort(event) {
    //将已经选好了的放到前面,不进行排序
    console.log("sort");
        console.log('sort');
    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")
                .querySelector('c-lex-custom-lightning-datatable')
        .getSelectedRows();
      let selectedRowsIds = [];
      for (var i in selectedRows) {
        selectedRowsIds.push(selectedRows[i].recordId);
      }
      console.log("selectedRowsIds = " + JSON.stringify(selectedRowsIds));
            console.log('selectedRowsIds = ' + JSON.stringify(selectedRowsIds));
      for (var i = 0; i < cloneData.length; i++) {
        if (selectedRowsIds.indexOf(cloneData[i].recordId) != -1) {
          if (i != 0) {
@@ -694,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;
@@ -751,20 +775,20 @@
  category3Change(event) {
    this.showSpinner = true;
    this.category3 = event.detail.value;
    this.category4 = "";
    this.category5 = "";
        this.category4 = '';
        this.category5 = '';
    categoryAllload({
      agencyProTypeStr: this.agencyProType,
      category3Str: this.category3
    }).then((result) => {
      if (result.result == "Success") {
            if (result.result == 'Success') {
        this.category4Option = result.category4Option;
        this.category5Option = result.category5Option;
        this.showSpinner = false;
      } else {
        this.showSpinner = false;
        console.log("Error:" + result.errorMsg);
        this.showMyToast("加载分类失败", result.errorMsg, "error");
                console.log('Error:' + result.errorMsg);
                this.showMyToast('加载分类失败', result.errorMsg, 'error');
      }
    });
  }
@@ -773,20 +797,20 @@
  category4Change(event) {
    this.showSpinner = true;
    this.category4 = event.detail.value;
    this.category5 = "";
        this.category5 = '';
    categoryload({
      agencyProTypeStr: this.agencyProType,
      category3Str: this.category3,
      category4Str: this.category4
    }).then((result) => {
      if (result.result == "Success") {
            if (result.result == 'Success') {
        this.category4Option = result.category4Option;
        this.category5Option = result.category5Option;
        this.showSpinner = false;
      } else {
        this.showSpinner = false;
        console.log("Error:" + result.errorMsg);
        this.showMyToast("加载分类失败", result.errorMsg, "error");
                console.log('Error:' + result.errorMsg);
                this.showMyToast('加载分类失败', result.errorMsg, 'error');
      }
    });
  }
@@ -821,7 +845,7 @@
      proLimitAndDateList: this.proLimitAndDate
    })
      .then((result) => {
        if (result.result == "Success") {
                if (result.result == 'Success') {
          this.consumableorderdetailsRecordsview =
            result.consumableorderdetailsRecordsview;
          this.currentPage = 1;
@@ -833,28 +857,28 @@
          this.warningMsgs = result.warningMsgList;
          // this.hasError = result.hasError;
          // this.hasWarning = result.hasWarning;
          this.showMyToast("搜索成功", result.errorMsg, "success");
                    this.showMyToast('搜索成功', result.errorMsg, 'success');
        } else {
          this.showSpinner = false;
          console.log("Error:" + result.errorMsg);
          if (result.errorMsg == "没有搜索到相关数据") {
            this.showMyToast(result.errorMsg, "", "error");
                    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);
                console.log('Error:' + error);
      });
  }
  //清除搜索栏
  clear(event) {
    this.category1 = "";
    this.category3 = "";
    this.category4 = "";
    this.category5 = "";
        this.category1 = '';
        this.category3 = '';
        this.category4 = '';
        this.category5 = '';
    this.showSpinner = true;
    searchConsumableorderdetails({
      userWorkLocationStr: this.userWorkLocation,
@@ -877,7 +901,7 @@
      ),
      proLimitAndDateList: this.proLimitAndDate
    }).then((result) => {
      if (result.result == "Success") {
            if (result.result == 'Success') {
        this.consumableorderdetailsRecordsview =
          result.consumableorderdetailsRecordsview;
        this.currentPage = 1;
@@ -885,14 +909,14 @@
        this.showCurrentReocrd();
        this.getAllChecked();
        this.showSpinner = false;
        this.showMyToast("搜索成功", result.errorMsg, "success");
                this.showMyToast('搜索成功', result.errorMsg, 'success');
      } else {
        this.showSpinner = false;
        console.log("Error:" + result.errorMsg);
        if (result.errorMsg == "没有搜索到相关数据") {
          this.showMyToast(result.errorMsg, "", "error");
                console.log('Error:' + result.errorMsg);
                if (result.errorMsg == '没有搜索到相关数据') {
                    this.showMyToast(result.errorMsg, '', 'error');
        } else {
          this.showMyToast("搜索失败", result.errorMsg, "error");
                    this.showMyToast('搜索失败', result.errorMsg, 'error');
        }
      }
    });
@@ -905,14 +929,16 @@
      i < len;
      i++
    ) {
      this.consumableorderdetailsRecordsview[i].check = event.target.checked;
            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事件
@@ -933,7 +959,7 @@
  //保存订单
  saveOrder(event) {
    this.showSpinner = true;
    console.log("start save");
        console.log('start save');
    save({
      contractNameStr: this.contractName,
      cocStr: JSON.stringify(this.coc),
@@ -951,20 +977,23 @@
      OSHFLGStr: this.OSHFLG
    }).then((result) => {
      this.showSpinner = false;
      if (result.result == "Success") {
            if (result.result == 'Success') {
        this.esetId = result.eSetId;
        const config = {
          type: "standard__webPage",
                    type: 'standard__webPage',
          attributes: {
            url:
              "/lexconsumable?ESetid=" + this.esetId + "&type=" + this.pageType
                            '/lexconsumable?ESetid=' +
                            this.esetId +
                            '&type=' +
                            this.pageType
          }
        };
        this[NavigationMixin.Navigate](config);
      } else {
        this.showSpinner = false;
        console.log("Error:" + result.errorMsg);
        this.showMyToast("保存失败", result.errorMsg, "error");
                console.log('Error:' + result.errorMsg);
                this.showMyToast('保存失败', result.errorMsg, 'error');
      }
    });
  }
@@ -988,20 +1017,23 @@
      OSHFLGStr: this.OSHFLG
    }).then((result) => {
      this.showSpinner = false;
      if (result.result == "Success") {
            if (result.result == 'Success') {
        this.esetId = result.eSetId;
        const config = {
          type: "standard__webPage",
                    type: 'standard__webPage',
          attributes: {
            url:
              "/lexconsumable?ESetid=" + this.esetId + "&type=" + this.pageType
                            '/lexconsumable?ESetid=' +
                            this.esetId +
                            '&type=' +
                            this.pageType
          }
        };
        this[NavigationMixin.Navigate](config);
      } else {
        this.showSpinner = false;
        console.log("Error:" + result.errorMsg);
        this.showMyToast("保存失败", result.errorMsg, "error");
                console.log('Error:' + result.errorMsg);
                this.showMyToast('保存失败', result.errorMsg, 'error');
      }
    });
  }
@@ -1009,9 +1041,9 @@
  //编辑
  editOrder(event) {
    setEditAble({ eSetidStr: this.esetId }).then((result) => {
      if (result.result == "Success") {
            if (result.result == 'Success') {
        const config = {
          type: "standard__webPage",
                    type: 'standard__webPage',
          attributes: {
            url: result.url
          }
@@ -1019,8 +1051,8 @@
        this[NavigationMixin.Navigate](config);
      } else {
        this.showSpinner = false;
        console.log("Error:" + result.errorMsg);
        this.showMyToast("编辑失败", result.errorMsg, "error");
                console.log('Error:' + result.errorMsg);
                this.showMyToast('编辑失败', result.errorMsg, 'error');
      }
    });
  }
@@ -1029,9 +1061,10 @@
  printOrder(event) {
    var site = window.location.origin;
    const config = {
      type: "standard__webPage",
            type: 'standard__webPage',
      attributes: {
        url: site + "/consumable/PrintConsumblePDF?ESetid=" + this.esetId
                url:
                    site + '/consumable/PrintConsumblePDF?ESetid=' + this.esetId
      }
    };
    this[NavigationMixin.Navigate](config);
@@ -1046,9 +1079,9 @@
  submitOrder(event) {
    sorder({ eSetidStr: this.esetId, accountidStr: this.accountid })
      .then((result) => {
        if (result.result == "Success") {
                if (result.result == 'Success') {
          const config = {
            type: "standard__webPage",
                        type: 'standard__webPage',
            attributes: {
              url: result.url
            }
@@ -1058,27 +1091,27 @@
          this.showSpinner = false;
          this.errorMsgs = result.errorMsgList;
          this.warningMsgs = result.warningMsgList;
          console.log("Error:" + result.errorMsg);
          if (result.errorMsg.indexOf("请上传订货配置单附件") != -1) {
            result.errorMsg = "请上传订货配置单附件";
                    console.log('Error:' + result.errorMsg);
                    if (result.errorMsg.indexOf('请上传订货配置单附件') != -1) {
                        result.errorMsg = '请上传订货配置单附件';
          }
          this.showMyToast("提交失败", result.errorMsg, "error");
                    this.showMyToast('提交失败', result.errorMsg, 'error');
        }
      })
      .catch((error) => {
        console.log("Error:" + error);
                console.log('Error:' + error);
      });
  }
  //删除订单
  deleteOrder(event) {
    if (!window.confirm("删除是不可恢复的,你确认要删除吗?")) {
        if (!window.confirm('删除是不可恢复的,你确认要删除吗?')) {
      return;
    }
    delConsumable({ eSetidStr: this.esetId }).then((result) => {
      if (result.result == "Success") {
            if (result.result == 'Success') {
        const config = {
          type: "standard__webPage",
                    type: 'standard__webPage',
          attributes: {
            url: result.url
          }
@@ -1086,8 +1119,8 @@
        this[NavigationMixin.Navigate](config);
      } else {
        this.showSpinner = false;
        console.log("Error:" + result.errorMsg);
        this.showMyToast("删除失败", result.errorMsg, "error");
                console.log('Error:' + result.errorMsg);
                this.showMyToast('删除失败', result.errorMsg, 'error');
      }
    });
  }
@@ -1103,7 +1136,11 @@
      this.showOfferPriceInputBtn = false;
    }
    if (
      !(this.editDelCommitBtnDisabled || this.editAble || this.edoffersPrice)
            !(
                this.editDelCommitBtnDisabled ||
                this.editAble ||
                this.edoffersPrice
            )
    ) {
      this.showPrintSheetBtn = true;
      this.showUploadSheetBtn = true;
@@ -1116,8 +1153,10 @@
      this.showDeleteBtn = false;
    }
    if (
      (this.editDelCommitBtnDisabled || this.editAble || this.edoffersPrice) &&
      this.coc.Order_status__c != "驳回"
            (this.editDelCommitBtnDisabled ||
                this.editAble ||
                this.edoffersPrice) &&
            this.coc.Order_status__c != '驳回'
    ) {
      this.showSaveOrderbtn1 = true;
    } else {
@@ -1128,9 +1167,9 @@
  //再申请
  reapplyOrder(event) {
    backOrder({ eSetidStr: this.esetId }).then((result) => {
      if (result.result == "Success") {
            if (result.result == 'Success') {
        const config = {
          type: "standard__webPage",
                    type: 'standard__webPage',
          attributes: {
            url: result.url
          }
@@ -1138,8 +1177,8 @@
        this[NavigationMixin.Navigate](config);
      } else {
        this.showSpinner = false;
        console.log("Error:" + result.errorMsg);
        this.showMyToast("再申请失败", result.errorMsg, "error");
                console.log('Error:' + result.errorMsg);
                this.showMyToast('再申请失败', result.errorMsg, 'error');
      }
    });
  }
@@ -1149,16 +1188,16 @@
    if (event.target.files.length > 0) {
      this.filesUploaded = event.target.files;
      this.fileName = event.target.files[0].name;
      console.log("this.fileName:" + this.fileName);
            console.log('this.fileName:' + this.fileName);
    }
  }
  //是否显示附件移除
  get attDelBtn() {
    if (
      this.fileName != "" &&
            this.fileName != '' &&
      this.fileName != null &&
      this.fileName != "请选择一个文件上传"
            this.fileName != '请选择一个文件上传'
    ) {
      return true;
    } else {
@@ -1176,7 +1215,7 @@
  //移除附件
  removeAtt() {
    this.filesUploaded = [];
    this.fileName = "";
        this.fileName = '';
  }
  //上传附件
@@ -1184,21 +1223,22 @@
    if (this.filesUploaded.length > 0) {
      this.file = this.filesUploaded[0];
      if (this.file.size > this.MAX_FILE_SIZE) {
        window.console.log("文件过大");
                window.console.log('文件过大');
        return;
      }
      this.fileReader = new FileReader();
      this.fileReader.onloadend = () => {
        this.fileContents = this.fileReader.result;
        let base64 = "base64,";
        this.content = this.fileContents.indexOf(base64) + base64.length;
                let base64 = 'base64,';
                this.content =
                    this.fileContents.indexOf(base64) + base64.length;
        this.fileContents = this.fileContents.substring(this.content);
        this.saveToFile();
      };
      this.fileReader.readAsDataURL(this.file);
    } else {
      this.fileName = "请选择一个文件上传";
            this.fileName = '请选择一个文件上传';
    }
  }
@@ -1212,50 +1252,50 @@
    })
      .then((result) => {
        this.showPopSpinner = false;
        if (result.result == "Success") {
                if (result.result == 'Success') {
          this.closePop();
          window.location.reload();
        } else {
          console.log("Error:" + result.errorMsg);
          this.showMyToast("上传失败", result.errorMsg, "error");
                    console.log('Error:' + result.errorMsg);
                    this.showMyToast('上传失败', result.errorMsg, 'error');
        }
      })
      .catch((error) => {
        this.showPopSpinner = false;
        this.showMyToast("上传失败", error, "error");
                this.showMyToast('上传失败', error, 'error');
      });
  }
  //删除附件
  deleteAtt(event) {
    this.showSpinner = true;
    var recordId = event.target.getAttribute("data-fileid");
    console.log("attid:" + recordId);
        var recordId = event.target.getAttribute('data-fileid');
        console.log('attid:' + recordId);
    deleteAtt({ contentVersionId: recordId, cocId: this.esetId })
      .then((result) => {
        this.showSpinner = false;
        if (result.result == "Success") {
                if (result.result == 'Success') {
          window.location.reload();
        } else {
          console.log("Error:" + result.errorMsg);
          this.showMyToast("删除失败", result.errorMsg, "error");
                    console.log('Error:' + result.errorMsg);
                    this.showMyToast('删除失败', result.errorMsg, 'error');
        }
      })
      .catch((error) => {
        this.showSpinner = false;
        console.log("Error:" + error);
        this.showMyToast("删除失败", JSON.stringify(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",
            type: 'standard__namedPage',
      attributes: {
        pageName: "filePreview"
                pageName: 'filePreview'
      },
      state: {
        recordIds: recordId,
@@ -1268,23 +1308,27 @@
  showSearchHos(event) {
    initHospital()
      .then((result) => {
        if (result.result == "Success") {
                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]['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);
        this.showMyToast("初始化检索医院页面失败", error, "error");
                console.log('Error:' + error);
                this.showMyToast('初始化检索医院页面失败', error, 'error');
      });
  }
@@ -1295,22 +1339,22 @@
      accountId: this.accountid
    })
      .then((result) => {
        if (result.result == "Success") {
                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]['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);
        this.showMyToast("搜索失败", error, "error");
                console.log('Error:' + error);
                this.showMyToast('搜索失败', error, 'error');
      });
  }
@@ -1322,8 +1366,8 @@
  //关闭弹窗
  closeHospitalPop() {
    this.showAttHosPop = false;
    this.chooseHospital = "";
    this.chooseHospitalId = "";
        this.chooseHospital = '';
        this.chooseHospitalId = '';
  }
  // //选择医院
@@ -1347,14 +1391,14 @@
    const row = event.detail.row;
    this.chooseHospitalId = row.Id;
    this.chooseHospital = row.Name;
    console.log("row.Id:" + row.Id);
    console.log("row.Name:" + row.Name);
        console.log('row.Id:' + row.Id);
        console.log('row.Name:' + row.Name);
    this.confirmHospital();
  }
  //确认选择医院
  confirmHospital() {
    if (this.chooseHospital != "" && this.chooseHospital != null) {
        if (this.chooseHospital != '' && this.chooseHospital != null) {
      this.hospitalId = this.chooseHospitalId;
      this.tempidHp = this.chooseHospitalId;
      this.hospitalName = this.chooseHospital;
@@ -1362,12 +1406,12 @@
      //消除警告
      var arr = [];
      for (var i in this.warningMsgs) {
        if (this.warningMsgs[i] != "请选择医院") {
                if (this.warningMsgs[i] != '请选择医院') {
          arr.push(this.warningMsgs[i]);
        }
      }
      this.warningMsgs = arr;
      if (this.tempidHp != "tempId" && this.tempidHp != "") {
            if (this.tempidHp != 'tempId' && this.tempidHp != '') {
        searchorderdetails({
          methodTypeStr: this.pageType,
          accountIdStr: this.accountid,
@@ -1379,31 +1423,39 @@
          editAbleStr: this.editAble
        })
          .then((result) => {
            if (result.result == "Success") {
                        if (result.result == 'Success') {
              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);
              if (result.errorMsg == "没有搜索到相关数据") {
                this.showMyToast(result.errorMsg, "", "error");
                            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);
            this.showMyToast("搜索产品失败", error, "error");
                        console.log('Error:' + error);
                        this.showMyToast('搜索产品失败', error, 'error');
          });
        this.tempidHp = "tempId";
                this.tempidHp = 'tempId';
      }
    } else {
      this.showMyToast("请选择医院", "", "error");
            this.showMyToast('请选择医院', '', 'error');
    }
  }
@@ -1411,23 +1463,27 @@
  showSearchCon() {
    initContract({ ctype: this.agencyProType1 })
      .then((result) => {
        if (result.result == "Success") {
                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]['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);
        this.showMyToast("初始化检索合同页面失败", error, "error");
                console.log('Error:' + error);
                this.showMyToast('初始化检索合同页面失败', error, 'error');
      });
  }
@@ -1440,22 +1496,22 @@
      OSHFLGStr: this.OSHFLG
    })
      .then((result) => {
        if (result.result == "Success") {
                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]['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);
        this.showMyToast("搜索失败", error, "error");
                console.log('Error:' + error);
                this.showMyToast('搜索失败', error, 'error');
      });
  }
@@ -1466,8 +1522,8 @@
  //关闭弹窗
  closeContractPop() {
    this.showConPop = false;
    this.chooseContract = "";
    this.chooseContractId = "";
        this.chooseContract = '';
        this.chooseContractId = '';
  }
  //选择合同
@@ -1483,23 +1539,23 @@
    const row = event.detail.row;
    this.chooseContractId = row.Id;
    this.chooseContract = row.Name;
    console.log("row.Id:" + row.Id);
    console.log("row.Name:" + row.Name);
        console.log('row.Id:' + row.Id);
        console.log('row.Name:' + row.Name);
    this.confirmContract();
  }
  //确认选择合同
  confirmContract() {
    if (this.chooseContract != "" && this.chooseContract != null) {
        if (this.chooseContract != '' && this.chooseContract != null) {
      this.contractId = this.chooseContractId;
      this.tempidPp = this.chooseContractId;
      this.contractName = this.chooseContract;
      this.closeContractPop();
      if (
        this.tempidPp != "tempId" &&
        this.tempidPp != "" &&
        this.contractId != "" &&
        this.pageType == "promotionorder"
                this.tempidPp != 'tempId' &&
                this.tempidPp != '' &&
                this.contractId != '' &&
                this.pageType == 'promotionorder'
      ) {
        searchorderdetails({
          methodTypeStr: this.pageType,
@@ -1512,51 +1568,63 @@
          editAbleStr: this.editAble
        })
          .then((result) => {
            if (result.result == "Success") {
                        if (result.result == 'Success') {
              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);
              if (result.errorMsg == "没有搜索到相关数据") {
                this.showMyToast(result.errorMsg, "", "error");
                            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);
            this.showMyToast("搜索产品失败", error, "error");
                        console.log('Error:' + error);
                        this.showMyToast('搜索产品失败', error, 'error');
          });
        this.tempidPp = "tempId";
                this.tempidPp = 'tempId';
      }
    } else {
      this.showMyToast("请选择合同", "", "error");
            this.showMyToast('请选择合同', '', 'error');
    }
  }
  showMyToast(title, message, variant) {
    console.log("show custom message");
    var iconName = "";
    var content = "";
    if (variant == "success") {
      iconName = "utility:check";
        console.log('show custom message');
        var iconName = '';
        var content = '';
        if (variant == 'success') {
            iconName = 'utility:check';
    } else {
      iconName = "utility:error";
            iconName = 'utility:error';
    }
    if (message != "") {
        if (message != '') {
      content =
        "<h2><strong>" + title + "<strong/></h2><h5>" + message + "</h5>";
                '<h2><strong>' +
                title +
                '<strong/></h2><h5>' +
                message +
                '</h5>';
    } else {
      content = "<h2><strong>" + title + "<strong/></h2>";
            content = '<h2><strong>' + title + '<strong/></h2>';
    }
    this.template
      .querySelector("c-common-toast")
            .querySelector('c-common-toast')
      .showToast(variant, content, iconName, 10000);
    // var mode;
    // if(this.isNoteStay){
@@ -1577,14 +1645,15 @@
  showCurrentReocrd() {
    var startIndex = 0;
    var endIndex = 0;
    console.log("len:" + this.consumableorderdetailsRecordsview.length);
        console.log('len:' + this.consumableorderdetailsRecordsview.length);
    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;
@@ -1594,14 +1663,14 @@
      } else {
        currentCount = this.pageSize;
      }
      console.log("this.totalPage:" + this.totalPage);
      console.log("this.pageSize:" + this.pageSize);
      console.log("mu:" + mu);
      console.log("currentCount:" + currentCount);
            console.log('this.totalPage:' + this.totalPage);
            console.log('this.pageSize:' + this.pageSize);
            console.log('mu:' + mu);
            console.log('currentCount:' + currentCount);
      startIndex = (this.currentPage - 1) * this.pageSize;
      endIndex = parseInt(startIndex) + parseInt(currentCount) - 1;
      console.log("startIndex:" + startIndex);
      console.log("endIndex:" + endIndex);
            console.log('startIndex:' + startIndex);
            console.log('endIndex:' + endIndex);
      if (this.editAble) {
        for (var i in this.currentRecord) {
          if (this.currentRecord[i].check) {
@@ -1620,7 +1689,9 @@
          }
        }
        if (count == 0) {
          currentRecord.push(this.consumableorderdetailsRecordsview[i]);
                    currentRecord.push(
                        this.consumableorderdetailsRecordsview[i]
                    );
        }
      }
      this.recordStart = startIndex + 1;
@@ -1641,14 +1712,18 @@
  }
  get totalPage() {
    if (this.consumableorderdetailsRecordsview.length % this.pageSize == 0) {
        if (
            this.consumableorderdetailsRecordsview.length % this.pageSize ==
            0
        ) {
      return Math.trunc(
        this.consumableorderdetailsRecordsview.length / this.pageSize
      );
    } else {
      return (
        Math.trunc(
          this.consumableorderdetailsRecordsview.length / this.pageSize
                    this.consumableorderdetailsRecordsview.length /
                        this.pageSize
        ) + 1
      );
    }
@@ -1684,7 +1759,7 @@
  //page size change
  pageSizeChange(event) {
    console.log("pagesize:" + event.detail);
        console.log('pagesize:' + event.detail);
    this.pageSize = event.detail;
    this.currentPage = 1;
    this.currentRecord = [];